如何调试“[object ErrorEvent] 抛出"?我的 Karma/Jasmine 测试出错? [英] How do I debug a "[object ErrorEvent] thrown" error in my Karma/Jasmine tests?
问题描述
我有几个失败的测试只输出[object ErrorEvent] throw
.我在控制台中没有看到任何可以帮助我查明违规代码的内容.我需要做些什么来追踪这些吗?
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 Console 找到确切的错误.
作为一个快速修复,你可以尝试运行你的没有源映射的测试:
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
也可以使用
Shortcut
ng test -sm=false
might also work
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] 抛出"?我的 Karma/Jasmine 测试出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!