Bail out when the first TAP test fails
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin initial commit Feb 23, 2014
.gitignore initial commit Feb 23, 2014
.travis.yml add travis Feb 23, 2014
History.md add history Feb 23, 2014
Makefile initial commit Feb 23, 2014
Readme.md add travis Feb 23, 2014
package.json 1.0.0 Mar 3, 2017
test.js fix test Feb 23, 2014

Readme.md

tap-bail

Abort TAP test runners on the first failing assertion.

Similar to mocha's --bail.

build status

Example

With tap-bail:

$ make test | tap-bail
TAP version 13
# test.js
# TAP version 13
# success
not ok 1 (unnamed assert)
  ---
    file:   /Users/julian/pro/tap-bail/test.js
    line:   5
    column: 5
    stack:
      - getCaller (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-assert.js:418:17)
      - Function.assert (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-assert.js:21:16)
      - Test._testAssert [as ok] (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-test.js:87:16)
      - Test.src (/Users/julian/pro/tap-bail/test.js:5:5)
      - Test.EventEmitter.emit (events.js:117:20)
      - Test.emit (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-test.js:104:8)
      - GlobalHarness.Harness.process (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-harness.js:87:13)
      - process._tickCallback (node.js:415:13)
      - Function.Module.runMain (module.js:499:11)
      - startup (node.js:119:16)
  ...

Without tap-bail:

$ make test
TAP version 13
# test.js
# TAP version 13
# success
not ok 1 (unnamed assert)
  ---
    file:   /Users/julian/pro/tap-bail/test.js
    line:   5
    column: 5
    stack:
      - getCaller (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-assert.js:418:17)
      - Function.assert (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-assert.js:21:16)
      - Test._testAssert [as ok] (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-test.js:87:16)
      - Test.src (/Users/julian/pro/tap-bail/test.js:5:5)
      - Test.EventEmitter.emit (events.js:117:20)
      - Test.emit (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-test.js:104:8)
      - GlobalHarness.Harness.process (/Users/julian/pro/tap-bail/node_modules/tap/lib/tap-harness.js:87:13)
      - process._tickCallback (node.js:415:13)
      - Function.Module.runMain (module.js:499:11)
      - startup (node.js:119:16)
  ...
ok 2 should be equal
ok 3 should be equal
# fail
ok 4 should be equal
ok 5 (unnamed assert)
# tests 5
# pass  4
# fail  1
ok 6 ./test.js


1..6
# tests 6
# pass  5
# fail  1
make: *** [test] Error 1

Compatibility

Since all tap-bail needs is TAP output it works with any language and any TAP producing library.

When using the node tap module, be sure to pass --tap in order not to get the abbreviated output:

$ tap --tap test.js | tap-bail

Installation

$ npm install -g tap-bail

License

MIT