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 there something I need to do to track these down?
[EDIT]: I'm running Karma v1.70, Jasmine v2.7.0
In my case the problem was with the service, as one of the object wil be undefined during tests running.
Service code sample was something like below access to dom,
The specs referring to this service were failing with the error '[object ErrorEvent] thrown'.
I mocked my service object inside all the specs which were referring to this and the issue got resolved.
Mock service
And use this mock service object in providers as below,
For me it was related to having a promise resolved in the
ngOnInit
of a component. I had to useasync
,fakeAsync
and tick as well as stubbing out the async service withspyOn
Angular - How to unit test component with asynchronous service call