JavaScript代碼覆蓋率工具:istanbul

jopen 10年前發布 | 27K 次閱讀 istanbul JavaScript開發

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

JavaScript代碼覆蓋率工具:istanbul

項目主頁:http://www.baiduhome.net/lib/view/home/1411615610703

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!