Skip to content

fix(@angular/build): add splitting option to unit-test builder - #33961

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-unit-test-splitting
Aug 28, 2026
Merged

fix(@angular/build): add splitting option to unit-test builder#33961
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-unit-test-splitting

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Adds a splitting option to the unit-test builder to control code splitting for the test build with the Vitest runner. This option is enabled by default to optimize test bundling performance and memory consumption, avoiding issues during code coverage collection. For Node-based test environments where live ESM bindings across chunk boundaries cause issues (such as uninitialized exports or mocking failures), splitting can be disabled.

Closes #33960 and closes #33948

@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 splitting option (defaulting to true) to the unit-test builder schema for the Vitest runner. This option allows users to enable or disable code splitting for test execution, which can help resolve issues with live ESM bindings in Node.js environments. The Vitest build options have been updated to respect this configuration, and comprehensive unit tests have been added to verify the behavior of the splitting option. There are no review comments, and I have no additional feedback to provide.

@alan-agius4
alan-agius4 requested a review from clydin August 28, 2026 14:40
@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 Aug 28, 2026
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 28, 2026
Adds a `splitting` option to the unit-test builder to control code
splitting for the test build with the Vitest runner. This option is
enabled by default to optimize test bundling performance and memory
consumption, avoiding issues during code coverage collection. For
Node-based test environments where live ESM bindings across chunk
boundaries cause issues (such as uninitialized exports or mocking
failures), splitting can be disabled.

Closes angular#33960 and closes angular#33948
@alan-agius4
alan-agius4 force-pushed the fix-unit-test-splitting branch from 8515226 to 0e23fea Compare August 28, 2026 14:53
@alan-agius4
alan-agius4 merged commit 4b8c62a into angular:main Aug 28, 2026
39 checks passed
@alan-agius4
alan-agius4 deleted the fix-unit-test-splitting branch August 28, 2026 15:21
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

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

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

2 participants