Debugging [object ErrorEvent] in Angular Unit Tests

So you’ve started unit testing your angular app and you get these crazy errors [object ErrorEvent] thrown. Gee, what a useful error message…

What this error is saying, is that your “test” may have passed, but there were javascript errors later on. And these can be particularly annoying to troubleshoot. The trick is to use your chrome dev tools while the tests are running.

The test looks like it passes in Chrome, but the console actually shows an exception being thrown. This is that ErrorEvent object that is being reported by the other error. This also has a much better error message along with a stack trace.

Leave a Reply

I’m David

Welcome to my little corner of the internet that I dedicate to programming. I’m a principal software engineer at Fynix Consulting and strive to always be learning new things. I love to code and I love to write about coding!

Let’s connect

Discover more from David Boothe's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading