Skip to content

Commit

Permalink
feat: add retries for hard failures (#211)
Browse files Browse the repository at this point in the history
* feat: add retries for hard failures

* chore: use default 0 for currentsConfig.retry.hardFailureMaxRetries

* chore: add retries to README
  • Loading branch information
agoldis authored Aug 31, 2024
1 parent d5bbdbb commit 1629759
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,17 @@ module.exports = {
// Additional headers for network requests, undefined by default
networkHeaders: {
"User-Agent": "Custom",
"x-ms-blob-type": "BlockBlob"
"x-ms-blob-type": "BlockBlob",
},
e2e: {
batchSize: 3, // orchestration batch size for e2e tests (Currents only, read below)
},
component: {
batchSize: 5, // orchestration batch size for component tests (Currents only, read below)
},
retry: {
hardFailureMaxRetries: 2, // max retries for hard Cypress failures, a hard failure is when Cyrpess crashes and doesn't report back any results (see https://docs.cypress.io/guides/guides/module-api#Handling-errors)
},
};
```

Expand Down Expand Up @@ -162,7 +165,7 @@ The configuration variables will resolve as follows:

## Batched Orchestration

This package uses its own orchestration and reporting protocol that is independent of cypress native implementation. The new [orchestration protocol]([https://currents.dev/readme/integration-with-cypress/cypress-cloud#batched-orchestration](https://currents.dev/readme/integration-with-cypress/cypress-cloud/batched-orchestration)) uses cypress in "offline" mode and allows batching multiple spec files for better efficiency. You can adjust the batching configuration in `currents.config.js` and use different values for e2e and component tests.
This package uses its own orchestration and reporting protocol that is independent of cypress native implementation. The new [orchestration protocol](<[https://currents.dev/readme/integration-with-cypress/cypress-cloud#batched-orchestration](https://currents.dev/readme/integration-with-cypress/cypress-cloud/batched-orchestration)>) uses cypress in "offline" mode and allows batching multiple spec files for better efficiency. You can adjust the batching configuration in `currents.config.js` and use different values for e2e and component tests.

## API

Expand Down
3 changes: 2 additions & 1 deletion packages/cypress-cloud/lib/cypress/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ export async function runSpecFile(

let retries = 0;
const currentsConfig = await getCurrentsConfig();

while (
currentsConfig.retry &&
retries < currentsConfig.retry.hardFailureMaxRetries &&
retries < (currentsConfig.retry.hardFailureMaxRetries ?? 0) &&
result.status === "failed"
) {
warn("Cypress runner failed with message: %s", result.message);
Expand Down

0 comments on commit 1629759

Please sign in to comment.