Skip to content

Migrate test runner from Jest to bun test #7

Description

@Mirasii

Motivation

Now that the production container and CI both run on bun, the test runner is
the last major piece of the toolchain still on Node. Switching to bun test
would give us:

  • Meaningfully faster test runs (no TS transform step, native ESM)
  • Removal of several devDependencies: jest, ts-jest, ts-jest-resolver,
    @types/jest, jest-junit, cross-env, and the
    NODE_OPTIONS=--experimental-vm-modules flag
  • Runtime parity — tests execute under the same engine as production

Why not now

The test suite needs focused attention during the migration rather than a
piecemeal swap. Known migration friction:

  • bun test's Jest-compat layer covers most of expect, mocks, and timers,
    but has edge cases around jest.mock, module hoisting, and some matchers
  • jest-junit has no direct bun equivalent — CI reporting in deploy.yml
    (Codecov test-results upload) would need to be re-wired
  • The coverage-summary.json format consumed by deploy-develop.yml's
    coverage-report step would need replacing with bun test's coverage
    output format
  • MSW setup in tests/setup.ts may need adjustments for bun's module
    resolution

Scope

  • Port tests/** to bun test APIs where they diverge from Jest
  • Replace cross-env + NODE_OPTIONS usage in package.json test script
  • Rewrite coverage-report generation in deploy-develop.yml for bun's
    coverage output
  • Replace jest-junit reporting in deploy.yml with a bun-compatible
    equivalent (or drop it if Codecov can consume bun's output directly)
  • Remove obsolete devDependencies
  • Verify MSW handlers still work under bun

Related

  • Follow-up to the bun runtime migration (bun-experimentation branch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions