{"name":"coverify","version":"1.3.2","description":"code coverage browserify transform","main":"index.js","bin":{"coverify":"bin/cmd.js"},"dependencies":{"convert-source-map":"^1.1.0","falafel":"^1.0.1","minimist":"^1.1.1","source-map":"~0.4.2","split2":"^0.2.1","stream-combiner2":"^1.0.2","through2":"~0.6.5"},"devDependencies":{"browserify":"^10.0.0","tape":"^4.0.0"},"repository":{"type":"git","url":"git://github.com/substack/coverify.git"},"scripts":{"test":"test/run.sh"},"homepage":"https://github.com/substack/coverify","keywords":["code","coverage","browserify","browserify-transform","test"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","testling":{"files":"test/ok.js","browsers":["ie/8..latest","firefox/3.5","firefox/latest","firefox/nightly","chrome/10","chrome/latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"9bca0f292691a06aeec332ac7d854dc62a021e0f","bugs":{"url":"https://github.com/substack/coverify/issues"},"_id":"coverify@1.3.2","_shasum":"82f63561cae17c09690cd963f824718478db8096","_from":".","_npmVersion":"2.9.0","_nodeVersion":"1.6.3","_npmUser":{"name":"substack","email":"substack@gmail.com"},"dist":{"shasum":"82f63561cae17c09690cd963f824718478db8096","tarball":"http://registry-npm.ywwl.com/coverify/download/coverify-1.3.2.tgz","integrity":"sha512-9TJzFQuNgVMPCEzBWnt8KzBlubt/EoRrax7lGRV1aXHSYWNQXMuGZ5zroZTQbc92oymlC5UD43bdzB+p96iuRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGXXna3mtEMEtNdrKb9yu2pfytHnJxLYpR5ItTQPjv+mAiAc6zc5cQSL7ZEW4SvXz0lpejxkWBSjgzgcNU98cw7Aqg=="}],"size":7897,"noattachment":false,"key":"/coverify/-/coverify-1.3.2.tgz"},"maintainers":[{"name":"substack","email":"mail@substack.net"},{"name":"chromakode","email":"npm@chromakode.com"}],"directories":{},"readme":"# coverify\n\ncode coverage browserify transform\n\n[![build status](https://secure.travis-ci.org/substack/coverify.png)](http://travis-ci.org/substack/coverify)\n\n# example\n\nSuppose we have a test.js:\n\n``` js\nvar test = require('tape');\nvar foo = require('./foo.js');\n\ntest('beep boop', function (t) {\n    t.plan(1);\n    \n    foo(function (err, x) {\n        if (err) deadCode();\n        t.equal(x * 5, 555);\n    });\n});\n```\n\nand a foo.js:\n\n``` js\nmodule.exports = function (cb) {\n    var i = 0;\n    var iv = setInterval(function () {\n        if (i++ === 10 || (false && neverFires())) {\n            clearInterval(iv);\n            cb(null, 111);\n        }\n    }, 10);\n};\n```\n\nNow with [browserify](http://browserify.org) just do:\n\n```\n$ browserify -t coverify example/test.js --bare | node | coverify\nTAP version 13\n# beep boop\nok 1 should be equal\n\n1..1\n# tests 1\n# pass  1\n\n# ok\n\n# /home/substack/projects/coverify/example/test.js: line 7, column 16-28\n\n  if (err) deadCode();\n           ^^^^^^^^^^^\n\n# /home/substack/projects/coverify/example/foo.js: line 3, column 35-48\n\n  if (i++ === 10 || (false && neverFires())) {\n                              ^^^^^^^^^^^^\n\n# coverage: 34/36 (94.4400%)\n\n```\n\n`browserify` compiled our `test.js` file, then `testling` ran our code in a\nlocal headless browser (we also could have used `node`), and then `coverify`\nparsed the test output for code coverage data and printed some nicely formatted\nresults on stderr. Hooray!\n\nand the exit code is non-zero because the coverage wasn't 100%:\n\n```\n$ echo $?\n1\n```\n\nIf you want to run code coverage for browser tests, you can use the\n[testling](https://npmjs.org/package/testling) command:\n\n```\n$ browserify -t coverify example/test.js | testling | coverify\n```\n\nand the output and exit codes work exactly the same, except the code is running\nin a browser instead of node.\n\n# methods\n\n``` js\nvar coverify = require('coverify')\nvar parse = require('coverify/parse')\n```\n\nUsually you can just do `browserify -t coverify` to get code coverage but you\ncan also use the api directly if you want to use this code directly.\n\n## var stream = coverify(file, opts={})\n\nReturn a transform stream for `file` that will instrument the input source file\nusing `console.log()`.\n\nTo use a different function from `console.log()`, pass in `opts.output`.\n\n## var stream = parse(cb)\n\nReturn a transform stream that accepts test output as input and looks for lines\nstarting with `COVERAGE` and `COVERED` to generate a coverage report in\n`cb(err, coverage, counts)`.\n\n`coverage` is an object that maps filenames from the bundle files to arrays of\ncoverage data.\n\n`counts` is an object mapping filenames to objects with `expr` and `total`\nfields for how many expressions were covered and how many expressions were\npresent.\n\nAll of the non-`/^(COVERAGE|COVERED)\\s/` lines are passed through from the input\nto the output.\n\nHere is some example coverage data that you can generate with `coverify --json`:\n\n```\n{\n  \"/home/substack/projects/coverify/example/test.js\": [\n    {\n      \"range\": [\n        158,\n        169\n      ],\n      \"lineNum\": 7,\n      \"column\": [\n        16,\n        28\n      ],\n      \"line\": \"        if (err) deadCode();\",\n      \"code\": \"deadCode();\"\n    }\n  ],\n  \"/home/substack/projects/coverify/example/foo.js\": [\n    {\n      \"range\": [\n        123,\n        135\n      ],\n      \"lineNum\": 3,\n      \"column\": [\n        35,\n        48\n      ],\n      \"line\": \"        if (i++ === 10 || (false && neverFires())) {\",\n      \"code\": \"neverFires()\"\n    }\n  ]\n}\n```\n\n# usage\n\n```\nusage: coverify OPTIONS\n\nOPTIONS are:\n\n  --json\n\n    Suppress normal output and print json coverage data to stdout.\n\n  -q, --quiet\n\n    Don't print non-coverage input back out to stdout and print coverage\n    output to stdout instead of stderr.\n\n  -c, --color\n\n    Use color in the output. Default: true if stdout is a TTY.\n\n  --stdout\n\n    Always print non-coverage input back out to stdout.\n\n  -o FILE, --output FILE\n\n    Print coverage data to FILE. Use \"@2\" for stderr (the default) and\n    \"@1\" or \"-\" for stdout.\n\n```\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install coverify\n```\n\nto get the browserify transform module.\n\nWhen you compile your tests with browserify you can just do:\n\n```\nbrowserify -t coverify ...\n```\n\nYou will also need the `coverify` command for parsing the test output:\n\n```\nnpm install -g coverify\n```\n\n# license\n\nMIT\n","publish_time":1430681583042,"_cnpm_publish_time":1430681583042,"dist-tags":{"latest":"1.5.1"}}