Skip to content

fix(@schematics/angular): keep base test build options in per-configuration Karma migration - #34405

Open
MeAkib wants to merge 3 commits into
angular:mainfrom
MeAkib:fix/karma-vitest-config-build-options
Open

MeAkib wants to merge 3 commits into
angular:mainfrom
MeAkib:fix/karma-vitest-config-build-options

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The Karma to Vitest migration moves build-only test options such as styles into a testing build configuration and points the test target at it. For each test configuration it created a separate testing-<name> build configuration containing only that configuration's own options. Because a test configuration's buildTarget replaces the base one, running ng test --configuration <name> lost the options moved from the base test options.

Merge the base options into each per-configuration build configuration, with the configuration's own values taking precedence.

…ration Karma migration

The Karma to Vitest migration moves build-only test options such as `styles` into a `testing` build
configuration and points the test target at it. For each test configuration it created a separate
`testing-<name>` build configuration containing only that configuration's own options. Because a
test configuration's `buildTarget` replaces the base one, running `ng test --configuration <name>`
lost the options moved from the base test options.

Merge the base options into each per-configuration build configuration, with the configuration's own
values taking precedence.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Karma to Vitest migration schematic to correctly handle inheritance of base test options in per-configuration build settings. It ensures that custom build options are properly merged, preventing potential configuration loss. The review feedback highlights a potential issue with spreading undefined base options and provides a safer implementation using a guard clause.

Comment thread packages/schematics/angular/migrations/migrate-karma-to-vitest/migration.ts Outdated
Comment thread packages/schematics/angular/migrations/migrate-karma-to-vitest/migration.ts Outdated
@MeAkib
MeAkib force-pushed the fix/karma-vitest-config-build-options branch from ac2914d to 8df4cb6 Compare October 21, 2026 02:04
@MeAkib
MeAkib force-pushed the fix/karma-vitest-config-build-options branch from 8df4cb6 to 5846b18 Compare October 21, 2026 02:06
@alan-agius4
alan-agius4 requested a review from clydin October 22, 2026 11:11
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @schematics/angular target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants