-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Repo: Move from Jest to Vitest #7112
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
Comments
Hey @JoshuaKGoldberg! I'd be glad to look into this |
I looked into this and I've managed to get tests fully green in 4 workspaces, and fell short by just one suite in 2. Main challenges and thoughts:
Regarding performance... Perhaps most interesting, because one of the slowest, is typescript-estree test, one of the ones that "almost pass", which I ran with parse.test.ts deleted. Here's Jest:
Which in Vitest, with threads disabled, performs like this:
You can see how individual suites are executed in about half the time it takes Jest to execute them. BUT with threads disabled, Vitest can't possibly keep up. |
I won't be spending any more time on this, but you're free to continue where I left off if you want to: https://github.com/wojtekmaj/typescript-eslint/tree/vitest I also used my script to help me out migrating 40+ repos, although the results were hugely underwhelming because your use cases were vastly different from mine: https://gist.github.com/wojtekmaj/6defa1f358daae28bd52b7b6dbeb7ab6 |
Apologies if I'm late to the discussion. I've implemented the codemods that migrate the code from
JestI ran the tests using
PerformanceThe results become comparable and
Test Files changed:
|
Can I interest you in a PR? |
@aryaemami59 Absolutely! Anything we mark with the "accepting prs" label is fair game to submit a PR for, no need to ask 🙂 (see contributing docs) |
@kirkwaiblinger Awesome, I'll give it a shot. Thanks. |
Just a quick update, I am still working on this, it's coming along nicely, I'm just trying to figure out how to minimze the changes necessary and get the integration tests to pass. |
I'm not sure if any of you are still working on it, but i've pushed the branch I had for if one of you has a better approach, or more work ready to go, feel free to shout up and I'll close mine we should move one package at a time so this is reviewable, and ideally keep large changes to follow up PRs if possible |
@43081j I'm still working on it, should be all done soon https://github.com/aryaemami59/typescript-eslint/tree/migrate-to-vitest. |
what's your plan for preparing it for code review? I doubt we'll be able to PR your whole branch in. it'd be helpful if you could cut it up a bit into one branch per project at least as we could be merging those now while you finish the rest if you want any help with that, let me know. generally hanging around on discord too |
Honestly I'm not sure yet, I would love to get some feedback from the maintainers on how to proceed. |
For the record, here's my local results of the eslint-plugin package tests from #10579 (i.e., Vitest:
Jest (current):
|
First of all, big thanks to everyone in this thread who has already done investigation and POCs to advance this effort! Taking a look at #10579 and #10582, I think it makes sense to do as much prework as we can to keep the diff minimal when actually cutting over, and keep several things in mind as part of the migration. Seemingly this includes:
What are people's thoughts of this is as a rough course of action? |
@kirkwaiblinger I have pretty much everything done already, I'm just cleaning up to minimize the changes, I can start submitting PRs for each workspace at a time. |
I guess the one other important point would be to get a satisfying conclusion to the performance issues brought up in #7112 (comment). I'm confused about this, since the linked doc says that
|
@kirkwaiblinger |
Are their docs just out of date? Or is it to do with forks instead of threads?? |
@kirkwaiblinger The default |
I see, thanks for the clarification @aryaemami59 ! |
Alright I think I'm just about ready to start putting up some PRs. |
this was a mistake and should've been raised in the PR as part of the review
👍 |
From #10579, running
Cool 🙂 |
All right! We've merged the last of the conversion PRs, meaning every package in typescript-eslint is now onboarded to Vitest. #11068 is now open to clean up the trailing bits of Jest that still exist. Thanks so much to everyone who participated - in particular @43081j and @aryaemami59 for so much investigation work and PR authoring! 👏 🔥 |
Kudos @43081j and @aryaemami59! |
Suggestion
Right now, we use Jest in this repository for unit tests. It works well. But, I've noticed unit tests starting to take quite a while. It'd be nice if we could reduce that speed.
Vitest purports to be much faster than Jest (and in my personal experience, is). If someone could send a draft PR with our repo migrated over to Vitest and all tests passing, it'd be nice to see:
Bonus points if someone can find or write codemods to do the migration automatically...!
Edit (April 2025): The initial normalization PRs are done and we're now merging the conversions for individual packages. This is roughly the order we're planning on as suggested by @aryaemami59 & @43081j:
jest
tovitest
#10771jest
tovitest
#10772jest
tovitest
#10773jest
tovitest
#10775jest
tovitest
#10777jest
tovitest
#10767integration-tests
fromjest
tovitest
#10778jest
tovitest
#10779jest
tovitest
#10677jest
tovitest
#10679jest
tovitest
#10764jest
tovitest
#10770rule-schema-to-typescript-types
fromjest
tovitest
#10774jest
tovitest
#10776The text was updated successfully, but these errors were encountered: