Skip to content
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

Errors when using Mocha 6 + Cypress #56

Closed
michaelw85 opened this issue Feb 20, 2019 · 3 comments
Closed

Errors when using Mocha 6 + Cypress #56

michaelw85 opened this issue Feb 20, 2019 · 3 comments

Comments

@michaelw85
Copy link

Expected behavior

No errors

Actual behavior

Errors when 2nd test suite is run. "Cannot read property xxxx of undefined"

Information about the Issue

Using following packages:

    "cypress": "^3.1.5",
    "mocha": "^6.0.0",
    "mocha-junit-reporter": "^1.18.0",
    "mocha-multi-reporters": "^1.1.7",

Steps to reproduce the behavior

Follow this guide to setup mocha-multi-reporters in cypress and run a test setup with 2 separate test files using spec and junit reporter.

Workaround

Downgrade to mocha 5.2.0 and everything is working as expected.

@YOU54F
Copy link
Contributor

YOU54F commented Mar 27, 2019

Just fixed this and proposed the following 2 PR's

#58
michaelleeallen/mocha-junit-reporter#80

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

    "mocha": "^6.0.0",
    "mocha-junit-reporter": "YOU54F/mocha-junit-reporter#master",
    "mocha-multi-reporters": "YOU54F/mocha-multi-reporters#master",

@YOU54F
Copy link
Contributor

YOU54F commented Jun 4, 2019

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
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

@francisu
Copy link
Collaborator

francisu commented Nov 4, 2020

1.5.1 now supports the current version of mocha

@francisu francisu closed this as completed Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants