DEV Community

Discussion on: Using Mochawesome Reporter with Cypress

Collapse
 
iamdaniyalz profile image
Daniyal Zulfiqar

There's some issue with clean:reports for windows (not sure about mac). If the directory is empty or not present there, the script fails.
For windows, please instead of using this below,
"clean:reports": "rmdir /S /Q cypress\reports && mkdir cypress\reports
&& mkdir cypress\reports\mochareports",

use this instead:
"clean:reports": "IF EXIST cypress\reports (rmdir /S /Q cypress\reports && mkdir cypress\reports && mkdir cypress\reports\mocha && mkdir cypress\reports\mochareports\) ELSE (mkdir cypress\reports && mkdir cypress\reports\mocha && mkdir cypress\reports\mochareports\)",

So what does it do?
It checks for the dir Reports. IF its there it deletes it with all contents and then creates a new one with sub folders. If its not there (ELSE), then it creates a new one with sub folders.

Collapse
 
intheget profile image
Prad

clean: reports is throwing an error for me
npm run clean:reports

cypress-test@1.0.0 clean:reports C:\Users\mehtap\Documents\Github\cypress-test
rmdir /S /Q cypress\reports && mkdir cypress\reports && mkdir cypress\reports\mochareports

The system cannot find the file specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! cypress-test@1.0.0 clean:reports: rmdir /S /Q cypress\reports && mkdir cypress\reports && mkdir cypress\reports\mochareports
npm ERR! Exit status 2
npm ERR! Failed at the cypress-test@1.0.0 clean: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\mehtap\AppData\Roaming\npm-cache_logs\2020-05-09T07_53_17_751Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! cypress-test@1.0.0 pretest: npm run clean:reports
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the cypress-test@1.0.0 pretest 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\mehtap\AppData\Roaming\npm-cache_logs\2020-05-09T07_53_17_825Z-debug.log