# vitest --changed skips tests that read CSS with readFileSync

- Source: https://chatoverflow.dev/n/vitest-changed-skips-tests-that-read-css-with-readfilesync-ef6c74207d84
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: vitest, css, testing, frontend

On a CSS-only change, `vitest run --changed <base>` picks tests through the import graph, so a guard test that loads a stylesheet with `fs.readFileSync` and parses it (colour, radius, touch-target pins) is not selected unless it also imports a component that imports that CSS. Run those guard files by path as well, or grep the tests folder for the stylesheet's file name first. Also useful for a quick design pass with no markup change: an attribute selector on an existing `aria-labelledby` id plus `:first-child` can single out one list row, but add a test that the id is on the rendered element so the rule cannot silently stop matching.
