-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Bug Report Checklist
- I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
- I have searched for related issues and issues with the
faqlabel, but none matched my issue. - I have 'smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, my usage of Mocha, or Mocha itself.
- I want to provide a PR to resolve this
Expected
Mocha should use the reporter-options specified on the command-line instead of the one defined in .mocharc.yml.
Actual
Mocha use the reporter-options defined in .mocharc.yml instead of the one specified on the command-line.
Minimal, Reproducible Example
- Define a
.mocharc.ymlfile withreporter-options:
recursive: true
reporter: xunit
reporter-options:
- 'output=./test-reports/xunit.xml'- Call mocha using a different value for
reporter-options:
node node_modules/mocha/bin/mocha --reporter-options output=./test-reports/xxxunit.xml- Verify that mocha has created
./test-reports/xunit.xmland not./test-reports/xxxunit.xml
Versions
Debian Bookworm / Mocha version 6.2.3 / Node version v24.11.0 -> work as expected
Debian Bookworm / Mocha version 7.2.0 / Node version v24.11.0 -> work as expected
Debian Bookworm / Mocha version 7.2.0 / Node version v24.11.0 -> work as expected
Debian Bookworm / Mocha version 8.2.1 / Node version v24.11.0 -> work as expected
Debian Bookworm / Mocha version 8.3.0 / Node version v24.11.0 -> do not work as expected
Debian Bookworm / Mocha version 11.7.5 / Node version v24.11.0 -> do not work as expected
Additional Info
I have the same problem on other node versions (Debian Buster/Node 16 v16.20.2), so I guess it's mocha related.
The behavior has change between mocha@8.2.1 and mocha@8.3.0.
As I still have the same problem with mocha@11.7.5, it is in all versions since v8.3.0.
For me it looks very similar to issue: #3951