[*] Chore: Replace jest with vitest for unit tests#7796
Merged
etrepum merged 7 commits intofacebook:mainfrom Sep 4, 2025
Merged
[*] Chore: Replace jest with vitest for unit tests#7796etrepum merged 7 commits intofacebook:mainfrom
etrepum merged 7 commits intofacebook:mainfrom
Conversation
…ation|regression|\.m?js|LexicalSelection\.ts' | cut -c4- | xargs -n1 git checkout
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zurfyx
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The version of jest we are using is old and jest in general doesn't work very well with modern toolchains (esm and typescript in particular). Switching to vitest runs the tests twice as fast, requires less configuration, gives us future options for browser tests instead of jsdom (a faster option than playwright), etc.
I decided to do this because I ran into problems with jest and asynchronous module loading for shiki languages when trying to update docusaurus.
Note that the integration tests are still in commonjs and run with jest. It will probably stay this way until we migrate that build infrastructure over to mjs.
Test plan
The whole thing is tests :)
Before
Unit tests run in 1m 26s with jest
After
Unit tests run in 38s with vitest (~2.25x faster)