webdriverio-community / wdio-cucumberjs-json-reporter

A WDIO reporter that creates CucumberJS JSON files for WebdriverIO
https://webdriver.io/docs/wdio-cucumberjs-json-reporter
MIT License
24 stars 32 forks source link

Timestamp reports #76

Open osmolyar opened 3 years ago

osmolyar commented 3 years ago

Is your feature request related to a problem? Please describe. Currently reports are named according to the Feature file, and overwritten each time the Feature file is run.

Describe the solution you'd like It would be nice to have a timestamp added to the file name to keep a record of prior reports.

Describe alternatives you've considered Something like the following

 onRunnerEnd() {
        const jsonFolder = (0, path_1.resolve)(process.cwd(), this.options.jsonFolder);
        const date = new Date().getTime()
        const jsonFile = (0, path_1.resolve)(jsonFolder, `${this.report.feature.id}_${date}.json`);
        const json = [this.report.feature];
        const output = (0, fs_extra_1.existsSync)(jsonFile) ? json.concat((0, fs_extra_1.readJsonSync)(jsonFile)) : json;
        (0, fs_extra_1.outputJsonSync)(jsonFile, output);
    }

Additional context

osmolyar commented 2 years ago

If acceptable, will submit a PR for this.

wswebcreation commented 2 years ago

Thanks for the Feature Request, if you want to can start with a PR

osmolyar commented 2 years ago

Submitted pull request https://github.com/webdriverio-community/wdio-cucumberjs-json-reporter/pull/80