{"dist":{"shasum":"4c3e7ccbea7fa0a28fadfb1c03088e8be9a62e81","tarball":"https://registry.npmjs.org/tap-finished/-/tap-finished-0.0.0.tgz","integrity":"sha512-HEQgSwm1Yhrd1g7edEDx0XbPEvKMiijsu1e5hCKBECMPbPlEQ9gcdKSrIJxpDBwDSMu0UI/ZoUz7jVMhhvMJMw==","signatures":[{"sig":"MEQCICk8JDe69Krk6NAcjNAgOAj4iJ86A8/GK+9SRNQT00XFAiABUJvvAh6nkPzI9eH1HITfNQJlgBYIsHEYq5LezjigHg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","name":"tap-finished","_from":".","author":{"url":"http://substack.net","name":"James Halliday","email":"mail@substack.net"},"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","license":"MIT","scripts":{"test":"tap test/*.js"},"_npmUser":{"name":"substack","email":"mail@substack.net"},"homepage":"https://github.com/substack/tap-finished","keywords":["tap","parse","stream","complete","test"],"testling":{"files":"test/*.js","browsers":["ie/8","ie/9","firefox/latest","chrome/latest","safari/latest","opera/latest"]},"repository":{"url":"git://github.com/substack/tap-finished.git","type":"git"},"_npmVersion":"1.2.2","description":"detect when tap output is finished","directories":{},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"dependencies":{"through":"~2.1.0","tap-parser":"~0.0.2"},"readmeFilename":"readme.markdown","devDependencies":{"tap":"~0.3.0","tape":"~0.2.2"},"_id":"tap-finished@0.0.0","version":"0.0.0"}