I have several failing tests that only output [object ErrorEvent] thrown
. I don\'t see anything in the console that helps me pinpoint the offending code. Is t
What can help is, if you have the Chrome window open for your Karma test runner, to open the developer tools and check the console there. For me, this helped me to find out that the app could not use the Array.findIndex method on an undefined array (because the data structure was organized by a date string, such as data[2018][3][28], and I happened to be pointing to the wrong date), but yet instead of just stopping at the error, the test kept running.
If sourcemap=false doesn't help, try to 1) open your browser running the tests 2) click debug button 3) open the console
The error will be there
For me the issue was that I had a test where I was accidentally using the auth0-lock library.
In the end, what can worked for me:
TestBed.resetTestingModule();
})
I had the same problem. One way this error happens is when you try to access anything null or undefined in template. Make sure you have safety checking on those variable.
For example this will throw [object: ErrorEvent] when config is undefined on component load.
template.html
<div *ngIf="config.options">
.....
......
</div>
Do this instead
<div *ngIf="config?.options">
.....
......
</div>