Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Test file naming: *.test vs *.spec

  • Status: accepted
  • Date: 2026-07-17
  • Deciders: FRAME maintainers

Nest scaffolding and many tutorials default to colocated *.spec.ts for unit tests, while Playwright commonly uses *.spec.ts for browser e2e. Mixing both layers under one suffix makes it easy for agents (and humans) to put HTTP/browser suites next to units, or to invent a third suffix (*.e2e-spec.ts).

Options considered:

  1. Nest-style: unit and Nest e2e both *.spec.ts (layer only by folder).
  2. Vitest-style: everything *.test.ts.
  3. Split by layer: unit *.test.ts(x), integration/e2e *.spec.ts under e2e/ or integration/ — drop *.e2e-spec.ts.

Use option 3 repo-wide:

SuffixLayerPlacement
*.test.ts(x)UnitColocated next to the module
*.spec.tsIntegration / e2eUnder e2e/ or integration/

Enforcement: @frame/vitest unit configs include only **/*.test.ts(x); Nest e2e uses e2e/**/*.spec.ts; Next Playwright uses testMatch: '**/*.spec.ts'.

  • Positive: Filename signals test layer; Nest training data that suggests *.spec.ts for units is overridden by AGENTS/skills/configs.
  • Negative / trade-offs: Nest generators may still emit *.spec.ts — rename to *.test.ts for units.
  • Follow-ups: Keep oxlint Vitest vs Playwright globs aligned with this split.
  • Related skills / AGENTS: root AGENTS.md (Testing), .agents/skills/vitest-testing, apps/nest/AGENTS.md, apps/next/AGENTS.md
  • Starlight guide: Testing principles