Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to store report in different folder with different report name for every test run - Mochawesome #382

Open
RaviThippana opened this issue Oct 12, 2022 · 1 comment

Comments

@RaviThippana
Copy link

RaviThippana commented Oct 12, 2022

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

@demirhancosku
Copy link

demirhancosku commented Jan 18, 2023

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',
     ......
  ],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants