bahmutov / bahmutov/cypress-repeat
post script not supported when spec fails in cypress-repeat
- Dominant language
- JavaScript
- Stars
- 39
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
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](https://github.com/bahmutov/cypress-repeat/blob/main/index.js#L153), 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 https://github.com/bahmutov/cypress-repeat/issues/33
Thank you!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with index.js around line 153, where the issue points to process.exit(testResults.totalFailed), and review the related issue #33. Reproduce both successful and failed cypress-repeat runs using the package.json scripts. Done means a failed repeat still permits the configured post script to run and generate its report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cypress, javascript
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100