Repository navigation
build: update vitest monorepo to v5 - #34031
Conversation
725f7c3 to
0a64044
Compare
95c1452 to
49d0eb3
Compare
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.
9324a33 to
f98e7b6
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 commit adds a test to validate vitest version 4.
…est in e2e tests Reduce installations times
Update `@vitest/browser-webdriverio` to the latest version.
f98e7b6 to
b6d2c32
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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?