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

Uncaught TypeError: Cannot read properties of undefined (reading 'length') #205

Open
Pverma96 opened this issue May 12, 2024 · 0 comments
Open

Comments

@Pverma96
Copy link

Pverma96 commented May 12, 2024

i am using mocha-multi-reporters in my mocha tests and generating mochawesome and mocha-junit-reports. When using --parallel flag, mocha-junit-reporter throws error:

Uncaught error outside test suite:
Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at isInvalidSuite (node_modules/mocha-junit-reporter/index.js:155:62)
at MochaJUnitReporter._onSuiteBegin (node_modules/mocha-junit-reporter/index.js:232:10)
at MochaJUnitReporter. (node_modules/mocha-junit-reporter/index.js:239:17)
at ParallelBufferedRunner.emit (node:events:530:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.allSettled (index 0)

command used to run the tests is:

./node_modules/mocha/bin/mocha.js --config .mocharc.cjs --parallel --reporter mocha-multi-reporters --reporter-options configFile=reporter-config.json --require mochawesome/register --exit test/**/*.spec.js

below is the reporter config file:

{
"reporterEnabled": "mochawesome, mocha-junit-reporter",
"mochawesomeReporterOptions": {
"reportDir": "results/mochawesome",
"overwrite": false,
"html": true,
"json": true,
"toConsole": true,
"consoleReporter": "spec"
},
"mochaJunitReporterReporterOptions": {
"mochaFile": "results/junit/test-results.xml"

}

noticed that if i remove "--require mochawesome/register" flag, i get same error as defined in #178

Version:
"mochawesome": "^7.1.3",
"mocha-junit-reporter": "2.2.0",
"mocha-multi-reporters": "^1.5.1"
"mocha": "^10.4.0",

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

1 participant