remember suite results as suites finish
This commit is contained in:
parent
f701fdc132
commit
7d2b900b48
@ -106,6 +106,51 @@ describe("TrivialNodeReporter", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('A suite runs', function(){
|
||||||
|
it("remembers suite results", function(){
|
||||||
|
var emptyResults = function(){return {items_:[]};};
|
||||||
|
this.reporter.reportSuiteResults({description:"Oven", results:emptyResults})
|
||||||
|
this.reporter.reportSuiteResults({description:"Mixer", results:emptyResults})
|
||||||
|
|
||||||
|
var self = this
|
||||||
|
var descriptions = []
|
||||||
|
for(var i=0; i<self.reporter.suiteResults.length; i++)
|
||||||
|
descriptions.push(self.reporter.suiteResults[i].description)
|
||||||
|
|
||||||
|
expect(descriptions).toEqual(["Oven", "Mixer"])
|
||||||
|
});
|
||||||
|
|
||||||
|
it("creates a description out of the current suite and any parent suites", function(){
|
||||||
|
var emptyResults = function(){return {items_:[]};};
|
||||||
|
var grandparentSuite = {description:"My house", results:emptyResults}
|
||||||
|
var parentSuite = {description:"kitchen", parentSuite: grandparentSuite, results:emptyResults}
|
||||||
|
this.reporter.reportSuiteResults({description:"oven", parentSuite: parentSuite, results:emptyResults})
|
||||||
|
|
||||||
|
expect(this.reporter.suiteResults[0].description).toEqual("My house kitchen oven")
|
||||||
|
});
|
||||||
|
|
||||||
|
it("gathers failing spec results from the suite. the spec must have a description.", function(){
|
||||||
|
this.reporter.reportSuiteResults({description:"Oven",
|
||||||
|
results:function(){
|
||||||
|
return {
|
||||||
|
items_:[
|
||||||
|
{failedCount:0, description:"specOne"},
|
||||||
|
{failedCount:99, description:"specTwo"},
|
||||||
|
{failedCount:0, description:"specThree"},
|
||||||
|
{failedCount:88, description:"specFour"},
|
||||||
|
{failedCount:3}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
|
||||||
|
expect(this.reporter.suiteResults[0].failedSpecResults).
|
||||||
|
toEqual([
|
||||||
|
{failedCount:99, description:"specTwo"},
|
||||||
|
{failedCount:88, description:"specFour"}
|
||||||
|
])
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
describe('Finishes', function(){
|
describe('Finishes', function(){
|
||||||
it("prints Finished in green if the test run succeeded", function(){
|
it("prints Finished in green if the test run succeeded", function(){
|
||||||
|
@ -40,6 +40,12 @@ jasmine.TrivialNodeReporter = function(sys) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fullSuiteDescription(suite) {
|
||||||
|
var fullDescription = suite.description
|
||||||
|
if (suite.parentSuite) fullDescription = fullSuiteDescription(suite.parentSuite) + " " + fullDescription
|
||||||
|
return fullDescription
|
||||||
|
}
|
||||||
|
|
||||||
var startNewLineIfNecessary = lineEnder(defaultColumnsPerLine);
|
var startNewLineIfNecessary = lineEnder(defaultColumnsPerLine);
|
||||||
|
|
||||||
this.now = function() { return new Date().getTime(); };
|
this.now = function() { return new Date().getTime(); };
|
||||||
@ -61,6 +67,21 @@ jasmine.TrivialNodeReporter = function(sys) {
|
|||||||
startNewLineIfNecessary();
|
startNewLineIfNecessary();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.suiteResults = [];
|
||||||
|
|
||||||
|
this.reportSuiteResults = function(suite) {
|
||||||
|
var suiteResult = {
|
||||||
|
description: fullSuiteDescription(suite),
|
||||||
|
failedSpecResults: []
|
||||||
|
};
|
||||||
|
|
||||||
|
suite.results().items_.forEach(function(spec){
|
||||||
|
if (spec.failedCount > 0 && spec.description) suiteResult.failedSpecResults.push(spec)
|
||||||
|
});
|
||||||
|
|
||||||
|
this.suiteResults.push(suiteResult)
|
||||||
|
};
|
||||||
|
|
||||||
this.reportRunnerResults = function(runner) {
|
this.reportRunnerResults = function(runner) {
|
||||||
var elapsed = this.now() - this.runnerStartTime;
|
var elapsed = this.now() - this.runnerStartTime;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user