supertape

tape with superpowers

Supertape

Tape with superpowers. Contains:

  • ability to catchexceptions and fail one test instead of all;
  • shows diff when test not equalor not deepEqual;
  • add jsonEqualthat converts to jsonbefore checking isEqual

Install

npm i supertape -D

Codemod

You can convert your codebase from tapeto supertapewith help of a convert-tape-to-supertapecodemod. 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 tapeasync functions and show error on reject;
  • @cloudcmd/stub- simplest sinon.stub alternative with diff support;

License

MIT

HomePage

http://github.com/coderaiser/supertape

Repository

https://github.com/coderaiser/supertape


上一篇:madrun
下一篇:minor

相关推荐

暂无相关文章

官方社区

扫码加入 JavaScript 社区