Skip to content

fix(@angular/build): setup unit-test polyfills before TestBed init #30299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025

Conversation

clydin
Copy link
Member

@clydin clydin commented May 13, 2025

To ensure that Zone.js is fully setup and patched prior to the use of TestBed, the setup file order for the vitest runner of the unit-test builder has been swapped. This is particularly relevant for fakeAsync which has a module level statement that attempts to capture the Zone instance. If Zone.js is not setup at that point, fakeAsync will fail to function in tests.

To ensure that Zone.js is fully setup and patched prior to the use of TestBed,
the setup file order for the `vitest` runner of the `unit-test` builder
has been swapped. This is particularly relevant for `fakeAsync` which
has a module level statement that attempts to capture the `Zone` instance.
If Zone.js is not setup at that point, fakeAsync will fail to function in
tests.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label May 13, 2025
@clydin clydin requested a review from alan-agius4 May 13, 2025 23:16
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label May 14, 2025
@clydin clydin merged commit 8b2ca7a into angular:main May 14, 2025
33 checks passed
@clydin
Copy link
Member Author

clydin commented May 14, 2025

The changes were merged into the following branches: main, 20.0.x

@clydin clydin deleted the unit-test/polyfills-first branch May 14, 2025 11:12
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: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants