node-coveralls
Coveralls.io support for node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button to your README.
Usage
- Add the latest version of
coveralls
to your package.json:
npm install coveralls --save
- Instrument your code with Istanbul, JSCover, node-jscoverage or any tool of your choosing
- Run your test suites against the instrumented files, with Istanbul, the Mocha LCOV Reporter, or, once again, the tool of your choosing
- Run
\
npm bin`/coveralls.js < /path/to/your/lcov_report.info`
coveralls.io require the presence of an environment variable called
COVERALLS\_REPO\_TOKEN
, whic contains the secret token to post your coverage data. Make sure it is available in your Ci environment, or the whole bild will fail (node-coveralls
will stop with a non-zero return code).
Setup example
In this repo, I used Istanbul and Mocha, and wrapped them all in the following npm
scripts:
"scripts": {
"test": "node ./test/runner.js",
"coverage": "`npm bin`/istanbul cover ./test/runner.js",
"coveralls": "npm run-script coverage && node bin/coveralls.js < coverage/lcov.info"
}
The Ci environments they run into execute the task coveralls
to send the data once the build is finished.
Supported CIs
Currently, node-coveralls
can send data from 3 CI environments:
- Travis
- Codeship.io
- local (Run from your dev machine)
The two first offer a great level of integration, the third os yet to be polished, though the major info is available.
More CIs ?
Feel free to pull-request the integration of another CI, or simply ask, it may be just enough to see it implemented 😉.
Roadmap
- More CIs
- Polish
- Enhnce code coverage (of course!)
Licence
MIT