Registry / testing / tap-bail

tap-bail

JSON →
library1.0.0jsnpmunverified

tap-bail is a command-line utility designed to streamline the testing process within the Test Anything Protocol (TAP) ecosystem. Its primary function is to read TAP output from standard input and terminate the test run immediately upon detecting the first failing assertion. This 'bail out' behavior is analogous to the `--bail` option found in other popular test runners like Mocha, enabling developers to pinpoint and address initial failures more efficiently without the overhead of waiting for an entire test suite to complete. The package is currently at version 1.0.0, indicating a stable, feature-complete state, likely in maintenance mode rather than active, rapid development. A key advantage of `tap-bail` is its broad compatibility: because it operates solely on TAP stream input, it functions seamlessly with any programming language or testing framework capable of generating TAP-compliant output. It is exclusively a command-line tool and does not expose any programmatic APIs for direct library usage within codebases. Its design emphasizes simplicity and utility within a CI/CD pipeline or local development workflow.

npm install tap-bail
INSTALL
IMPORT
SIG · TAP-BAIL
T
tap-bail
testingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Demonstrates how to install tap-bail and use it to bail out of a test run after the first failure with a simple TAP test file.

npm install -g tap tap-bail # Create a sample test file: test.js cat > test.js << EOF const tap = require('tap'); tap.test('passing test', t => { t.ok(true, 'should be true'); t.end(); }); tap.test('failing test that bails', t => { t.equal(1, 2, 'this will fail'); // This assertion will cause tap-bail to exit t.ok(true, 'this will not be reached if tap-bail is used'); t.end(); }); tap.test('another passing test', t => { t.ok(true, 'this will not be reached if tap-bail is used'); t.end(); }); EOF # Run the tests with tap-bail, observe that the subsequent tests are skipped tap --tap test.js | tap-bail
tap-bail --version
Debug
Known issues
gotchaWhen using `tap-bail` with the Node.js `tap` module, it is crucial to pass the `--tap` flag to the `tap` runner itself. Without `--tap`, the `tap` module produces abbreviated, human-readable output instead of the full TAP stream, which `tap-bail` requires to function correctly.
fix
Ensure your `tap` command includes the `--tap` flag, e.g., `tap --tap my-tests.js | tap-bail`.
affects: >=1.0.0
Errors
Common errors & fixes
Tests are not bailing out after the first failure; the entire test suite continues to execute.
`tap-bail` is either not used in the test pipeline, or the input stream is not valid TAP output.
fix
Ensure `tap-bail` is correctly piped to your test runner's output (e.g., `your-test-command | tap-bail`). Verify that `your-test-command` is producing valid TAP output. If using the `tap` module, remember to include `--tap` (e.g., `tap --tap my-tests.js | tap-bail`).
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
tap-bail — npm install tap-bail · libregistry