Cypress: Could not load reporter by name

Created on 15 Jan 2018  路  6Comments  路  Source: cypress-io/cypress

  • Operating System: MacOS High Sierra
  • Cypress Version: 1.4.1
  • Browser Version: Chrome latest

Is this a Feature or Bug?

Bug.

Current behavior:

When specifying any custom reporter (tried with mocha-multi-reporters and mochawesome) in cypress.json, cypress fails with

Could not load reporter by name: mocha-multi-reporters

We searched for the reporter in these paths:

- /Users/redacted/redacted/ui-test-poc/mocha-multi-reporters
- /Users/redacted/redacted/ui-test-poc/node_modules/mocha-multi-reporters

However, the reporter is installed and can be found at the specified path:

/Users/redacted/redacted/ui-test-poc/node_modules/mocha-multi-reporters

Desired behavior:

Cypress loads the reporter successfully

How to reproduce:

  • make a starter project
  • run npm i mocha-multi-reporters --save-dev
  • add the following cypress.json file:

    {
     "videoRecording": false,
     "reporter": "mocha-multi-reporters",
     "reporterOptions": {
       "configFile": "multi-reporter-config.json"
     }
    }
    
    
  • run npx cypress run

Test code:

n/a

Additional Info (images, stack traces, etc)

n/a

unexpected behavior

Most helpful comment

Update: mocha was not installed, that's the reason why it failed.

Shouldn't mocha be auto-installed with cypress? Also, the error messages should indicate mocha is missing instead of the reporter.

All 6 comments

Update: mocha was not installed, that's the reason why it failed.

Shouldn't mocha be auto-installed with cypress? Also, the error messages should indicate mocha is missing instead of the reporter.

I ran into the same problem with mochawesome. The error message on the terminal is not helpful.

screenshot from 2018-03-13 14-13-31

Thankfully you had a section in your reporters documentation specifically about mochawesome. Can the error thrown on terminal be little more descriptive?

FYI: I had to install mocha as a dev-dependency - peer-dependency didnt work

Context: I use lerna and yarn as a monorepo, also had to add cypress, mocha, and mochawesome to nohoist.

package.json on root:

  "workspaces": {
    "packages": ["packages/*"],
    "nohoist": [
      "**/mochawesome",
      "**/mochawesome/**",
      "**/mocha",
      "**/mocha/**",
      "**/cypress",
      "**/cypress/**"
    ]
  }

I had to install mocha as a dev-dependency - peer-dependency didn't work

Peer dependencies are not installed when running npm i.

If any of you have any issue, please consider opening a new issue if you still experience any problem. Commenting on closed issues is not a good way to get attention to your problem.

Released in 3.0.0.

I ran into the same problem with mochawesome. @defel 's solution worked for me.
Thanks @defel .

Was this page helpful?
0 / 5 - 0 ratings