Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging jasmine tests with resharper and phantom js

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?

Thanks in advance

like image 967
Voice Avatar asked Sep 03 '13 06:09

Voice


2 Answers

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 () { };
like image 175
Torbjörn Nomell Avatar answered Nov 02 '22 23:11

Torbjörn Nomell


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.

like image 20
Evgeny Nikitin Avatar answered Nov 03 '22 00:11

Evgeny Nikitin