我正在尝试获得我的node.js项目的代码覆盖率。我正在使用摩卡和伊斯坦布尔来达到这个目的。但是我在通过伊斯坦布尔时得到了0:没有收集覆盖信息,没有写入覆盖信息就退出,Mocha和伊斯坦布尔都安装在本地。package.json中的脚本如下所示
"scripts": {
"test": "node_modules/.bin/mocha",
"test:coverage": "./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha"
}文件夹结构如下-项目-node_modules-测试--单元-01test1.tes.js -02test2.test.js
我的.istanbul.yml文件
verbose: false
instrumentation:
root: ./node_modules/.bin/istanbul
default-excludes: true
excludes: []
embed-source: false
variable: __coverage__
compact: true
preserve-comments: false
complete-copy: false
save-baseline: false
baseline-file: ./coverage/coverage-baseline.json
reporting:
print: summary
reports:
- lcov
dir: ./coverage
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
hooks:
hook-run-in-context: false
post-require-hook: null我在运行coomand
npm运行测试:覆盖率
在终端(Mac OSX)中。我对此相当陌生,因此非常欢迎任何意见。请帮帮我,我已经花了一整天的时间了。
https://stackoverflow.com/questions/42415581
复制相似问题