Sitelet https://web.archive.org/web/20220707143643/https://github.com/angular/angular/pull/46049
Skip to content
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

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

Closed

Conversation

AndrewKushnir
Copy link
Contributor

@AndrewKushnir AndrewKushnir commented May 18, 2022

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 comp: core target: patch labels May 18, 2022
@AndrewKushnir AndrewKushnir requested a review from alxhub May 18, 2022
@ngbot ngbot bot added this to the Backlog milestone May 18, 2022
@ngbot ngbot bot added this to the Backlog milestone May 18, 2022
@AndrewKushnir
Copy link
Contributor Author

@AndrewKushnir AndrewKushnir commented May 18, 2022 •

Initial presubmit + TGP.

alxhub
alxhub approved these changes May 19, 2022
@AndrewKushnir AndrewKushnir added action: merge and removed action: review labels May 19, 2022
@alxhub alxhub added target: rc and removed target: patch labels May 23, 2022
@alxhub
Copy link
Contributor

@alxhub 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 issue 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

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Jun 23, 2022

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 comp: core target: rc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants