fix(test): exclude .claude/ from jest scanning (kills ~163 phantom worktree suites + OOM) - #488
Closed
jonathonbyrdziak wants to merge 1 commit into
Closed
fix(test): exclude .claude/ from jest scanning (kills ~163 phantom worktree suites + OOM)#488jonathonbyrdziak wants to merge 1 commit into
jonathonbyrdziak wants to merge 1 commit into
Conversation
Jest was walking into `.claude/worktrees/agent-*` — stale registered git worktrees left by Claude Code agents (April/June snapshots on old branches). Because each is a full copy of the repo tree, jest ran ~163 phantom duplicate suites, which: - tripled runtime (59s -> 18s after this change) - OOM-killed a jest worker (SIGKILL), making the whole run non-deterministic - buried the real ~24 failing suites in noise (231 -> 68 total suites) `.claude/` is gitignored (Claude Code convention dir) so this only affects local runs, but every agent/dev using worktrees hits it. Added `<rootDir>/.claude` to both modulePathIgnorePatterns (haste-map collisions) and testPathIgnorePatterns (test discovery). Scope: hygiene only. The 24 remaining real-tree failures are pre-existing and environment-specific (arm64-musl @napi-rs/xattr binding, missing kubectl fixtures, TextEncoder-under-jsdom) — untouched here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
PR opened: #502 (autonomous heartbeat cycle). Fix applied and verified in an isolated worktree off |
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.
Problem
yarn test:unit:jeston a cleanmaincheckout is slow, non-deterministic, and noisy. Root cause: jest walks into.claude/worktrees/agent-*— stale registered git worktrees left behind by Claude Code agents (April/June snapshots, on old branchesfeat/token-ws3-slim-tool-catalogandworktree-agent-ac361fc4). Each is a full copy of the repo tree, so jest discovers and runs their test files as if they were part of the working tree.Measured impact on this machine (
node --experimental-vm-modules .../jest.js, no filters):.claude/worktreessuitesThe SIGKILL made runs non-deterministic (a worker dies mid-run) and the ~163 duplicate suites buried the real failures.
Fix
Add
<rootDir>/.claudeto both ignore lists injest.config.js:modulePathIgnorePatterns— stops haste-map module/mock collisions from the duplicated treestestPathIgnorePatterns— stops test discovery inside them.claude/is already gitignored (it's the Claude Code convention dir), so this only affects local runs — but every agent/dev who has ever created a worktree hits it. Two-line, additive, no behavior change to real tests.Scope / not included
This is hygiene only. After the fix, 24 real-tree suites still fail — all pre-existing and environment-specific, not touched here:
@napi-rs/xattr-linux-arm64-muslnative binding missing (arm64/musl box; fine on x64 CI)readlink ENOENTunder/tmpReferenceError: TextEncoder is not definedwhenpgis imported under thejsdomtest environment (3 suites — a genuine cross-env bug worth a follow-up, but out of scope for this PR)Note for whoever's chasing the "jest fails on clean branch" report: the earlier "missing
babel-preset-expo" theory is a red herring — this repo has no Expo/babel-preset-expodependency at all (Electron/Vue/Babel toolchain);grep babel-preset-expoover the whole jest log returns 0.🤖 Generated with Claude Code