Skip to content

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

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

chore(repo): Migrate to Vitest 5#9664
wobsoriano wants to merge 5 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: 05b47aa

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 6, 2026 5:13pm UTC
swingset Ready Ready Preview Sep 6, 2026 5:13pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Team

Run ID: fa9a8ab2-996d-492b-b4de-df85e70def08

📥 Commits

Reviewing files that changed from the base of the PR and between bc3c89e and 05b47aa.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • .changeset/vitest-five.md
  • package.json
  • packages/backend/src/tokens/__tests__/request.test.ts
  • packages/eslint-plugin/package.json
  • packages/expo-passkeys/package.json
  • packages/headless/package.json
  • packages/headless/src/test-utils/jest-dom.d.ts
  • packages/headless/src/test-utils/vitest-axe.d.ts
  • packages/ui/src/utils/colors/__tests__/legacy.test.ts
  • vitest.workspace.mjs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
💤 Files with no reviewable changes (1)
  • vitest.workspace.mjs

Included review availability: 9 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.


📝 Walkthrough

Walkthrough

Vitest and @vitest/coverage-v8 are upgraded to 5.0.0 in the root and package dependencies. Vitest Assertion augmentations now use two generic parameters. CSS-variable tests use vi.stubGlobal and vi.unstubAllGlobals(). Expo Passkeys adds TypeScript as a development dependency. The Vitest workspace configuration is removed. A Vitest patch changeset is added.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 05b47

This updates the repository’s Vitest tooling and related test typings and global stubs for Vitest 5 compatibility. No concrete merge-blocking behavior or production risk remains identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: migrating the monorepo to Vitest 5.
Description check ✅ Passed The description directly states that the pull request migrates the monorepo to Vitest 5, which matches the changeset and objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Linked repositories: Your configuration references 7 linked repositories, but your current plan allows 5. Analyzed clerk/clerk_go, clerk/dashboard, clerk/accounts, clerk/backoffice, clerk/clerk, skipped clerk/clerk-docs, clerk/cloudflare-workers.


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: 05b47aa

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.

Updated to the 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

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-09-06T17:16:17.373Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 05b47aa.

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