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
28
votes
6 answers

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'); var add = require('./add'); test('add: two numbers…
FreddyNoNose
  • 478
  • 1
  • 7
  • 13
14
votes
1 answer

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
  • 31,111
  • 21
  • 89
  • 120
12
votes
2 answers

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' }, function(error) { if(error){ …
Lorentz Lasson
  • 885
  • 8
  • 26
7
votes
3 answers

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. More about tape The idea is to define multiple…
Getter Jetter
  • 2,033
  • 1
  • 16
  • 37
6
votes
1 answer

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 I test to see if the function is throwing a…
Philip
  • 4,592
  • 2
  • 20
  • 28
6
votes
2 answers

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 = ""; req.on("data", function(data){ …
Huw Davies
  • 791
  • 7
  • 19
5
votes
1 answer

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 terrible for testing. Currently my application…
Paul S
  • 892
  • 10
  • 25
5
votes
1 answer

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 test? What is the difference between using…
oibe
  • 1,047
  • 1
  • 7
  • 10
5
votes
1 answer

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)) }) But this always results in an actual error…
jona
  • 399
  • 4
  • 14
5
votes
1 answer

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 available in PhpUnit. Those methods will be…
jtrezza
  • 354
  • 4
  • 13
4
votes
6 answers

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 really inelegant: var shell =…
Joseph
  • 914
  • 2
  • 14
  • 29
3
votes
1 answer

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/lib/ReactContext -x react/lib/ExecutionEnvironment…
Priyesh Tiwari
  • 331
  • 1
  • 3
  • 13
3
votes
0 answers

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 default Component.extend({ viewClass:…
MightyMight
  • 109
  • 1
  • 10
2
votes
2 answers

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 is the function I want to test const…
Cerulean
  • 5,543
  • 9
  • 59
  • 111
2
votes
1 answer

$.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('check if Deferred work?', (t) => { let dfd =…
Pristine Kallio
  • 505
  • 5
  • 19
1
2 3