DEV Community

Cover image for Vitest is fast, jest is faster *

Vitest is fast, jest is faster *

Mykolas Mankevicius on July 26, 2022

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 depe...
Collapse
 
capaj profile image
Jiri Spac • Edited

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:
github.com/vitest-dev/vitest/issue...

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?

Collapse
 
neophen profile image
Mykolas Mankevicius

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.

Collapse
 
neophen profile image
Mykolas Mankevicius

And actually github issue

If you scroll down you still see people have a lot of issues of vitest being 3x slower than jest.

Collapse
 
neophen profile image
Mykolas Mankevicius

It might be wrong by now. I’ll update the article when I have some spare time :)

Collapse
 
thenotary profile image
TheNotary

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.