Detect when TAP output has completed. Normally with tap-parser
the complete
event fires only when the stream ends. This module detects and waits for the expected number of assertions and then ends the stream. This is an updated and API-compatible version of tap-finished
; see differences below.
const completed = require('tap-completed')
const ws = completed(function (results) {
console.log(results)
})
tap.pipe(ws)
- Upgraded
tap-parser
from v0.2.0 to v10 - Incorporates a fix by Julian Gruber (substack/tap-finished#6)
- Behaves like a modern stream in that it has a
destroy([err])
method and always emits a'close'
event - The
wait
period (see below) resets on a new incoming line.
Returns a writable stream that consumes TAP. The callback will be called with the results
from tap-parser
, equivalent to:
const completed = require('tap-completed')
const ws = completed().on('complete', callback)
Options:
wait
(number, default 1000): how long to wait for more output (like diagnostics) after the end was detected.
With npm do:
npm install tap-completed
MIT © 2013-present James Halliday, 2020-present Vincent Weevers.