Debugging jasmine tests with resharper and phantom js

橙三吉。 提交于 2019-11-30 18:50:49

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

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

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.

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

Edit:
Since Jasmine 2.0 you need to use:

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

Jason's answer was really helpful. But I'd like to add that you have to enable script debugging in IE: Internet Options -> Advanced -> uncheck 'Disable script debugging (Internedt Explorer)'.
Then you can put debugger in your js and it will raise the 'Visual Studio Just-In-Time Debugger' popup.

I got debugger; to work by setting IE 11 as my test browser in ReSharper options. The cool thing is that you can set your breakpoints in the Visual Studio version of the code and set through and debug using Visual Studio. You really do not need to interact with the browser.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!