JavaScript代码覆盖率工具:istanbul
istanbul 是一个采用 JavaScript 开发代码覆盖率检查工具。它具有以下特性:
- 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)
用例
支持以下用例:
- 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
示例报表:
http://gotwarlost.github.io/istanbul/public/coverage/lcov-report/index.html
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!