Open mthaak opened 1 year ago
@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.
I had the same problem and could not figure out why it was failing - there where no other error messages.
After a lot of testing I added a --reporter=list
parameter and surprisingly got more output as to what was going on.
In my case a "port already in use" error which was just hidden by mocha before (without the --reporter
parameter).
Maybe this helps others to debug further.
I'm getting the same issue. Completely blocked until this is resolved.
my mocha config: const mochaConfig = { spec: ['./Axios/tests/*/[sS]pec.ts'], timeout: 6600000, parallel: true, jobs: 2, require: ['tsconfig-paths/register', 'ts-node/register', './tests/mocha-test-hooks.ts'], reporter: 'mocha-junit-reporter', reporterOptions: { mochaFile: './test-results/test-results.[hash].xml' } };
Getting this error:
C:\Users\jsmith\git\myProject\node_modules\mocha-junit-reporter\index.js:217
return testsuites[testsuites.length - 1].testsuite;
^
TypeError: Cannot read properties of undefined (reading 'testsuite')
at lastSuite (C:\Users\jsmith\git\myProject\node_modules\mocha-junit-reporter\index.js:217:46)
at MochaJUnitReporter.
I noticed that when running mocha in debug:
mocha:runner reporterOptions: { mocha:runner '[object Object]': true, mocha:runner mochaFile: 'test-results.xml', <-------------------------------- mocha:runner attachments: false, mocha:runner antMode: false, mocha:runner jenkinsMode: false, mocha:runner properties: null, mocha:runner toConsole: false, mocha:runner rootSuiteTitle: 'Root Suite', mocha:runner testsuitesTitle: 'Mocha Tests', mocha:runner suiteTitleSeparatedBy: ' ' mocha:runner },
No matter what I change the name of the file to in my config (mochaFile: './test-results/chris-is-silly.xml') the debugger always shows the mochaFile as 'test-results.xml'. No idea if that's related or helpful.
I had the same problem and could not figure out why it was failing - there where no other error messages. After a lot of testing I added a
--reporter=list
parameter and surprisingly got more output as to what was going on. In my case a "port already in use" error which was just hidden by mocha before (without the--reporter
parameter).Maybe this helps others to debug further.
This helped, thanks.
I am running
mocha-junit-reporter
using Cypress. However, sporadically (6 out of 100 times) it fails with this stack-trace:While running this command:
yarn exec cypress run --component --reporter=junit --reporter-options="mochaFile=/tmp/test-reports/test-output-components.xml,toConsole=true"