Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

supertape

2.0.1 • Public • Published

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

Install

npm i supertape

DownloadsWeekly Downloads

1,555

Version

2.0.1

License

MIT

Unpacked Size

10.6 kB

Total Files

7

Last publish

Collaborators

  • avatar