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 ruleP2stack specificStack: react
testingcss-modulesjsdomvitest
Don't unit-test styles that come from external CSS modules
Avoid asserting computed CSS from SCSS/CSS modules in jsdom/happy-dom unit tests, since those styles aren't applied; test inline/prop-driven values or use a tool that renders real CSS.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | expect(getComputedStyle(p).fontFamily).toBe('Inter'); // SCSS module not applied in unit test |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // assert values applied inline / via props, which jsdom can read |
| 2 | expect(typography).toHaveStyle({ color: 'red' }); |
Explanation (EN)
Objašnjenje (HR)