michaelleeallen / mocha-junit-reporter

A JUnit XML reporter for mocha.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using --forbid-only in mocha

kobik opened this issue · comments

Hi,

When running mocha with --forbid-only switch and there are tests with .only, i'm getting the following error

*****/node_modules/mocha-junit-reporter/index.js:217
    return testsuites[testsuites.length - 1].testsuite;
                                             ^

TypeError: Cannot read properties of undefined (reading 'testsuite')
    at lastSuite (*****/node_modules/mocha-junit-reporter/index.js:217:46)
    at MochaJUnitReporter.<anonymous> (*****/node_modules/mocha-junit-reporter/index.js:262:5)
    at Runner.emit (node:events:525:35)
    at Runner.emit (node:domain:489:12)
    at Runner.fail (*****/node_modules/mocha/lib/runner.js:453:8)
    at Runner._uncaught (*****/node_modules/mocha/lib/runner.js:983:12)
    at process.emit (node:events:525:35)
    at process.emit (node:domain:489:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (*****/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
    at process._fatalException (node:internal/process/execution:149:25)

Node.js v18.16.0