Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug Jasmine tests with Resharper?

I can't find a way to debug (walk through) JavaScript code when running Jasmine tests with Resharper in Visual Studio 2012. I tried running tests with browser (Chrome) but the test runner closes the port as soon as the test is run and so I cannot put a breakpoint in the code. Also tried running in Internet Explorer and put breakpoints in Visual Studio but it won't attach to the process. My test has a lot of ///reference scripts that Resharper includes automatically in the test runner but I don't want to manually do this for every test that I want to debug. Please help me understand this. If you have a jasmine test that is failing, then how do you debug it?

like image 673
orad Avatar asked Apr 25 '13 18:04

orad


People also ask

How do I run unit tests with ReSharper?

Right click on the project or solution in the VS solution-explorer and choose 'Run Unit Tests' Or go to the Resharper menu, choose Unit-Testing and choose one of the options from there.

Is dotCover included with ReSharper?

With JetBrains dotCover (which is also available with the ReSharper Ultimate license), you can easily discover the degree to which the code of your solution is covered with unit tests.


1 Answers

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(){} 
like image 128
Torbjörn Nomell Avatar answered Sep 27 '22 22:09

Torbjörn Nomell