question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR: Failed to merge reports - Mochawesome

See original GitHub issue

Current behavior:

I’ve installed the Mochawesome reporter and all the needed plugins. Whenever I try to run a folder it keeps giving me an ERROR that Cypress failed to merge the reports. It looks like that the script does not create a file in the folder mocha.

It only creates a report.json in Mochareports. image

this is a part of my package.json.

{
  "scripts": {
    "cypress:open": "npm install && cypress open",
    "cypress:open:local": "npm install && cypress open --env configFile=local",
    "cypress:open:dev": "npm install && cypress open --env configFile=dev",
    "cypress:open:tst": "npm install && cypress open --env configFile=tst",
    "cypress:open:acc": "npm install && cypress open --env configFile=acc",
    "cypress:run": "npm install && cypress run",
    "cypress:run:local": "npm install && cypress run --browser chrome --headless --env configFile=local",
    "cypress:run:tst": "npm install && cypress run --browser chrome --headless --env configFile=tst",
    "cypress:run:acc": "npm install && cypress run --browser chrome --headless --env configFile=acc",
    "cypress:run:acc:teampark": "npm install && cypress run --browser chrome --headless --env configFile=acc --spec cypress/integration/team_park.js --config video=false",
    "clean:reports": "(if exist cypress\\reports (rmdir /S /Q cypress\\reports)) && mkdir cypress\\reports && mkdir cypress\\reports\\mocha  &&  mkdir cypress\\reports\\mochareports",
    "pretest": "npm run clean:reports",
    "scripts": "cypress run --spec cypress/integration/website/schooltrip/**/*",
    "combine-reports": "mochawesome-merge  cypress/reports/mocha/*.json > cypress/reports/report.json",
    "generate-report": "marge cypress/reports/mochareports/report.json -f report -o cypress/reports/mochareports",
    "posttest": "npm run combine-reports && npm run generate-report",
    "test": "npm run scripts || npm run posttest"

Desired behavior:

What cypress needs to do according to all online explanation is to create a file in the Mocha and Mochareports and merge these files in order to get an HTML report.

Error given after a run:

> @ posttest C:\Users\iessadeq\Desktop\*********l\******-cypress-tests-master
> npm run combine-reports && npm run generate-report


> @ combine-reports C:\Users\iessadeq\Desktop\***********\*****-cypress-tests-master
> mochawesome-merge  cypress/reports/mocha/*.json > cypress/reports/report.json

ERROR: Failed to merge reports

Error: Pattern cypress/reports/mocha/*.json matched no report files

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ combine-reports: `mochawesome-merge  cypress/reports/mocha/*.json > cypress/reports/report.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ combine-reports script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iessadeq\AppData\Roaming\npm-cache\_logs\2020-07-10T13_54_21_097Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ posttest: `npm run combine-reports && npm run generate-report`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ posttest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iessadeq\AppData\Roaming\npm-cache\_logs\2020-07-10T13_54_21_243Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ test: `npm run scripts || npm run posttest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iessadeq\AppData\Roaming\npm-cache\_logs\2020-07-10T13_54_21_386Z-debug.log

Test code to reproduce

"reporter": "cypress-multi-reporters",
    "reporterOptions": {
        "reporterEnabled": "mochawesome",
        "mochawesomeReporterOptions": {
            "reportDir": "cypress/reports/mocha",
            "quite": true,
            "overwrite": false,
            "html": false,
            "json": true
        }

I’ve tried several things without any succes… Could anyone help please?

Versions

  "devDependencies": {
    "chance": "^1.1.0",
    "cypress": "^4.7.0",
    "cypress-file-upload": "^3.5.3",
    "cypress-multi-reporters": "^1.4.0",
    "lodash": "^4.17.15",
    "mocha": "^8.0.1",
    "mocha-junit-reporter": "^1.23.3",
    "mochawesome": "^6.1.1",
    "mochawesome-merge": "^4.1.0",
    "mochawesome-report-generator": "^5.1.0"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
denisbalykocommented, Aug 18, 2021

You can change the legacy command:

from: mochawesome-merge cypress/reports/mocha/*.json > cypress/reports/report.json

to: mochawesome-merge cypress/reports/mocha/*.json -o cypress/reports/report.json

0reactions
aswinecommented, Jun 14, 2022

Pattern StagingJsonReports/.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=StagingJsonReports,reportFilename=StagingTests,html=false,json=true,overwrite=false

After the execution I have my json reports for each individual tests in the folder “StagingJsonReports”, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Error: Pattern mochawesome-report/*.json ...
I am getting the below error for merging reports. In my local machine, it working fine. enter image description here · cypress ·...
Read more >
Problems in merging individual test suite Mochawesome ...
All the tests get executed without an issue, but this error pops up during the report Merge process. I've referred online and no...
Read more >
mochawesome/general - Gitter
I am getting this error - ERROR: Failed to merge reports. Error: Pattern cypress/results/mochawesome*.json matched no report files
Read more >
Discussion of Using Mochawesome Reporter with Cypress
Whenever I try to run a folder it keeps giving me an ERROR that Cypress failed to merge the reports. It looks like...
Read more >
Cypress — merging multiple mochawesome reports | by Kristijan
json file in cypress/report folder. Input files and output file should not be in same location, otherwise, generating step will fail. Generating HTML....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found