No catch-all try/catch blocks that swallow errors
Why it matters
A try/catch block in a test that has no assertion, no throw, and no console.error converts every runtime error into a silent pass. When the production function throws — due to a network failure, a missing DB record, an uncaught null — the test catches it, discards it, and reports success. This pattern is common in AI-generated tests that wrap async calls defensively without understanding that swallowing errors in tests defeats the entire purpose of having tests. ISO-25010:2011 fault-tolerance requires that faults be detectable, not hidden.
Severity rationale
High because silent error-swallowing means production failures that would be caught by tests instead generate a green CI run.
Remediation
Replace bare catch {} or catch { /* ignore */ } blocks in tests with either an expect(...).rejects.toThrow() assertion or a re-throw. Never discard an error inside a test:
// Before: fetchUser throwing is treated as success
it('fetches user', async () => {
try {
await fetchUser('123')
} catch {
// ignore
}
})
// After: error path is explicitly asserted
it('throws for unknown user', async () => {
await expect(fetchUser('does-not-exist')).rejects.toThrow('User not found')
})
// Or: surface real failures immediately
it('fetches user', async () => {
const user = await fetchUser('123')
expect(user.id).toBe('123')
})
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Test Reality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability.fault-tolerance — Fault tolerance (reliability sub-characteristic)
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-test-theater·automated