Problem
__tests__/** files are currently in a TypeScript-checking vacuum:
| Check |
Sees test files? |
Why |
pnpm type-check:build (tsc --build) |
❌ No |
Each layer's tsconfig.json (e.g. src/entities/tsconfig.json:14) explicitly excludes __tests__/** for build perf |
vitest |
❌ Type-wise |
Transpiles via esbuild, doesn't enforce strict types at runtime |
IDE LSP (root tsconfig.json) |
✅ Yes |
But IDE ≠ CI |
Result: test fixtures can drift from canonical types and CI stays green. Discovered concretely during PR #195 (GH#110) — InvoiceTemplate fixture used id/data/updatedAt instead of templateId/invoiceData/(no field). All gates green; only IDE flagged it. Fixed in commit 5bbc8b6.
Why It's Dangerous
- "tests pass = types correct" assumption is false. Fixture-shape bugs survive merge.
- New developers running
pnpm test get false confidence.
- When fixture is later read by reachable code (refactor, new test), runtime
undefined access.
- Erodes the architecture-as-contract guarantee — the canonical type registry is no longer enforced everywhere.
Proposed Fix
Add pnpm type-check:tests as a separate gate:
- Create
tsconfig.test.json at repo root, extending tsconfig.json, without the __tests__/** exclude. May need composite: false and noEmit: true.
- Add npm script:
"type-check:tests": "tsc --noEmit -p tsconfig.test.json".
- Wire into CI alongside
type-check:build and lint (parallelize: pnpm type-check:build & pnpm type-check:tests & pnpm lint & wait).
- Document in
CLAUDE.md and rules/testing.md.
Acceptance
Effort
S, ~1h. Low risk — purely additive gate.
References
Problem
__tests__/**files are currently in a TypeScript-checking vacuum:pnpm type-check:build(tsc --build)tsconfig.json(e.g.src/entities/tsconfig.json:14) explicitly excludes__tests__/**for build perfvitesttsconfig.json)Result: test fixtures can drift from canonical types and CI stays green. Discovered concretely during PR #195 (GH#110) —
InvoiceTemplatefixture usedid/data/updatedAtinstead oftemplateId/invoiceData/(no field). All gates green; only IDE flagged it. Fixed in commit5bbc8b6.Why It's Dangerous
pnpm testget false confidence.undefinedaccess.Proposed Fix
Add
pnpm type-check:testsas a separate gate:tsconfig.test.jsonat repo root, extendingtsconfig.json, without the__tests__/**exclude. May needcomposite: falseandnoEmit: true."type-check:tests": "tsc --noEmit -p tsconfig.test.json".type-check:buildandlint(parallelize:pnpm type-check:build & pnpm type-check:tests & pnpm lint & wait).CLAUDE.mdandrules/testing.md.Acceptance
pnpm type-check:testsruns in CI on every PR__tests__/**(verify with a deliberate broken fixture in a draft PR)Effort
S, ~1h. Low risk — purely additive gate.
References
5bbc8b6 test(creator-store): align InvoiceTemplate fixture with canonical type.ai/.claude/rules/testing.md