📝 Require labeled AAA blocks in tests
Rule in CONTRIBUTING.md; decision, why and rejected unlabeled ordering in development/testing.md.
This commit is contained in:
1 parent
34567856a5
commit
62a5599ab3
2 files changed
+33
No files matched your search
@@ -67,6 +67,12 @@ before the implementation. The loop is **type → red → green → refactor**:
|
||||
`npm run verify` as the definition-of-done gate.
|
||||
|
||||
Every test pairs an `expectTypeOf(...)` with an `assert.*`; keep them together.
|
||||
Each test body follows **AAA (Arrange–Act–Assert)** with labeled blocks
|
||||
separated by a blank line: `// Arrange` sets up the inputs (e.g. the matcher
|
||||
factory), `// Act` exercises the subject once from them (not a second
|
||||
throwaway call), `// Assert` holds every check — type expectations first,
|
||||
runtime assertions last; an empty block drops its label (see
|
||||
[development/testing.md § AAA ordering](./development/testing.md#aaa-ordering)).
|
||||
Type-first is enforced structurally: `npm test` runs `check:tsc` before the
|
||||
test runner, so a wrong type can never be papered over by a passing assertion.
|
||||
Per [AGENTS.md § Never do](./AGENTS.md#never-do), reach green honestly — fix the
|
||||
|
||||
Reference in new issue
Block a user