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

Cannot read properties of undefined (reading 'testsuite') #178

Open
mthaak opened this issue Nov 20, 2022 · 10 comments
Open

Cannot read properties of undefined (reading 'testsuite') #178

mthaak opened this issue Nov 20, 2022 · 10 comments

Comments

@mthaak
Copy link

mthaak commented Nov 20, 2022

I am running mocha-junit-reporter using Cypress. However, sporadically (6 out of 100 times) it fails with this stack-trace:

Cannot read properties of undefined (reading 'testsuite')
TypeError: Cannot read properties of undefined (reading 'testsuite')
    at lastSuite (/home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/node_modules/mocha-junit-reporter/index.js:217:46)
    at MochaJUnitReporter.<anonymous> (/home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/node_modules/mocha-junit-reporter/index.js:258:5)
    at Runner.emit (node:events:539:35)
    at Runner.emit (node:domain:475:12)
    at Reporter.emit (/home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/packages/server/lib/reporter.js:354:46)
    at Object.onMocha (/home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/packages/server/lib/project-base.js:273:34)
    at Socket.<anonymous> (/home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/packages/server/lib/socket-base.js:259:40)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at Socket.emitUntyped (/home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/circleci/.cache/Cypress/10.11.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

While running this command: yarn exec cypress run --component --reporter=junit --reporter-options="mochaFile=/tmp/test-reports/test-output-components.xml,toConsole=true"

@yuritoledo
Copy link

yuritoledo commented Feb 27, 2023

@michaelleeallen could you take a look at this? Look at least 5 dudes with this problem :(

@Nuxij
Copy link

Nuxij commented May 11, 2023

I have just hit this issue too is there any fix?

@yuritoledo
Copy link

To give up :(

@cl-fl
Copy link

cl-fl commented May 11, 2023

@Nuxij switching from reporter: 'mocha-junit-reporter' to reporter: 'junit' fixed the issue for me so maybe worth a try? 🤷

@zjkipping
Copy link
Contributor

Switching the reporter isn't a "fix", you are just using an entirely different system... From my side we didn't start experiencing this error until we started adding the [suitName] to the mochaFile output name config. This variable just needs to be escaped if it doesn't exist instead of crashing everything...

@AM1988
Copy link

AM1988 commented Jan 12, 2024

Hi there.

Still having this issue with "mocha-junit-reporter": "2.2.1", using it together with mocha-multi-reporters.

@kirrg001
Copy link

Same here. The issue comes and goes. Any workarounds?

"node_modules/mocha-junit-reporter": {
"version": "2.2.1"
"node_modules/mocha-multi-reporters": {
"version": "1.5.1",

@kirrg001
Copy link

kirrg001 commented Feb 6, 2024

@clayreimann Hi ✋ How can we help to get this bug fixed? Do you have any guess why this is happening randomly? I can create a pull request.

@AM1988
Copy link

AM1988 commented Feb 6, 2024

reproducible also when running tests with --parallel flag

@kirrg001
Copy link

kirrg001 commented Feb 6, 2024

I am also experiencing this problem a lot since we run parallel processes.

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

7 participants