Skip to content

feat: add --smart-rerun to prioritize or skip previously failed tests#10684

Open
Thompsonay wants to merge 1 commit into
vitest-dev:mainfrom
Thompsonay:feat/smart-rerun-failed-tests
Open

feat: add --smart-rerun to prioritize or skip previously failed tests#10684
Thompsonay wants to merge 1 commit into
vitest-dev:mainfrom
Thompsonay:feat/smart-rerun-failed-tests

Conversation

@Thompsonay

Copy link
Copy Markdown

Summary

  • Adds --smart-rerun: caches failed test file paths to .vitest-failed-cache.json and runs them first on the next invocation, ahead of the rest of the suite. Cache clears automatically once everything passes.
  • Adds --smart-rerun-only-failed (requires --smart-rerun): instead of reordering, skips files that passed last run entirely and only executes previously-failed files. Falls back to a full run if the cache is empty or stale.
  • Both flags are off by default and do not alter existing behavior.

Test plan

  • Unit tests for cache save/load/clear, corrupted-cache handling, reorder, and filter logic (test/unit/test/smart-rerun.test.ts)
  • CLI parsing tests for both flags (test/unit/test/cli-test.test.ts)
  • pnpm run build passes with no type errors
  • Full test/unit suite passes
  • Verified pre-existing/environment-specific failures elsewhere in the monorepo are unaffected by this change (reproduced identically on main via git stash)

Closes #7834
Related to #10247

Adds --smart-rerun, which caches failed test file paths and runs them
first on the next invocation, ahead of the rest of the suite. The cache
clears automatically once everything passes.

Adds --smart-rerun-only-failed (requires --smart-rerun) to skip files
that passed last run entirely and only execute previously-failed files,
falling back to a full run when the cache is empty or stale.

Both flags are off by default and do not change existing behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the maybe automated User is likely an AI agent, or the content was generated by an AI assistant without user control label Jun 30, 2026
@github-actions

Copy link
Copy Markdown

Hello @Thompsonay. Your PR has been labeled maybe automated because it appears to have been fully generated by AI with no human involvement.

To keep your PR open, please follow these steps:

  • Confirm that you are a real human. If you are an automated agent, disclose that
  • Confirm you've read, reviewed and stand behind its content
  • Confirm you've read the full issue along with all of its comments, as well as any linked issues and their comments
  • Make sure it follows our contribution guidelines and uses the correct GitHub template
  • Disclose any AI tools you used (e.g. Claude, Copilot, Codex)

Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically.

These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context.

@netlify

netlify Bot commented Jun 30, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 136027e
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a43cc36aa5a6f00085b5e39
😎 Deploy Preview https://deploy-preview-10684--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@Thompsonay

Copy link
Copy Markdown
Author

I contributed to the open source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maybe automated User is likely an AI agent, or the content was generated by an AI assistant without user control

1 participant