如何调试"[object ErrorEvent]引发"错误消息?我的业力/茉莉花测试中出现错误? [英] How do I debug a "[object ErrorEvent] thrown" error in my Karma/Jasmine tests?

查看:126
本文介绍了如何调试"[object ErrorEvent]引发"错误消息?我的业力/茉莉花测试中出现错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个失败的测试,仅输出[object ErrorEvent] thrown.我在控制台中看不到任何可帮助我查明有问题的代码的内容.我需要做些什么来追踪这些东西吗?

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?

:我正在运行Karma v1.70,Jasmine v2.7.0

: I'm running Karma v1.70, Jasmine v2.7.0

推荐答案

仅供参考:运行测试后,只需打开 DevTools控制台,您就可以找到确切的错误.

FYI: you can find the exact error thrown just by open DevTools Console once your tests are running.

作为一种快速解决方案,您可以尝试在没有源地图的情况下运行测试:

As a quickfix you can try to run your tests without sourcemaps:

CLI v6.0.8及更高版本
--source-map=false

CLI v6.0.x早期版本
--sourceMap=false

CLI v1.x
--sourcemaps=false

快捷方式ng test -sm=false也可能有效

https://github.com/angular/angular-cli/issues/7296

更新: 我也遇到了这个问题,所以我刚迁移到最新的cli,并确保所有软件包都在package.json中进行了更新,并且我完全重新安装了node_modules,所以现在问题已经解决了.

UPDATE: I had that issue as well, so I just migrated to the latest cli and make sure that all packages are updated in package.json also I fully reinstalled the node_modules so now the issue has gone.

这篇关于如何调试"[object ErrorEvent]引发"错误消息?我的业力/茉莉花测试中出现错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