0

`1. I have configured mochawesome depandencies and now my package.json has following

  • "mocha": "^8.3.0", "mochawesome": "^6.2.1", "mochawesome-merge": "^4.2.0", "mochawesome-report-generator": "^5.2.0"
  1. After test execution , i could able to merge the separate json reports in a folder using command

"npx mochawesome-merge Test/cypress/reports/mocha/*.json > test/cypress/reports/mochareports/report.json"

  1. Now to prepare the html report from merged json, when i am trying to execute below command

"npx marge test/cypress/reports/mochareports/report.json --reportDir ./ --inline"

getting error as 'command not found: marge'

Could any one please let me know, what exactly i am doing wrong here`

Smith Ranjan
  • 97
  • 2
  • 6

3 Answers3

2

use npx mochawesome-report-generator .... instead of npx marge .... It worked for me.

Devrullah
  • 21
  • 2
1

Version 4 has come with a breaking change — it no longer accepts params like reportDir or rootDir. Instead, it now accepts a list of file paths or glob patterns to source report files. If you are migrating to Version 4, you will likely have to change your params accordingly.

See a solution here: https://github.com/Antontelesh/mochawesome-merge

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Frieder
  • 11
  • 1
0

I faced same issue.

ERROR: Failed to merge reports
SyntaxError: cypress/reports/output.json: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at C:\Users\usman.allaudin\CypressAutomation\node_modules\mochawesome-merge\node_modules\jsonfile\index.js:33:18
    at C:\Users\usman.allaudin\CypressAutomation\node_modules\graceful-fs\graceful-fs.js:123:16

There's no need to worry about this; I have a solution. Just replace the below code

From

"merge": "mochawesome-`merge cypress/reports/*.json > cypress/reports/output.json"

To

"mochawesome-merge cypress/reports/*.json -o cypress/reports/output.json"
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77