bcoe / bcoe/c8

c8 report throws error in node.js 8

Open
#207 2 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

I have a project which has package.json scripts:
```js
"test": "c8 --no-check-coverage -r none tape test/test.js | tap-min",
"posttest": "c8 report"
```

I would expect this to function in node.js 8+ but `c8 report` fails in node.js 8:
```
{ Error: ENOENT: no such file or directory, scandir '/usr/src/npm/process-on-spawn/coverage/tmp'
at fs.readdirSync (fs.js:904:18)
at Report._loadReports (/usr/src/npm/process-on-spawn/node_modules/c8/lib/report.js:211:19)
at Report._getMergedProcessCov (/usr/src/npm/process-on-spawn/node_modules/c8/lib/report.js:148:37)
at Report.getCoverageMapFromAllCoverageFiles (/usr/src/npm/process-on-spawn/node_modules/c8/lib/report.js:66:31)
at Report.run (/usr/src/npm/process-on-spawn/node_modules/c8/lib/report.js:46:31)
at Object.exports.outputReport (/usr/src/npm/process-on-spawn/node_modules/c8/lib/commands/report.js:25:16)
at Object.exports.handler (/usr/src/npm/process-on-spawn/node_modules/c8/lib/commands/report.js:9:17)
at Object.runCommand (/usr/src/npm/process-on-spawn/node_modules/yargs/lib/command.js:240:40)
at Object.parseArgs [as _parseArgs] (/usr/src/npm/process-on-spawn/node_modules/yargs/yargs.js:1154:41)
at Object.parse (/usr/src/npm/process-on-spawn/node_modules/yargs/yargs.js:627:25)
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/usr/src/npm/process-on-spawn/coverage/tmp' }
```

My expectation was that this would exit without reporting an error. For now I'm installing `if-ver` to have my posttest skip running `c8 report` in node.js 8.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.