feat(vitest): add --stale CLI option for iterative test running#9916
Open
holyhli wants to merge 8 commits intovitest-dev:mainfrom
Open
feat(vitest): add --stale CLI option for iterative test running#9916holyhli wants to merge 8 commits intovitest-dev:mainfrom
holyhli wants to merge 8 commits intovitest-dev:mainfrom
Conversation
Add stale option definition to CLI config, type definition to UserConfig interface, and mutual exclusion check with --changed in resolveConfig. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Create StaleManifest class for persistent mtime tracking, wire into VitestCache, and initialize in core.ts during setup. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add filtering logic to detect stale tests based on mtime comparison, handle first-run behavior, and update manifest with scanned files. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add stale config checks to FilesNotFoundError guard, manifest persistence, watch mode reset blocks, and user messaging. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add 6 comprehensive test cases covering first-run, subsequent-run, dependency changes, mutual exclusion, and test file changes. Includes fixture directory with test and source files. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add manual prose section to cli.md explaining first-run behavior, mutual exclusion with --changed, and forceRerunTriggers interaction. Auto-generated cli-generated.md entry. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add .sisyphus directory to eslint ignores to prevent parsing errors on markdown documentation files. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
AriPerkkio
reviewed
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
--staleCLI option inspired by Elixir Mix's--staleoption that runs only test files whose transitive module dependencies have changed since the last--stalerun.Primary Use Case - Agentic Coding Systems: Modern agentic coding tools (Claude Code, GitHub Copilot Workspace, OpenCode, Cursor with Composer, etc.) build harness systems that rely heavily on unit tests for validation. These agents run tests continuously during their development loops, and running full test suites dramatically slows their iteration time.
--staleprovides the fast feedback cycle agents need by running only affected tests.Secondary Use Case - Human Development: Developers making small iterative changes also benefit from faster test cycles without requiring git.
How it works:
Resolves #9917
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.✅ See feat: add --stale CLI option for agentic coding systems #9917 for feature discussionTests
Documentation
Changesets
Implementation Highlights
Agentic System Benefits:
Technical Design:
--changed(enforced at config resolution)forceRerunTriggers(config changes → full suite)node_modules/.vite/vitest/)Example - Agentic Workflow: