Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post script not supported when spec fails in cypress-repeat #44

Open
jjorgenson-globality opened this issue Jan 20, 2023 · 1 comment
Open

Comments

@jjorgenson-globality
Copy link

Hey there! I'm having some issues using the post script after cypress-repeat finishes and encounters a fail.

package.json

"cy:run:repeat": "cypress-repeat run -n ${npm_config_times:-5} --browser ${npm_config_test_browser:-chrome} --record false --env configFile=${npm_config_env:-test} --spec",

// Pre and Post scripts
"precy:run:repeat": "npm run report:clean",
"postcy:run:repeat": "npm run report:merge & npm run report:generate",

// Where the scripts point to
"report:clean": "rm -R -f cypress/reports",
"report:merge": "mochawesome-merge cypress/reports/*.json > cypress/reports/index.json",
"report:generate": "marge cypress/reports/index.json --reportDir cypress/reports/mochaReport --assetsDir cypress/reports/mochaReport/assets --charts true --autoOpen true --showHooks always",

When the repeats finish all successfully, the report opens, and the terminal looks like:

***** finished 5 run(s) successfully *****

> postcy:run:repeat
> npm run report:merge & npm run report:generate
... so on and so forth

When a fail occurs:

cypress-repeat: run 2 of 3 failed

and kicked out. No post script triggered.

I'm guessing it has something to do with process.exit(testResults.totalFailed) found here, but not totally sure.

TLDR It would be really nice to have the option of having failed tests without exiting altogether so we can still generate reports.
Somewhat related to #33

Thank you!

@bahmutov
Copy link
Owner

I would not change this like this. You do want to fail if there are any failed tests, right? You could add an option to allow failures and only then exit with zero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants