Take the 2-minute tour ×

How do you get the Resharper 7 test runner to show the stacktrace for Jasmine tests.

My setup is Resharper 7 (build in Jasmine) testrunner and PhantomJs. When executing any failing test the error message always ends with:

Exception doesn't have a stacktrace

In the 1.6 "Lavender" version of Phantom has added the feature to print the stacktrace when an error occurs.

To replicate this just create a mytest.js file and add the following code to it:

describe("A suite", function() {
share|improve this question
You might want to ask this question here: devnet.jetbrains.net/community/resharper/resharper_eap or here: devnet.jetbrains.net/community/resharper/… –  bitbonk Jul 9 '12 at 8:36
Do you get an error message? I just get "undefined" before "Exception doesn't have a stack trace" in both Phantomjs and chrome. –  mikebridge Aug 3 '12 at 20:06
Same for me. I get undefined before the "Exception doesn't have a stack trace" but nothing apart from that. –  Mharlin Aug 5 '12 at 20:03
add comment

3 Answers

Sorry, I don't use Resharper, but I used to face the same issue with phantomjs and jasmine ConsoleReporter.

I think it boils down to the fact that jasmine does not throw an Error message for failed expectations and that the stack is captured by phantomjs only when error is actually thrown (jasmine.js):

jasmine.ExpectationResult = function(params) {
var trace = (params.trace || new Error(this.message));

Changing that line as follows fixed it for me:

var err;
try { throw new Error(this.message); } catch(e) { err = e };
var trace = (params.trace || err);
share|improve this answer
add comment
up vote 2 down vote accepted

Got a good response from the Jetbrains Resharper team when I logged the issue. They fixed it and it's in the 7.1 release of Resharper, which can be downloaded from their EAP site

share|improve this answer
add comment

In the spec file, where you have your javascript (jasmine) unit tests, you need a reference to the source that is being tested. Normally you have this in the SpecRunner.html, but Resharper rolls it's own SpecRunner.

Add this reference line to the top of the XyzSpec.js file

/// <reference path="/js/path-goes-here/your-file-here.js" />

describe("Utils", function () {
    describe("when calculating quantity", function() {

Drove me almost nuts until I started looking around in Resharper's spec runner.

PS: If a new problem shows up 'Unit Test Runner failed to load test assembly' and you have Chrome as default browser, change the browser for javascript unit tests in the Resharper options.

share|improve this answer
I already had a reference to my javascript file. My tests failed if I didn't add that. Unfortunately still no stack trace but I told the R# team and they have it planned for the 7.1 release –  Mharlin Aug 8 '12 at 17:56
add comment

Your Answer


