Repository navigation
perf(tests): slim test entry, shared isolate for side-effect-free tests - #101
Merged
Merged
Conversation
- wrangler.test.toml main -> tests/worker-main.ts: only the DO classes, with ChatDO and Showtime stubbed (they pulled in the agent loop and screenshot stack, ~8s per DO test). session-do.test.ts runs in a workers-chat project whose main is still src/index.ts. - New workers-shared project (isolate: false) for test files that do not mock, patch globals, fake timers or touch D1/DO bindings, following local imports. tests/isolation.ts decides; a `vitest-isolate` comment opts out. 228 files; 6 file-shuffled runs of that set green. - source-timestamps.test.ts reads src/ with fs in the node project (18s -> 0.2s); still fails on a planted datetime(now). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leorfer23
force-pushed
the
perf/route-tests
branch
from
October 14, 2026 20:30
b4b0940 to
4f4ca9c
Compare
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.
Follow-up to #99. Three cuts to the unit suite's module-loading cost.
wrangler.test.tomlmain→tests/worker-main.ts: only the DO classes, withChatDOandShowtimestubbed. Those two pulled in the agent loop and the screenshot stack, ~8s on every file that touches a DO.session-do.test.ts(the only real ChatDO user) runs in a newworkers-chatproject whose main is stillsrc/index.ts. DO tests: ~8s → ~3s each.workers-sharedproject runs withisolate: false.tests/isolation.tsputs a file there only if neither it nor any local helper it imports mocks modules, patches globals, fakes timers, or touches D1/DO bindings. Avitest-isolatecomment opts a file out (used once:artifacts/member-view.test.ts). That's 228 files, and 6 runs of that set with file order shuffled were all green.source-timestamps.test.tsnow readssrc/withfsin the node project instead ofimport.meta.globinside workerd: 18s → 0.2s. It still fails on a planteddatetime('now').public/_bundles/skill.zip, which went stale on main after docs(blobs): list the MIME types the blob API actually allows #97 (docs change without a rebuild).Measured (load 3–8, machine shared with other agents)
Biggest remaining cost: ~300 isolated files that use
vi.mockagainst route modules. They can't share an isolate without rewriting their mocks.🤖 Generated with Claude Code