我可以使用伊斯坦布尔为摩卡html-cov的仪器

我正在尝试使用istanbul instrument输出mocha -R html-cov但不能得到它的工作。

我的testing脚本是:

 test: post: - node_modules/.bin/istanbul cover node_modules/.bin/_mocha -dir $CIRCLE_ARTIFACTS -- -u exports -R spec - node_modules/.bin/istanbul instrument . -o lib-cov - cp package.json lib-cov/ # needs to be copied manually - MY_LIB_COV=1 node_modules/.bin/mocha -R html-cov > $CIRCLE_ARTIFACTS/coverage.html 

我的testing有以下开关:

 var mylib = process.env.MY_LIB_COV ? require('../lib-cov') : require('../'); 

伊斯坦布尔在lcov-report/index.html给了我一个很好的输出。
摩卡的html-cov在coverage.html给了我'0%覆盖率0 SLOC'

伊斯坦布尔的lcov报告是丑陋的。 我想用漂亮的mocha -R html-cov报告。

我find的所有例子都使用jscoverage。 我必须使用jscoverage吗? 我错过了一个把戏吗?

是的,摩卡的html-cov只报告jscoverage提供了什么。 请参阅https://mochajs.org/#reporters