c8 icon indicating copy to clipboard operation
c8 copied to clipboard

c8 report throws error in node.js 8

Open coreyfarrell opened this issue 5 years ago • 2 comments

I have a project which has package.json scripts:

"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.

coreyfarrell avatar Mar 27 '20 16:03 coreyfarrell

I've got a similar error using Node v10.16.3

{ Error: ENOENT: no such file or directory, mkdir '/home/iudx-auth-server/coverage/tmp' at mkdirSync (fs.js:757:3) at writeCoverage (internal/process/coverage.js:20:5) at process.reallyExit (internal/process/coverage.js:64:5) at process.exit (internal/process/per_thread.js:170:13) at process.once (internal/cluster/child.js:36:15) at Object.onceWrapper (events.js:286:20) at process.emit (events.js:198:13) at finish (internal/child_process.js:817:14) at process._tickCallback (internal/process/next_tick.js:61:11) errno: -2, syscall: 'mkdir', code: 'ENOENT', path: '/home/iudx-auth-server/coverage/tmp' } Edit:Please excuse the formatting

ThorodanBrom avatar Mar 31 '20 12:03 ThorodanBrom

You are seeing a different error. You are seeing an error writing coverage data where this bug is reporting an error reporting (reading) the coverage.

coreyfarrell avatar Mar 31 '20 13:03 coreyfarrell