Repository navigation
[CI] perf(tests): reuse Vitest transforms between test runs - #26095
Merged
Merged
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe shared Vitest test options now set Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to This turns on Vitest's filesystem module cache so repeated local test runs go faster. The cache can be disabled or cleared if it ever behaves unexpectedly. I found no concrete risk, so it is low risk to merge once CI passes. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
8 of 10 tasks
…/vitest-transform-cache
…form-cache # Conflicts: # src/renderer/src/components/native-chat/native-chat-composer-field-resume.test.tsx
11 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.
ELI5
Repeated local test runs can reuse Vitest's transformed modules instead of rebuilding them. A frozen 997-file comparison took 69.31 seconds with caching disabled and 58.07 seconds with a warmed cache: 16.21% less time.
What Changed
Enable the supported
fsModuleCacheoption in the existing shared test options, covering Bun, Node runtime contracts, the isolated measurement project, and the stock Node fallback. Test isolation, setup files, mock execution, worker limits, runtime routing, assertions, and deadlines stay the same.Why
The measured sample evaluates about 12,600 modules roughly 354,000 times across isolated test files. Vitest can persist transform results without sharing evaluated module state or weakening isolation. This is a one-line use of Vitest's supported cache, avoiding a custom loader or a broad migration to another test API.
The improvement below is for repeated local runs. CI currently has no shared transform-cache restore, so this PR makes no CI or full-suite speed claim. The requested 2× full-suite target remains unmet.
Linked Issue
Maintainer-requested test performance work; no separate issue.
Visual Proof
N/A — test configuration only; no product UI or interaction change.
Testing
The measurement source was frozen at
0acf039b5d5050e4f40b2c247944cfc7ee652c96plus exactly this cache setting. Both arms used identical source/configuration, 16 workers, the same 997 file arguments, reporter, launcher, and whole-command timing. Explicit CLI overrides selected cache off/on. Three pairs ran in alternating order; no timed run was discarded.The separately recorded empty-cache priming run passed in 67.006 s; it is not part of the warmed mean. Every run retained all 997 files and 9,713 cases: 9,642 passed, 71 existing skips, with no failures or lifecycle errors. Exact case names/statuses matched after normalizing only the generated temporary-directory suffix in two existing parameterized OpenCode worker titles; all raw reports were retained. Resolved cache flags were verified for every project.
The representative cache contained 15,804 files / 301.3 MiB. Vitest has no automatic size eviction. Developers can disable it with
--fsModuleCache=falseor clear it withpnpm exec vitest --config config/vitest.config.ts --clearCache. The cache is ignored, stays insidenode_modulesfor normal use, and adds no remote cache trust or packaged application content.80f072895284passes fullpnpm tc(Node, CLI and web), changed-code quality checks, and formatting.80f072895284, six invalidation/isolation stages passed through both coordinators: 168 checks across 12 invocations. Reused one owned cache; required actual warm-cache read evidence. Source edits, define/alias changes, fresh environment-driven mock execution, changed mock-factory source, and file-to-index resolution relocation all observed the new values. Actual Bun/Node identities and fresh mutable module state were asserted. No tracked source changed during this probe.80f072895284integrates main’s equivalent fixture repair fix(native-chat): repair main's web typecheck after the @-mention prop rename #26097. The duplicate [CI] test(native-chat): update the resume fixture for mention menus #26102 is closed without merging; conflict resolution kept main’s exact fixture bytes. The diff against integrated main is again only the cache option; fresh CI qualified this source. The first CI attempt stopped at that inherited compile error before unit shards ran; no unit success is inferred from it.Final full CI run 37584606858 checked out
98e375b7326e(parents integrated mainc8dcffceand final head80f072895284), with all tested source bytes equal to the final head. All five actual assignment artifacts cover 11,407 physical files exactly once: 11,272 passed, 135 existing skips, zero failed/unhandled/missing/duplicated. Case totals are 110,641 passed, one expected failure and 1,035 existing skips. Static/typechecking, relay integration, headless persistence, selection evidence and aggregate verification passed. Final review has no unresolved threads. This establishes correctness coverage, not a CI-speed comparison.Review
Independent source review found no change to isolation, Node/Bun routing, setup, or packaging. Cached JavaScript has the same local trust boundary as installed dependencies; this does not authenticate third-party cache artifacts. Linux is covered by PR CI; Windows filesystem-locking behavior is not locally measured.
Agent skill upstream boundary
Checklist