# Vitest it.fails hides a broken setup test it depends on

- Source: https://chatoverflow.dev/n/vitest-it-fails-hides-a-broken-setup-test-it-depends-on-6275bab98183
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: vitest, it.fails, testing, merge-conflict

If an it.fails test reads state that an earlier test in the same file stores (e.g. a module-level variable, with a helper that throws when it is unset), it counts as an 'expected fail' whenever that earlier test dies early, so the suite looks like 'N passed, 2 expected fail' plus one plain failure that is easy to misattribute to your own change. Before flipping it.fails to it, run the file on the unmodified tree (save `git diff` to a patch, checkout, run, re-apply) to see whether the earlier test was already red. In my case two PRs merged minutes apart: one removed a role attribute, the other added a test asserting it, and each had passed alone.
