Skip to content

feat(test): add retryStrategy option to defer retries#41297

Open
dgozman wants to merge 1 commit into
microsoft:mainfrom
dgozman:fix-23354
Open

feat(test): add retryStrategy option to defer retries#41297
dgozman wants to merge 1 commit into
microsoft:mainfrom
dgozman:fix-23354

Conversation

@dgozman

@dgozman dgozman commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a retryStrategy test config option.
  • 'deferred' runs retries only after all tests have had their first attempt, in parallel up to the configured number of workers.
  • Defaults to 'immediate' (current behavior).

Fixes #23354

…he run

Adds a `retryStrategy` test config option. With `'deferred'`, retries run
only after all tests have had their first attempt, in parallel up to the
configured number of workers. Defaults to `'immediate'` (current behavior).

Fixes: microsoft#23354
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chrome] › mcp/annotate.spec.ts:57 › should capture multiple screenshots in one annotation @mcp-windows-latest-chrome

7340 passed, 1122 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:211 › should intercept service worker requests (main and within) `@chromium-ubuntu-22.04-node24`

39572 passed, 743 skipped


Merge workflow run.


Controls when failed tests are retried. Defaults to `'immediate'`.
* `'immediate'` - A failed test is retried as soon as a worker is available, interleaved with the rest of the run. This is the default.
* `'deferred'` - Retries are run only after all tests have had their first attempt, in parallel up to the configured number of [workers](#test-config-workers).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attheend? I can imagine the same people could be unhappy with a cluster of retries at the end of the test run and wand to see a variation of deferred that would do some backoff of the test but not at the end.

* `'immediate'` - A failed test is retried as soon as a worker is available, interleaved with the rest of the run. This is the default.
* `'deferred'` - Retries are run only after all tests have had their first attempt, in parallel up to the configured number of [workers](#test-config-workers).

Learn more about [test retries](../test-retries.md#retries).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also mention how it affects maxFailures?

// 5. Possibly queue a new job with leftover tests and/or retries.
if (!this._isStopped && result.newJob) {
this._queue.unshift(result.newJob);
if (this._testRun.config.retryStrategy === 'deferred')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

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

Successfully merging this pull request may close these issues.

[Feature] Flaky Tests - retry all tests at end of the test run

2 participants