Skip to content

Run bun test files in parallel (fixes #261) - #277

Merged
theogravity merged 12 commits into
mainfrom
feat/parallel-tests
Sep 30, 2026
Merged

theogravity merged 12 commits into
mainfrom
feat/parallel-tests

Conversation

@theogravity

Copy link
Copy Markdown
Contributor

What

Turns on bun test --parallel for every package and removes the two hazards that only survived serial execution (measured facts, probed on 1.4.0 and 1.4.2):

  • tmux sweep: a preload afterAll fires once per run serially but after EVERY file under --parallel. The run-wide tmux kill-all moved from test-preload.ts to scripts/test-run.sh, which outlives every worker. (The leak net itself predates this PR; see docs/testing-notes.md.)
  • implicit DB boot: five server suites reached the shared @/db singleton without migrating it, riding file order in the one-process serial run. They now call ensureMigratedTestDb() (+ prepareLocalPlugins() where the restart gate needs it) in beforeAll. Idempotent, serial stays green.

Then the flag: --parallel=12 for server/api, server/web, node/agent; --parallel=4 everywhere else; in the test scripts (bun ignores a parallel key in bunfig.toml, measured; bun.com/docs/test lists it as CLI-only).

Numbers (48-core dev machine, 51 turbo tasks)

package serial parallel
apps/server/api 115.6 s 40.1 s
apps/server/web 58.8 s 11.3 s
apps/node/agent 13.6 s 6.0 s
packages/pane-runtime 18.7 s 14.0 s

Verification

  • Three consecutive full bun run test (51/51 tasks, 0 failed tests) on bun 1.4.2, plus a --parallel=1 serial gate on the server package and test:scripts; verify-types, lint:check, lint:prose clean.
  • A local flake from the bake (@internal/desktop-server meta-test pinning the test-script string) is fixed in 1d2b919.
  • Dev machine bun upgraded 1.4.0 → 1.4.2 to match CI's builder image; no lockfile churn.

Design + plan: docs/superpowers/specs/2026-09-29-parallel-tests-design.md, docs/superpowers/plans/2026-09-29-parallel-tests.md. CI --shard split of test-server-node follows as a stacked PR.

No changeset: test infra only, no shipped code changes.

@theogravity
theogravity merged commit e55d467 into main Sep 30, 2026
13 of 16 checks passed
@theogravity
theogravity deleted the feat/parallel-tests branch September 30, 2026 03:18
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant