Got TypeError: Cannot read property 'passes' of undefined using Cypress when generating mochawesome report
I got the same error when using mocha
version 6.0.0
or above.
If you could, try using version 5.2.0
, until the problem is solved, and it will work fine.
Mocha 6 requires a stat collector to be instantiated
i’ve now updated, tested and released updated modules that fix this with mocha 6, but also retains backwards compatibility with mocha 5 and earlier versions.
https://www.npmjs.com/package/cypress-multi-reporters https://www.npmjs.com/package/mocha-junit-reporters
Example against Mocha 5 Example against Mocha 6
the changes required are minimal
npm i mocha-junit-reporters
npm i cypress-multi-reporters
in reporterOpts.json
{
"reporterEnabled": "mocha-junit-reporters, mochawesome",
"mochaJunitReportersReporterOptions": {
"mochaFile": "cypress/reports/junit/test_results[hash].xml",
"toConsole": false
},
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports/mocha",
"quiet": true,
"overwrite": false,
"html": false,
"json": true
}
}
in cypress.json
{
...
"reporter": "cypress-multi-reporters",
"reporterOptions": {
"configFile": "reporterOpts.json"
}
See https://github.com/YOU54F/cypress-docker-typescript/pull/22/files
Hopefully the PR's will be merged in the source repo's soon but for now, enjoy