Scope the root test script to tests/ so npm test runs from a clean install - #948
Merged
iamtoruk merged 1 commit intoAug 10, 2026
Merged
Conversation
…stall vitest's default glob reached the Electron app's specs under app/, which carry their own vitest config and their own jsdom in app/node_modules. From a root install that fails with ERR_MODULE_NOT_FOUND: jsdom, so the command CONTRIBUTING documents and the one RELEASING.md names as the pre-release gate both error out. Move the scoping CI already applies into package.json: test runs tests/ minus the parallelism-sensitive cache-refresh-lock suites, test:locks runs those three serially, test:watch keeps watch mode at the same scope. The first two are byte-identical to the invocations .github/workflows/tests.yml spells out, so the workflow can be pointed at the scripts to stop the two drifting apart again; that edit is left out of this PR so it needs no workflow permissions. test plus test:locks together still cover all 192 files under tests/. Scoping the script changes what a trailing path argument means: vitest ORs positional filters, so 'npm test -- tests/providers/hermes.test.ts' would no longer narrow to that file, it would run the whole suite. Rewrite those to 'npx vitest run <path>' everywhere they appear - four provider guides and the MCP design plan, thirteen lines in all. Also refresh the stale test docs: 42 files/568 tests (now 192 under tests/), the per-directory counts, the line claiming vitest does not run in CI which stopped being true when tests.yml landed, and the provider test-gap list, which still named antigravity and gemini after both gained test files. Record the cache-refresh-lock naming convention in CONTRIBUTING, since the split makes it load-bearing: a lock test that misses the prefix runs under the full worker pool and flakes, and one that matches it but is absent from test:locks never runs at all.
This was referenced Aug 10, 2026
pull Bot
pushed a commit
to TheTechOddBug/codeburn
that referenced
this pull request
Aug 11, 2026
cli-json-daily, spend-flow and cli-emitters spawn the real CLI per test and blow the 5s default under full parallel suite load while passing in isolation - the flake set getagentseal#948 documented on unmodified main, observed again locally (cli-json-daily) and in CI (cli-emitters on a green PR). Same file-level remedy the CLI menubar suite already uses; the default stays 5s for everything else.
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
npm testdoes not work from a clean root install."test": "vitest"is unscoped, so vitest's default glob reaches the Electron app's specs underapp/. Those carry their ownapp/vitest.config.tsand their ownjsdominapp/package.json, installed intoapp/node_modules— which a rootnpm cidoes not create. The run dies before it gets anywhere:This is already a known trap —
.github/workflows/tests.ymldocuments it in a comment ("the root default glob picking them up is exactly what failed run #2 withERR_MODULE_NOT_FOUND: jsdom") and works around it by spelling out a scoped vitest invocation in the workflow. But the workaround lives only in CI, so:CONTRIBUTING.mdtells a new contributor to runnpm test, which fails on their first try.RELEASING.mdnamesnpm testas the pre-release gate ("Before Every Release → Run the test suite"). That command currently errors out.Change
Move the scoping CI already applies into
package.json, and have CI call the scripts so the two cannot drift again:testtests/, minus the parallelism-sensitivecache-refresh-locksuitestest:locks--poolOptions.forks.singleFork=true)test:watchtest, watch mode — preserves the oldvitestbehaviourtest(189 files) andtest:locks(3) together cover all 192 files undertests/, so nothing is orphaned by the split.CI behaviour is unchanged — this PR does not touch
.github/workflows/. Thetestandtest:locksstrings are byte-identical to the invocationstests.ymlalready spells out (verified by string equality, not by eye), so if you want the two to stop drifting apart, those tworun:lines can becomenpm testandnpm run test:locksin a one-line follow-up. I left that edit out deliberately so this PR needs no workflow permissions — happy to add it if you would rather have it here.One consequence worth calling out
Scoping the script changes what a trailing path argument means. vitest ORs positional filters, so
npm test -- tests/providers/hermes.test.tsnow resolves tovitest run tests --exclude "…" tests/providers/hermes.test.ts— which does not narrow to that file, it runs everything. Measured:So every documented use of that idiom is rewritten to
npx vitest run <path>— 13 lines across the four provider guides (opencode,hermes,codewhale,lingtai-tui) anddocs/design/codeburn-mcp-plan.md. Without that, a contributor followingdocs/providers/hermes.mdwould expect a ten-second single-file run and get the full suite instead.Docs refreshed alongside, because they had drifted:
CONTRIBUTING.md: "42 test files, 568 tests" → 189 of 192 files / 2,494 tests.CONTRIBUTING.mdanddocs/architecture.mdboth still name five providers without test files, buttests/providers/antigravity.test.tsandtests/providers/gemini.test.tsexist onmaintoday. Corrected to the three that are genuinely missing (claude, goose, qwen). Pre-existing, but it sits in the sections this PR rewrites.docs/architecture.md: per-directory counts (27/1/15 → 141/1/44, plustests/sharing/), and the line "It does not run vitest in CI today", which stopped being true whentests.ymllanded.RELEASING.md: the pre-release gate now namesnpm run test:lockstoo, since CI treats those suites as reporting-only and a maintainer should eyeball them by hand before publishing.CONTRIBUTING.mdalso gains a line making the lock-test convention explicit: a new cross-process-lock test must both match thetests/cache-refresh-lock-*prefix and be added totest:locks. Nothing recorded that before, and the split makes it load-bearing — a lock test named anything else runs under the full worker pool and flakes, while one that matches the prefix but is missing fromtest:lockssilently never runs.Verification
Run on a clean
npm ciin a fresh worktree at3536a1d:npx vitest run app/renderer/App.test.tsx→ERR_MODULE_NOT_FOUND: jsdom. Reproduced.npm test→ no jsdom error, 189 files / 2,494 tests collected.npx vitest run tests --exclude "tests/cache-refresh-lock*" --testTimeout=30000→ 187 passed | 2 skipped (189 files), 2,489 passed | 5 skipped (2,494 tests), 0 failures.npx tsc --noEmit→ clean.One caveat worth flagging rather than burying: at the default 5s
testTimeoutI could not get a green run on my machine — I saw 17, then 12, then 1 failure across runs, all timeouts, and the same flakiness on unmodifiedmainat the same SHA (so it is not introduced here; upstream CI is green on3536a1d). Raising only--testTimeoutmakes it uniformly green, which suggests the 5s default is tight for the suites that spawn CLI subprocesses on slower or loaded hardware. I have deliberately not touched the timeout in this PR — happy to open a separate one if you think it is worth doing.npm run test:locksfails on my hardware, as#904describes; it also fails there on unmodifiedmain, and CI keeps itcontinue-on-error, so this PR does not change its status.Notes
Related to #947 (release cadence) only in passing: the pre-release gate in
RELEASING.mdbeing a command that errors out seemed worth fixing regardless of when the next release lands.