adamgruber / mochawesome-report-generator

Standalone mochawesome report generator. Just add test data.
MIT License
233 stars 90 forks source link

Pattern UKStagingJsonReports/.jsons/*.json matched no report files #199

Closed aswine closed 2 years ago

aswine commented 2 years ago

Error: Pattern UKStagingJsonReports/.jsons/*.json matched no report files

I have my tests running as

npx cypress run --browser chrome --headless --spec cypress/integration/uk/smoke/*.spec.js --env grepTags=@TryNow --reporter-options reportDir=UKStagingJsonReports,reportFilename=StagingTests,html=false,json=true,overwrite=false

Here I have given a folder name and the name of the json reports as per my test environment. After the execution I have my json reports for each individual tests in the folder "UKStagingJsonReports", but the execution fails saying StagingJsonReports/.jsons/*.json matched no report files. Is there a way to override this. Also my screenshots are getting copied from the default directory to the this custom report directory. Are there ways to override this.

Error message as it is:

Read and merge jsons from "UKStagingJsonReports/.jsons" Copy screenshots folder from "/Users/aswinedavalath/Automation_Web/c*****/cypress/screenshots" to "UKStagingJsonReports/screenshots" An error was thrown in your plugins file while executing the handler for the 'after:run' event.

Desired behavior User should be able to allowed to decide where to store the json reports and screenshots if the user wants to create a new folder for the same. Screenshot 2022-06-16 at 09 36 43

adamgruber commented 2 years ago

This sounds like you are using mochawesome-merge. I do not maintain that package so if this is the case, I suggest you open an issue in that repo.

aswine commented 2 years ago

Mochawesome merge was trying to find reports to merge, but they are unable to find it. The command executed in the CLI was npx cypress run --browser chrome --headless --spec cypress/integration/uk/smoke/*.spec.js --env grepTags=@TryNow --reporter-options reportDir=UKStagingJsonReports,reportFilename=StagingTests,html=false,json=true,overwrite=false. Reports are generated in the expected path as given in the CLI command

Screenshot 2022-06-17 at 14 31 12

adamgruber commented 2 years ago

What does your cypress config look like?

aswine commented 2 years ago

"chromeWebSecurity": false, "defaultCommandTimeout": 10000, "requestTimeout": 10000, "screenshotOnRunFailure": true, "skipCopyingScreenshots": true, "viewportWidth": 1440, "viewportHeight": 900, "pageLoadTimeout": 10000, "reporter": "../node_modules/mochawesome/src/mochawesome.js", "video": false

adamgruber commented 2 years ago

So looks like mochawesome is saving your reports to the expected directory. However mochawesome-merge is looking for a .jsons directory which doesn't exist. Where are you calling mochawesome-merge? You may need to adjust the options there.

aswine commented 2 years ago

mochawesome-merge-error

adamgruber commented 2 years ago

Oh, I see. You're using cypress-mochawesome-reporter which is another package I do not maintain. It bundles mochawesome and mochawesome-merge. Please file an issue with that project.

aswine commented 2 years ago

Closing the issue as I was able to resolve this. Thank you for your help