Blanket.js vs Istanbul-js vs JSCover [英] Blanket.js vs Istanbul-js vs JSCover
问题描述
我正在尝试决定JS测试代码覆盖率工具,但无法清楚地看到它们之间的差异。谷歌的热门歌曲是blanket.js,istanbul-js和JSCover。
I am trying to decide on a JS test code coverage tool but cannot see clearly the differences between them. The top hits in Google are blanket.js, istanbul-js and JSCover.
任何人都可以提供有关它们与优缺点之间关键差异的任何信息吗?
Can anyone offer any information on the key differences between them and advantages/disadvantages?
还有其他吗?有用的那些?
Are there any other useful ones out there?
推荐答案
经过一番尝试后,我清楚地找到 伊斯坦布尔 将覆盖率分析引入node-js项目的最方便的工具。
After some trying around i clearly find istanbul the most convenient tool to bring coverage analysis to a node-js project.
- 安装了 npm install
- 它设置了它的行为通过 .istanbul.yml
- 由其自己的可执行文件调用
- 它提供多种报告格式,如三叶草, lcov,jscoverage等。
- its installed with npm install
- it sets up its behavior via the .istanbul.yml
- gets invoked by its own executable
- it provides multiple report formats such as clover, lcov, jscoverage, etc.
伊斯坦布尔使用提供的可执行文件或js-script来执行测试和收集覆盖信息。它可以通过 npm 安装:
Istanbul uses the provided executable or js-script to perform the tests and collect coverage information. It can be installed via npm:
npm install istanbul mocha
成功安装后只需通过
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha
尊重'_',因为mocha按照所述分析 _mocha
-executable这里
respect the '_' since mocha forks the _mocha
-executable as stated here
blanket.js for nodejs可以轻松整合
blanket.js for nodejs integrates easily by
- 安装 npm install
- 通过包配置其行为.json
- 通过命令行要求毯子来 mocha 调用
- 生成由 mocha 的记者解释的统计数据,即 html-cov
- 可以在浏览器JS中使用
- its installed with npm install
- configuring its behavior via the package.json
- getting invoked by mocha by requiring blanket at commandline
- generating statistics that are interpreted by mocha's reporters, i.e. html-cov
- can be used in browser JS
基本上它可以在doi之后使用ng
basically it is ready to use after doing
npm install blanket mocha
$ b $成功安装后b
只需运行你的mocha测试
after successful installation simply run your mocha tests like that
./node_modules/.bin/mocha --require blanket --reporter html-cov >coverage.html
不幸的是你必须调用如果你想收集报道信息以及收集测试报告,摩卡会进行两次测试,因为你只能向摩卡提供一名记者。
Unfortunately you have to invoke the mocha tests twice if you want to collect coverage information as well as collect test reports since you can only provide one reporter to mocha.
我不能说 JSCover ,因为它的安装对我来说很复杂。
对我来说重要的是我不必以root身份安装任何软件包,甚至不需要编译,因为对于其他用户来说创建开发环境会变得更加复杂。
I can not say anything about JSCover since its installation was to complicated for me. Important for me was that i do not have to install any packages as root or even compile things since it becomes more complicated for other users to create a development environment.
这篇关于Blanket.js vs Istanbul-js vs JSCover的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!