Multiple reporter for Mocha
$ npm i -D @mochajs/multi-reporterUse --reporter in your test command.
{
"scripts": {
"test": "mocha --reporter @mochajs/multi-reporter"
}
}Or, add reporter to your configuration file.
{
"reporter": "@mochajs/multi-reporter"
}Create .reporters.json file.
{
"spec": true,
"xunit": {
"output": "report.xml"
}
}By default, it will use .reporters.json as config file. To use other file, use --reporter-options in your test command.
{
"scripts": {
"test": "mocha --reporter @mochajs/multi-reporter --reporter-options config=filename.json"
}
}Or, add reporter-option to your configuration file.
{
"reporter": "@mochajs/multi-reporter",
"reporter-option": [
"config=filename.json"
]
}