Tho*_*ggi 8 babel istanbul ava nyc
我想nyc ava和babel所有人在一起好好相处.我有一个问题,async/await分支显示为未覆盖,所以这是有效的,我无法集成babel-plugin-istanbul插件进行测试.
我在项目中有两个文件,src/index.js和src/test.js.
{
"name": "example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "ava",
"coverage": "NODE_ENV=test nyc npm run test",
"report": "nyc report --reporter=html",
"report:open": "open ./coverage/index.html",
"cover": "npm run coverage && npm run report && npm run report:open"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-runtime": "^6.26.0",
"bluebird": "^3.5.0",
"lodash": "^4.17.4"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-cli": "^6.26.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-register": "^6.26.0",
"nyc": "^11.2.1",
"sinon": "^3.2.1",
"testdouble": "^3.2.4"
},
"babel": {
"presets": ["env"],
"plugins": ["transform-runtime"],
"env": {
"test": {
"plugins": ["istanbul"]
}
}
},
"ava": {
"require": ["babel-register"],
"babel": "inherit"
},
"nyc": {
"sourceMap": false,
"instrument": false
}
}
Run Code Online (Sandbox Code Playgroud)
这是什么运行:
> example@1.0.0 coverage /Users/me/Desktop/example
> NODE_ENV=test nyc npm run test
> example@1.0.0 test /Users/me/Desktop/example
> ava
11 passed
----------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files | Unknown | Unknown | Unknown | Unknown | |
----------|----------|----------|----------|----------|----------------|
> example@1.0.0 report /Users/me/Desktop/example
> nyc report --reporter=html
> example@1.0.0 report:open /Users/em/Desktop/example
> open ./coverage/index.html
Run Code Online (Sandbox Code Playgroud)
为什么不在src/index.js报道中显示?
| 归档时间: |
|
| 查看次数: |
572 次 |
| 最近记录: |