Skip to content

CI: multi-runtime test matrix (Bun + Node + Deno) #293

@pathosDev

Description

@pathosDev

Spawned from the coverage analysis right after the chat-sample
sweep. This is the single highest-leverage improvement we
identified — it lifts ~19 framework files from ~50 % coverage to
~85 % without writing a single new test.

The gap

Today bun test is the only test runner CI invokes. That leaves
the runtime-adapter files measured against zero exercise:

file line coverage
src/runtime/tcp/DenoTcpBackend.ts 2 %
src/runtime/http/DenoHonoRunner.ts 5 %
src/worker/WorkerNode.ts 5 %
src/runtime/tcp/NodeTcpBackend.ts 6 %
src/worker/WorkerCluster.ts 7 %
src/runtime/http/NodeHonoRunner.ts 7 %
src/runtime/sqlite/BetterSqliteDriver.ts 27 %
src/runtime/worker/NodeWorkerBackend.ts 32 %
src/runtime/http/index.ts, sqlite/index.ts, tcp/index.ts 59 % each
src/runtime/sqlite/BunSqliteDriver.ts 67 %

These aren't dead branches. The runtime-detection layer
(src/runtime/detect.ts) picks the correct backend at boot time
based on which globals exist. When the test suite runs in Bun,
the Node + Deno code paths get statically imported (for type
side-effects) but are never executed.

Scope

  • Add a CI matrix step that re-runs the existing test suite under
    Node and Deno in addition to Bun. Reuse the same test/ tree —
    no test-code changes required. Recommended shape:
    strategy:
      matrix:
        runtime: [bun, node, deno]
    with three corresponding run: lines (the existing
    package.json already has smoke:bun / smoke:node /
    smoke:deno, so the runners are already proven to work in all
    three — extending that to the full suite is the next step).
  • For Node, prefer node --test (built-in) or run via
    bunx vitest / bunx tsx — needs investigation; the suite uses
    bun:test's globals so a thin shim or Vitest-import remap is
    likely needed.
  • For Deno, deno test --node-modules-dir may be the smoothest
    path given existing npm:-style imports.
  • Skip tests that legitimately don't apply to a runtime (e.g. a
    BunSqliteDriver-specific test should skip under Node) via
    runtime.is('bun') guards or describe-level
    .skipIf(...) blocks.
  • Update README.md → "Compatibility" section to reflect what's
    actually CI-verified.

Acceptance criteria

  • CI matrix runs the unit suite under all three runtimes.
  • Line coverage for src/runtime/**/*.ts rises to ≥ 85 %.
  • Line coverage for src/worker/**/*.ts rises to ≥ 85 %.
  • No reduction in test count (don't permanently skip tests
    that just happen to be flaky under a specific runtime —
    diagnose those individually).

Out of scope

  • Adding new tests. This issue is purely about exercising the
    existing suite against more runtimes.
  • Bun-specific perf tuning (e.g. bun:sqlite vs Node SQLite
    driver speeds) — separate concern.

Notes

The chat sample's smoke-test (examples/chat/smoke-test.ts)
already runs against all three runtimes via the smoke:* scripts.
That proves the cross-runtime story works end-to-end; the missing
piece is plumbing the unit suite into the same matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    infrastructureCI / build / live-integration testspriority: highTop priority — high impact, plan next

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions