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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make mocha-junit-reporter work with Mocha 6 #80

Merged
merged 4 commits into from Jun 7, 2019
Merged

fix: Make mocha-junit-reporter work with Mocha 6 #80

merged 4 commits into from Jun 7, 2019

Conversation

YOU54F
Copy link
Contributor

@YOU54F YOU54F commented Mar 27, 2019

Mocha 6 introduced breaking changes in v6.0 specifically around reporters

https://github.com/mochajs/mocha/releases/tag/v6.0.0

the particular breaking change for reporters - mochajs/mocha#3458

PR tracking the mocha 6 upgrade and failing CI test run

YOU54F/template-cypress-docker-typescript#15

TypeError: Cannot read property 'failures' of undefined
    at MochaJUnitReporter.getXml (/root/app/e2e/node_modules/mocha-junit-reporter/index.js:291:22)
    at MochaJUnitReporter.flush (/root/app/e2e/node_modules/mocha-junit-reporter/index.js:238:18)
    at MochaJUnitReporter.<anonymous> (/root/app/e2e/node_modules/mocha-junit-reporter/index.js:144:10)
    at emitOne (events.js:120:20)
    at Runner.emit (events.js:210:7)
    at Reporter.emit (/root/.cache/Cypress/3.1.3/Cypress/resources/app/packages/server/lib/reporter.js:239:55)
    at Object.server.startWebsockets.onMocha (/root/.cache/Cypress/3.1.3/Cypress/resources/app/packages/server/lib/project.js:296:22)
    at Socket.<anonymous> (/root/.cache/Cypress/3.1.3/Cypress/resources/app/packages/server/lib/socket.js:237:36)
    at emitTwo (events.js:125:13)
    at Socket.emit (events.js:213:7)
    at /root/.cache/Cypress/3.1.3/Cypress/resources/app/packages/socket/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

I have created forks of mocha-multi-reporter and mocha-junit-reporter and applied the fix in my cypress test suite, pulling in the forked repos with fixes applied and everything is working end to end now including mochawesome reporting.

Test runs are now passing 馃憤 would need a major version release, as it will be a breaking change for any users with mocha versions below 6.

https://circleci.com/gh/YOU54F/cypressio-docker-typescript/95

@clayreimann
Copy link
Collaborator

Thanks for doing the legwork @YOU54F!

I'm going to clear the backlog of other PRs (I hope this morning), so that people (like me) using mocha<6 can get all the new stuff. After that's done I'll do this major rev

@YOU54F
Copy link
Contributor Author

YOU54F commented Mar 31, 2019

No worries chap! Glad to be able to help out on a project I have used for ages 馃憤

@aboe026
Copy link

aboe026 commented Apr 25, 2019

bump. It would be nice to have this as I'm seeing the same error with mocha 6+.

@clayreimann
Copy link
Collaborator

Thanks for the bump. I鈥檒l try to integrate this this week

Sent with GitHawk

@YOU54F
Copy link
Contributor Author

YOU54F commented May 5, 2019

Hi mate, just to let you know this is now backwards compatible with mocha <6 as we now check mocha's package.json file and if its greater or equal to 6, we set a flag and create the statsCollected

@aboe026
Copy link

aboe026 commented May 30, 2019

any update @clayreimann ?

@YOU54F
Copy link
Contributor Author

YOU54F commented Jun 4, 2019

@clayreimann - any chance we could get this merged?

Cypress uses mocha-junit-reporter internally, and therefore won't work with mocha6 until this change is merged.

See the following file/line for where they reference it

https://github.com/cypress-io/cypress/blob/06796484ec46f9a4bd1e666a887e0f0c44e49032/packages/server/lib/reporter.coffee#L132

@clayreimann clayreimann merged commit b28d669 into michaelleeallen:master Jun 7, 2019
@YOU54F
Copy link
Contributor Author

YOU54F commented Jun 7, 2019

Nice one @clayreimann 馃檶馃憣馃馃徑

@clayreimann
Copy link
Collaborator

You're welcome, and thanks for the contribution. The new release should be out soon.

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

Successfully merging this pull request may close these issues.

None yet

3 participants