Bug.
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
Cypress loads the reporter successfully
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"
}
}
npx cypress run
n/a
n/a
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.
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 .
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.