🐛 Bug: Error loading 3rd-party reporters swallowed and replaced with generic "invalid reporter" #2575
Open
Description
SR:
- Use the npm to install third-party reporter (e.g. myReporter).
- Modify the reporter by adding a module (e.g. "diff = require('diff')") into myReporter.js file.
- Try to run the mocha with the report.
ER: Appears correct error message (e.g. Error: Cannot find module 'diff').
AR: Appears error message:
node node_modules/mocha/bin/mocha test.js --reporter myReporter
"myReporter" reporter not found
\node_modules\mocha\lib\mocha.js:166
throw new Error('invalid reporter "' + reporter + '"');
^
Error: invalid reporter "myReporter"
at Mocha.reporter (\node_modules\mocha\lib\mocha.js:166:13)
at Object.<anonymous> (\node_modules\mocha\bin\_mocha:212:7)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
I reported the issue here in case if someone also will encounter the problem.