How do you debug Jasmine tests with Resharper? How do you debug Jasmine tests with Resharper? javascript javascript

How do you debug Jasmine tests with Resharper?


Since I didn't got debugger; to work I found another solution.By adding the following to my test, resharper won't be notified that the test has finished so we can set debug breakpoints in the opened browser (I use chrome) and update (F5) the page.

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

Since Jasmine 2.0 you need to use:

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

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

Also this can be done for QUnit

QUnit.moduleDone = function(){}


Try to use debugger keyword. Simply add the following line to the code you want to debug (perhaps into the spec):

debugger;

It invokes any available debugging functionality. It doesn't work in IE but works pretty well in Chrome (you wrote you use it so I guess it's enough just for debugging).

Of course, after that be sure to remove the debugger keyword! Perhaps there is no really simple way how to avoid it in production code in general (in case you will use it not only in spesc) but if you are interested in this SO question could be helpful.


As I posted on Debugging jasmine tests with resharper and phantom js

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.