Skip to content

fix(core): restore NgModule state correctly after TestBed overrides#46049

Closed
AndrewKushnir wants to merge 1 commit intoangular:mainfrom
AndrewKushnir:test_bed_override_fix
Closed

fix(core): restore NgModule state correctly after TestBed overrides#46049
AndrewKushnir wants to merge 1 commit intoangular:mainfrom
AndrewKushnir:test_bed_override_fix

Conversation

@AndrewKushnir
Copy link
Contributor

This commit updates the NgModule logic to account for a case when a type has more than one generated def. This is a common situation for NgModules which have at least two: ɵmod and ɵinj. Previously, the second def was not stored before applying overrides, thus leaving it modified after the test, leaking the state as a result. This fix ensures that we store all defs before applying any overrides.

// cc @gkalpak

PR Type

What kind of change does this PR introduce?

  • Bugfix

Does this PR introduce a breaking change?

  • Yes
  • No

This commit updates the NgModule logic to account for a case when a type has more than one generated def. This is a common situation for NgModules which have at least two: ɵmod and ɵinj. Previously, the second def was not stored before applying overrides, thus leaving it modified after the test, leaking the state as a result. This fix ensures that we store all defs before applying any overrides.
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release labels May 18, 2022
@AndrewKushnir AndrewKushnir requested a review from alxhub May 18, 2022 22:07
@ngbot ngbot bot modified the milestone: Backlog May 18, 2022
@AndrewKushnir
Copy link
Contributor Author

AndrewKushnir commented May 18, 2022

Initial presubmit + TGP.

@AndrewKushnir AndrewKushnir 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 May 19, 2022
@alxhub alxhub added target: rc This PR is targeted for the next release-candidate and removed target: patch This PR is targeted for the next patch release labels May 23, 2022
@alxhub
Copy link
Member

alxhub commented May 23, 2022

This PR was merged into the repository by commit 8704574.

@alxhub alxhub closed this in 8704574 May 23, 2022
alxhub pushed a commit that referenced this pull request May 23, 2022
…46049)

This commit updates the NgModule logic to account for a case when a type has more than one generated def. This is a common situation for NgModules which have at least two: ɵmod and ɵinj. Previously, the second def was not stored before applying overrides, thus leaving it modified after the test, leaking the state as a result. This fix ensures that we store all defs before applying any overrides.

PR Close #46049
@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 Jun 23, 2022
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: core Issues related to the framework runtime target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants