Repository navigation
chore: upgrade vite to v8 and vitest to v4 - #44833
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
There was a problem hiding this comment.
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.
Move @vitejs/plugin-react from dependencies to devDependencies in apps/studio, and @vitest/coverage-v8 from dependencies to devDependencies in packages/ui-patterns.
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › broadcast modal validates JSON payload Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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-reactmoved to devDependencies in apps/studio,@vitest/coverage-v8moved 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.
…vitest # Conflicts: # pnpm-lock.yaml
Braintrust eval report
|
Upgrade vite and vitest to their latest major versions across the monorepo, along with related packages.
Changed:
vitecatalog:^7.3.2→^8.0.8(Rolldown replaces esbuild/Rollup)vitestcatalog:^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.4vite-tsconfig-paths:^4.3.2/^5.1.4→^6.1.1Pinned to vite 7:
apps/lite-studio—@react-router/devhasn't declared vite 8 support yetblocks/vue— Nuxt plugins (vite-plugin-inspect,vite-dev-rpc,vite-hot-client,vite-plugin-vue-tracer) haven't declared vite 8 support yetTest fixes for vitest 4 breaking changes:
apps/studio/lib/api/snippets.utils.test.ts— Replacedvi.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, somockedFS.access.mockResolvedValueetc. wereundefined.apps/studio/lib/api/self-hosted/functions/index.test.ts— ChangedmockReturnValuetomockImplementation(function() { ... })for a constructor mock. Vitest 4 no longer allowsmockReturnValuewhen the mock is called withnew.apps/studio/tests/pages/api/mcp/index.test.ts— Changed arrow function to regularfunctioninmockImplementationforStreamableHTTPServerTransport. Arrow functions can't be constructors, and vitest 4 now enforces this.packages/ui-patterns/vitest.setup.ts— ChangedResizeObservermock from arrow function to regularfunctionfor the same constructor enforcement reason. This was crashing Radix popover rendering in jsdom.To test
pnpm test:studio— all 226 test files should passpnpm --filter ui-patterns vitest run— all 183 tests should passpnpm --filter www test -- --run— all 19 tests should passpnpm --filter ui vitest run— all tests should passpnpm --filter dev-tools vitest run— all tests should passpnpm --filter ai-commands vitest run— all tests should passSummary by CodeRabbit