Skip to content
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

test: Migrate from Jest to vitest #47466

Merged
merged 4 commits into from
Aug 26, 2024
Merged

test: Migrate from Jest to vitest #47466

merged 4 commits into from
Aug 26, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Aug 24, 2024

Summary

There are some benefits, like faster tests and thus saving CI time, but the main reason for me is¹:

Jest still does not properly support ESM packages, this causes a lot of stuff breaking.
Sometimes you need to adjust imports for mocking, and sometimes other random stuff break.

Instead of wasting valuable developer lifetime we can use vitest which works perfectly with ESM.

Running locally:

Jest vitest
32.739s 6.375s

¹ (really just annoyed by wasting time fixing tests that are not broken but the testing framework is...)

Checklist

@susnux susnux added this to the Nextcloud 31 milestone Aug 24, 2024
@susnux susnux requested a review from skjnldsv as a code owner August 24, 2024 15:03
@susnux susnux changed the title Chore/migrate vitest test: Migrate from Jest to vitest Aug 24, 2024
@susnux susnux added 3. to review Waiting for reviews tests Related to tests javascript labels Aug 24, 2024
@susnux susnux requested a review from artonge August 24, 2024 15:42
@susnux susnux force-pushed the chore/migrate-vitest branch from 0dce19a to 44afaf4 Compare August 26, 2024 12:10
susnux added 4 commits August 26, 2024 17:27
There are some benefits, like faster tests and thus saving CI time, but the main reason for me is:

Jest still does not properly support ESM packages, this casues a lot of breaking stuff.
Sometimes you need to adjust imports for mocking, and somethimes other random stuff break.
Instead of wasting valuable developer lifetime we can use vitest which works perfectly with ESM.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the chore/migrate-vitest branch from 44afaf4 to 30d090f Compare August 26, 2024 15:30
@susnux susnux merged commit 4fcf4db into master Aug 26, 2024
173 checks passed
@susnux susnux deleted the chore/migrate-vitest branch August 26, 2024 18:30
@skjnldsv skjnldsv mentioned this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews javascript tests Related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants