Antontelesh / mochawesome-merge

Merge several Mochawesome JSON reports
MIT License
85 stars 16 forks source link

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

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.

aswine commented 2 years ago

Screenshot 2022-06-17 at 14 31 04 Screenshot 2022-06-16 at 09 36 43

Antontelesh commented 2 years ago

@aswine are you sure this error is from mochawesome-merge? Also, could you please share your command/script for merging the reports?

aswine commented 2 years ago
"uk:staging:merge:reports": "mochawesome-merge ./UKStagingJsonReports/*.json > UKStaging-combined-report.json && marge  --cdn=true  UKStaging-combined-report.json" 

But this command was not executed. The command which I provided in the description was the only one executed.

Reports are getting generated under the folder UKStagingJsonReports, but the error says no reports found at UKStagingJsonReports/.jsons/

I tried changing. ">" to "o" in the merge command, but didn't help

Antontelesh commented 2 years ago

What script/library prints the message Read and merge jsons from "UKStagingJsonReports/.jsons"?

mochawesome-merge library does not print such messages. I bet it is printed even before mochawesome-merge is executed. And since it mentions wrong directory (/.jsons/), I believe the issue is somewhere else.

Otherwise, I recommend you to place a couple of console.log calls within your node_modules/mochawesome-merge files to check what arguments were resolved to

aswine commented 2 years ago

mochawesome-merge-error

Antontelesh commented 2 years ago

Can you log what options resolve to here?

My assumption is that your system unwraps your pattern to separate files before passing arguments to mochawesome-merge. I would recommend you to change your config so that you don’t use the .jsons directory.

aswine commented 2 years ago

Thank you for the help. I am closing the issue as I was able to resolve this