ConsoleReporter is not showing stack trace on errors

195 views
Skip to first unread message

Renier Morales

unread,
Apr 12, 2012, 10:21:59 PM4/12/12
to jasmi...@googlegroups.com
When running a spec like this:
it("should show an error", function() {
    expect(0).toEqual(1);
});

Using ConsoleReporter, Jasmine (standalone, using phantomjs) does report the spec as failed, but it doesn't show the nice stack trace I've seen in jasmine-node.

Has anyone seen this with ConsoleReporter? Is this a known problem?

Saludos,
    --Renier

Renier Morales

unread,
Apr 13, 2012, 2:43:20 PM4/13/12
to jasmi...@googlegroups.com
This function in ConsoleReporter seems points to a stack property to save it in the failed results:

function eachSpecFailure(suiteResults, callback) {
    for (var i = 0; i < suiteResults.length; i++) {
      var suiteResult = suiteResults[i];
      for (var j = 0; j < suiteResult.failedSpecResults.length; j++) {
        var failedSpecResult = suiteResult.failedSpecResults[j];
        var stackTraces = [];
        // THIS LINE,
        for (var k = 0; k < failedSpecResult.items_.length; k++) stackTraces.push(failedSpecResult.items_[k].trace.stack);
        callback(suiteResult.description, failedSpecResult.description, stackTraces);
      }
    }
  }

But if I stringify that whole object, I only see this { ..., trace: { message: "Expected 0 to be 1" } }

It seems that line in the function above, should be storing the message too so it can print it out later. Also, why is there no stack? Should there be?

    --Renier

Jasmine Hegman

unread,
Apr 25, 2013, 1:24:20 PM4/25/13
to jasmi...@googlegroups.com, ren...@morales-rodriguez.net
I have no experience with ConsoleReporter, as I have always used HtmlReporter through phantom, but these issues may point you in a direction, because yes, there should be, but it has a history of being problematic:

Reply all
Reply to author
Forward
0 new messages