How do I debug a “[object ErrorEvent] thrown” error in my Karma/Jasmine tests?

后端 未结 17 2299
生来不讨喜
生来不讨喜 2020-12-04 09:51

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

17条回答
  •  自闭症患者
    2020-12-04 10:18

    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

    ..... ......

    Do this instead

    ..... ......

提交回复
热议问题