Skip to content

fix: avoid retrying expected failures (fix #11068) - #11156

Closed
AltafShk wants to merge 1 commit into
vitest-dev:mainfrom
AltafShk:fix/it-fails-retry-11068
Closed

AltafShk wants to merge 1 commit into
vitest-dev:mainfrom
AltafShk:fix/it-fails-retry-11068

Conversation

@AltafShk

@AltafShk AltafShk commented Sep 6, 2026

Copy link
Copy Markdown

Description

test.fails currently retries after the test fails as expected, causing the test body and its side effects to run more than once. Stop the retry loop after an expected failure and add regression coverage that verifies the test body runs only once when retries are configured.

Resolves #11068

AI assistance: Codex was used during implementation and testing; I reviewed and approved the changes.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

The following focused checks were run locally:

  • pnpm --filter vitest build
  • vitest test/retry.test.ts across the threads, forks, and vmThreads projects
  • pnpm lint
  • pnpm typecheck

Documentation

  • No documentation change is needed for this bug fix.

Changesets

  • The PR title describes the fix and uses the fix: prefix.

Stop retrying test.fails after it fails as expected, and add regression coverage for the execution count.

Closes vitest-dev#11068
@sheremet-va

Copy link
Copy Markdown
Member

The CI is failing with your changes

@AltafShk

Copy link
Copy Markdown
Author

Looking at the PR in progress by @hi-ogawa , I realise that the early break incorrectly skipped retries across repeats. I saw #11219, and I think that it handles the result transition at the correct point in the lifecycle. I’m happy for it to supersede #11156. Thanks!

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vitest incorrectly retries the it.fails tests

2 participants