build: update vitest monorepo to v5 - #34031
Open
alan-agius4 wants to merge 9 commits into
Open
Conversation
alan-agius4
force-pushed
the
pr-takeover-34030
branch
2 times, most recently
from
September 7, 2026 08:55
725f7c3 to
0a64044
Compare
alan-agius4
force-pushed
the
pr-takeover-34030
branch
from
September 7, 2026 10:04
95c1452 to
49d0eb3
Compare
alan-agius4
marked this pull request as ready for review
September 7, 2026 10:20
There was a problem hiding this comment.
Code Review
This pull request upgrades Vitest and its associated packages from version 4 to 5.0.0 across the workspace. It updates default configuration files to use the .mts extension, deprecates the splitting option in the unit-test schema, and refactors E2E tests to utilize a centralized helper for installing Vitest-related dependencies. Additionally, it introduces platform-specific test filtering in the E2E runner. A review comment highlights an issue in the new Vitest v4 compatibility test, which incorrectly uses the Vitest v5 playwright() configuration API alongside Vitest v4 dependencies.
alan-agius4
force-pushed
the
pr-takeover-34030
branch
from
September 7, 2026 15:22
b55b185 to
fc4817a
Compare
See associated pull request for more information. Closes angular#34030 as a pr takeover
Refactor `applyVitestBuilder` to read dependency versions directly from `@schematics/angular/utility/latest-versions/package.json` and install them in a single batch using `installWorkspacePackages`. Update all Vitest E2E test suites to pass dependency options (`playwright`, `coverageV8`, `coverageIstanbul`, `webdriver`) directly to `applyVitestBuilder`, eliminating hardcoded major version installations and preventing version mismatches during major dependency upgrades.
…lder DEPRECATED: The `splitting` option in the unit-test builder is deprecated as it is no longer needed with Vitest 5. Disabling code splitting is no longer necessary with Vitest 5, as the issue where shared-module exports were uninitialized in class-field initializers under JSDOM has been resolved.
…t configuration Update the generated Vitest base configuration file extension from `.ts` to `.mts` to ensure it is treated as an ES module by default. This avoids warnings from Vite regarding ESM syntax in CommonJS files when the workspace does not define `"type": "module"`. Also updates related schematics tests, karma migration hints, and builder integration test specs to use `vitest-base.config.mts`.
…oject In Vitest 5, inline projects declared under `test.projects` extend the declaring root configuration by default (`extends: true`). Because the Angular CLI test runner already explicitly merges user-provided options from the configuration file into `projectConfig`, automatic root inheritance caused array options—such as `browser.instances` and plugins—to be merged and concatenated twice. Setting `extends: false` on the inline project configuration keeps it isolated from the declaring root config and prevents duplicate browser instance registrations and repeated test runs.
Updates `@vitest/browser-webdriverio` to `^5.0.0-rc.1` in `latest-versions`
and drops `{ force: true }` from package installation in Vitest E2E utilities.
This commits adds a test to validate vitest version 4.
…est in e2e tests Reduce installations times
Update `@vitest/browser-webdriverio` to the latest version.
alan-agius4
force-pushed
the
pr-takeover-34030
branch
from
September 8, 2026 15:40
84697fb to
fbee73c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
@vitest/*packages are on v4.installPackage, which can lead to version mismatches when upgrading Vitest.splittingoption in@angular/build:unit-testwas introduced to work around an issue in Vitest 4 where shared-module exports in class-field initializers were uninitialized under JSDOM when code splitting was enabled..tsextension which produced ESM warnings in projects without"type": "module".extends: true, which caused array options likebrowser.instancesto be concatenated twice.What is the new behavior?
This PR updates the Vitest monorepo dependencies to v5 and takes over #34030 with the following changes:
build: update vitest monorepo to v5vitest,@vitest/browser-*,@vitest/coverage-*) to v5.0.0.latest-versionspackage definitions accordingly.test: resolve vitest dependencies from latest-versions in e2e testsapplyVitestBuilderto dynamically resolve dependency versions directly from@schematics/angular/utility/latest-versions/package.jsonand install them in a single batch usinginstallWorkspacePackages.playwright,coverageV8,coverageIstanbul,webdriver) directly toapplyVitestBuilder, eliminating hardcoded major version installations.refactor(@angular/build): deprecate splitting option in unit-test buildersplittingoption inschema.jsonas deprecated (x-deprecated: "No longer needed with Vitest 5."). Disabling code splitting is no longer necessary with Vitest 5, as the shared chunk initialization issue under JSDOM has been resolved.splitting: falseworkaround fromvitest-shared-chunk-init_spec.ts.refactor(@schematics/angular): use .mts extension for generated Vitest configurationvitest-base.config.mtsinstead of.tsto ensure Node.js treats it as ESM regardless of workspace package type.fix(@angular/build): disable root config extension for inline test projectextends: falseon the inline project configuration in the Vitest configuration plugin. Since the Angular CLI test runner already explicitly merges user-provided options intoprojectConfig, disabling automatic root config extension prevents duplicate browser instances and repeated test executions in Vitest 5.build: update @vitest/browser-webdriverio to 5.0.0-rc.1@vitest/browser-webdriverioto^5.0.0-rc.1inlatest-versions.{ force: true }in Vitest E2E package installation.Does this PR introduce a breaking change?