Why your Vitest test suite is slow (and how to fix it)
Briefly

Why your Vitest test suite is slow (and how to fix it)
"Our project is a big old React SPA, made of ~307k LOC, with ~500 test files for a net total of ~2662 tests (unit and component/integration tests). We had been wanting to migrate out of Jest for several fairly common reasons: its poor ESM support, the complexity of its configuration, and most of all, the belief that a more modern tool would run our tests much faster."
"Vitest was actually ~1.5x slower than Jest locally, and ~2x slower on CI... Yikes. After more research, we found out that we were not the only team to have noticed such a slowdown compared to Jest, but apart from performance, all of our other expectations were met! So we were not ready to give up with Vitest!"
"It's now been a month since the migration, and I'm happy to say that we've finally successfully made our Vitest setup faster than our old Jest one! Here's how we did it."
A development team migrated a large React single-page application with 307k lines of code and 2,662 tests from Jest to Vitest. Initially, Vitest performed 1.5x slower locally and 2x slower on CI than Jest, contrary to expectations. After researching similar cases and understanding test runner pipelines, the team implemented optimizations that ultimately made Vitest faster than their original Jest setup. While Vitest met expectations regarding ESM support, configuration simplicity, and modern developer experience, performance required targeted improvements to achieve the desired speed gains.
Read at Medium
Unable to calculate read time
[
|
]