Vitest 4 to 5 on a 3,000-file test suite: what the upgrade bought us
We moved our test runner from Vitest 4.1.8 to Vitest 5.0.4 this week. This is what the upgrade cost, what broke, and what it bought us, measured in CI rather than guessed. The setup About 3,000 test files. Three CI lanes (shards), merged into one coverage report at the end. Around 139 CI runs a day on self-hosted runners. Node 22, the forks pool, test isolation on. That last line matters. The…
This week, the testing framework Vitest was upgraded from version 4.1.8 to 5.0.4. The upgrade resulted in an 18% reduction in CI time, bringing it close to the 19% speedup predicted by the Vitest team's benchmarks. The Vitest suite consists of approximately 3,000 test files, with testing split across three CI lanes that merge into a single coverage report.
The upgrade involved some minor issues, including unawaited .resolves causing test failures, a new requirement for mocks to live at module scope, and coverage remapping counting ?? fallbacks as branches. The upgrade required no changes to the CI pipeline, and the coverage gate was unaffected. The migration process took about half a day and is expected to pay back quickly with a daily CI time saving of around 8 runner-hours.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.