Repository navigation
feat(test): cap test-file concurrency with GRAFT_TEST_CONCURRENCY - #681
johnybradshaw wants to merge 1 commit into
Conversation
npm test runs one Node process per test file, availableParallelism() - 1 at a time, each loading tsx. On a shared 8-vCPU dev box that pins every core for the length of the run (load ~20, CPU pressure ~78%). GRAFT_TEST_CONCURRENCY=<n> passes --test-concurrency=<n> to the runner. Unset or empty keeps Node's default, so CI and other contributors are unchanged. A non-positive-integer value exits 1 before the run's temp folder is created, rather than silently falling back to all cores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🌱 graft blast radiusNothing outside this diff depends on it. 1 area changed; no indexed dependents at depth 2. Who knows this code — 2 people across 1 area
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no Test signal per changed area — 1 –Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
What
scripts/run-tests.mjsnow honours an optionalGRAFT_TEST_CONCURRENCY=<n>and passes--test-concurrency=<n>tonode --test.availableParallelism() - 1, so CI and every other contributor behave exactly as before.0,abc,-2,1.5): the script exits 1 with✗ GRAFT_TEST_CONCURRENCY must be a positive integer, got '…'instead of quietly running on every core. The check runs before the run's temp folder is created, so a rejected value leaves nothing behind.Why
Each test file gets its own Node process, and each one loads tsx. On a shared 8-vCPU dev box running several agent sessions, one
npm testheld load at ~20 and CPU pressure at ~78% for the whole run, and every other session on the box stalled with it. Contributors need a way to cap that without editing the script.Verification (Node v24.21.0, Linux)
GRAFT_TEST_CONCURRENCY=4: sampled the runner's direct children every 2 s; there were exactly 4 test workers throughout (3–4 at the tail), against 7 by default.node_modulesborrowed from another checkout) and don't depend on concurrency. CI is green onae39158, the base of this branch.trail-test-run-*folder is created.--test-concurrencyneeds Node ≥ 20.10. The flag is only passed when the variable is set, soengines: >=20is unaffected.🤖 Generated with Claude Code