-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Dialog is not removed during tests, leading to order-dependent tests #23385
Comments
It's because |
@jbeder have you tried using the new |
Yep, Joey had mentioned that to me, which is why I had pinged him when it
didn't work.
…On Thu, Aug 19, 2021 at 1:55 PM Kristiyan Kostadinov < ***@***.***> wrote:
@jbeder <https://github.com/jbeder> have you tried using the new teardown
flag in TestBed? We have a test in the Framework repo
<https://github.com/angular/angular/blob/master/packages/core/test/test_bed_spec.ts#L1363>
that verifies something similar to what you're describing. The new flag
should be exposed in Catalyst as well.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#23385 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAICUBQ3WHJZ3QLQKSJ73TDT5VHQ7ANCNFSM5CISGSHQ>
.
|
I spent some more time trying to reproduce it, but the only way I could get it to happen was to turn off the |
If you'd like a reproducible example, see CL/392502204. |
@jbeder I think the issue may be tests from other files that do not set the new flag and wind up getting bundled in with the tests in the file you edited. I changed the I think there still might be some kind of bug here though, because it shouldn't matter if other |
@mmalerba First, there is indeed one test in a different file that doesn't set the teardown flag, and I set it to true, and sure enough, the test passes. (The strange thing is that it's a nearly trivial test - it doesn't do anything other than instantiate a very simple injectible class, which is why I didn't add the teardown flag to it.) But second, I'm confused by your analysis - won't |
Ah I didn't know that. I thought the tests in the CL were the only ones you were concerned with, so I just used Obviously if that is what's happening, it's still a bug of some sort, but you could at least work around it by making sure that all of your tests have the flag |
SG. Should I keep this bug open, or file a different one about the flag
getting overwritten in Catalyst?
…On Mon, Aug 23, 2021 at 5:39 PM mmalerba ***@***.***> wrote:
Ah I didn't know that. I thought the tests in the CL were the only ones
you were concerned with, so I just used describe.only as a way of
ensuring that only tests with the flag set were being run. The reason I
suspected this is that Catalyst apparently works differently than TestBed
externally in that it calls initTestEnvironment before every test. I
thought it was possible that it wasn't actually updating the behavior with
the new flag settings on subsequent calls, so I wanted to make sure all the
tests were specifying the flag.
Obviously if that is what's happening, it's still a bug of some sort, but
you could at least work around it by making sure that all of your tests
have the flag
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#23385 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAICUBS22H5VCSLGNV7ELDDT6LE35ANCNFSM5CISGSHQ>
.
|
Also, related: is the plan for this flag to be automatically set for all tests? (If not, why not?) |
It'll be turned on by default in v13, but we'll have an automated migration that opts existing users out of it explicitly. We can't turn it on by default, because there's a possibility of breaking existing tests. E.g. when we enabled it on our own repo, it revealed some test failures that took a while to track down. |
I have a set of screenshot tests using Angular Catalyst that pass when run A, B but fail when run B, A; the failure is that the screenshot for A, when run after B, shows the shadow of the dialog that was created for B. (I'm not linking to them because they're internal to Google.)
If I add:
to test B, then they pass in either order. The test infrastructure should clean this up automatically to keep the tests hermetic.
@josephperrott indicated that "it is created by an injector which doesn't belong to a specific NgModule so it isn't torn down".
The text was updated successfully, but these errors were encountered: