Cannot read properties of undefined (reading 'testsuite')
mthaak opened this issue ยท 13 comments
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"
@michaelleeallen could you take a look at this? Look at least 5 dudes with this problem :(
I have just hit this issue too is there any fix?
To give up :(
@Nuxij switching from reporter: 'mocha-junit-reporter'
to reporter: 'junit'
fixed the issue for me so maybe worth a try? ๐คท
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...
Hi there.
Still having this issue with "mocha-junit-reporter": "2.2.1"
, using it together with mocha-multi-reporters
.
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",
@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.
reproducible also when running tests with --parallel
flag
I am also experiencing this problem a lot since we run parallel processes.