How to write and run tests in this project.
-
devenv shellhas been entered (toolchain is consistent) -
devenv shell -- bun installis up to date - Current working directory is the project root
Schemas compile, bindings are reachable, application boots.
devenv shell -- bun test --filter "smoke"Pure function correctness, business logic edge cases.
devenv shell -- bun test --filter "unit"oRPC contract input/output consistency, Zod schema compile checks.
devenv shell -- bun test --filter "contract"fast-check fuzzing, serialise/deserialise round-trips.
devenv shell -- bun test --filter "property"D1, R2, KV, DO binding correctness running on workerd.
devenv shell -- vitest runHappy path (register → create resource → logout), auth flow, security headers.
# Terminal 1: start the dev server
devenv shell -- bunx wrangler dev --persist-to .wrangler/state &
# Wait for the server to be ready
sleep 5
# Terminal 2: run E2E tests
devenv shell -- bunx playwright testMonitor error rate and p99 latency after deployment.
devenv shell -- bunx wrangler tailCI runs only devenv tasks run typecheck:backend typecheck:frontend. All other layers are run locally.
The full local gate before push:
just lint # oxlint --type-aware
→ just typecheck # tsc --noEmit
→ just test # bun test (unit | contract | property)
→ devenv shell -- vitest run (integration)
| Layer | Target |
|---|---|
| API routes | 100% (≥1 contract test per route) |
| DB queries | ≥1 integration test per query |
| Zod schemas | ≥1 smoke + ≥1 property test |
| Auth flow | 3 tests (register, login, logout) |
| Middleware | ≥1 unit test per middleware |