Skip to content

Conversation

@markerikson
Copy link
Collaborator

I've spent the last few days doing a significant amount of work trying to benchmark and improve Immer's performance, to address #1152 .

As part of that, I frequently needed to rerun the tests, but the current Jest + TS-Jest setup was annoyingly slow.

We switched over to use Vitest for the Redux repos a while back. I've been very happy with it, and part of that is that it seems to run our own tests noticeably faster.

I tried migrating Immer's tests to Vitest, and got them working. They also seem to run significantly faster. So, I'm submitting the Vitest migration as a PR in case you're interested.

Note that the work for this PR includes a lot of AI-generated code from Claude. This is a relatively new experiment for me, and I've done a lot of careful babysitting to keep it going in the right direction and tried to review and check the results.

Overall, the changes in this PR:

  • Added Vitest config files, including a new reporter that tries to mimic the existing "skip obsolete snapshot changes" behavior
  • Updated tests to work with Vitest:
    • Changed jest references to vi
    • Restructured patch.js, as the existing runPatchTest abstraction was resulting in Vitest thinking no tests were in the file. Created a similar runPatchTests method and updated all usages to call that method instead, and ensured that all tests are being run.
    • changed some describe blocks to test to ensure they're executed correctly
  • Removed Jest config files

@mweststrate
Copy link
Collaborator

This looks great, thanks for taking the effort! Since Github since still doesn't offer a rebase button, I'll just merge and fix up anything after

@mweststrate mweststrate merged commit 4b8bcc5 into immerjs:main Sep 12, 2025
0 of 2 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 10.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants