使用 testacular(现在是 karma)在浏览器中调试 [英] debug in browser using testacular (now karma)

查看:30
本文介绍了使用 testacular(现在是 karma)在浏览器中调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出在我破坏单元测试时调试它们的最佳方法.通常在以前的测试环境中,我可以只在浏览器中运行测试并断点测试或代码并查看我的测试失败的原因.我似乎无法弄清楚如何用睾丸做到这一点.有没有一种简单的方法来调试单元测试?

I am trying to figure out the best way to debug my unit tests when I break them. Typically in previous test environments I could just run the tests in the browser and breakpoint the test, or the code and see why my test was failing. I can't seem to figure out how to do that with testacular. Is there an easy way to debug unit tests?

推荐答案

Include "browsers = ['Chrome'];"在您的 karma.config 文件中.

Include "browsers = ['Chrome'];" in your karma.config file.

当 Chrome 打开时,您应该会在顶部看到Karma - connected",右上角有一个Debug"按钮.

When Chrome opens, you should see "Karma - connected" at the top, with a "Debug" button to the upper-right.

单击此调试按钮,将打开Karma DEBUG RUNNER"选项卡.然后,只需像往常一样右键单击、检查元素和调试.

Click this debug button, and a "Karma DEBUG RUNNER" tab will open. Then, simply right-click, inspect element, and debug as you normally would.

这篇关于使用 testacular(现在是 karma)在浏览器中调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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