Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
25 views

When carrying out my unit tests, how can I execute custom code if at least one of my unit tests fails?

In a test file, I've added several unit tests using the Tape test harness. What I'd like to do now is ensure that, if at least one of my unit tests fails (screenshot), some custom JS code is executed. ...
cag8f's user avatar
  • 938
0 votes
1 answer
1k views

How to use jsdom in a file which is bundled with Browserify?

I am trying to create a unit test for a function. In the test, I would like to emulate the global document object (e.g. document.getElementById()) using the jsdom package. I have installed jsdom in ...
cag8f's user avatar
  • 938
0 votes
0 answers
23 views

Testing if object implements interface (type alias) [duplicate]

I am using a minimal testing library (Tape) which has a handful of testing methods available similar to many test frameworks. I have a type alias and an object which implements it. export type myType =...
myol's user avatar
  • 9,623
-3 votes
1 answer
1k views

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 ...
J. Hesters's user avatar
  • 14.5k
1 vote
0 answers
72 views

Need explanation for this particular quirky asynchronous behavior

I have e2e tests for a javascript library, which works with the canvas element. It's organized this way: there is an html page with a list of links, the canvas, and an image element. When I click on a ...
d.k's user avatar
  • 4,426
2 votes
2 answers
692 views

How do I test asynchronous function throwing error with Tape?

I'm trying to test an async function that calls an API using Tape but I don't seem to be having much luck. I've used Mocha/Chai and Jasmine before but I'm not sure how to do what I want here. This ...
Cerulean's user avatar
  • 5,923
7 votes
3 answers
1k views

Tape "test exited without ending" error with asynchronous forEach loops

What I'm doing Edit: I created a repo with a simplified version of my problem reproducing the issue. I'm trying to set up automated frontend testings with browserstack, selenium-webdriver and tape. ...
Getter Jetter's user avatar
1 vote
1 answer
192 views

nodejs - How to check which portion of code is tested with unit tests?

I am using tape and istanbul to write unit tests in my Node.js project and the result is the following: Statements : 93.04% ( 107/115 ) Branches : 86.84% ( 33/38 ) Functions : 90% ( 27/30 ) ...
Marko Rochevski's user avatar
-1 votes
1 answer
79 views

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-...
AxD's user avatar
  • 3,082
0 votes
1 answer
117 views

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 ...
fgonzalez's user avatar
  • 3,877
0 votes
1 answer
623 views

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 ...
Sunny Pun's user avatar
  • 726
0 votes
0 answers
252 views

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/...
Amy Pellegrini's user avatar
3 votes
1 answer
2k views

How to debug react tape unit test in VS code

I am debugging third party library unit test. Test case is running using tape and tape-run. It is using below command to run test cases. "test": "browserify -x react-native -x react/addons -x react/...
Priyesh Tiwari's user avatar
1 vote
0 answers
72 views

Making tests independent in Node JS Tape

I am trying to test functions in my script that I have written in Node JS. I am using tape for unit testing. But I am facing one problem of how to make each test case independent. Eg. there are some ...
Chacha's user avatar
  • 421
1 vote
1 answer
2k views

Mocking methods in Tape Node js

What is the way to mock methods in unit tests using tape in Node js? I did not find anything in readme. I am pretty new to Node js, so this question seems pretty simple to some people. Please ...
Chacha's user avatar
  • 421
2 votes
1 answer
248 views

$.Deferred() and $.ajax() not working in Node.JS

