Whenever I am executing the whole Cypress suite from the command line to execute a specific folder, when a test case fails during the suite execution the "posttest" section in the package.json file is not executed . Throws following error.
error Command failed with exit code 3.
In package.json file the script section is as follows
"scripts": {
"pretest": "yarn run [some command]",
"chrome": "yarn run cypress run --browser chrome",
"cypress:open": "cypress open",
"combine-reports": "mochawesome-merge --reportDir cypress\\reports\\mocha > cypress\\reports\\mochareports\\report.json",
"generate-report": "marge cypress\\reports\\mochareports\\report.json -f report -o cypress\\reports\\mochareports",
"report:copyScreenshots": "Xcopy cypress\\screenshots cypress\\reports\\mochareports\\screenshots /E/H/C/I",
"test": "cypress run",
"posttest": "yarn run report:copyScreenshots && yarn run combine-reports && yarn run generate-report"
}
Command executed for command line :
yarn run test --spec "cypress/integration/Demo1/*" --browser chrome