Open RaviThippana opened 1 year ago
Correct definition as follows;
module.exports = {
.....
reporter: "mochawesome",
'reporter-option': [
'reportDir=reports/',
'reportFilename=[datetime]-[name]',
'overwrite=false',
'timestamp=isoUtcDateTime',
....
],
}
Also you can generate reportDir dynamically if you want;
const timestamp = new Date().getTime();
module.exports = {
......
reporter: "mochawesome",
'reporter-option': [
'reportDir=reports/'+timestamp,
'reportFilename=[datetime]-[name]',
'overwrite=false',
'timestamp=isoUtcDateTime',
......
],
}
Even though I mentioned reporterOptions in .mocharc.js file. Mochawesome is not saving with the new file name. By default it's saving into Folder - mochawesome-report\mochawesome.html Below snippet is my .mocharc.js file: module.exports = { reporter: "mochawesome", reporterOptions: { reportFilename: "[status]_[datetime]-[sample]-report", timestamp: "longDate", }, }; Packagae.json: { "scripts": { "test": "mocha --timeout 800000 --config= ./.mocharc.js ./test/mocha.spec.js"
},
"dependencies": { "mocha": "^10.0.0", }, "devDependencies": { "mochawesome": "^7.1.3" }
}
Please advise. Thanks in advance