Registry / testing / tap-out

tap-out

JSON →
library3.0.0jsnpmunverified

tap-out is a JavaScript library designed to parse Test Anything Protocol (TAP) output streams, converting them into structured JavaScript objects and emitting events for various TAP data types. Currently at version 3.0.0, its release cadence is tied to significant internal changes or feature additions, with major versions indicating potential breaking changes. It distinguishes itself by providing both a streaming API and a final callback for comprehensive results, allowing detailed programmatic inspection of test results, assertions, and metadata. Unlike simple TAP formatters, tap-out focuses on programmatic access to the parsed data, making it suitable for building custom test reporters, analysis tools, or integrating with CI/CD pipelines.

npm install tap-out
INSTALL
IMPORT
SIG · TAP-OUT
T
tap-out
testingjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tapOut
const tapOut = require('tap-out');
import tapOut from 'tap-out';
Version 3.x is a CommonJS module. For ESM, use v4.x or higher, which introduced ESM support.

Demonstrates piping a simulated TAP stream into `tap-out`, logging individual assertion events and the final parsed output object.

const tapOut = require('tap-out'); const { Readable } = require('stream'); // Simulate a TAP stream from a test runner const tapInput = new Readable({ read() { this.push('TAP version 13\n'); this.push('# Subtest: My Test Suite\n'); this.push('ok 1 - should pass\n'); this.push('not ok 2 - should fail - Diagnostics:\n'); this.push(' ---\n'); this.push(' message: "Expected false to be true"\n'); this.push(' severity: fail\n'); this.push(' ...\n'); this.push('1..2\n'); this.push('# tests 2\n'); this.push('# pass 1\n'); this.push('# fail 1\n'); this.push(null); // End of stream } }); const parser = tapOut(function (err, output) { if (err) { console.error('Parsing error:', err); return; } console.log('Final output summary:'); console.log(JSON.stringify(output, null, 2)); }); parser.on('assert', (assert) => { console.log(`[EVENT] Assertion: ${assert.ok ? 'PASS' : 'FAIL'} - ${assert.name}`); }); parser.on('fail', (assertion) => { console.error(`[EVENT] FAILED ASSERTION: ${assertion.name}`); }); parser.on('version', (version) => { console.log(`[EVENT] TAP Version: ${version.raw}`); }); parser.on('end', () => { console.log('[EVENT] TAP stream ended.'); }); tapInput.pipe(parser);
Debug
Known issues
breakingIn v3.0.0, the parsing stream no longer automatically ends when piped. This changes the behavior for applications that relied on `tap-out` closing the stream itself, potentially leading to hanging processes if not explicitly ended.
fix
Manually end the input stream (e.g., `process.stdin.end()` or `tapInput.push(null)` for Readable streams) after all TAP data has been sent to trigger the parser's final callback and `end` event.
affects: >=3.0.0
breakingThe callback function signature for `tapOut()` changed in v3.0.0 to `function (err, output) {}`. Code expecting only `function (output) {}` will have `err` as the first argument, potentially misinterpreting it as the `output`.
fix
Update callback signatures to `function (err, output) {}` and check for errors before processing the `output` object.
affects: >=3.0.0
gotchaVersion 3.x of `tap-out` is distributed as a CommonJS module. Attempting to `import` it in an ESM context will result in a `SyntaxError` unless a Node.js loader or transpiler is used.
fix
Use `const tapOut = require('tap-out');` for CommonJS environments. For native ESM, consider upgrading to `tap-out` v4.x or later, which provides ESM support.
affects: >=3.0.0 <4.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Attempting to use `import tapOut from 'tap-out'` in a non-ESM Node.js environment with `tap-out` v3.x (which is CJS-only).
fix
Change `import tapOut from 'tap-out'` to `const tapOut = require('tap-out');` or configure your project for ESM and upgrade to `tap-out` v4.x.
TypeError: tapOut is not a function
Incorrectly attempting to instantiate `tapOut` (e.g., `new tapOut()`) or not calling it as a function to obtain the stream instance.
fix
Ensure `tapOut` is called as a function: `const parser = tapOut(callback);`.
The program hangs and the final callback is never called.
The input TAP stream was not properly ended after all data was piped to `tap-out`. This is a breaking change introduced in v3.0.0 where the stream no longer auto-ends.
fix
Ensure the input stream to `tap-out` is explicitly ended (e.g., `input_stream.push(null)` for a Readable stream, or `process.stdin.end()` when piping from stdin) to signal the end of the TAP data and trigger the final callback.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
tap-out — npm install tap-out · libregistry