Skip to content

chore(repo): Migrate to Vitest 5 - #9664

Draft
wobsoriano wants to merge 3 commits into
mainfrom
rob/vitest-5
Draft

chore(repo): Migrate to Vitest 5#9664
wobsoriano wants to merge 3 commits into
mainfrom
rob/vitest-5

Conversation

@wobsoriano

@wobsoriano wobsoriano commented Sep 4, 2026

Copy link
Copy Markdown
Member

Description

Migrates the monorepo to Vitest 5 https://vitest.dev/blog/vitest-5.html

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a86baa3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

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

Not sure what this means? Click here to learn what changesets are.

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

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Sep 5, 2026 7:37pm UTC
swingset Ready Ready Preview Sep 5, 2026 7:37pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9664

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9664

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9664

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9664

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9664

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9664

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9664

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9664

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9664

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9664

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9664

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9664

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9664

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9664

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9664

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9664

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9664

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9664

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9664

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9664

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9664

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9664

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9664

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9664

commit: a86baa3

declare module 'vitest' {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Assertion<T = any> extends CustomMatchers<T> {}
interface Assertion<R, T> extends CustomMatchers<R> {}

@wobsoriano wobsoriano Sep 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

new two-parameter Assertion interface for custom matcher augmentations https://vitest.dev/guide/migration/#assertion-types-expose-return-and-received-types

Comment on lines +131 to +133
vi.stubGlobal('window', mockWindow);
vi.stubGlobal('getComputedStyle', mockGetComputedStyle);
vi.stubGlobal('document', {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

global assignments in DOM environments now propagate to the window https://vitest.dev/guide/migration/#dom-environment-global-assignments-now-update-the-underlying-window

this is the documented way to override globals

Comment thread vitest.workspace.mjs
@@ -1,3 +0,0 @@
import { defineWorkspace } from 'vitest/config';

export default defineWorkspace(['./packages/*/vitest.config.{mts,mjs,js,ts}', './scripts/vitest.config.mjs']);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🪓 defineWorkspace no longer exists in Vitest 5 and nothingr eferenced this file, turbo runs vitest per package

If we ever need a root runner, the equivalent is test.projects

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant