-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Labels
Description
- Version: 7.10.0
- Platform: macOS 12.1
- Node: 17.1
Configuration options for "include" and "src" are very unclear. Without specifying either, several extraneous files are included in the report and some are actually not included at all (despite their tests running).
package.json
{
"scripts": {
"test": "NODE_ENV=test NODE_OPTIONS='--no-warnings --loader=./loader.mjs' mocha './lib'",
"test:coverage": "c8 --check-coverage npm test"
},
"c8": {
"branches": 100,
"exclude": [
"**/*.fixture.js",
"**/*.spec.{js,cjs,mjs,ts,tsx,jsx}" // c8 is expecting .test.*
]
},
}file directory
./lib
├ compose.js
├ compose.spec.js
├ diff.js
├ diff.spec.js
├ Form.jsx
├ Form.spec.js
c8 coverage report
// passing mocha spec output for compose.spec.js, diff.spec.js, and Form.spec.js
-----------------|---------|----------|---------|---------|------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------|---------|----------|---------|---------|------------------
All files | 92.57 | 95.31 | 66.66 | 92.57 |
PACKAGE | 100 | 84.61 | 54.54 | 100 |
loader.mjs | 100 | 87.5 | 100 | 100 | 33
mocha.setup.js | 100 | 80 | 28.57 | 100 | 13
PACKAGE/lib | 88.94 | 98.03 | 85.71 | 88.94 |
<stdin> | 73.41 | 85.71 | 80 | 73.41 | 51-71
compose.js | 100 | 100 | 100 | 100 |
diff.js | 100 | 100 | 100 | 100 |
-----------------|---------|----------|---------|---------|------------------
Unexpectedly, ./loader.mjs and ./mocha.setup.js are included, yet Form.spec.js is not.
Specifying anything for "include" seems to cause the coverage report to be empty, and "src" seems to have no affect whatsoever.
ihavenonickname