-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'passes' of undefined #269
Comments
At first glance this seems to be related to changes that were made in mocha 6.0.0. Specifically as part of mochajs/mocha#3458. The reporter continues to work as expected when used directly with mocha, however when used with Cypress it is throwing errors. I wrote mochawesome to work with mocha and unfortunately Cypress has been known to have issues. I will try to look into this further but cannot guarantee when or if a fix will be released. A temporary workaround would be to install a version of mocha <6. |
@adamgruber Thank you~ |
Just fixed this and proposed the following 2 PR's stanleyhlng/mocha-multi-reporters#58 My branch tracking the changes, with failing builds with mocha 6 pre and post fix is here https://github.com/YOU54F/cypressio-docker-typescript/pull/15/files If you do want to move up to mocha 6, you can pull my forked branch in the interim, whilst we wait for the maintainers of the source repo to review/merge/release the PR
|
Updated instructions 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 Example against Mocha 5 the changes required are minimal
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 |
any update? |
Any update? |
Mocha 6 introduced a new "stats-collector" that reporters have to manually instantiate in order to get stats. If running under Mocha 6 reporters that haven't done this will throw exceptions like `Cannot read property 'passes' of undefined` or `Cannot read property 'failures' of undefined`. fixes adamgruber#269 fixes adamgruber#282
Mocha 6 introduced a new "stats-collector" that reporters have to manually instantiate in order to get stats. If running under Mocha 6 reporters that haven't done this will throw exceptions like `Cannot read property 'passes' of undefined` or `Cannot read property 'failures' of undefined`. fixes adamgruber#269 fixes adamgruber#282
Mocha 5.2.0 won't have this issue, only the latest Mocha 6.x and 7.x are still having this same issue... |
Any news on this matter? Meanwhile Cypress 4.0 has been released and they now require Mocha 7.0.1 (https://docs.cypress.io/guides/references/migration-guide.html#Migrating-to-Cypress-4-0) |
Just released v5.0.0 to address this. Specifies mocha 7+ as a peer dependency. |
I've installed the latest mocha, mochawesome, cypress etc,but when i run 'npm test',No test report was generated.
package.json:
exception:
The text was updated successfully, but these errors were encountered: