DEV Community

Discussion on: Using Mochawesome Reporter with Cypress

Collapse
 
guptapranay profile image
Pranay Gupta

For those, who have experienced an error npm ERR! code ELIFECYCLE
npm ERR! errno 1
while generating a report for the failed scenario, there is a simple solution.

When cypress scenarios are getting failed, it triggers an error code that NPM treats as an unexpected error in the test script which stops the execution immediately. Instead of writing custom code to handle this, we can leverage the Linux command.

For Example (In your package.json file):
npx cyprees run --spec cypress/integration/specFile.js || true

This will stop NPM error and will allow cypress execution gracefully with your post-test script.

Collapse
 
tejkumar profile image
Tejkumar Kempaiah

@pranaygupta : I tried the suggestion, Still facing the same error.

npm ERR! code ELIFECYCLE
npm ERR! errno 1

-------------------Complete error------------------
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Project1@1.0.0 combine-reports: mochawesome-merge ./cypress/reports/mocha/*.json > cypress/reports/mochareports/report.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Project1@1.0.0 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\admin\AppData\Roaming\npm-cache_logs\2021-08-12T14_58_25_631Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Project1@1.0.0 posttest: npm run combine-reports && npm run generate-report && npm run archive-report
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Project1@1.0.0 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\admin\AppData\Roaming\npm-cache_logs\2021-08-12T14_58_25_700Z-debug.log