How could I ovverride the json file generated while executing the command -
testcafe chrome ./path-to-tests/*(.js|.testcafe|.ts) --reporter cucumber-json
It usually has a long name and it doesn't delete the previously generated json on the next run.
Hence, I thought a good solution would be to have a static file name defined which gets regenerated everytime on every run and hence we will no longer have the old json reports.
Any suggestions on this please?
Link to npm package -
Npm testcafe reporter cucumber json link
CodePudding user response:
The testcafe-reporter-cucumber-json
reporter is not officially supported by TestCafe.
Currently, it seems like there is no way to achieve the required behavior by the reporter's existing options. I advise you to send a PR with the required functionality to the reporter's repository. Or you can also create your own fork, add the required functionality to it, and start using this fork instead of the original reporter.
Here's what I recommend doing:
- Add a new command line argument, e.g.
--reporter-json-file-name
(similar to--reporter-json-folder
). This argument should set the name for the result report file. - Add the logic in the
writeJsonFiles
method. This method should take into account your command line argument to skip creating a unique report file name and use the name that was set by the added command line argument for all generated reports.