stack traces
This commit is contained in:
parent
5018f0d1c2
commit
b1dceeacd4
|
@ -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(){
|
||||
|
||||
|
|
|
@ -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<stackTraces.length; i++) {
|
||||
sys.print(stackTraces[i]);
|
||||
newline();
|
||||
}
|
||||
}
|
||||
function finished(elapsed) { newline(); sys.print("Finished in " + elapsed/1000 + " seconds"); }
|
||||
function summary(colorF, specs, assertions, failed) { newline();
|
||||
|
@ -105,15 +109,17 @@ jasmine.TrivialNodeReporter = function(sys) {
|
|||
var suiteResult = suiteResults[i];
|
||||
for(var j=0; j<suiteResult.failedSpecResults.length; j++) {
|
||||
var failedSpecResult = suiteResult.failedSpecResults[j];
|
||||
callback(suiteResult.description, failedSpecResult.description);
|
||||
var stackTraces = [];
|
||||
for(var k=0; k<failedSpecResult.items_.length; k++) stackTraces.push(failedSpecResult.items_[k].trace.stack);
|
||||
callback(suiteResult.description, failedSpecResult.description, stackTraces);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.reportRunnerResults = function(runner) {
|
||||
eachSpecFailure(this.suiteResults, function(suiteDescription, specDescription) {
|
||||
specFailureDetails(suiteDescription, specDescription);
|
||||
})
|
||||
eachSpecFailure(this.suiteResults, function(suiteDescription, specDescription, stackTraces) {
|
||||
specFailureDetails(suiteDescription, specDescription, stackTraces);
|
||||
});
|
||||
|
||||
finished(this.now() - this.runnerStartTime);
|
||||
|
||||
|
|
Loading…
Reference in New Issue