-
-
Notifications
You must be signed in to change notification settings - Fork 716
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
Replace Jest with Vitest 2 #4728
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4728 +/- ##
===========================================
- Coverage 90.48% 71.14% -19.34%
===========================================
Files 265 262 -3
Lines 38113 37819 -294
Branches 3166 1955 -1211
===========================================
- Hits 34488 26908 -7580
- Misses 2650 9638 +6988
- Partials 975 1273 +298 ☔ View full report in Codecov by Sentry. |
4762bb5
to
9386082
Compare
1c217a6
to
191982c
Compare
9f50b69
to
47ea443
Compare
@birkskyum I took a look at the unit test config as you requested. Looks good afaict. Coverage is in a separate command, If there is a particular file that consistently runs more slowly, using I don't claim to be a Vitest expert though. I switched from Jest -> Vitest -> Bun, and experienced speed wins each time. But you're using newer versions of Jest and Vitest, so things may have changed. And these tests use JSDom, which I've never needed to use, which is slower than running tests on node. The benefit of this PR, is not only does Vitest provide ESM support, it brings some future proofing because Vitest should eventually be rewritten in native code, given VoidZero's vision for a rust based end-to-end toolchain. |
@jasongitmail , thank you very much for the review. It is a good idea to try to narrow down single files that might be impacting the numbers, and if beforeEach/All .concurrent() can help. I haven't looked into either of those, I just ported the tests directly, so it's likely there's something to gain. You can run Vitest with Bun, and see a speedup? I haven't had much success with that. Unless the --bun flag is set, I believe bun just fires up node to run vitest. If you can run with this flag, please let me know, because then I have to update some tickets. If you can see a speedup running without the --bun flags, that's quite surprising to me given it's likely the same node process as not using bun, but they might of course have a trick. |
This PR replaces the test runner (unit/integration/build) from Jest to Vitest 2, which has built-in support for TS/ESM and the same syntax as Jest. This PR serves to help us evaluate the option, and to move forward faster if there's a decision to proceed at some point.
A key motivation for examining this change is that I've found it quite challenging to move these tickets forward:
Part of the struggle is that Jest only has experimental ESM support, and I've so far not managed to see an effect of the useESM setting in the ts-jest plugin used in this repo.
It's a continuation of
Relates to Rolldown, because vitest is downstream of vite, and thus eventually will swap internals to use rolldown:
Relates a bit to browser runner, because vitest is working on a browser mode:
Launch Checklist