{"_id":"tap-finished","_rev":"89807","name":"tap-finished","description":"detect when tap output is finished","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"substack","email":""}],"time":{"modified":"2021-06-03T10:29:19.000Z","created":"2013-01-23T03:45:16.908Z","0.0.1":"2013-11-26T06:34:45.895Z","0.0.0":"2013-01-23T03:45:16.908Z"},"users":{},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"repository":{"type":"git","url":"git://github.com/substack/tap-finished.git"},"versions":{"0.0.1":{"name":"tap-finished","version":"0.0.1","description":"detect when tap output is finished","main":"index.js","dependencies":{"through":"~2.3.4","tap-parser":"~0.2.0"},"devDependencies":{"tap":"~0.4.6","tape":"~2.3.0"},"scripts":{"test":"tap test/*.js"},"testling":{"files":"test/*.js","browsers":["ie/8","ie/9","firefox/latest","chrome/latest","safari/latest","opera/latest"]},"repository":{"type":"git","url":"git://github.com/substack/tap-finished.git"},"homepage":"https://github.com/substack/tap-finished","keywords":["tap","parse","stream","complete","test"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","readmeFilename":"readme.markdown","bugs":{"url":"https://github.com/substack/tap-finished/issues"},"_id":"tap-finished@0.0.1","dist":{"shasum":"08b5b543fdc04830290c6c561279552e71c4bd67","size":3627,"noattachment":false,"key":"/tap-finished/-/tap-finished-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tap-finished/download/tap-finished-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"directories":{},"publish_time":1385447685895,"_hasShrinkwrap":false,"_cnpm_publish_time":1385447685895},"0.0.0":{"name":"tap-finished","version":"0.0.0","description":"detect when tap output is finished","main":"index.js","dependencies":{"through":"~2.1.0","tap-parser":"~0.0.2"},"devDependencies":{"tap":"~0.3.0","tape":"~0.2.2"},"scripts":{"test":"tap test/*.js"},"testling":{"files":"test/*.js","browsers":["ie/8","ie/9","firefox/latest","chrome/latest","safari/latest","opera/latest"]},"repository":{"type":"git","url":"git://github.com/substack/tap-finished.git"},"homepage":"https://github.com/substack/tap-finished","keywords":["tap","parse","stream","complete","test"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","readmeFilename":"readme.markdown","_id":"tap-finished@0.0.0","dist":{"shasum":"4c3e7ccbea7fa0a28fadfb1c03088e8be9a62e81","size":3288,"noattachment":false,"key":"/tap-finished/-/tap-finished-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tap-finished/download/tap-finished-0.0.0.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"directories":{},"publish_time":1358912716908,"_hasShrinkwrap":false,"_cnpm_publish_time":1358912716908}},"readme":"# tap-finished\n\ndetect when [tap output](http://testanything.org) is finished\n\n[![build status](https://secure.travis-ci.org/substack/tap-finished.png)](http://travis-ci.org/substack/tap-finished)\n\n[![browser support](http://ci.testling.com/substack/tap-finished.png)](http://ci.testling.com/substack/tap-finished)\n\nNormally with [tap-parser](https://github.com/substack/tap-parser) the\n`'results'` event fires only after the stream is closed. This module lets you\ndetect whether a stream seems closed without waiting for the `'end'` event.\n\n# example\n\nGiven this tap output in `tap_output.txt`:\n\n```\nTAP version 13\n# wait\nok 1 (unnamed assert)\nnot ok 2 should be equal\n  ---\n    operator: equal\n    expected: 5\n    actual:   4\n  ...\n\n1..2\n# tests 2\n# pass  1\n# fail  1\n```\n\nand given this script that pipes stdin into the finished stream:\n\n``` js\nvar finished = require('tap-finished');\nvar stream = finished(function (results) {\n    console.dir(results);\n});\nprocess.stdin.pipe(stream);\n```\n\nWe'll use `cat` to create a stream that contains the tap output but doesn't end\nand then pipe that to the script:\n\n```\n$ cat tap_output.txt /dev/stdin | node stream.js \n{ ok: false,\n  asserts: \n   [ { ok: true, number: 1, name: '(unnamed assert)' },\n     { ok: false, number: 2, name: 'should be equal' } ],\n  pass: [ { ok: true, number: 1, name: '(unnamed assert)' } ],\n  fail: [ { ok: false, number: 2, name: 'should be equal' } ],\n  errors: [],\n  plan: { start: 1, end: 2 } }\n^C\n```\n\nEven though the `'end'` message never came, we still got the parsed results.\nYay!\n\n# methods\n\n``` js\nvar finished = require('tap-finished')\n```\n\n## var ws = finished(opts={}, cb)\n\nReturn a writable stream `ws` that consumes tap input. \n`cb(results)` fires with the `results` from\n[tap-parser](https://github.com/substack/tap-parser)\nwhen the stream seems finished or when the `'end'` event occurs.\n\n`opts.wait` controls how long to wait in milliseconds for more input before\nfiring the `cb` if the `'end'` event doesn't fire.\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install tap-finished\n```\n\nYou can use this module in the browser with [browserify](http://browserify.org).\n\n# license\n\nMIT\n","_attachments":{},"readmeFilename":"readme.markdown","homepage":"https://github.com/substack/tap-finished","bugs":{"url":"https://github.com/substack/tap-finished/issues"},"license":"MIT"}