chore(test): fail fast when Bun predates —parallel test isolation#392
Conversation
bun test --parallel (and --isolate) first shipped in Bun 1.3.13. Older Bun silently ignores the flags, runs every test file in one process, and lets mock.module() registrations bleed across files — surfacing as hundreds of order-dependent failures. Bun does not enforce engines.bun at install time, so raise the floor to >=1.3.13 and add a preflight (scripts/check-bun-version.ts) that both test scripts run first, failing loudly with an upgrade hint instead of a confusing test cascade. Also sync stale docs that still referenced the removed scripts/run-tests.ts runner (gone since #280) and its flags — notably e2e.md, which documented `test:e2e:op -- --filter react` to scope a run when a forwarded positional pattern now broadens the run to the whole (expensive) e2e suite instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
- e2e.md: the single-fixture example targeted the fixture project dir (test/e2e/fixtures/react/), which matches no tests; point at the test file (test/e2e/react.test.ts) instead, and fix the patch filename (1.58.2 -> 1.60.0). - CLAUDE.md: CI runs `bun run test`, not a bare `bun test`. - CONTRIBUTING.md: steer contributors to `bun run test` (isolation + version preflight) over bare `bun test`, and replace the removed runner's --filter/--debug/--har flags with the env-var equivalents. - run-e2e-op.ts: the JSDoc example used the dead --filter flag; forwarded args now go to `bun test`, where a positional path broadens the run. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `-t "sign in"` example matched no test name. The registered names are "project builds with no errors", "typecheck passes with no errors", and "app loads and auth flow works" — use "project builds". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
—parallel test isolation
#393) The E2E fixture-authoring docs still described the pre-#280 harness. Update them to match the current manifest-driven setup: - Fixture config now lives in test/e2e/fixtures.manifest.ts (keyed by name), not exported from each test file; tests call createFixtureHarness(name). - Correct the exported helpers to the plural runFixtureTests()/runBrowserTests() in CONTRIBUTING.md (were the singular runFixtureTest()/runBrowserTest()). - Fixture setup uses `npm ci` (fixtures migrated from bun to npm with a checked-in package-lock.json), not `bun install`. - Refresh the FixtureConfig field list (drop removed `description`/`pinned`, add `pinnedDependencyRanges`/`packageJsonOverrides`) and drop the stale `--force`/non-pinned refresh flags (the script only accepts `--only`). Follow-up to #392, which deliberately scoped this rewrite out. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Summary
On Bun older than 1.3.13,
bun run testreports hundreds of failures on a cleanmain— 1811 pass / 303 fail on Bun 1.3.11. The--parallel/--isolateflags don't exist before 1.3.13, so Bun silently ignores them, runs all 143 test files in one process, and letsmock.module()registrations bleed across files. CI is green only because setup-bun installs the latest Bun. This raises the floor and adds a preflight so a stale Bun fails loudly with an upgrade hint instead of a confusing test cascade.Changes
engines.bunto>=1.3.13, the first version wherebun test --parallel(which implies--isolate) exists. Confirmed against the official 1.3.12 and 1.3.13 binaries — the flags land in 1.3.13.scripts/check-bun-version.ts, run first by bothtestandtest:e2e. Bun does not enforceengines.bunat install time (verified on 1.3.11 and 1.3.13), so this is the only mechanism that catches a stale Bun before the suite runs. It reads the floor fromengines.bun, so there's one source of truth. Co-located test covers the version matrix.scripts/run-tests.ts, removed in chore(test): pin fixture deps and manifest-drive the e2e harness #280:CLAUDE.md,.claude/rules/testing.md,.claude/rules/scripts.md,.claude/rules/e2e.md,CONTRIBUTING.md, and thescripts/run-e2e-op.tsJSDoc. These are loaded as agent instructions, so a stale runner reference sends both agents and contributors after a file that no longer exists.test:e2e:op -- --filter reactto scope a run, but a forwarded positional pattern is OR'd withtest/e2e/and broadens the run to the entire suite. E2E is the 30-minute Playwright suite that creates real users against the production Clerk API. Replaced the removed runner's--filter/--debug/--harflags with their env-var equivalents, and pointed the single-fixture example at the test file (test/e2e/react.test.ts) rather than the fixture project dir, which matched nothing.Not planned
ci.yml— setup-bun already installs a Bun newer than the floor, and the preflight now catches any environment that isn't. A pin would be one more thing to bump.build-binaries.ymlalone (it's there for a darwin-arm64 codesign issue). Added one line todocs/releasing.mdnoting that pin only covers compiling and sits below the test floor.e2e.md's "How fixtures work" / "Adding a new fixture" and CONTRIBUTING's fixture description still predate chore(test): pin fixture deps and manifest-drive the e2e harness #280's manifest-driven harness (config infixtures.manifest.ts,npm ci,createFixtureHarness). That's a separate subsystem doc migration; tracked as a follow-up.Verification
Full unit suite on Bun 1.3.13: 2123 pass / 0 fail across 144 files.
format,lint, andtypecheckall clean. On Bun 1.3.11,bun run testnow stops immediately with the required range, the found version, andbun upgrade.