From b1dceeacd408746603ece6de5257b8e88ca4328d Mon Sep 17 00:00:00 2001 From: Steve Conover Date: Mon, 28 Feb 2011 17:20:22 -0800 Subject: [PATCH] stack traces --- spec/suites/TrivialNodeReporterSpec.js | 28 +++++++++++++++++++++----- src/node/TrivialNodeReporter.js | 16 ++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/spec/suites/TrivialNodeReporterSpec.js b/spec/suites/TrivialNodeReporterSpec.js index fbe45bc..255041f 100644 --- a/spec/suites/TrivialNodeReporterSpec.js +++ b/spec/suites/TrivialNodeReporterSpec.js @@ -159,13 +159,13 @@ describe("TrivialNodeReporter", function() { it("prints suite and spec descriptions together as a sentence", function(){ this.reporter.suiteResults = [ {description:"The oven", failedSpecResults:[ - {description:"heats up"}, - {description:"cleans itself"} + {description:"heats up", items_:[]}, + {description:"cleans itself", items_:[]} ]}, {description:"The mixer", failedSpecResults:[ - {description:"blends things together"} + {description:"blends things together", items_:[]} ]} - ] + ]; this.reporter.reportRunnerResults(failingRun); @@ -174,7 +174,25 @@ describe("TrivialNodeReporter", function() { expect(this.fakeSys.getOutput()).toContain("The mixer blends things together"); }); - }) + it("prints stack trace of spec failure", function(){ + this.reporter.suiteResults = [ + {description:"The oven", failedSpecResults:[ + {description:"heats up", + items_:[ + {trace:{stack:"stack trace one"}}, + {trace:{stack:"stack trace two"}} + ]} + ]} + ]; + + this.reporter.reportRunnerResults(failingRun); + + expect(this.fakeSys.getOutput()).toContain("The oven heats up"); + expect(this.fakeSys.getOutput()).toContain("stack trace one"); + expect(this.fakeSys.getOutput()).toContain("stack trace two"); + }); + + }); describe('Finished line', function(){ diff --git a/src/node/TrivialNodeReporter.js b/src/node/TrivialNodeReporter.js index 5745370..33b04aa 100644 --- a/src/node/TrivialNodeReporter.js +++ b/src/node/TrivialNodeReporter.js @@ -30,10 +30,14 @@ jasmine.TrivialNodeReporter = function(sys) { function plural(str, count) { return count == 1 ? str : str + "s"; } - function specFailureDetails(suiteDescription, specDescription) { + function specFailureDetails(suiteDescription, specDescription, stackTraces) { newline(); sys.print(suiteDescription + " " + specDescription); newline(); + for(var i=0; i