Vite 8 and Vitest 4 upgrade lands in n8n monorepo
The n8n codebase has been upgraded to Vite 8 and Vitest 4, bringing build optimizations and stricter test validation across the entire monorepo. Cross-platform path handling in the editor-ui build was also resolved as part of this migration.
n8n's build tooling has been brought up to date with the latest stable versions of Vite and Vitest. This migration upgrades Vite from v7 to v8.0.3 and Vitest from v3 to v4 across the monorepo, including the @codspeed/vitest-plugin benchmarking plugin.
The upgrade required extensive compatibility work. Vitest 4 enforces stricter mocking behavior than v3—test files across composables, stores, and the design system had mock implementations rewritten to be explicit rather than relying on v3's looser inference. Some tests needed timeout adjustments, and others required fixes for vi.mock factory hoisting issues that the older version silently allowed.
Configuration changes accompanied the dependency updates. Four TypeScript packages now use moduleResolution: bundler for better compatibility with Vite 8's module resolution. Coverage configuration shifted from an "all files" pattern to explicit "include: ['src/**']" declarations. Editor-ui gained a Sass compiler and updated build plugin versions for istanbul, node-polyfills, and static-copy.
Cross-platform path handling in the editor-ui vite config was simplified—the static copy plugin now uses straightforward string paths instead of explicit posixPath resolution, making the configuration more portable.
This upgrade keeps the monorepo current with the JavaScript ecosystem. Users won't notice immediate changes, but developers benefit from faster builds and the project stays aligned with upstream improvements.
View Original GitHub DescriptionFact Check
Summary
[!NOTE] While this summary was written by claude, the migration work was done manually utilizing the migration guides for Vite and Vitest I apologize for the chunky PR, but this migration is something that was best done in a single run.
Upgrades Vite from v7 to v8.0.3 and Vitest from v3 to v4 across the monorepo, along with all necessary compatibility fixes to keep the build, tests, and tooling green.
Core upgrades:
- Vite 8.0.3 across the whole project
- Vitest 4 across all packages already using vitest (Jest migration will be done in a future PR)
- @codspeed/vitest-plugin updated to match Vitest 4
Build & config changes:
- moduleResolution: bundler added to @n8n/composables, @n8n/i18n, @n8n/rest-api-client, @n8n/stores tsconfigs
- Vite static copy plugin pathing fixed for cross-platform compatibility (Windows path handling for web-tree-sitter)
- Editor-ui build optimizations applied alongside dependency updates
Test fixes required by Vitest 4's stricter rules:
- Mock setup overhauled across many test files — EventSource, WebSocket, ResizeObserver, IntersectionObserver, BrowserNotifications, and more now use explicit mock implementations rather than relying on v3's looser behavior
- vi.mock factory hoisting issues resolved in several composable and store tests
- Backend unit tests updated (CLI license test timezone bug, config test)
- @n8n/chat and design-system test setups rewritten
- Snapshots updated for useDataSchema
Infra/misc:
- Empty test suites added to packages that need them for CI shard distribution
- Lockfile refreshed (pnpm-lock.yaml)
- pnpm-workspace.yaml catalog entries updated for new dependency versions
Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/CAT-2610
Review / Merge checklist
- PR title and summary are descriptive. (conventions) <!-- **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** -->
- Docs updated or follow-up ticket created.
- Tests included. <!-- A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests. -->
- PR Labeled with
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)