Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: typescript
testingassertionstest-qualityfalse-positives
Make negative/absence assertions fail loudly, not by timing out
Avoid assertions that pass simply because an element eventually disappears or a duration elapses; tie the assertion to a deterministic signal so a regression actually fails the test.
PR: hegnar-bellsheep-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // passes even on a real success because the snackbar auto-dismisses |
| 2 | await expect.element(page.getByRole('status')).not.toBeInTheDocument(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // fails on success: asserts the failure analytics event was pushed |
| 2 | await expect.poll(() => lastEvent()?.action_success).toBe(false); |
Explanation (EN)
Objašnjenje (HR)