Skip to content

test: run test files in parallel - #388

Merged
willgosnold merged 2 commits into
mainfrom
test/parallel
Oct 27, 2026
Merged

willgosnold merged 2 commits into
mainfrom
test/parallel

Conversation

@willgosnold

Copy link
Copy Markdown
Owner

Part of #382

Problem

bun test --isolate runs test files one after another. The whole suite takes about 770 s from source and about 750 s for test/e2e/ against the binary on a 20-thread machine. Bun 1.4.3 has --parallel, which runs files in worker processes and implies --isolate. Nothing uses it.

Change

  • package.json: test is bun test --parallel.
  • ci.yml: the unit files, the "so only from source" run and the e2e files all use --parallel. On the one-file fork and vendor shards it does nothing, but one form is simpler than two.
  • release.yml: the whole-suite run is bun test --parallel.
  • CONTRIBUTING.md: the local e2e command gains --parallel, and one line says what it does.

Files run side by side. Tests inside one file still run in order.

CI wall time is bound by fork.test.ts, which is one file, so the gain in CI is small. The gain is mostly local. The CI job times will be added from real runs.

Verification

All on this 20-thread machine (i5-13500), Bun 1.4.3, back to back, 0 failures in every run.

Run Wall time Pass / skip / fail
bun test --isolate, from source 772 s 2326 / 1 / 0
bun test --parallel, from source, x3 175, 175, 171 s 2326 / 1 / 0 each
test/e2e/ against dist/patchbook, serial 750 s 1534 / 13 / 0
test/e2e/ against dist/patchbook, --parallel, x3 167, 166, 168 s 1534 / 13 / 0 each

The counts match across all runs, so no test depends on running alone. Nothing was retried.

The limiter is fork.test.ts. Bun's --timings file gives 167.5 s for it inside the 13-file parallel run, which is the wall time. vendor.test.ts is next at 129 s, then intent.test.ts at 42 s. The other ten files add up to under 2 minutes. That is why 750 s becomes 167 s and not 750 / 20.

One thing I can't explain. fork.test.ts on its own takes 262 s, both plain and with --parallel, and also when run with usage.test.ts. It takes 167 s when all 13 files run together. The CPU governor is powersave, so a single busy core may clock lower than a loaded machine. I did not test that. CI's fork shard runs that one file, so it should see the 262 s case on this machine, not the 167 s one.

Not checked: macOS and the root jobs. I'm running ci.yml by hand on this branch to cover them.

Written with Claude Sonnet 5.5 in Claude Code

🤖 Generated with Claude Code

willgosnold and others added 2 commits October 27, 2026 22:05
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@willgosnold
willgosnold merged commit b47f511 into main Oct 27, 2026
18 checks passed
@willgosnold
willgosnold deleted the test/parallel branch October 27, 2026 22:42
@willgosnold

Copy link
Copy Markdown
Owner Author

Found in review, outside this PR's change. It comes from #383, and main had it before this PR.

The "so only from source" run fails only when its pattern matches no test. --test-name-pattern "init stopped by a preload, so only from source" exits 0 with 8 of the 12 tests. So if one of the two describes that skip under PATCHBOOK_CMD were renamed without that phrase, its tests would skip in every binary run and never run from source, and CI would stay green.

I'll open an issue for it.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant