问题描述
我想让伊斯坦布尔工作。
I am trying to get Istanbul to work.
我在运行伊斯坦布尔结束时不断收到此消息:
I keep getting this message at the end of running istanbul:
I我已经尝试了我在网上找到的所有内容,你可以看到:
I have tried everything I could find online as you can see:
"scripts": {
"start": "node ./bin/start.js",
"test": "mocha test --no-timeouts",
"debug_mocha": "node-debug --no-timeouts _mocha",
"eslint": "eslint .",
"jshint": "jshint --exclude ./node_modules .",
"istanbul": "istanbul cover --include-all-sources --hook-run-in-context node_modules/.bin/_mocha -- -u exports -R spec test/**/*",
"istanbul2":"istanbul cover node_modules/.bin/_mocha -- -u exports -R spec test/**/*",
"istanbul1":"istanbul cover node_modules/.bin/_mocha -- test/**/*",
"istanbul0":"istanbul cover _mocha test/**/*.js",
"istanbul3":"istanbul cover _mocha -- -R spec --recursive test"
}
我的.istanbul.yml文件位于项目的根部,看起来伊斯坦布尔正在成功地提起它。
my .istanbul.yml file is at the root of the project and looks like istanbul is picking it up successfully.
//.istanbul.yml
instrumentation:
compact: false
save-baseline: true
reporting:
reports:
- lcov
- cobertura
我缺少什么?
推荐答案
试试这个,可能适合你。 package.json中的脚本标记
Try this, may works for you. Script tag in your package.json
"cover" : "NODE_ENV=test babel-node ./node_modules/babel-istanbul/lib/cli cover --dir ./coverage _mocha -- -R spec --ui bdd ./test/setup.js ./test --recursive"
setup.js 将是您的设置javascript
setup.js will be your setup javascript
./ test 将是所有测试所在的文件夹。
./test will be the folder where all your tests sits.
需要安装的软件包:
- babel-istanbul
- babel-node
- mocha
这对我有用:)(npm run cover)
This works for me :) (npm run cover)
注意:
如果在 Windows :删除 NODE_ENV = test ,可能需要将 _mocha 完整路径设置为节点模块文件夹
Note: if on windows: remove NODE_ENV=test, and may need to make the _mocha full path to your node module folder
这篇关于伊斯坦布尔代码覆盖Mocha测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!