Code development platform for open source projects from the European Union institutions 🔵 EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content

report --output ‹path› ignores leading slash of an absolute path

Running website-evidence-collector report --output /tmp/report.html /tmp/investigation.json ends up with an ENOENT error, because wec (or yargs?) somehow trims the leading slash (/) of the argument of the required1 --output|-o parameter2.

Error: ENOENT: no such file or directory, open 'tmp/report.html'
    at Object.writeFileSync (node:fs:2425:20)
    at Reporter.saveFile (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/src/reporter/reporter.js:168:16)
    at Reporter.generateHtmlReport (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/src/reporter/reporter.js:46:14)
    at runReporter (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/src/commands/reporterCommand.js:102:22)
    at Object.handler (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/src/commands/reporterCommand.js:68:15)
    at file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/node_modules/yargs/build/lib/command.js:206:54
    at maybeAsyncResult (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/node_modules/yargs/build/lib/utils/maybe-async-result.js:9:15)
    at CommandInstance.handleValidationAndGetResult (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/node_modules/yargs/build/lib/command.js:205:25)
    at CommandInstance.applyMiddlewareAndGetResult (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/node_modules/yargs/build/lib/command.js:245:20)
    at CommandInstance.runCommand (file:///home/debian/.npm-packages/lib/node_modules/website-evidence-collector/node_modules/yargs/build/lib/command.js:128:20) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'tmp/report.html'
}
  1. BTW: Help screen website-evidence-collector report --help does not include required --output command line parameter in its usage example – actually, help screens don't inform about required v optional parameters at all.

  2. You cannot use /dev/stdout as output specification because WEC uses the output filename's extension to derive which format is requested; selecting output format with a switch might be a better design choice.