Closed davidwesst closed 6 years ago
I'm hoping to submit a pull request ASAP, as I've tested this locally and it appears to work fine. Just need to make sure I'm not breaking something else.
Hi @davidwesst,
The xunit
test report will be used by default. To disable xunit
test reporter, you can localize the setting by creating the following config.json
file.
$ cat config.json
{
"reporterEnabled": "tap"
}
I have created a demo branch for your to verify. https://github.com/stanleyhlng/mocha-multi-reporters-demo/blob/issue35-xunit.xml/config.json
Hope this help,
Thanks, Stanley
I believe you forgot about configFile
mocha -R mocha-multi-reporters --reporter-options configFile=config.json
@davidwesst please re-open this issue if you still have the same problem.
I stumbled over this too and found the source by running DEBUG=mocha:reporters:MultiReporters npm test
-- the problem was misconfigured .mocharc.json
. I got it working with the following:
.mocharc.json
:
"reporter": "mocha-multi-reporters",
"reporterOptions": {
"configFile": ".mocha-multi-reporters.json"
},
.mocha-multi-reporters.json
:
{
"reporterEnabled": "spec"
}
My error had been using reporter-options
instead of reporterOptions
and assuming that I could put all configuration in .mocharc.json
rather than setting up the required configFile
.
Expected behavior
No xunit.xml file should appear in root directory.
Actual behavior
File named xunit.xml appears when tests are run.
Information about the Issue
Looking at the code, I found that line 68 references is local project config.json file, which is configured for XUnit.
Changing this file to point at my the executable directory config.json file would only use the project's config.json file.
Steps to reproduce the behavior