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

chore: migrate from Jest to Vitest #2495

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Conversation

wojtekmaj
Copy link
Contributor

@wojtekmaj wojtekmaj commented Jan 15, 2024

Requires #2409.

Requires #2494.

Migrates the entire monorepo from Jest to Vitest.

Copy link

changeset-bot bot commented Jan 15, 2024

⚠️ No Changeset found

Latest commit: e1b231d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@wojtekmaj wojtekmaj force-pushed the vitest branch 2 times, most recently from ac96bed to 5ff82aa Compare January 18, 2024 09:09
@wojtekmaj wojtekmaj changed the title Migrate from Jest to Vitest chore: migrate from Jest to Vitest Jan 18, 2024
@wojtekmaj wojtekmaj marked this pull request as ready for review January 18, 2024 09:59
@wojtekmaj wojtekmaj force-pushed the vitest branch 3 times, most recently from fd92279 to ad84b7a Compare January 22, 2024 09:39
@diegomura
Copy link
Owner

diegomura commented Jan 22, 2024

@wojtekmaj Just to understand this better (not familiarized with vitest), the benefit of this is better support for ESM and more performant? About the latter I'm not so concern as the entire testsuite runs in like 6sec. Also curious how tight this lib is to vite, considering we don't use it here

@diegomura
Copy link
Owner

Actually, about performance, I tested this branch and tests take 50% more to run (9s). It's not bad either s not concerned, but still curious :)

@wojtekmaj
Copy link
Contributor Author

There are multiple reasons to go with Vitest. It's quickly raising popularity for good reasons.

Better ESM support and better (and ever-improving) performance are some of them. The importance of the former is only going to get bigger, as more and more modules go ESM-only.

Other benefits:

  • Fewer dependencies, faster installs
  • Easier, less error prone configuration
  • No globals clashes when working with another test runner (e.g. Playwright)

@wojtekmaj
Copy link
Contributor Author

Hmmm, interesting. You're right that the overall run time has increased a bit, and this is while the individual tests run faster:

Before:
PASS packages/renderer/tests/resume.test.js (6.884 s)

After:
✓ |renderer| tests/resume.test.jsx (3 tests) 3767ms

Before:
PASS packages/renderer/tests/pageWrap.test.js (7.924 s)

After:
✓ |renderer| tests/pageWrap.test.jsx (1 test) 3553ms

This makes me convinced that while there is probably something I could still tweak, the more tests and the more complex they are, the faster Vitest will be in relation to Jest.

@wojtekmaj
Copy link
Contributor Author

Now it's 35% faster than Jest on CI! ;)

@wojtekmaj wojtekmaj mentioned this pull request Jan 23, 2024
@diegomura diegomura merged commit 8f84cad into diegomura:master Jan 23, 2024
1 check passed
@wojtekmaj wojtekmaj deleted the vitest branch January 23, 2024 21:17
mskec pushed a commit to mskec/react-pdf that referenced this pull request Feb 26, 2024
* Go all-in with Jest ESM migration

* Migrate from Jest to Vitest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants