mocha coverage report生成
 发布于 11 年前  作者 bornkiller  6215 次预览  最后一次回复是 10 年前  来自 分享 

依赖工具

  • istanbul
  • mocha

测试命令

node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- -u exports -R spec

注意事项

4 回复
ArronYR

windows给跪了,执行 istanbul cover _mocha 直接报错了。

ArronYR

有哪位朋友windows上跑起来了?还烦请告知解决办法

lucasrui

linux系统里,正常的指令是istanbul cover _mocha,但在Windows系统执行该指令会报错SyntaxError: Unexpected token ILLEGAL,在查看了stackoverflow的相关解答后才发现是istanbul找不到_mocha这个指令,所以命令应该这样:istanbul cover {your_npm_path}\npm\node_modules\mocha\bin\_mocha。