@@ -98,6 +98,29 @@ Each test makes exactly one behavioral claim. Multiple `expect` calls are fine w
9898different facets of the _ same_ outcome. But if you're checking two unrelated behaviors, those are
9999two tests. No conditional logic, no branching, no try/catch — a test is a straight line.
100100
101+ ### Never silently pass — fail loudly
102+
103+ Guard clauses that ` return ` early inside test callbacks silently satisfy the expectation without
104+ checking anything. If a callback receives unexpected input, that's a bug in the test setup — it
105+ should fail, not quietly pass.
106+
107+ ``` typescript
108+ // Bad: silently satisfies the expectation if a non-transaction envelope arrives
109+ .expect ((envelope : Envelope ) => {
110+ if (envelopeItemType (envelope ) !== ' transaction' ) return ;
111+ // ... assertions that never run
112+ })
113+
114+ // Good: hard-fails so you know the envelope type was wrong
115+ .expect ((envelope : Envelope ) => {
116+ expect (envelopeItemType (envelope )).toBe (' transaction' );
117+ // ... assertions always run
118+ })
119+ ```
120+
121+ The same applies to any test callback or predicate: if a condition must hold for the assertions to
122+ be meaningful, assert on it — don't skip past it.
123+
101124### Assert behavior, not implementation
102125
103126If someone refactored the internals but the function still returned the correct result, would this
@@ -494,6 +517,7 @@ directly proves readiness.
494517
495518Before you're done, verify each test against these criteria:
496519
520+ - [ ] No early ` return ` in test callbacks — use assertions to hard-fail on unexpected input
497521- [ ] Catches a real potential bug — not just confirming the happy path works
498522- [ ] Single, clear reason it could fail
499523- [ ] Description reads as a behavior specification (no "should", no "works correctly")
0 commit comments