Skip to content

🐛 Bug: Error loading 3rd-party reporters swallowed and replaced with generic "invalid reporter" #2575

Open
@yuriyKazan

Description

SR:

  1. Use the npm to install third-party reporter (e.g. myReporter).
  2. Modify the reporter by adding a module (e.g. "diff = require('diff')") into myReporter.js file.
  3. 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.

Metadata

Assignees

No one assigned

    Labels

    area: usabilityconcerning user experience or interfacestatus: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions