Skip to content

[ci] Test files in TS-vacuum — fixture drift not caught by gate (TD-foll-110) #196

@ignromanov

Description

@ignromanov

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:

  1. Create tsconfig.test.json at repo root, extending tsconfig.json, without the __tests__/** exclude. May need composite: false and noEmit: true.
  2. Add npm script: "type-check:tests": "tsc --noEmit -p tsconfig.test.json".
  3. Wire into CI alongside type-check:build and lint (parallelize: pnpm type-check:build & pnpm type-check:tests & pnpm lint & wait).
  4. Document in CLAUDE.md and rules/testing.md.

Acceptance

  • pnpm type-check:tests runs in CI on every PR
  • Fails on type errors in __tests__/** (verify with a deliberate broken fixture in a draft PR)
  • Documented in testing rules

Effort

S, ~1h. Low risk — purely additive gate.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    advisor:kaiAssigned to Kai (CTO)p2Nice-to-havetech-debtTechnical debt items

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions