ciconq
ciconq

Reputation: 247

Cypress running npm and npx scripts in one script sequentially

I am using Cypress and I have the following scripts:

"merge:reports": "mochawesome-merge mochawesome-report/*.json > cypress-combined-report.json",
"create:html:report": "npm run merge:reports && marge --reportDir final-report cypress-combined-report.json",
"delete:reportFolder": "if exist mochawesome-report rmdir /Q /S mochawesome-report && if exist final-report rmdir /Q /S final-report",
"start": "npm run delete:reportFolder && npx cypress run --browser chrome && npm run merge:reports && `enter code here`npm run create:html:report"

What I want is all those scripts running sequentially but I think there is something I am missing here as I am not that familiar with npm and npx as when I trigger this script only it is passing:

npx cypress run --browser chrome

But when I try to execute the script with all the 4 scripts I am getting an error which I think is due to having a npx script:

npm run start

Would be glad for any suggestions or advices where I am wrong, thanks!

Upvotes: 1

Views: 1668

Answers (1)

Alapan Das
Alapan Das

Reputation: 18639

  1. If it is unintentional I could see enter code here written for start, please remove that and try running afterwards.

  2. Delete the node_modules folder and package-lock.json files. Then run npm i to install all the dependencies again and then again try running npm run start

  3. Or Remove npx from the cypress run: "start": "npm run delete:reportFolder && cypress run --browser chrome && npm run merge:reports && npm run create:html:report"

Upvotes: 1

Related Questions