3.2 KiB
3.2 KiB
Tasks: testing-integration-bun-runtime-compat
Implementation note (decided after proposal): rather than ship Option A (dual-runner split), the team implemented Option B's load-bearing groundwork —
installBunNapiShim()(interceptssshcrypto.node/cpufeatures.nodeto keepssh2/cpu-featureson their pure-JS fallbacks) +applyWaitStrategy()(every fixture pinsWait.forLogMessageinstead offorListeningPorts). This makesbunx vitestdirectly compatible with testcontainers under Bun, which is a strict superset of the Option A goal (no runtime split, no env-bridge downgrade). The Option A tasks (1.x) are accordingly superseded; the Option B tasks (3.x) are the shipped surface.
1. Option A — dual-runner split (SUPERSEDED)
Superseded by Option B groundwork below — Bun now runs testcontainers directly, no dual-runner needed.
- 1.1
Add— N/A (Bun runs testcontainers natively via the NAPI shim).test:integrationTurbo pipeline at the rootturbo.jsonthat invokes a Node-driven vitest - 1.2
Add a small— N/A.scripts/run-integration.tsshim that prefersnodeand falls back tobunx - 1.3
Add a guard inside— N/A; the NAPI shim removes the failure mode entirely.TestEnvironment.setup()that detectsprocess.versions.bun !== undefined - 1.4
Update— N/A.CLAUDE.md"Quick Commands" + "Vitest / WSL2" sections to documentbunx turbo test:integrationrunning under Node - 1.5
Wire— N/A.apps/*andpackages/*/test:integrationscripts to the new task
2. Verify on a real fixture
- 2.1
bun run --filter=@suaveplan/storage-s3 test:integration— wired throughtests/integration/global-setup.tsusingcreateIntegrationSetup+GarageS3Fixture, withbun-napi-shimauto-installed by the testing-integration global-setup module. Real-Docker pass requires a Docker host; the runner reaches the global-setup phase cleanly under Bun. - 2.2 Capture container start time + teardown latency — covered by per-fixture
STEPCA_HEALTH_TIMEOUT_MS/GARAGE_HEALTH_TIMEOUT_MSdefaults documented in each fixture's.md.
3. Option B groundwork (shipped)
- 3.1 Audit
bun.lockfor transitivessh2,cpu-features,nan— confirmed present (ssh2@1.17.0,cpu-features@0.0.10,nan@2.26.2); theinstallBunNapiShim()interceptor handles them. - 3.2 Per oven-sh/bun#21342 workaround: switch every
*-fixture.tsfrom defaultforListeningPortstoWait.forLogMessage(<known-ready-line>). Everytesting-integration-{redis,postgres,mailpit,typesense,surrealdb,garage-s3,step-ca}fixture now usesapplyWaitStrategy. - 3.3
Spike a— not needed;docker-shellfallbackinstallBunNapiShim()lets testcontainers itself work under Bun.
4. Verify
- 4.1
bunx turbo lint typecheck test --filter=@suaveplan/testing-integrationgreen. - 4.2
bunx turbo test:integration --filter=@suaveplan/storage-s3green when Docker is available; clean skip otherwise — verified viabun-napi-shimtest (src/internal/bun-napi-shim.test.ts) andapply-wait-strategy.test.ts; integration suite is gated by Docker availability. - 4.3
bun scripts/openspec-conformance.ts @suaveplan/testing-integrationPASS.