Questions tagged [node.js-tape]

A simple TAP-producing test library for node.js. The tape API is a small superset of the node core assert module.

Tape's NPM Page:
https://www.npmjs.com/package/tape

Tape source code:
https://github.com/substack/tape

Tape advocacy essay:
https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4

45 questions
0
votes
1 answer

Unit test in Node js

I'm learning unit testing in node js using Tape.js, and so far I only find it useful to test the result returned by a function, but what what about to test if a callback has been called exactly n times? I have this function which calls a callback…
fgonzalez
  • 3,787
  • 7
  • 45
  • 79
0
votes
1 answer

React Native Babel Tape SyntaxError Invalid or unexpected token with PNG files

I am writing an App using React Native, and I would like to test the App components with Tape and JSX syntax, so I think 'babel' is a must. However when I run tape -r babel-register tests/**/*.js, I received the infamous SyntaxError with a PNG…
Sunny Pun
  • 726
  • 5
  • 14
0
votes
0 answers

How to test React router without errors?

I've implemented an App component which contains a Route using React and React router: import { BrowserRouter as Router, Route } from 'react-router-dom'; import createHeader from './components/header/header'; import createLandingPage from…
Amy Pellegrini
  • 3,200
  • 1
  • 13
  • 19
0
votes
1 answer

How would one write a resolve.alias function for gulp?

I'm using Gulp and Tape to run my test suite instead of Webpack and Tape. The reason is for speed and simplicity. Gulp functional task approach instead of testing while bundling. Now, in order for it to work I need to resolve a file path for an…
MightyMight
  • 109
  • 1
  • 10
0
votes
1 answer

Cannot unit test JavaScript functions with Tape/ Sinon

I have a module that I want to test using Tape and Sinon. Unfortunately I'm not doing very well. Here is the module code: let config = require('./config'); let request = require('request'); let restify = require('restify'); let certificateUtils =…
user8232860
0
votes
1 answer

Nitrous.io pathname

I need to test in the browser because I am using WebAudio. Okay, so since I'm using tape, I run browserify -t babelify index.js | browser-run -p 3000 The problem is that I'm using Nitrous.io, so the test complains: Error: Cannot find module…
Lo HaBuyshan
  • 359
  • 2
  • 12
0
votes
1 answer

ES6 javascript tests using Tape and Nightmare.js

I've been trying to test my ES6 code using Tape assertions and Nightmare.js to load a test page. I keep trying different ES6 methods: async/await, yield, generators, and I think I'm a bit over my head. I'm also not sure when and when to not use…
Dave Landry
  • 246
  • 1
  • 7
0
votes
1 answer

How to validate Error message with Tape?

I'm currently learning how to use Tape for unit testing. I've been able to verify that an error is thrown in my test. However, how can we verify that the message thrown with the Error is equal to an expected message? Example unit test: var test =…
user3786913
0
votes
1 answer

nodejs and TAPE integration issues. App initialization call gets blocked

I am creating unit tests for nodejs app using "tape". When I run tests, the process gets blocked forever. When I dug deeper, I found that if I run "nodejs mainapp.js" the process doesn't end. That's also blocking running of unit tests. Looks like…
user2080367
  • 73
  • 1
  • 5
0
votes
1 answer

Callback when test fails with tape

Is it a way to call a function in case of error? I have a test like that: t.true(ARRAY.every(function(item){ return item.label }), 'Every item should have label') So I am looking for a callback to specify which item hasn't label in case of…
0
votes
1 answer

Supertest + Tape + Restify - Can't set headers twice error on consecutive calls

I'm building an API using Node.js and Restify. I am trying to do functional endpoint testing using Supertest and Tape. I have a test that makes two consecutive calls to the API and it is saying that I can't set the headers after they are sent.…
evcohen
  • 225
  • 1
  • 2
  • 8
0
votes
1 answer

Including backbone installed through bower in a node.js test script

I am having a gulp based project, and use browserify and debowerify to build the application. The application Depends on Backbone - installed as bower component. Has some additional domain classes which requires backbone. I build 1 above as…
jacquard
  • 1,307
  • 1
  • 11
  • 16
0
votes
2 answers

restify tape test hang

I'm attempting to use tape to test an API built with restify. The issue I'm having is that the tests don't complete until some "timeout" or something occurs. The test suite just hangs. Here's a simple test I'm using: var test = require('tape'); var…
Michael Irwin
  • 3,119
  • 5
  • 24
  • 40
-1
votes
1 answer

How can I configure popular JavaScript unit test frameworks to co-operate with Jenkins?

I want Jenkins to run JavaScript unit tests. Although I came across different JavaScript unit test frameworks, like Jasmine or Tape, I cannot find any documentation on how to make them work and set-up their output to co-operate with Jenkins. Can…
AxD
  • 2,714
  • 3
  • 31
  • 53
-3
votes
1 answer

Cannot find module with **/*.test.js

I'm trying to set up testing for my Next.js project. I want to test it with RITEway which is based on tape. I want a test command that finds all files in my src/ folder that end with .test.js. Here is the commend I came up with: "test":…
J. Hesters
  • 13,117
  • 31
  • 133
  • 249
1 2
3