-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating to Vitest #174
Comments
Official Nextjs example code : https://github.com/vercel/next.js/tree/canary/examples/with-vitest |
Why Vitest? Next.js has a built-in configuration for Jest, which is not the case with Vitest if not wrong? I can understand we can use Vitest with Vite but Next.js is not build on top of Vite. Love to hear any feedback and suggestion. What bring Vitest compared to Jest? |
https://vitest.dev/guide/comparisons.html#jest Mainly for performance reasons, faster test suits means faster feedback loop which means improved DX. There will be official Vite support in Nextjs probably when they reached 1.0 |
The default configuration provided by Next.js for Jest use @swc/jest behind the scene, should provide a good performance. Based on some reddit post, Vitest is even slower: https://www.reddit.com/r/reactjs/comments/1066fvv/test_runner_spa_vite_react_vitest_vs_jestswc/?rdt=41518 |
Here is another post about the performance: https://www.jameslmilner.com/posts/speeding-up-typescript-jest-tests/ |
You may be probably right, sorry I did not considered the SWC, Most recent bench mark without SWC integration shows it is just marginally faster, probably new Turbo pack will improve the test performance more with Jest or bring a testing capabilities like Bun. So I'll close this issue! |
@kaushalyap Thank you for your suggestion, always open to feedback and suggestion. I would totally reconsider Vitest in the future, very promising. |
@kaushalyap The project is now using Vitest for testing instead of Jest, thank you so much for the suggestion Better DX compared to Jest and less configuration |
It seems you recently start working on Playwright migration, which is great!
Next migration is to migrate from Jest to Vitest, since Vitest is reaching 1.0, currently in v1 beta
The text was updated successfully, but these errors were encountered: