Skip to content

feat(@angular/build): add polyfills option to unit-test builder - #34156

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:feat/unit-test-polyfills-option
Sep 24, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
clydin:feat/unit-test-polyfills-option

Conversation

@clydin

@clydin clydin commented Sep 24, 2026

Copy link
Copy Markdown
Member

Adds an optional 'polyfills' array option to the 'unit-test' builder. When omitted, polyfills continue to be inherited from the specified 'buildTarget'. When defined, the test target's 'polyfills' option takes precedence, allowing projects to configure test-specific polyfills or provide polyfills for library test targets that build with '@angular/build:ng-packagr'.

Adds an optional 'polyfills' array option to the 'unit-test' builder.
When omitted, polyfills continue to be inherited from the specified 'buildTarget'.
When defined, the test target's 'polyfills' option takes precedence, allowing projects to configure test-specific polyfills or provide polyfills for library test targets that build with '@angular/build:ng-packagr'.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Sep 24, 2026
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/build labels Sep 24, 2026

@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 introduces a new polyfills option to the unit-test builder, enabling users to specify custom polyfills for testing or override those inherited from the build target. The feedback highlights a critical issue in the Vitest runner where changing the fallback zone testing strategy from 'dynamic' to 'none' will break TestBed initialization for projects using custom polyfill files that import zone.js internally. Reverting this fallback to 'dynamic' is recommended to safely handle these cases.

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Sep 24, 2026
@alan-agius4
alan-agius4 merged commit feb41cc into angular:main Sep 24, 2026
42 of 43 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

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

@clydin
clydin deleted the feat/unit-test-polyfills-option branch September 24, 2026 11:07
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Oct 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants