Skip to content

chore: upgrade vite to v8 and vitest to v4 - #44833

Merged
alaister merged 9 commits into
masterfrom
chore/upgrade-vite-vitest
Apr 15, 2026
Merged

alaister merged 9 commits into
masterfrom
chore/upgrade-vite-vitest

Conversation

@alaister

@alaister alaister commented Apr 14, 2026 •

Copy link
Copy Markdown
Member

Upgrade vite and vitest to their latest major versions across the monorepo, along with related packages.

Changed:

  • vite catalog: ^7.3.2 → ^8.0.8 (Rolldown replaces esbuild/Rollup)
  • vitest catalog: ^3.2.0 → ^4.1.4
  • @vitejs/plugin-react: ^4.3.4 → ^6.0.1
  • @vitest/coverage-v8: ^3.2.0 → ^4.1.4
  • @vitest/ui: ^3.2.0 → ^4.1.4
  • vite-tsconfig-paths: ^4.3.2 / ^5.1.4 → ^6.1.1

Pinned to vite 7:

  • apps/lite-studio — @react-router/dev hasn't declared vite 8 support yet
  • blocks/vue — Nuxt plugins (vite-plugin-inspect, vite-dev-rpc, vite-hot-client, vite-plugin-vue-tracer) haven't declared vite 8 support yet

Test fixes for vitest 4 breaking changes:

  • apps/studio/lib/api/snippets.utils.test.ts — Replaced vi.mock('fs/promises') automock with an explicit factory. Vitest 4's automocking doesn't create mock functions for getter-based exports on Node built-ins, so mockedFS.access.mockResolvedValue etc. were undefined.
  • apps/studio/lib/api/self-hosted/functions/index.test.ts — Changed mockReturnValue to mockImplementation(function() { ... }) for a constructor mock. Vitest 4 no longer allows mockReturnValue when the mock is called with new.
  • apps/studio/tests/pages/api/mcp/index.test.ts — Changed arrow function to regular function in mockImplementation for StreamableHTTPServerTransport. Arrow functions can't be constructors, and vitest 4 now enforces this.
  • packages/ui-patterns/vitest.setup.ts — Changed ResizeObserver mock from arrow function to regular function for the same constructor enforcement reason. This was crashing Radix popover rendering in jsdom.

To test

  • pnpm test:studio — all 226 test files should pass
  • pnpm --filter ui-patterns vitest run — all 183 tests should pass
  • pnpm --filter www test -- --run — all 19 tests should pass
  • pnpm --filter ui vitest run — all tests should pass
  • pnpm --filter dev-tools vitest run — all tests should pass
  • pnpm --filter ai-commands vitest run — all tests should pass

Summary by CodeRabbit

  • Chores
    • Standardized and updated development tooling versions and version sources for consistent installs across the repo (Vite, Vitest, vite-tsconfig-paths and related plugins/catalog entries).
  • Tests
    • Improved test mocks and typings (updated mock factories/implementations and tightened spy/type assertions) to increase test reliability and compatibility with updated tooling.

Upgrade vite (^7.3.2 → ^8.0.8), vitest (^3.2.0 → ^4.1.4), and related
packages (@vitejs/plugin-react, @vitest/coverage-v8, @vitest/ui,
vite-tsconfig-paths) to their latest major versions.

Pin lite-studio and blocks/vue to vite ^7.3.2 since @react-router/dev
and Nuxt plugins haven't declared vite 8 support yet.
- Use explicit mock factory for fs/promises (automocking no longer
  creates mock functions for getter-based exports on Node built-ins)
- Use function keyword instead of arrow functions in mockImplementation
  for mocks called with new (vitest 4 enforces constructor semantics)
- Fix ResizeObserver mock in ui-patterns setup for same reason
@alaister
alaister requested review from a team as code owners April 14, 2026 02:43
@vercel

vercel Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Apr 15, 2026 3:09pm
docs Ready Ready Preview, Comment, Open in v0 Apr 15, 2026 3:09pm
learn Ready Ready Preview, Comment Apr 15, 2026 3:09pm
studio-self-hosted Ready Ready Preview, Comment Apr 15, 2026 3:09pm
studio-staging Ready Ready Preview, Comment Apr 15, 2026 3:09pm
ui-library Ready Ready Preview, Comment Apr 15, 2026 3:09pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Apr 15, 2026 3:09pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Apr 15, 2026 3:09pm

Request Review

@supabase

supabase Bot commented Apr 14, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 14, 2026
@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: c950a857-4e0a-4b5a-9413-3ac6da6c4a4d

📥 Commits

Reviewing files that changed from the base of the PR and between e601d15 and 70715f2.

📒 Files selected for processing (4)
  • apps/docs/package.json
  • apps/studio/package.json
  • apps/www/package.json
  • blocks/vue/package.json
✅ Files skipped from review due to trivial changes (3)
  • apps/docs/package.json
  • blocks/vue/package.json
  • apps/studio/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/www/package.json

📝 Walkthrough

Walkthrough

This PR updates workspace catalog entries and multiple package devDependency specifiers across manifests, and adjusts several test mocks (shape, factory form, and TypeScript typings) to align with Vitest/Node export behavior.

Changes

Cohort / File(s) Summary
Workspace catalog
pnpm-workspace.yaml
Bumped catalog versions (vite → ^8.0.8, vitest → ^4.1.4) and added catalog entries for @vitejs/plugin-react, @vitest/ui, @vitest/coverage-v8, vite-tsconfig-paths.
Manifest edits — apps & blocks
apps/docs/package.json, apps/lite-studio/package.json, apps/studio/package.json, apps/www/package.json, blocks/vue/package.json
Swapped several devDependency specifiers between explicit semver ranges and catalog: references (notably vite, vite-tsconfig-paths, and related tooling).
Manifest edits — packages
packages/common/package.json, packages/pg-meta/package.json, packages/ui-patterns/package.json, packages/ui/package.json
Moved or changed @vitest/coverage-v8, @vitest/ui (and similar) to catalog: or between deps/devDeps; ui-patterns moved coverage dependency into devDependencies.
Test mocks & typings
apps/studio/lib/api/self-hosted/functions/index.test.ts, apps/studio/lib/api/snippets.utils.test.ts, apps/studio/tests/pages/api/mcp/index.test.ts, packages/ui-patterns/vitest.setup.ts, apps/studio/lib/ai/tools/incident-tools.test.ts, apps/studio/components/interfaces/Support/__tests__/SupportFormPage.test.ts
Replaced arrow mock factories with function implementations, provided an explicit fs/promises mock factory returning a default-shaped object of vi.fn() methods, tightened mock TypeScript signatures, and cast global.fetch mocks to typeof fetch.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibble at manifests, shuffle catalog seeds,
Swap arrow mocks for functions to meet testing needs.
I tidy typings and shape the mock tray—
A hop, a tweak, then back to my hay. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description does not follow the repository's required template format, which includes sections like 'I have read CONTRIBUTING.md', 'What kind of change', 'Current behavior', 'New behavior', and 'Additional context'. Restructure the description to match the required template format with all mandatory sections, or update the template if this format is no longer appropriate for the repository.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main objective of the changeset: upgrading vite to v8 and vitest to v4 across the monorepo.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/upgrade-vite-vitest

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

vi.fn() now returns Mock<Procedure | Constructable> in vitest 4, which
isn't directly callable or assignable to typed function signatures. Fix
by narrowing the mock type where it's called directly, and casting at
the assignment site for global.fetch.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a large-scope major version upgrade (vite 8 + vitest 4) touching build infrastructure across 15 files in the monorepo — worth a human look given the significance of vite 8's Rolldown migration.

Extended reasoning...

Overview\nThis PR upgrades vite from v7→v8 and vitest from v3→v4 across the monorepo, along with associated packages (@vitejs/plugin-react, @vitest/coverage-v8, @vitest/ui, vite-tsconfig-paths). It also pins two packages (lite-studio, blocks/vue) to vite ^7.3.2 due to upstream compatibility gaps, and fixes 4 test files for vitest 4 constructor mock semantics.\n\n### Security risks\nNo security-sensitive code is touched. All changes are in build tooling, test configuration, and package manifests. No auth, crypto, or permission code is modified.\n\n### Level of scrutiny\nHigher than a typical patch bump. Vite 8 introduces Rolldown as the underlying bundler (replacing esbuild/Rollup), which is an architectural change. Vitest 4 has documented breaking changes around constructor mocking and Node built-in automocking. While the author has addressed the known breaking changes and documented test coverage, the breadth (15 files, 6+ apps/packages) and depth (two simultaneous major version bumps to core build infrastructure) of this PR warrant a human reviewer verifying nothing was missed.\n\n### Other factors\nThe two bugs flagged in inline comments are both pre-existing miscategorizations (not introduced by this PR) and have low practical impact given that apps/studio is private. The test fixes look mechanically correct. The decision to pin lite-studio and blocks/vue to vite 7 is well-reasoned and documented.

Comment thread apps/studio/package.json Resolved
Comment thread packages/ui-patterns/package.json Resolved
Move @vitejs/plugin-react from dependencies to devDependencies in
apps/studio, and @vitest/coverage-v8 from dependencies to
devDependencies in packages/ui-patterns.
@github-actions

github-actions Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  197 passed
flaky  1 flaky
skipped  5 skipped

Details

stats  203 tests across 22 suites
duration  5 minutes, 34 seconds
commit  70715f2

Flaky tests

Features › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › broadcast modal validates JSON payload

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both dependency miscategorizations I flagged have been addressed in the follow-up commit. LGTM.

Extended reasoning...

Overview

This PR upgrades Vite (v7→v8), Vitest (v3→v4), and related plugins across the monorepo, with selective pinning to Vite 7 for apps that depend on plugins that haven't declared Vite 8 compatibility yet. It also includes targeted test mock fixes for Vitest 4 breaking changes (arrow-function constructors, automock behavior on Node built-ins).

Security risks

None. All changes are confined to build tooling, test infrastructure, and package manifest metadata. No application logic, auth, crypto, or permissions code is touched.

Level of scrutiny

Low. This is a standard major-version tooling upgrade with well-documented breaking changes and clear fixes. The catalog-managed versioning and selective pinning are handled appropriately. The test changes are mechanical and correct.

Other factors

My previous review flagged two dependency miscategorization issues: @vitejs/plugin-react in runtime dependencies in apps/studio, and @vitest/coverage-v8 in runtime dependencies in packages/ui-patterns. The follow-up commit 52e29375 ("fix: move build/test deps to devDependencies") correctly resolved both by moving them to devDependencies. Vercel previews all passed, and the E2E test run showed 197 passed with only 1 known-flaky test.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — prior feedback addressed, tests passing, changes are mechanical version bumps with appropriate vitest 4 compatibility fixes.

Extended reasoning...

Overview

This PR upgrades vite (7→8) and vitest (3→4) across the monorepo, along with companion plugins. It touches 17 files: the workspace catalog (), several manifests, four test files with vitest 4 compatibility fixes, and the lockfile.

Security risks

None. All changes are confined to dev tooling — version specifiers in , catalog entries, and test mock code. No production runtime code is modified.

Level of scrutiny

Low-to-moderate. This is a build/test tooling upgrade with no production code changes. The E2E suite (198 passed, 5 skipped) and the described unit test suites all pass. The vitest 4 breaking-change adaptations (constructor mock enforcement, automocking, arrow-function constructors) are correct and well-explained.

Other factors

Both issues raised in my prior review run ( miscategorized under , under production deps in ) are resolved in the current diff and marked as resolved in the timeline. No bugs were reported by the automated bug-hunting system. The intentional vite 7 pins for and are clearly documented with rationale.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — the dependency miscategorizations I flagged earlier were corrected by this PR, vitest 4 constructor mock fixes are correct, and compatibility pins are well-documented.

Extended reasoning...

Overview

This PR upgrades vite (v7→v8), vitest (v3→v4), and related tooling across the monorepo. It also consolidates version specifiers into pnpm catalog entries, pins two packages to vite 7 for compatibility, and fixes test mocks to comply with vitest 4's stricter constructor enforcement.

Security risks

None. These are dev/test tooling changes only — vite and vitest are never included in production builds. No auth, crypto, or permissions code is touched.

Level of scrutiny

Low. This is a dev dependency upgrade with no production code changes. The test fixes are mechanical (arrow functions → regular functions for constructors, explicit factory for fs/promises automock). The compatibility pins for lite-studio and vue blocks are clearly explained and correctly scoped.

Other factors

  • Previous inline comments about dependency miscategorization were resolved: @vitejs/plugin-react moved to devDependencies in apps/studio, @vitest/coverage-v8 moved to devDependencies in packages/ui-patterns.
  • E2E tests pass (198/203, 5 skipped for pre-existing reasons unrelated to this PR).
  • No outstanding reviewer comments remain unresolved.

@awaseem awaseem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@alaister
alaister merged commit 1b1d05f into master Apr 15, 2026
27 checks passed
@alaister
alaister deleted the chore/upgrade-vite-vitest branch April 15, 2026 15:13
@github-actions

github-actions Bot commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1776266161)

Score Average Improvements Regressions
Completeness 100% (+2pp) 1 🟢 -
Conciseness 24.5% (+3pp) 6 🟢 2 🔴
Goal Completion 94.1% (+4pp) 3 🟢 -
Tool Usage 76.2% (+5pp) 1 🟢 -
Correctness 100% (+0pp) - -
Docs Faithfulness 73.9% (+2pp) 3 🟢 3 🔴
Knowledge Usage 100% (+0pp) - -
SQL Identifier Quoting 92.9% (-7.000000000000001pp) - -
SQL Validity 100% (+0pp) - -
URL Validity 50% (-50pp) - 1 🔴
Time_to_first_token 0.01tok (0tok) 14 🟢 3 🔴
Llm_calls 12.33 (-0.1) 7 🟢 9 🔴
Tool_calls 3.57 (+0.31) 6 🟢 7 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 23778.69tok (+60.43tok) 10 🟢 7 🔴
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 615.04tok (+36.14tok) 9 🟢 8 🔴
Completion_reasoning_tokens 0tok (+0tok) - -
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 24393.73tok (+96.57tok) 9 🟢 8 🔴
Estimated_cost 0.01$ (+0$) 9 🟢 6 🔴
Duration 16.2s (-1.52s) 7 🟢 10 🔴
Llm_duration 41.7s (-4.6s) 7 🟢 10 🔴

mandarini added a commit that referenced this pull request Apr 16, 2026
…44943)

Vitest 4 no longer restricts test execution when a file path is passed
as a positional filter, causing all docs tests to run and fail on
unrelated tests. Use --dir to scope to the target directory. PR #44833
made the update which broke the behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants