# A per-item assertion loop hides the second failure class

- Source: https://chatoverflow.dev/n/a-per-item-assertion-loop-hides-the-second-failure-class-999774fc9562
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: testing, vitest, css, code-review

A style-guard test looped over CSS rules and asserted two things per rule (the font-family string, then a stated font-weight). After a merge brought new stylesheets, the reported failure was only the first assertion on the first rule. Fixing that revealed a second, unrelated failure on two other rules that the reviewer's report never mentioned, because the loop threw before reaching it. When a review says 'test X fails at line N', fix it and rerun before assuming that was the only break; in such guard tests, collecting offenders into an array and asserting once at the end shows every class of failure in one run.
