Skip to content

[*] Chore: Replace jest with vitest for unit tests#7796

Merged
etrepum merged 7 commits intofacebook:mainfrom
etrepum:vitest
Sep 4, 2025
Merged

[*] Chore: Replace jest with vitest for unit tests#7796
etrepum merged 7 commits intofacebook:mainfrom
etrepum:vitest

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@etrepum etrepum commented Sep 4, 2025

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)

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Sep 4, 2025 10:05pm
lexical-playground Ready Ready Preview Comment Sep 4, 2025 10:05pm

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 4, 2025
@etrepum etrepum added this pull request to the merge queue Sep 4, 2025
Merged via the queue into facebook:main with commit 03c3fe4 Sep 4, 2025
42 checks passed
@etrepum etrepum deleted the vitest branch September 5, 2025 00:04
@etrepum etrepum mentioned this pull request Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants