Error during cleanup of component: Display error too
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[X] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior In TestBed.resetTestingModule() an error may occur. The error is not logged to the console, only the component that failed to be destroyed is logged.
Expected behavior The console.error at this line https://github.com/angular/angular/blob/master/packages/core/testing/src/test_bed.ts#L252 will also log the error.
What is the motivation / use case for changing the behavior? Currently I cannot investigate why I get this error, I’ve disabled all my ngOnDestroy’s but still getting this error.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:34
- Comments:24 (2 by maintainers)
Top Results From Across the Web
Testing Angular component with unsubscribe Error during ...
The "Error during component cleanup" error message happens because when ngOnDestroy() is called, this.routeSubscription is undefined.
Read more >[Solved]-ERROR: 'Error during cleanup of component', Object ...
I am Getting this error while creating a new component in Angular 2.! Error when using AngularJS component inside Angular app: "Error: Trying...
Read more >OnDestroy - Angular
A lifecycle hook that is called when a directive, pipe, or service is destroyed. Use for any custom cleanup that needs to occur...
Read more >API Reference | React Hooks Testing Library
A React component to wrap the test component in when rendering. ... These could be result or an error depending on what the...
Read more >Testing Angular Components with Stub Services and Spies in ...
you'll be greeted with an error message of StaticInjectorError: To fix this you need to import HttpClientModule in TestBed because we are using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In my case, I was trying to
unsubscribefrom an undefined subscription inngOnDestroy. Just verifying non-null subscription did the trick:Solved by adding this to my unit tests:
But I’m not sure about why it solves it…