Skip to content

fix(core): move TestBed TestingModule reset to afterEach #21737

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

Conversation

josephperrott
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] angular.io application / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Currently the TestingModule is reset using beforeEach, resetting the module before each test is run. This prevents code that manages destruction of Modules, Components, Services, etc. from being able to properly destroy.

Issue Number: #18831

What is the new behavior?

The TestingModule is reset using afterEach, ensuring that the destruction of the all pieces get a change to properly clean up.

Does this PR introduce a breaking change?

[x] Yes
[ ] No

Tests which are broken by this change are likely revealing leaks within their code because of improper tear downs occurring before this change.

Other information

@mhevery mhevery added the area: testing Issues related to Angular testing features, such as TestBed label Jan 24, 2018
@josephperrott josephperrott force-pushed the change-reset-module-to-after-each branch from 222412e to c367106 Compare January 24, 2018 15:47
Closes angular#18831

BREAKING CHANGE: reset of TestingModule has changed from being done in a
    beforeEach to an afterEach.
@josephperrott josephperrott force-pushed the change-reset-module-to-after-each branch from c367106 to 44de5c2 Compare January 24, 2018 16:40
@josephperrott josephperrott deleted the change-reset-module-to-after-each branch January 25, 2018 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 Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: testing Issues related to Angular testing features, such as TestBed cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants