Detalhes do pacote

tap-completed

vweevers50.4kMIT2.0.0

Detect when TAP output has completed

complete, minipass, stream, tap

readme (leia-me)

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 Test Standard Common Changelog

Usage

const completed = require('tap-completed')

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

ws.write('TAP version 13')
ws.write('# my test')
ws.write('ok 1 hello world')
ws.write('ok 2 should be equal')
ws.write('1..2')

Differences from tap-finished

  • Upgraded tap-parser from 0.2.0 to 18
  • Incorporates a fix by Julian Gruber (substack/tap-finished#6)
  • 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.

The stream is unfortunately not compatible with Node.js streams; it's best to treat it as its own interface and to read the source.

Install

With npm do:

npm install tap-completed

License

MIT

changelog (log de mudanças)

Changelog

2.0.0 - 2024-11-17

Changed

  • Breaking: upgrade to tap-parser 18 (34c5395) (Vincent Weevers)

1.0.1 - 2022-07-01

Fixed

  • Pin minipass to avoid destroy() bug (3bb345a) (Vincent Weevers)

1.0.0 - 2020-08-07

:seedling: Initial release.