虽然我的测试通过了 mocha,但我的覆盖率仍然为零:
5 passing (12ms)
-----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
lib | 0 | 0 | 0 | 0 |
index.js | 0 | 0 | 0 | 0 | 3-28
src | 0 | 0 | 0 | 0 |
index.js | 0 | 0 | 0 | 0 | 2-20
-----------|---------|----------|---------|---------|-------------------
我在 package.json 中的脚本部分如下:
"scripts": {
"lint": "eslint ./src",
"build": "npm run lint && babel ./src -d ./lib",
"test": "mocha --require babel-core/register",
"test-with-coverage": "nyc --all npm run test"
},
我的纽约部分如下:
"nyc": {
"reporter": [
"lcov",
"text"
]
}