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)。我對此很新,所以任何投入都非常受歡迎。請幫助我,我已經花了整整一天的時間。