Tuesday, July 17, 2018

Angular Error: Illegal state: Could not load the summary for directive SomeComponent

Apparently I had encountered this issue before, but it came up again and I had to research it again (I only know I came across it before because the link to the answer on SO was purple).

When your tests fail with this message, make sure you're including the component under test (SomeComponent) in the declarations of the TestBed. It's super simple, but apparently it's bitten me at least twice.

Wednesday, July 11, 2018

Angular Tests: Error during cleanup of component

I've come across this error quite a few times and it always takes me a few minutes to remember how to overcome it so I figured I should write about it.

This error typically arises for me when I subscribe to an observable in my ngOnInit, but then don't unsubscribe in ngOnDestroy. That's it. If you (or Future Me) start seeing this error - followed by a ton of text written to the console - you may want to check if you've added a .subscribe in ngOnInit and then unsubscribe in your ngOnDestroy.