Debugging [object ErrorEvent] in Angular Unit Tests

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, however 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.