Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including supertape with all npm packages installed. Try it out:

var supertape = require("supertape")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

supertape v2.0.1

tape with superpowers

Supertape NPM version Dependency Status Build Status Coverage Status

Tape with superpowers. Contains:

  • ability to work with esm modules;
  • shows diff when test not equal or not deepEqual;
  • add jsonEqual that converts to json before checking isEqual;
  • produce deteiled stack traces for async functions;

Install

npm i supertape -D

Codemod

You can convert your codebase from tape to supertape with help of a convert-tape-to-supertape codemod. Here is example of a result.

Example

const test = require('supertape');

test('lib: arguments', async (t) => {
    throw Error('hello');
    // will call t.fail with an error
    // will call t.end
    
    t.end();
});

test('lib: diff', async (t) => {
    t.equal({}, {hello: 'world'}, 'should equal');
    t.end();
});

// output
`
- Expected
+ Received

- Object {}
+ Object {
+   "hello": "world",
+ }
`

Related

  • try-to-tape - wrap tape async functions and show error on reject;
  • @cloudcmd/stub - simplest sinon.stub alternative with diff support;

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free