Migrate test setup to Vitest #1162
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
jestreferences tovipatch.js, as the existingrunPatchTestabstraction was resulting in Vitest thinking no tests were in the file. Created a similarrunPatchTestsmethod and updated all usages to call that method instead, and ensured that all tests are being run.describeblocks totestto ensure they're executed correctly