istanbul: A Javascript code coverage tool written in JS
Yet another code coverage tool for Javascript, with the following features:
- All-javascript instrumentation library that tracks statement, branch,
and function coverage and reverse-engineers line coverage with 100% fidelity.
- Module loader hooks to instrument code on the fly
- Command line tools to run node unit tests "with coverage turned on" and no cooperation
whatsoever from the test runner
- HTML and LCOV reporting.
- Ability to use as middleware when serving JS files that need to be tested on the browser.
- Can be used on the command line as well as a library
- Based on the awesome esprima parser and the equally awesome escodegen code generator
- Well-tested on node 0.4.x, 0.6.x, 0.8.x and the browser (instrumentation library only)
Use cases
Supports the following use cases and more
- transparent coverage of nodejs unit tests
- ability to use in an
npm test
script for conditional coverage
- instrumentation of files in batch mode for browser tests (using yeti for example)
- Server side code coverage for nodejs by embedding it as custom middleware
Links