-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: angular 14.2 mount compilation error #23593
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
@@ -309,6 +308,6 @@ getTestBed().initTestEnvironment( | |||
|
|||
setupHooks(() => { | |||
// Not public, we need to call this to remove the last component from the DOM | |||
TestBed['tearDownTestingModule']() | |||
TestBed.resetTestingModule() | |||
getTestBed()['tearDownTestingModule']() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this function isn't part of the public API for TestBed
? Would it make sense to guard it with a try/catch
to keep us from blowing up, or would that just break tests in a less-obvious way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An error thrown here makes sense, since otherwise it would lead to some really strange behavior (like not removing the previously mounted component). Since it threw, it was very easy to track down what was going on and get a fix for it.
It is marked as a public property, just not exposed on the interface for some reason.
User facing changelog
Fix Angular 14.2 mount compilation error
Additional details
Angulars 14.2 update changed the API we relied on for tearing down the component between tests. Before 14.2,
tearDownTestingModule
was a static method on theTestBed
class but was changed to be a method on the instance. Converting allTestBed
references to thegetTestBed()
factory function gives us the proper instance of TestBed with the methods we need and reatins backwards compatibility.Steps to test
Running the system tests in
system-tests/test/component_testing_spec.ts
is the best way to test. Theangular-14
project has had it's deps bumped. Without the changes tomount
this test will fail.How has the user experience changed?
Screen.Recording.2022-08-29.at.11.01.34.AM.mov
PR Tasks
cypress-documentation
?type definitions
?