Repository navigation
perf(test): faster local test loop and cold-worktree changed runs - #33421
Merged
Merged
Conversation
- test:changed exits before starting Vitest when Git reports no changed files. - Unrecorded tests beyond 100 in scope use Vitest's static import graph instead of all running, so a fresh worktree's first changed run no longer runs the whole suite (patched RecordedModulesResolver; CI does not record, unchanged). - Bun's slow config load was the SQLite import scan statting every unit test; filtered runs now classify only the tests their filters can select, and the scan walks directories instead of fs.globSync. - Silence the native config loader notice on every run. - Zod's test bundle is content-addressed and reused, so a killed run leaks nothing; leaked per-run directories older than 6h are swept. - build:packages skips compiling when package inputs, compiler, and dist are unchanged; test scripts no longer nest pnpm invocations.
nwparker
marked this pull request as ready for review
October 25, 2026 05:53
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5 tasks done
5 tasks done
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.
What changed
test:changedwith no changes exits before Vitest starts. It usesgit status(plusdiff <ref>...HEADfor a ref) as the check. Unlikels-files --modified,git statusrefreshes stale index stat data instead of rehashing files. The scripts also stop nestingpnpm runcalls.recordDependenciesrecords are per checkout, so a new worktree's firsttest:changedran every test. A small Vitest patch keeps per-test records. When more than 100 tests in scope have no record, those tests are selected with Vitest's static import graph instead of all running. When 100 or fewer lack a record, they still run, which records them. A missing record therefore still means the test runs or is covered by the static graph. CI does not record, so it is unaffected.run, only the tests the filters can select get classified. This mirrors Vitest's substring andfile:linematching and never selects fewer files than Vitest does. Watch,related,--dirand--rootstill scan everything. The scan also walks directories instead of usingfs.globSync. The native config loader notice is silenced.vitest-zod-*directories that older launchers leaked are swept once they are more than 6h old.build:packagesskips compiling when process-host sources, the build script, the exact TypeScript/tsx/@types/node installs, and thedistfile sizes and mtimes are unchanged.Timings
Heavily loaded macOS machine (load average 30–100). Base and branch were interleaved, 6 runs each, in sibling worktrees. Times are wall-clock medians, with the minimum in parentheses.
pnpm test src/shared/app-version.test.ts --maxWorkers=2pnpm test src/shared/worktree --maxWorkers=2(24 files)pnpm test:changed, no changesbuild:packages, unchanged--changedtouching a widely imported shared typeThe last row is selection only (
vitest list --filesOnly); the selected files then run.Runner choice
Bun hosting stays. It was adopted for multi-file throughput, and CI runs suites on Bun, so local single-file runs keep the same runtime. After this change, a single file still takes about 0.9s through the Bun launcher versus about 0.5s with plain Node Vitest. For about 20 files the two are within noise.
Tests
Added tests: run-filter parsing (inherited arguments ignored, never narrower than Vitest), the changed precheck, and Zod bundle reuse/sweep. The SQLite cache test was updated for the walker. Targeted suites,
pnpm tcandcheck:code-quality:changedpass.