How We Migrated 100k Tests from Jest to Vitest at Shopify in 2026
In early 2026, Shopify’s frontend engineering team faced a growing pain point: our Jest-based test suite, spanning over 100,000 individual tests across 12 product lines, was dragging down developer velocity. Average CI runtime for full test runs had crept up to 47 minutes, flaky test rates hovered at 8%, and Jest’s limited native ESM support was blocking our adoption of modern JavaScript standards. After a 3-month evaluation, we chose to migrate fully to Vitest, a Vite-native test runner with built-in Jest compatibility, faster transform pipelines, and first-class ESM support. Here’s how we pulled off the migration of 100k tests with zero downtime, no broken builds, and a 40% reduction in CI runtime by the end of 2026.
Pre-Migration Assessment: Why Vitest?
Before committing to a full migration, we audited our existing Jest setup to identify blockers and validate Vitest as a fit. Our Jest suite relied on custom matchers, global mocks, a heavily modified Jest configuration with 14 custom transform plugins, and tight integration with our internal CI pipeline. We ran a 2-week proof of concept (POC) migrating 500 tests from a low-risk product line to Vitest, which delivered immediate wins:
- Local test watch mode startup time dropped from 12 seconds to 1.8 seconds
- Single test file run time decreased by 35% on average
- Native ESM support eliminated the need for our custom CJS-to-ESM shim layer
The POC confirmed Vitest could handle our scale, so we greenlit the full migration with a target completion date of Q3 2026.
Our Phased, Zero-Downtime Migration Strategy
Migrating 100k tests in one go would have been catastrophic for developer productivity, so we adopted a 4-phase incremental approach:
- Phase 1: New Tests Only (Q1 2026) – We updated our lint rules and CI gates to require all new test files use Vitest instead of Jest. This let us build familiarity with Vitest APIs across teams without touching existing tests.
- Phase 2: Low-Risk Batch Migration (Q1-Q2 2026) – We targeted non-critical product lines first, using a custom codemod we built to auto-convert 70% of compatible Jest test files to Vitest syntax. For files using custom Jest matchers or mocks, we manually migrated and documented fixes for common edge cases.
- Phase 3: Dual CI Run (Q2 2026) – As we migrated more tests, we updated our CI pipeline to run both Jest (for unmigrated tests) and Vitest (for migrated tests) in parallel. We failed builds if either runner reported failures, ensuring no regressions slipped in during the transition.
- Phase 4: Sunset Jest (Q3 2026) – Once 99% of tests were migrated, we removed all Jest dependencies, config, and CI jobs. The final 1% of edge case tests were manually migrated by their owning teams.
Key Challenges and Solutions
No large-scale migration is without hurdles. Here are the biggest issues we faced and how we solved them:
Custom Jest Matchers and Mocks
Shopify’s internal testing library included 23 custom Jest matchers (e.g., toMatchShopifyCurrency, toHaveValidCheckoutState) and global mocks for our API and component libraries. Vitest’s Jest compatibility layer handled most standard Jest APIs, but our custom matchers required a small shim: we wrapped our existing matcher definitions in Vitest’s expect.extend API, which took 2 engineer-weeks to complete.
ESM Adoption
Most of our codebase still used CommonJS modules, which Jest supports natively but Vitest handles via its Vite-based transform pipeline. We opted to migrate tests to ESM incrementally alongside the Vitest migration, using Vite’s optimizeDeps to handle CJS dependencies during the transition. This added 3 weeks to the timeline but set us up for long-term ESM adoption across our frontend stack.
Developer Onboarding
With 1,200+ frontend engineers at Shopify, we needed to minimize confusion during the migration. We published a internal migration guide, held 4 office hours sessions, and added a Slack bot that automatically commented on PRs with Jest tests, linking to the migration guide and offering to run the codemod automatically.
Results
By September 2026, we had fully migrated all 100,127 tests to Vitest. The impact was immediate and measurable:
- Full CI test runtime dropped from 47 minutes to 28 minutes (40% reduction)
- Flaky test rate fell from 8% to 6% (25% reduction)
- Local test startup time decreased by 85% on average
- Annual CI cost savings of ~$120k due to reduced runner uptime
We saw zero critical incidents related to the migration, and developer sentiment surveys showed 89% of engineers preferred Vitest over Jest for local development.
Lessons Learned
For teams considering a large-scale test runner migration, we recommend:
- Start with a small POC to validate the new tool with your specific stack
- Use incremental phases instead of a big-bang migration to avoid disrupting workflows
- Invest in codemods and automation to reduce manual migration work
- Communicate early and often with your engineering team to reduce friction
Conclusion
Migrating 100k tests from Jest to Vitest was a massive undertaking, but the velocity and cost wins made it well worth the effort. Vitest’s native Vite integration, faster performance, and ESM support have future-proofed our test stack for years to come. If your team is struggling with slow Jest runs or ESM limitations, we highly recommend evaluating Vitest for your own migration.







