Skip to content

fix(@angular/build): ensure test hooks are registered in non-headless browser mode#31792

Closed
clydin wants to merge 1 commit intoangular:mainfrom
clydin:unit-test/always-testbed-hooks
Closed

fix(@angular/build): ensure test hooks are registered in non-headless browser mode#31792
clydin wants to merge 1 commit intoangular:mainfrom
clydin:unit-test/always-testbed-hooks

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 13, 2025

This commit moves the beforeEach and afterEach hook registrations for TestBed cleanup to be outside the global setup guard.

In non-headless browser environments, the setup file can be executed in different contexts where the global guard prevents the hooks from being registered, leading to inconsistent test behavior. This change ensures the cleanup hooks are always registered, improving reliability for headed browser test execution.

… browser mode

This commit moves the `beforeEach` and `afterEach` hook registrations for TestBed cleanup to be outside the global setup guard.

In non-headless browser environments, the setup file can be executed in different contexts where the global guard prevents the hooks from being registered, leading to inconsistent test behavior. This change ensures the cleanup hooks are always registered, improving reliability for headed browser test execution.

Due to the nature of the issue, which only manifests in headed browser mode, automated testing in a CI environment is problematic.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Nov 13, 2025
@clydin clydin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 13, 2025
@clydin clydin closed this Nov 13, 2025
@clydin clydin deleted the unit-test/always-testbed-hooks branch November 14, 2025 15:26
@angular-automatic-lock-bot
Copy link

This issue 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 Dec 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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.

1 participant