I prefer using bun:test [1] where possible, super fast to run, all built-in no need to install any packages, supports watch mode, also TypeScript tests just works out of the box without additional deps or steps. You'll also get all the benefits of bun which is a breath of fresh air over npm.<p>[1] <a href="https://bun.sh/docs/cli/test" rel="nofollow">https://bun.sh/docs/cli/test</a>
Vitest does not support CommonJS mocking as of today.<p>I switched to Vitest because Jest was giving me flaky coverage results: <a href="https://github.com/nodejs/node/issues/51251">https://github.com/nodejs/node/issues/51251</a><p>And while Vitest' coverage is stable, I had to add an indirection layer to change how I mock out calls to GitHub's API (@github/octokit).<p>Oh, side note: vite-node's --watch functionality does not restart the process. It does hot reloading which is different enough that it requires some rework at how you set up your app structure and callbacks.
We switched from Jest to Vitest this summer as part of the effort to migrate a large node repository to ESM. Jest presented a lot of issues after switching to ESM. Vitest was compatible with our existing jest code, minus a couple altered method signatures. It was also compatible with custom matchers we had implemented with jest-extend.<p>Most of the migration effort was spent on configuration for our needs. Vitest is quite flexible so it was just a matter of nailing down what worked for us.
FWIW I tried switching a fairly large project from Jest to Vitest, hoping for performance improvements. Instead I got some inscrutable errors about circular dependencies.<p>More generally this is one of the really annoying things about Node.js. You might have some circular dependency that works everywhere, but it fails when you use some specific bundler or test runner. Cause they all handle things slightly differently.
Im interested if anyone has experience using node's native test runner in a non-trivial project?<p>We are not using the module mocks from Jest in our project and a quick PoC showed significant (3x) speed improvement, but i am worried about the battle-tested:ness.
I just recently did a website conversion that used vite and took a look at both vitest and playwright.<p>Ended up going with playwright for the “batteries included” browser support and because we use .Net Core for the backend.<p>dotnet doesn’t always get the best support from pure JS/TS projects, so it seemed like a reasonable hedge.
What is meant by “interactive snapshot testing”? If this is the ability to generate and update snapshots in watch mode, Vitest supports this, even though the feature matrix in the article indicates that it does not. I know because I used this feature last month.
Why not use Node’s built-in testing platform with node --test for server-side purposes or small projects? You can run typescript too. The only drawback is the lack of an expect function, but you can easily built your own or use mine, it’s called tinyexpect.