Skip to content

fix(@angular/build): require only the launchers the karma configuration loads - #34576

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
MeAkib:fix/karma-runner-launcher-check
Oct 29, 2026
Merged

alan-agius4 merged 2 commits into
angular:mainfrom
MeAkib:fix/karma-runner-launcher-check

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

The upfront dependency validation of the unit-test builder's karma runner derives a launcher package from each browser name. This requests packages that do not exist, such as karma-chromium-launcher for ChromiumHeadless (provided by karma-chrome-launcher) or a package named after a custom launcher defined in a Karma configuration file, so ng test fails before running.

Follow the vitest runner: skip the launcher validation when a custom configuration is used, since it loads its own plugins, and otherwise require karma-chrome-launcher, the only launcher of the built-in configuration. New unit specs for the karma runner's dependency validation fail without this change.

…on loads

The upfront dependency validation of the unit-test builder's karma runner derives
a launcher package from each browser name. This requests packages that do not
exist, such as `karma-chromium-launcher` for `ChromiumHeadless` (provided by
`karma-chrome-launcher`) or a package named after a custom launcher defined in
a Karma configuration file, so `ng test` fails before running.

Follow the vitest runner: skip the launcher validation when a custom
configuration is used, since it loads its own plugins, and otherwise require
`karma-chrome-launcher`, the only launcher of the built-in configuration.
New unit specs for the karma runner's dependency validation fail without this
change.

@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 simplifies Karma browser launcher dependency validation by only checking for 'karma-chrome-launcher' when no custom runner configuration is specified, rather than dynamically checking based on the configured browsers. Unit tests have been updated to reflect and verify this behavior. The feedback suggests omitting 'runnerConfig: false' in the unit tests to avoid type-safety issues, as 'undefined' is sufficient to represent the absence of a custom configuration.

Comment thread packages/angular/build/src/builders/unit-test/runners/karma/index_spec.ts Outdated
…iguration loads

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Oct 29, 2026
@alan-agius4
alan-agius4 merged commit e6c29bd into angular:main Oct 29, 2026
41 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

@MeAkib
MeAkib deleted the fix/karma-runner-launcher-check branch October 30, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants