tap-completed

1.0.1 • Public • Published

tap-completed

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.

npm status node Travis build status JavaScript Style Guide

Usage

const completed = require('tap-completed')

const ws = completed(function (results) {
  console.log(results)
})

tap.pipe(ws)

Differences from tap-finished

  • 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.

API

ws = completed([options][, callback])

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.

Install

With npm do:

npm install tap-completed

License

MIT © 2013-present James Halliday, 2020-present Vincent Weevers.

Package Sidebar

Install

npm i tap-completed

Weekly Downloads

1,427

Version

1.0.1

License

MIT

Unpacked Size

5.33 kB

Total Files

4

Last publish

Collaborators

  • vweevers