Skip to main content

backend-testing

このモノレポ(project-template-2026)の `apps/backend`(Hono BFF)でテストを書く/直す/レビューするときの唯一の実装ガイド。ルート単体テストを PGlite(インメモリ Postgres)上で request→db→response で回し、`hono/testing` の `testClient` で型付き RPC として叩く方式・共通ヘルパ(`support.ts` / `seed.ts`)・session/認可の seed・並列性・落とし穴を集約する。以下のいずれかのとき必ず読むこと —— (1) `apps/backend` に新しいルートのテストを追加する/既存テストを直す・レビューする、(2) PGlite・`vi.mock('@icasu/db/client')`・`migrateTestDb`・`withSession`・`testSession`・`seedTask`・`seedSessionUser`・`testClient`・`InferRequestType` の使い方を知りたい、(3) テストで DB を差し替える/マイグレーションを当てる/session や role を用意する/楽観ロック(body の `expectedVersion`)や zValidator の 400/404/409 を検証する、(4) 「テストが並列で衝突しないのはなぜか」「negative test で型が通らない」等のテスト特有の疑問がある。バックエンドのテストに関わるならまずこのスキルを読む。

Jump to install

Source facts

Repository
yamatatsu/project-template-2026
Last source activity
July 14, 2026 at 12:48
Detected SKILL.md language
Japanese
Stars
3
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.