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?
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.
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.
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(){}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With