使用 resharper 和 phantom js 调试 jasmine 测试 [英] Debugging jasmine tests with resharper and phantom js

查看:19
本文介绍了使用 resharper 和 phantom js 调试 jasmine 测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前段时间已经提出了类似的问题你如何调试 Jasmine使用 Resharper 进行测试? 建议的内容对我来说并不真正有效(将 debugger; 放在测试代码中).每次运行测试时,都会打开一个新的浏览器窗口,并且线程会通过调试器跳转.有什么办法让它工作吗?还有有什么方法可以用 phantom runner 和 Resharper 调试 jasmine 测试?

Similar question was already asked some time ago How do you debug Jasmine tests with Resharper? What is suggested there doesn't really work for me (place debugger; in test code). Each time the tests are run, a new browser window opens and thread jumps through debugger. Is there any way to make it work? And also is there any way to debug jasmine tests with phantom runner and Resharper?

提前致谢

推荐答案

要在浏览器中调试,请将以下代码添加到您的 js 测试文件中.

To debug in the browser, add the code below to your js test file.

jasmine.getEnv().currentRunner_.finishCallback = function () {};

Resharper 不会收到测试已完成的通知,因此我们可以在打开的浏览器(我使用 chrome)中设置调试断点并按 F5 进入页面.

Resharper won't be notified that the test has finished so we can set debug breakpoints in the opened browser (I use chrome) and F5 the page.

完成后在 resharper testrunner 窗口中停止测试.

Stop the tests in resharper testrunner window when you're done.


从 Jasmine 2.0 开始你需要使用:


Since Jasmine 2.0 you need to use:

ReSharperReporter.prototype.jasmineDone = function () { };

这篇关于使用 resharper 和 phantom js 调试 jasmine 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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