0
我试图获得我的node.js项目的代码覆盖范围。为此,我正在使用摩卡和伊斯坦布尔。但我得到0传球 伊斯坦布尔:没有收集覆盖范围的信息,退出没有写覆盖信息 摩卡和伊斯坦布尔在当地安装。里面的package.json脚本看起来像伊斯坦布尔:没有收集覆盖范围的信息,没有写入覆盖范围信息而退出
"scripts": {
"test": "node_modules/.bin/mocha",
"test:coverage": "./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha"
}
文件夹结构看起来像 -----项目 ---- node_modules ---测试 --unit -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)。我对此很新,所以任何投入都非常受欢迎。请帮助我,我已经花了整整一天的时间。