I have the following implementation. import _ from 'lodash'; import test from 'tape'; import 'jsdom-global/register'; let jQuery = require('jquery')(window); let $ = global.jQuery = jQuery; test('...
Pristine Kallio's user avatar
32 votes
6 answers
33k views

stdout is not a tty. Using bash for node + tape + tap-spec

Was looking at a tape + tap video and tried to get it to work. OS: Windows 7 Git Bash Shell node main.js | ./node_modules/.bin/tap-spec stdout is not a tty. main.js: var test = require('tape'); ...
FreddyNoNose's user avatar
0 votes
1 answer
2k views

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 ...
MightyMight's user avatar
3 votes
0 answers
410 views

Karma, Webpack, Tape & Absolute path issue

This is an interesting situation. The puzzle is this: The component's name is TODO Controller.js import Component from 'component'; import View from 'app-folder/components/todo/view'; export ...
MightyMight's user avatar
0 votes
1 answer
630 views

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 ...
user avatar
1 vote
1 answer
1k views

JS Tape - Wait for previous async test to complete to move to next test

I am new to the working with TAPE JS for testing. I have it all setup and working, and it works fine with regular tests. But I am trying to test a unique REST API based product that relies on certain ...
Dylan Cross's user avatar
  • 5,986
0 votes
1 answer
20 views

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 ...
Lo HaBuyshan's user avatar
1 vote
1 answer
42 views

Testing method calls

I'm a bit of a hacker (i.e. write some code and manually test the functionality) but now I want to add a bit more structure to my coding by adding some unit tests and follow a TDD approach. But I'm ...
hloughrey's user avatar
  • 968
1 vote
1 answer
2k views

How to write a custom assertion for testing node or javascript with tape, or check for substring rather than t.deepEquals()?

Using tape, how can I write a custom assertion method to use in place of t.equal()? Or is there a test assertion method that can check for a substring so that the entire string I'm testing does not ...
user6641586's user avatar
1 vote
0 answers
369 views

Why does this promise code never run?

As you can see in the .gif below, I call tape.js twice in my integration tests and it works fine. But the second time I run the tests, after I've commented out the code to insert test data into my ...
Richard's user avatar
  • 16.4k
1 vote
2 answers
978 views

Testing AMD modules with tape/ES6 unit tests?

I have a web app using: ES5 RequireJS Underscore Backbone jQuery I have tried setting up a new unit test suite using: ES6 Tape Babel6 My AMD module app/util/stringUtil.js: define([], function() { ...
BunnyRabbit's user avatar
0 votes
1 answer
2k views

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....
Dave Landry's user avatar
13 votes
2 answers
2k views

How to test a function that throws an error asynchronously, using tape?

I am attempting to test this module (receiver.js) for an error thrown: var request = require('request') module.exports = function(url){ request({ url: url, method: 'POST' }, ...
Lorentz Lasson's user avatar
5 votes
1 answer
4k views

forcing completion of an rxjs observer

I've got an rxjs observer (really a Subject) that tails a file forever, just like tail -f. It's awesome for monitoring logfiles, for example. This "forever" behavior is great for my application, but ...
Paul S's user avatar
  • 952
0 votes
1 answer
650 views

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 ...
user avatar
6 votes
1 answer
4k views

Asserting throws in tape - node

So I am trying to test out a function, it is a client-side function(un-finish) which is why it is embedded in the test itself(until I can figure out a better solution). The problem I am having is when ...
Philip's user avatar
  • 4,592
0 votes
1 answer
382 views

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 ...
user2080367's user avatar
1 vote
1 answer
2k views

running multiple tests via npm test and jspm

I'm using jspm to manage the modules in my project. I'd like to write tests using tape and using ES6 syntax. I'd like to be able to run those tests from the command line using npm test. If I run ...
user5325596's user avatar
  • 2,370
5 votes
1 answer
961 views

What is the purpose of using "plan" vs "end" in substack/tape?

substack's tape testing module allows you to specify the number of assertions ahead of time with the plan method, and then it will automatically call end for you. Why not just put end at the end of a ...
oibe's user avatar
  • 1,067
6 votes
2 answers
89 views

How to test node data chunking function

I'm working on a project which uses node and we're trying to achieve 100% coverage of our functions. This is the only function we haven't tested, and it's within another function. var userInput = ""...
Huw Davies's user avatar
5 votes
1 answer
2k views

Handling errors in a Tape test?

If I have a function that throws an error and I want to test for that error, I'd write something like this: test('throws at something that is not a string', t => { t.plan(1) t.err(loadString(9)...
jona's user avatar
  • 399
0 votes
1 answer
279 views

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 ...
Samuel Martineau's user avatar
0 votes
1 answer
600 views

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 ...
evcohen's user avatar
  • 225
6 votes
1 answer
2k views

Is there a way to make a setUp and tearDown methods on tape?

I am using tape for testing in JavaScript, but in some cases I want to set some configuration variables that are available in all the tests within a file. Something like the setUp and tearDown methods ...
jtrezza's user avatar
  • 362
4 votes
6 answers
1k views

How do I use gulp with tape?

I'm trying to integrate Gulp with Tape (https://github.com/substack/tape), the NodeJs test harness. How can I do this? There doesn't seem to be an existing gulp plugin. I've see this, but it looks ...
Joseph's user avatar
  • 914
14 votes
1 answer
3k views

When using (substack's) Tape module for testing, how do I run only one test in a file?

When using Tape how do I run a specific test and ignore all other tests?
nelsonic's user avatar
  • 32.7k
0 votes
1 answer
280 views

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 ...
jacquard's user avatar
  • 1,307
1 vote
2 answers
1k views

How to set up JavaScript github test harness using tape & testling

I have a (JavaScript) repository on github which I would like to set up a test harness for. It seems ‘tape’ and ‘testling’ should do what I want (minimal lightweight solution with pretty github ...
ChrisV's user avatar
  • 9,031
0 votes
2 answers
880 views

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 ...
Michael Irwin's user avatar