Testing in CI

Room tests are plain unit tests. They don’t start a server or open a browser, so they run anywhere your test runner does — in milliseconds, with no external services to stand up.

Local

npx irtio test          # runs *.test.ts against your room
npx irtio test --watch  # re-run on change

GitHub Actions

name: ci
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22, cache: pnpm }
      - run: pnpm install --frozen-lockfile
      - run: pnpm exec irtio test

Determinism

Every simulated run takes a seed, and the server clock is fixed-step, so a test that passes once passes every time. Flaky multiplayer tests — the reason most teams don’t write them — simply don’t happen here.

If a test is nondeterministic, it’s because your room reads wall-clock time or Math.random() directly. Use the injected ctx.now and ctx.random instead and it becomes reproducible.

What to cover

TestProves
Happy path per RPCthe rules work
Rejected/illegal movesthe server refuses cheating
Disconnect + reconnectseats resume cleanly
Two clients racingownership conflicts resolve

Next steps

Placeholder content.