Skip to content
EN · PT

Gate: single-test-per-unit

A unit has one test file per test layer, or declares the split with a reason.

Property Value
Checker single-test-per-unit
Confronts code
Blocking by default — new project yes
Blocking by default — existing project no — informs

Two files testing one unit in one layer split what the unit is proven by, and each looks complete on its own: in the reference app a hook had useIapNative.test.ts and useIapNative.test.tsx, and five models had tests both under __tests__/unit/models and under __tests__/unit/lambdas/. Which one to extend, which one a gate reads, which one a mutation run counts — each answer was a guess.

The unit a test tests is the project’s own derivation read backwards (TestedUnits), so nothing assumes a language or a layout. A split the project means is declared in one of the files with @split-test: <why>.

gates:
- name: single-test-per-unit
on: [code]
check: single-test-per-unit

Source: checker · its spec