Skip to content

Conversation

@katinthehatsite
Copy link
Contributor

@katinthehatsite katinthehatsite commented Jan 15, 2026

Related issues

Fixes STU-1207

Proposed Changes

This PR migrates from jest to vitest.

Testing Instructions

  • Confirm all the tests are passing in the CI
  • Review vitest config and setup files and feel free to add suggestions
  • You can also run the tests locally to confirm everything is passing correctly

Note: I initially wanted to split the setup files for node and dom but after doing that, I noticed that they had quite a bit in common for now so decided to leave as is. We can also do the split if we think it is necessary.

In some cases, it was tricky to mock things so the mocks might be longer, especially since vitest is quite strict with enforcing types.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@katinthehatsite katinthehatsite self-assigned this Jan 15, 2026
@katinthehatsite katinthehatsite marked this pull request as draft January 15, 2026 10:36
@katinthehatsite katinthehatsite requested a review from a team January 22, 2026 16:36
@katinthehatsite katinthehatsite marked this pull request as ready for review January 22, 2026 16:36
@katinthehatsite katinthehatsite changed the title Install vitest Mig Jan 22, 2026
@katinthehatsite katinthehatsite changed the title Mig Migrate jest tets to vitest Jan 22, 2026
@fredrikekelund
Copy link
Contributor

I took a quick look at Buildkite to compare unit test times between this PR and #2465.

Looks like migrating to Vitest basically cut them in half 🤩

macOS Windows
Vitest 2min21s 5min51s
Jest 4min30s 8min56s

@wpmobilebot
Copy link

wpmobilebot commented Jan 23, 2026

📊 Performance Test Results

Comparing 6e64da8 vs trunk

site-editor

Metric trunk 6e64da8 Diff Change
load 2894.00 ms 2907.00 ms +13.00 ms 🔴 0.4%

site-startup

Metric trunk 6e64da8 Diff Change
siteCreation 7068.00 ms 7107.00 ms +39.00 ms 🔴 0.6%
siteStartup 3925.00 ms 3921.00 ms -4.00 ms 🟢 -0.1%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

Copy link
Contributor

@bcotrim bcotrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! @katinthehatsite
All 1,138 tests pass without any errors.

A couple of notes:

  1. Some logs from Studio CLI are polluting the test outputs. We could consider mocking ora globally in vitest.setup.ts or adding it to the alias config.
Image
  1. There are still some references to "Jest" in some files. For good measure we should probably clean these up:
    • CLAUDE.md:47
    • docs/ai-instructions.md
    • packages/eslint-plugin-studio/ - still uses Jest (could be a follow-up)

@katinthehatsite
Copy link
Contributor Author

Thanks for taking time to do the review @bcotrim ! All great suggestions, I will take a look at them today 👀

@katinthehatsite
Copy link
Contributor Author

@bcotrim I made some further changes based on your suggestions, let me know what you think.

@katinthehatsite
Copy link
Contributor Author

I forgot to mention:

packages/eslint-plugin-studio/ - still uses Jest (could be a follow-up)

Let's do this as a follow-up because there are lots of changes in this PR already 😓 I will open an issue for this

@katinthehatsite
Copy link
Contributor Author

Copy link
Contributor

@bcotrim bcotrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the changes and creating the follow-up issue @katinthehatsite!
Sorry for being picky, but there are still some warning logs during test execution. Could we address those before merging?

@katinthehatsite
Copy link
Contributor Author

Thanks for addressing the changes and creating the follow-up issue @katinthehatsite!
Sorry for being picky, but there are still some warning logs during test execution. Could we address those before merging?

No worries at all, looking 👀

@katinthehatsite
Copy link
Contributor Author

I made some further updates, let me know what you think!

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.

5 participants