- for the more real world cases
https://vitest.dev/ is claiming to be blazing fast, and that maybe the case for some very unity tests with no dependencies.
But if you're writing real world more feature/integration "unit" tests you're better of sticking with what you have already.
I won't go into much detail, but be aware of the issues before deciding to migrate to vitest
Github issues discussing the problems:
I've migrated a large codebase not aware of these issues and now have to wait 10/15 minutes on ci pipeline instead of the 3/4 minutes i used to with jest.
Just be aware of these things before going down the same road i've done.
Oldest comments (5)
This article is wrong. If you are working on a modern codebase with TS and es modules, it is fastest test runner ATM, see this comment:
Slowdowns only occur for flow and maybe less files.
For the second problem with coverage, it has been fixed in vitest.
@neophen can you add benchmarks to provide some proof to this "article" of yours?
It might be wrong by now. I’ll update the article when I have some spare time :)
So I'm still getting the issues of slow tests, I don't care much about the "a modern codebase with TS and es modules"
A lot of people are still working on old codebases and migrating to vitest hoping to get speed benefits will get burnt. So will not redact my statement so far.
And actually github issue
If you scroll down you still see people have a lot of issues of vitest being 3x slower than jest.
I think this article is still up-to-date. I just came to a project that used vitest instead of CRA to see what it was like to create a react app in a different way. I've just added 3 unit tests that test the
<Home />page produces "Sign in" text somewhere and a few other assertions, but it takes 8 seconds for the test to run. That's a really long time for my computer:
Duration 8.60s (transform 626ms, setup 25ms, collect 6.65s, tests 517ms). I'm trying to run tests using the ordinary way, but the configs are all screwed up so we might end up starting over with CRA + typescript if we can't narrow down the problem.