And what I meant was *this* commit was pulling in the fixes to TrivialConsoleReporter
This commit is contained in:
commit
da297d0f56
@ -6,24 +6,26 @@ var path = require('path');
|
||||
// undefined = "diz be undefined yo";
|
||||
|
||||
var jasmineGlobals = require("../src/base");
|
||||
for(var k in jasmineGlobals) {global[k] = jasmineGlobals[k];}
|
||||
for (var k in jasmineGlobals) {
|
||||
global[k] = jasmineGlobals[k];
|
||||
}
|
||||
|
||||
//load jasmine src files based on the order in runner.html
|
||||
var srcFilesInProperRequireOrder = [];
|
||||
var runnerHtmlLines = fs.readFileSync("spec/runner.html", "utf8").split("\n");
|
||||
var srcFileLines = [];
|
||||
for (var i=0; i<runnerHtmlLines.length; i++)
|
||||
if (runnerHtmlLines[i].match(/script(.*?)\/src\//))
|
||||
for (var i = 0; i < runnerHtmlLines.length; i++)
|
||||
if (runnerHtmlLines[i].match(/script(.*?)\/src\//))
|
||||
srcFileLines.push(runnerHtmlLines[i]);
|
||||
for (i=0; i<srcFileLines.length; i++) srcFilesInProperRequireOrder.push(srcFileLines[i].match(/src=\"(.*?)\"/)[1]);
|
||||
for (i=0; i<srcFilesInProperRequireOrder.length; i++) require(srcFilesInProperRequireOrder[i]);
|
||||
for (i = 0; i < srcFileLines.length; i++) srcFilesInProperRequireOrder.push(srcFileLines[i].match(/src=\"(.*?)\"/)[1]);
|
||||
for (i = 0; i < srcFilesInProperRequireOrder.length; i++) require(srcFilesInProperRequireOrder[i]);
|
||||
|
||||
|
||||
/*
|
||||
Pulling in code from jasmine-node.
|
||||
Pulling in code from jasmine-node.
|
||||
|
||||
We can't just depend on jasmine-node because it has its own jasmine that it uses.
|
||||
*/
|
||||
We can't just depend on jasmine-node because it has its own jasmine that it uses.
|
||||
*/
|
||||
|
||||
global.window = {
|
||||
setTimeout: setTimeout,
|
||||
@ -34,61 +36,54 @@ global.window = {
|
||||
|
||||
delete global.window;
|
||||
|
||||
function noop(){}
|
||||
function noop() {
|
||||
}
|
||||
|
||||
jasmine.executeSpecs = function(specs, done){
|
||||
for (var i = 0, len = specs.length; i < len; ++i){
|
||||
jasmine.executeSpecs = function(specs, done) {
|
||||
for (var i = 0, len = specs.length; i < len; ++i) {
|
||||
var filename = specs[i];
|
||||
require(filename.replace(/\.\w+$/, ""));
|
||||
}
|
||||
|
||||
var jasmineEnv = jasmine.getEnv();
|
||||
jasmineEnv.reporter = new jasmine.TrivialConsoleReporter(sys.print, done)
|
||||
var consoleReporter = new jasmine.TrivialConsoleReporter(sys.print, done);
|
||||
|
||||
jasmineEnv.addReporter(consoleReporter);
|
||||
jasmineEnv.execute();
|
||||
};
|
||||
|
||||
jasmine.getAllSpecFiles = function(dir, matcher){
|
||||
jasmine.getAllSpecFiles = function(dir, matcher) {
|
||||
var specs = [];
|
||||
|
||||
if (fs.statSync(dir).isFile() && dir.match(matcher)) {
|
||||
specs.push(dir);
|
||||
} else {
|
||||
var files = fs.readdirSync(dir);
|
||||
for (var i = 0, len = files.length; i < len; ++i){
|
||||
for (var i = 0, len = files.length; i < len; ++i) {
|
||||
var filename = dir + '/' + files[i];
|
||||
if (fs.statSync(filename).isFile() && filename.match(matcher)){
|
||||
if (fs.statSync(filename).isFile() && filename.match(matcher)) {
|
||||
specs.push(filename);
|
||||
}else if (fs.statSync(filename).isDirectory()){
|
||||
} else if (fs.statSync(filename).isDirectory()) {
|
||||
var subfiles = this.getAllSpecFiles(filename, matcher);
|
||||
subfiles.forEach(function(result){
|
||||
subfiles.forEach(function(result) {
|
||||
specs.push(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return specs;
|
||||
};
|
||||
|
||||
jasmine.printRunnerResults = function(runner){
|
||||
var results = runner.results();
|
||||
var suites = runner.suites();
|
||||
var msg = '';
|
||||
msg += suites.length + ' spec' + ((suites.length === 1) ? '' : 's') + ', ';
|
||||
msg += results.totalCount + ' expectation' + ((results.totalCount === 1) ? '' : 's') + ', ';
|
||||
msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\n';
|
||||
return msg;
|
||||
};
|
||||
|
||||
function now(){
|
||||
function now() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
jasmine.asyncSpecWait = function(){
|
||||
jasmine.asyncSpecWait = function() {
|
||||
var wait = jasmine.asyncSpecWait;
|
||||
wait.start = now();
|
||||
wait.done = false;
|
||||
(function innerWait(){
|
||||
(function innerWait() {
|
||||
waits(10);
|
||||
runs(function() {
|
||||
if (wait.start + wait.timeout < now()) {
|
||||
@ -102,41 +97,37 @@ jasmine.asyncSpecWait = function(){
|
||||
})();
|
||||
};
|
||||
jasmine.asyncSpecWait.timeout = 4 * 1000;
|
||||
jasmine.asyncSpecDone = function(){
|
||||
jasmine.asyncSpecDone = function() {
|
||||
jasmine.asyncSpecWait.done = true;
|
||||
};
|
||||
|
||||
for ( var key in jasmine) {
|
||||
for (var key in jasmine) {
|
||||
exports[key] = jasmine[key];
|
||||
}
|
||||
|
||||
/*
|
||||
End jasmine-node runner
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
End jasmine-node runner
|
||||
*/
|
||||
|
||||
var isVerbose = false;
|
||||
var showColors = true;
|
||||
process.argv.forEach(function(arg){
|
||||
switch(arg) {
|
||||
case '--color': showColors = true; break;
|
||||
case '--noColor': showColors = false; break;
|
||||
case '--verbose': isVerbose = true; break;
|
||||
process.argv.forEach(function(arg) {
|
||||
switch (arg) {
|
||||
case '--color': showColors = true; break;
|
||||
case '--noColor': showColors = false; break;
|
||||
case '--verbose': isVerbose = true; break;
|
||||
}
|
||||
});
|
||||
|
||||
var specs = jasmine.getAllSpecFiles(__dirname + '/suites', new RegExp(".js$"));
|
||||
var domIndependentSpecs = [];
|
||||
for(var i=0; i<specs.length; i++) {
|
||||
if (fs.readFileSync(specs[i], "utf8").indexOf("document.createElement")<0) {
|
||||
for (var i = 0; i < specs.length; i++) {
|
||||
if (fs.readFileSync(specs[i], "utf8").indexOf("document.createElement") < 0) {
|
||||
domIndependentSpecs.push(specs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
jasmine.executeSpecs(domIndependentSpecs, function(runner, log){
|
||||
jasmine.executeSpecs(domIndependentSpecs, function(runner, log) {
|
||||
if (runner.results().failedCount === 0) {
|
||||
process.exit(0);
|
||||
} else {
|
||||
|
@ -1,431 +1,490 @@
|
||||
if (jasmine.TrivialConsoleReporter) {
|
||||
describe("TrivialConsoleReporter", function() {
|
||||
describe("TrivialConsoleReporter", function() {
|
||||
//keep these literal. otherwise the test loses value as a test.
|
||||
function green(str) {
|
||||
return '\033[32m' + str + '\033[0m';
|
||||
}
|
||||
|
||||
function red(str) {
|
||||
return '\033[31m' + str + '\033[0m';
|
||||
}
|
||||
|
||||
//keep these literal. otherwise the test loses value as a test.
|
||||
function green(str) { return '\033[32m' + str + '\033[0m'; }
|
||||
function red(str) { return '\033[31m' + str + '\033[0m'; }
|
||||
function yellow(str) { return '\033[33m' + str + '\033[0m'; }
|
||||
function yellow(str) {
|
||||
return '\033[33m' + str + '\033[0m';
|
||||
}
|
||||
|
||||
function prefixGreen(str) { return '\033[32m' + str; }
|
||||
function prefixRed(str) { return '\033[31m' + str; }
|
||||
function prefixGreen(str) {
|
||||
return '\033[32m' + str;
|
||||
}
|
||||
|
||||
var newline = "\n";
|
||||
function prefixRed(str) {
|
||||
return '\033[31m' + str;
|
||||
}
|
||||
|
||||
var passingSpec = { results: function(){ return {passed: function(){return true;}}; } },
|
||||
failingSpec = { results: function(){ return {passed: function(){return false;}}; } },
|
||||
skippedSpec = { results: function(){ return {skipped: true}; } },
|
||||
passingRun = { results: function(){ return {failedCount: 0, items_: [null, null, null]}; } },
|
||||
failingRun = { results: function(){ return {failedCount: 7, items_: [null, null, null]}; } };
|
||||
var newline = "\n";
|
||||
|
||||
function repeatedlyInvoke(f, times) { for(var i=0; i<times; i++) f(times+1); }
|
||||
|
||||
function repeat(thing, times) {
|
||||
var arr = [];
|
||||
for(var i=0; i<times; i++) arr.push(thing);
|
||||
return arr;
|
||||
var passingSpec = {
|
||||
results: function() {
|
||||
return {
|
||||
passed: function() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var fiftyRedFs = repeat(red("F"), 50).join(""),
|
||||
fiftyGreenDots = repeat(green("."), 50).join("");
|
||||
|
||||
function simulateRun(reporter, specResults, suiteResults, finalRunner, startTime, endTime) {
|
||||
reporter.reportRunnerStarting();
|
||||
for(var i=0; i<specResults.length; i++) reporter.reportSpecResults(specResults[i]);
|
||||
for(i=0; i<suiteResults.length; i++) reporter.reportSuiteResults(suiteResults[i]);
|
||||
reporter.runnerStartTime = startTime;
|
||||
reporter.now = function(){return endTime;};
|
||||
reporter.reportRunnerResults(finalRunner);
|
||||
}
|
||||
|
||||
beforeEach(function() {
|
||||
this.out = (function(){
|
||||
var output = "";
|
||||
},
|
||||
failingSpec = {
|
||||
results: function() {
|
||||
return {
|
||||
print:function(str) {output += str;},
|
||||
getOutput:function(){return output;},
|
||||
clear: function(){output = "";}
|
||||
passed: function() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
},
|
||||
skippedSpec = {
|
||||
results: function() {
|
||||
return {skipped: true};
|
||||
}
|
||||
},
|
||||
passingRun = {
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results: function() {
|
||||
return {failedCount: 0, items_: [null, null, null]};
|
||||
}
|
||||
},
|
||||
failingRun = {
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results: function() {
|
||||
return {
|
||||
failedCount: 7, items_: [null, null, null]};
|
||||
}
|
||||
};
|
||||
|
||||
this.done = false
|
||||
var self = this
|
||||
this.reporter = new jasmine.TrivialConsoleReporter(this.out.print, function(runner){
|
||||
self.done = true
|
||||
});
|
||||
function repeatedlyInvoke(f, times) {
|
||||
for (var i = 0; i < times; i++) f(times + 1);
|
||||
}
|
||||
|
||||
function repeat(thing, times) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < times; i++) arr.push(thing);
|
||||
return arr;
|
||||
}
|
||||
|
||||
function simulateRun(reporter, specResults, suiteResults, finalRunner, startTime, endTime) {
|
||||
reporter.reportRunnerStarting();
|
||||
for (var i = 0; i < specResults.length; i++) {
|
||||
reporter.reportSpecResults(specResults[i]);
|
||||
}
|
||||
for (i = 0; i < suiteResults.length; i++) {
|
||||
reporter.reportSuiteResults(suiteResults[i]);
|
||||
}
|
||||
reporter.runnerStartTime = startTime;
|
||||
reporter.now = function() {
|
||||
return endTime;
|
||||
};
|
||||
reporter.reportRunnerResults(finalRunner);
|
||||
}
|
||||
|
||||
var reporter, out, done;
|
||||
|
||||
beforeEach(function() {
|
||||
out = (function() {
|
||||
var output = "";
|
||||
return {
|
||||
print:function(str) {
|
||||
output += str;
|
||||
},
|
||||
getOutput:function() {
|
||||
return output;
|
||||
},
|
||||
clear: function() {
|
||||
output = "";
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
done = false;
|
||||
reporter = new jasmine.TrivialConsoleReporter(out.print, function(runner) {
|
||||
done = true
|
||||
});
|
||||
|
||||
|
||||
describe('Integration', function(){
|
||||
it("prints the proper output under a pass scenario. small numbers.", function(){
|
||||
simulateRun(this.reporter,
|
||||
repeat(passingSpec, 3),
|
||||
[],
|
||||
{
|
||||
results:function(){
|
||||
return {
|
||||
items_: [null, null, null],
|
||||
totalCount: 7,
|
||||
failedCount: 0
|
||||
};
|
||||
}
|
||||
},
|
||||
1000,
|
||||
1777);
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
[
|
||||
"Started",
|
||||
green(".") + green(".") + green("."),
|
||||
"",
|
||||
"Finished in 0.777 seconds",
|
||||
green("3 specs, 7 expectations, 0 failures"),
|
||||
""
|
||||
].join("\n") + "\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("prints the proper output under a pass scenario. large numbers.", function(){
|
||||
simulateRun(this.reporter,
|
||||
repeat(passingSpec, 57),
|
||||
[],
|
||||
{
|
||||
results:function(){
|
||||
return {
|
||||
items_: [null, null, null],
|
||||
totalCount: 7,
|
||||
failedCount: 0
|
||||
};
|
||||
}
|
||||
},
|
||||
1000,
|
||||
1777);
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
[
|
||||
"Started",
|
||||
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") + //50 green dots
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") + newline +
|
||||
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") + //7 green dots
|
||||
green(".") + green("."),
|
||||
|
||||
"",
|
||||
"Finished in 0.777 seconds",
|
||||
green("3 specs, 7 expectations, 0 failures"),
|
||||
""
|
||||
].join("\n") + "\n"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it("prints the proper output under a failure scenario.", function(){
|
||||
simulateRun(this.reporter,
|
||||
[failingSpec, passingSpec, failingSpec],
|
||||
[{description:"The oven",
|
||||
results:function(){
|
||||
return {
|
||||
items_:[
|
||||
{failedCount:2,
|
||||
description:"heats up",
|
||||
items_:[
|
||||
{trace:{stack:"stack trace one\n second line"}},
|
||||
{trace:{stack:"stack trace two"}}
|
||||
]}
|
||||
]
|
||||
};
|
||||
}},
|
||||
{description:"The washing machine",
|
||||
results:function(){
|
||||
return {
|
||||
items_:[
|
||||
{failedCount:2,
|
||||
description:"washes clothes",
|
||||
items_:[
|
||||
{trace:{stack:"stack trace one"}}
|
||||
]}
|
||||
]
|
||||
};
|
||||
}}
|
||||
],
|
||||
{
|
||||
results:function(){
|
||||
return {
|
||||
items_: [null, null, null],
|
||||
totalCount: 7,
|
||||
failedCount: 2
|
||||
};
|
||||
}
|
||||
},
|
||||
1000,
|
||||
1777);
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
[
|
||||
"Started",
|
||||
red("F") + green(".") + red("F"),
|
||||
"",
|
||||
"The oven heats up",
|
||||
" stack trace one",
|
||||
" second line",
|
||||
" stack trace two",
|
||||
"",
|
||||
"The washing machine washes clothes",
|
||||
" stack trace one",
|
||||
"",
|
||||
"Finished in 0.777 seconds",
|
||||
red("3 specs, 7 expectations, 2 failures"),
|
||||
""
|
||||
].join("\n") + "\n"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('A Test Run', function(){
|
||||
|
||||
describe('Starts', function(){
|
||||
it("prints Started", function(){
|
||||
this.reporter.reportRunnerStarting();
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
"Started" + newline
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('A spec runs', function(){
|
||||
it("prints a green dot if the spec passes", function(){
|
||||
this.reporter.reportSpecResults(passingSpec);
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
green(".")
|
||||
);
|
||||
});
|
||||
|
||||
it("prints a red dot if the spec fails", function(){
|
||||
this.reporter.reportSpecResults(failingSpec);
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
red("F")
|
||||
);
|
||||
});
|
||||
|
||||
it("prints a yellow star if the spec was skipped", function(){
|
||||
this.reporter.reportSpecResults(skippedSpec);
|
||||
|
||||
expect(this.out.getOutput()).toEqual(
|
||||
yellow("*")
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('Many specs run', function(){
|
||||
it("starts a new line every 50 specs", function(){
|
||||
var self = this;
|
||||
repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 49);
|
||||
|
||||
expect(this.out.getOutput()).
|
||||
toEqual(repeat(red("F"), 49).join(""));
|
||||
|
||||
repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 3);
|
||||
|
||||
expect(this.out.getOutput()).
|
||||
toEqual(fiftyRedFs + newline +
|
||||
red("F") + red("F"));
|
||||
|
||||
repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 48);
|
||||
repeatedlyInvoke(function(){self.reporter.reportSpecResults(passingSpec);}, 2);
|
||||
|
||||
expect(this.out.getOutput()).
|
||||
toEqual(fiftyRedFs + newline +
|
||||
fiftyRedFs + newline +
|
||||
green(".") + green("."));
|
||||
});
|
||||
});
|
||||
|
||||
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('Spec failure information', function(){
|
||||
|
||||
it("prints suite and spec descriptions together as a sentence", function(){
|
||||
this.reporter.suiteResults = [
|
||||
{description:"The oven", failedSpecResults:[
|
||||
{description:"heats up", items_:[]},
|
||||
{description:"cleans itself", items_:[]}
|
||||
]},
|
||||
{description:"The mixer", failedSpecResults:[
|
||||
{description:"blends things together", items_:[]}
|
||||
]}
|
||||
];
|
||||
|
||||
this.reporter.reportRunnerResults(failingRun);
|
||||
|
||||
expect(this.out.getOutput()).toContain("The oven heats up");
|
||||
expect(this.out.getOutput()).toContain("The oven cleans itself");
|
||||
expect(this.out.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.out.getOutput()).toContain("The oven heats up");
|
||||
expect(this.out.getOutput()).toContain("stack trace one");
|
||||
expect(this.out.getOutput()).toContain("stack trace two");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Finished line', function(){
|
||||
|
||||
it("prints the elapsed time in the summary message", function(){
|
||||
this.reporter.now = function(){return 1000;};
|
||||
this.reporter.reportRunnerStarting();
|
||||
this.reporter.now = function(){return 1777;};
|
||||
this.reporter.reportRunnerResults(passingRun);
|
||||
expect(this.out.getOutput()).toContain("0.777 seconds");
|
||||
});
|
||||
|
||||
it("prints round time numbers correctly", function(){
|
||||
var self = this;
|
||||
function run(startTime, endTime) {
|
||||
self.out.clear();
|
||||
self.reporter.runnerStartTime = startTime;
|
||||
self.reporter.now = function(){return endTime;};
|
||||
self.reporter.reportRunnerResults(passingRun);
|
||||
}
|
||||
|
||||
run(1000, 11000);
|
||||
expect(this.out.getOutput()).toContain("10 seconds");
|
||||
|
||||
run(1000, 2000);
|
||||
expect(this.out.getOutput()).toContain("1 seconds");
|
||||
|
||||
run(1000, 1100);
|
||||
expect(this.out.getOutput()).toContain("0.1 seconds");
|
||||
|
||||
run(1000, 1010);
|
||||
expect(this.out.getOutput()).toContain("0.01 seconds");
|
||||
|
||||
run(1000, 1001);
|
||||
expect(this.out.getOutput()).toContain("0.001 seconds");
|
||||
});
|
||||
|
||||
it("prints the full finished message", function(){
|
||||
this.reporter.now = function(){return 1000;};
|
||||
this.reporter.reportRunnerStarting();
|
||||
this.reporter.now = function(){return 1777;};
|
||||
this.reporter.reportRunnerResults(failingRun);
|
||||
expect(this.out.getOutput()).toContain("Finished in 0.777 seconds");
|
||||
});
|
||||
});
|
||||
|
||||
describe("specs/expectations/failures summary", function(){
|
||||
it("prints statistics in green if there were no failures", function() {
|
||||
this.reporter.reportRunnerResults({
|
||||
results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 0};}
|
||||
});
|
||||
expect(this.out.getOutput()).
|
||||
toContain("3 specs, 7 expectations, 0 failures");
|
||||
});
|
||||
|
||||
it("prints statistics in red if there was a failure", function() {
|
||||
this.reporter.reportRunnerResults({
|
||||
results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 3};}
|
||||
});
|
||||
expect(this.out.getOutput()).
|
||||
toContain("3 specs, 7 expectations, 3 failures");
|
||||
});
|
||||
|
||||
it("handles pluralization with 1's ones appropriately", function() {
|
||||
this.reporter.reportRunnerResults({
|
||||
results:function(){return {items_: [null], totalCount: 1, failedCount: 1};}
|
||||
});
|
||||
expect(this.out.getOutput()).
|
||||
toContain("1 spec, 1 expectation, 1 failure");
|
||||
});
|
||||
});
|
||||
|
||||
describe("done callback", function(){
|
||||
it("calls back when done", function() {
|
||||
expect(this.done).toBeFalsy();
|
||||
this.reporter.reportRunnerResults({
|
||||
results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 0};}
|
||||
});
|
||||
expect(this.done).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
describe('Integration', function() {
|
||||
it("prints the proper output under a pass scenario. small numbers.", function() {
|
||||
simulateRun(reporter,
|
||||
repeat(passingSpec, 3),
|
||||
[],
|
||||
{
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results:function() {
|
||||
return {
|
||||
items_: [null, null, null],
|
||||
totalCount: 7,
|
||||
failedCount: 0
|
||||
};
|
||||
}
|
||||
},
|
||||
1000,
|
||||
1777
|
||||
);
|
||||
|
||||
expect(out.getOutput()).toEqual(
|
||||
[
|
||||
"Started",
|
||||
green(".") + green(".") + green("."),
|
||||
"",
|
||||
"Finished in 0.777 seconds",
|
||||
green("3 specs, 7 expectations, 0 failures"),
|
||||
""
|
||||
].join("\n") + "\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("prints the proper output under a pass scenario. large numbers.", function() {
|
||||
simulateRun(reporter,
|
||||
repeat(passingSpec, 57),
|
||||
[],
|
||||
{
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results:function() {
|
||||
return {
|
||||
items_: [null, null, null],
|
||||
totalCount: 7,
|
||||
failedCount: 0
|
||||
};
|
||||
}
|
||||
},
|
||||
1000,
|
||||
1777);
|
||||
|
||||
expect(out.getOutput()).toEqual(
|
||||
[
|
||||
"Started",
|
||||
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") + //50 green dots
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") +
|
||||
|
||||
green(".") + green(".") + green(".") + green(".") + green(".") + //7 green dots
|
||||
green(".") + green("."),
|
||||
|
||||
"",
|
||||
"Finished in 0.777 seconds",
|
||||
green("3 specs, 7 expectations, 0 failures"),
|
||||
""
|
||||
].join("\n") + "\n"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it("prints the proper output under a failure scenario.", function() {
|
||||
simulateRun(reporter,
|
||||
[failingSpec, passingSpec, failingSpec],
|
||||
[
|
||||
{description:"The oven",
|
||||
results:function() {
|
||||
return {
|
||||
items_:[
|
||||
{failedCount:2,
|
||||
description:"heats up",
|
||||
items_:[
|
||||
{trace:{stack:"stack trace one\n second line"}},
|
||||
{trace:{stack:"stack trace two"}}
|
||||
]}
|
||||
]
|
||||
};
|
||||
}},
|
||||
{description:"The washing machine",
|
||||
results:function() {
|
||||
return {
|
||||
items_:[
|
||||
{failedCount:2,
|
||||
description:"washes clothes",
|
||||
items_:[
|
||||
{trace:{stack:"stack trace one"}}
|
||||
]}
|
||||
]
|
||||
};
|
||||
}}
|
||||
],
|
||||
{
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results:function() {
|
||||
return {
|
||||
items_: [null, null, null],
|
||||
totalCount: 7,
|
||||
failedCount: 2
|
||||
};
|
||||
}
|
||||
},
|
||||
1000,
|
||||
1777);
|
||||
|
||||
expect(out.getOutput()).toEqual(
|
||||
[
|
||||
"Started",
|
||||
red("F") + green(".") + red("F"),
|
||||
"",
|
||||
"The oven heats up",
|
||||
" stack trace one",
|
||||
" second line",
|
||||
" stack trace two",
|
||||
"",
|
||||
"The washing machine washes clothes",
|
||||
" stack trace one",
|
||||
"",
|
||||
"Finished in 0.777 seconds",
|
||||
red("3 specs, 7 expectations, 2 failures"),
|
||||
""
|
||||
].join("\n") + "\n"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('When a Jasmine environment executes', function() {
|
||||
beforeEach(function() {
|
||||
reporter.reportRunnerStarting();
|
||||
});
|
||||
|
||||
it("should print 'Started' to the console", function() {
|
||||
expect(out.getOutput()).toEqual("Started" + newline);
|
||||
});
|
||||
|
||||
describe('when a spec reports', function() {
|
||||
beforeEach(function() {
|
||||
out.clear();
|
||||
});
|
||||
|
||||
it("prints a green dot if the spec passes", function() {
|
||||
reporter.reportSpecResults(passingSpec);
|
||||
|
||||
expect(out.getOutput()).toEqual(green("."));
|
||||
});
|
||||
|
||||
it("prints a red dot if the spec fails", function() {
|
||||
reporter.reportSpecResults(failingSpec);
|
||||
|
||||
expect(out.getOutput()).toEqual(red("F"));
|
||||
});
|
||||
|
||||
it("prints a yellow star if the spec was skipped", function() {
|
||||
reporter.reportSpecResults(skippedSpec);
|
||||
|
||||
expect(out.getOutput()).toEqual(yellow("*"));
|
||||
});
|
||||
});
|
||||
|
||||
describe('when a suite reports', function() {
|
||||
var emptyResults;
|
||||
beforeEach(function() {
|
||||
emptyResults = function() {
|
||||
return {
|
||||
items_:[]
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
it("remembers suite results", function() {
|
||||
reporter.reportSuiteResults({description: "Oven", results: emptyResults});
|
||||
reporter.reportSuiteResults({description: "Mixer", results: emptyResults});
|
||||
|
||||
expect(reporter.suiteResults[0].description).toEqual('Oven');
|
||||
expect(reporter.suiteResults[1].description).toEqual('Mixer');
|
||||
});
|
||||
|
||||
it("creates a description out of the current suite and any parent suites", function() {
|
||||
var grandparentSuite = {
|
||||
description: "My house",
|
||||
results: emptyResults
|
||||
};
|
||||
var parentSuite = {
|
||||
description: "kitchen",
|
||||
parentSuite: grandparentSuite,
|
||||
results: emptyResults
|
||||
};
|
||||
reporter.reportSuiteResults({ description: "oven", parentSuite: parentSuite, results: emptyResults });
|
||||
|
||||
expect(reporter.suiteResults[0].description).toEqual("My house kitchen oven");
|
||||
});
|
||||
|
||||
it("gathers failing spec results from the suite - the spec must have a description.", function() {
|
||||
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(reporter.suiteResults[0].failedSpecResults).
|
||||
toEqual([
|
||||
{ failedCount: 99, description: "specTwo" },
|
||||
{ failedCount: 88, description: "specFour" }
|
||||
]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('and finishes', function() {
|
||||
|
||||
describe('when reporting spec failure information', function() {
|
||||
|
||||
it("prints suite and spec descriptions together as a sentence", function() {
|
||||
reporter.suiteResults = [
|
||||
{description:"The oven", failedSpecResults:[
|
||||
{description:"heats up", items_:[]},
|
||||
{description:"cleans itself", items_:[]}
|
||||
]},
|
||||
{description:"The mixer", failedSpecResults:[
|
||||
{description:"blends things together", items_:[]}
|
||||
]}
|
||||
];
|
||||
|
||||
reporter.reportRunnerResults(failingRun);
|
||||
|
||||
expect(out.getOutput()).toContain("The oven heats up");
|
||||
expect(out.getOutput()).toContain("The oven cleans itself");
|
||||
expect(out.getOutput()).toContain("The mixer blends things together");
|
||||
});
|
||||
|
||||
it("prints stack trace of spec failure", function() {
|
||||
reporter.suiteResults = [
|
||||
{description:"The oven", failedSpecResults:[
|
||||
{description:"heats up",
|
||||
items_:[
|
||||
{trace:{stack:"stack trace one"}},
|
||||
{trace:{stack:"stack trace two"}}
|
||||
]}
|
||||
]}
|
||||
];
|
||||
|
||||
reporter.reportRunnerResults(failingRun);
|
||||
|
||||
expect(out.getOutput()).toContain("The oven heats up");
|
||||
expect(out.getOutput()).toContain("stack trace one");
|
||||
expect(out.getOutput()).toContain("stack trace two");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when reporting the execution time', function() {
|
||||
|
||||
it("prints the full finished message", function() {
|
||||
reporter.now = function() {
|
||||
return 1000;
|
||||
};
|
||||
reporter.reportRunnerStarting();
|
||||
reporter.now = function() {
|
||||
return 1777;
|
||||
};
|
||||
reporter.reportRunnerResults(failingRun);
|
||||
expect(out.getOutput()).toContain("Finished in 0.777 seconds");
|
||||
});
|
||||
|
||||
it("prints round time numbers correctly", function() {
|
||||
function run(startTime, endTime) {
|
||||
out.clear();
|
||||
reporter.runnerStartTime = startTime;
|
||||
reporter.now = function() {
|
||||
return endTime;
|
||||
};
|
||||
reporter.reportRunnerResults(passingRun);
|
||||
}
|
||||
|
||||
run(1000, 11000);
|
||||
expect(out.getOutput()).toContain("10 seconds");
|
||||
|
||||
run(1000, 2000);
|
||||
expect(out.getOutput()).toContain("1 seconds");
|
||||
|
||||
run(1000, 1100);
|
||||
expect(out.getOutput()).toContain("0.1 seconds");
|
||||
|
||||
run(1000, 1010);
|
||||
expect(out.getOutput()).toContain("0.01 seconds");
|
||||
|
||||
run(1000, 1001);
|
||||
expect(out.getOutput()).toContain("0.001 seconds");
|
||||
});
|
||||
});
|
||||
|
||||
describe("when reporting the results summary", function() {
|
||||
it("prints statistics in green if there were no failures", function() {
|
||||
reporter.reportRunnerResults({
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results:function() {
|
||||
return {items_: [null, null, null], totalCount: 7, failedCount: 0};
|
||||
}
|
||||
});
|
||||
expect(out.getOutput()).
|
||||
toContain("3 specs, 7 expectations, 0 failures");
|
||||
});
|
||||
|
||||
it("prints statistics in red if there was a failure", function() {
|
||||
reporter.reportRunnerResults({
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results:function() {
|
||||
return {items_: [null, null, null], totalCount: 7, failedCount: 3};
|
||||
}
|
||||
});
|
||||
expect(out.getOutput()).
|
||||
toContain("3 specs, 7 expectations, 3 failures");
|
||||
});
|
||||
|
||||
it("handles pluralization with 1's ones appropriately", function() {
|
||||
reporter.reportRunnerResults({
|
||||
specs: function() {
|
||||
return [null];
|
||||
},
|
||||
results:function() {
|
||||
return {items_: [null], totalCount: 1, failedCount: 1};
|
||||
}
|
||||
});
|
||||
expect(out.getOutput()).
|
||||
toContain("1 spec, 1 expectation, 1 failure");
|
||||
});
|
||||
});
|
||||
|
||||
describe("done callback", function() {
|
||||
it("calls back when done", function() {
|
||||
expect(done).toBeFalsy();
|
||||
reporter.reportRunnerResults({
|
||||
specs: function() {
|
||||
return [null, null, null];
|
||||
},
|
||||
results:function() {
|
||||
return {items_: [null, null, null], totalCount: 7, failedCount: 0};
|
||||
}
|
||||
});
|
||||
expect(done).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@ -1,65 +1,111 @@
|
||||
jasmine.TrivialConsoleReporter = function(print, doneCallback) {
|
||||
//inspired by mhevery's jasmine-node reporter
|
||||
//https://github.com/mhevery/jasmine-node
|
||||
|
||||
doneCallback = doneCallback || function(){};
|
||||
|
||||
var defaultColumnsPerLine = 50,
|
||||
ansi = { green: '\033[32m', red: '\033[31m', yellow: '\033[33m', none: '\033[0m' },
|
||||
language = { spec:"spec", expectation:"expectation", failure:"failure" };
|
||||
|
||||
function coloredStr(color, str) { return ansi[color] + str + ansi.none; }
|
||||
|
||||
function greenStr(str) { return coloredStr("green", str); }
|
||||
function redStr(str) { return coloredStr("red", str); }
|
||||
function yellowStr(str) { return coloredStr("yellow", str); }
|
||||
|
||||
function newline() { print("\n"); }
|
||||
function started() { print("Started");
|
||||
newline(); }
|
||||
|
||||
function greenDot() { print(greenStr(".")); }
|
||||
function redF() { print(redStr("F")); }
|
||||
function yellowStar() { print(yellowStr("*")); }
|
||||
|
||||
function plural(str, count) { return count == 1 ? str : str + "s"; }
|
||||
|
||||
function repeat(thing, times) { var arr = [];
|
||||
for(var i=0; i<times; i++) arr.push(thing);
|
||||
return arr;
|
||||
}
|
||||
|
||||
function indent(str, spaces) { var lines = str.split("\n");
|
||||
var newArr = [];
|
||||
for(var i=0; i<lines.length; i++) {
|
||||
newArr.push(repeat(" ", spaces).join("") + lines[i]);
|
||||
}
|
||||
return newArr.join("\n");
|
||||
}
|
||||
|
||||
function specFailureDetails(suiteDescription, specDescription, stackTraces) {
|
||||
newline();
|
||||
print(suiteDescription + " " + specDescription);
|
||||
newline();
|
||||
for(var i=0; i<stackTraces.length; i++) {
|
||||
print(indent(stackTraces[i], 2));
|
||||
newline();
|
||||
}
|
||||
}
|
||||
function finished(elapsed) { newline();
|
||||
print("Finished in " + elapsed/1000 + " seconds"); }
|
||||
function summary(colorF, specs, expectations, failed) { newline();
|
||||
print(colorF(specs + " " + plural(language.spec, specs) + ", " +
|
||||
expectations + " " + plural(language.expectation, expectations) + ", " +
|
||||
failed + " " + plural(language.failure, failed)));
|
||||
newline();
|
||||
newline(); }
|
||||
function greenSummary(specs, expectations, failed){ summary(greenStr, specs, expectations, failed); }
|
||||
function redSummary(specs, expectations, failed){ summary(redStr, specs, expectations, failed); }
|
||||
|
||||
|
||||
|
||||
|
||||
doneCallback = doneCallback || function() {
|
||||
};
|
||||
|
||||
var defaultColumnsPerLine = 50,
|
||||
ansi = {
|
||||
green: '\033[32m',
|
||||
red: '\033[31m',
|
||||
yellow: '\033[33m',
|
||||
none: '\033[0m'
|
||||
},
|
||||
language = {
|
||||
spec: "spec",
|
||||
expectation: "expectation",
|
||||
failure: "failure"
|
||||
};
|
||||
|
||||
function coloredStr(color, str) {
|
||||
return ansi[color] + str + ansi.none;
|
||||
}
|
||||
|
||||
function greenStr(str) {
|
||||
return coloredStr("green", str);
|
||||
}
|
||||
|
||||
function redStr(str) {
|
||||
return coloredStr("red", str);
|
||||
}
|
||||
|
||||
function yellowStr(str) {
|
||||
return coloredStr("yellow", str);
|
||||
}
|
||||
|
||||
function newline() {
|
||||
print("\n");
|
||||
}
|
||||
|
||||
function started() {
|
||||
print("Started");
|
||||
newline();
|
||||
}
|
||||
|
||||
function greenDot() {
|
||||
print(greenStr("."));
|
||||
}
|
||||
|
||||
function redF() {
|
||||
print(redStr("F"));
|
||||
}
|
||||
|
||||
function yellowStar() {
|
||||
print(yellowStr("*"));
|
||||
}
|
||||
|
||||
function plural(str, count) {
|
||||
return count == 1 ? str : str + "s";
|
||||
}
|
||||
|
||||
function repeat(thing, times) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < times; i++) arr.push(thing);
|
||||
return arr;
|
||||
}
|
||||
|
||||
function indent(str, spaces) {
|
||||
var lines = (str || '').split("\n");
|
||||
var newArr = [];
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
newArr.push(repeat(" ", spaces).join("") + lines[i]);
|
||||
}
|
||||
return newArr.join("\n");
|
||||
}
|
||||
|
||||
function specFailureDetails(suiteDescription, specDescription, stackTraces) {
|
||||
newline();
|
||||
print(suiteDescription + " " + specDescription);
|
||||
newline();
|
||||
for (var i = 0; i < stackTraces.length; i++) {
|
||||
print(indent(stackTraces[i], 2));
|
||||
newline();
|
||||
}
|
||||
}
|
||||
|
||||
function finished(elapsed) {
|
||||
newline();
|
||||
print("Finished in " + elapsed / 1000 + " seconds");
|
||||
}
|
||||
|
||||
function summary(colorF, specs, expectations, failed) {
|
||||
newline();
|
||||
print(colorF(specs + " " + plural(language.spec, specs) + ", " +
|
||||
expectations + " " + plural(language.expectation, expectations) + ", " +
|
||||
failed + " " + plural(language.failure, failed)));
|
||||
newline();
|
||||
newline();
|
||||
}
|
||||
|
||||
function greenSummary(specs, expectations, failed) {
|
||||
summary(greenStr, specs, expectations, failed);
|
||||
}
|
||||
|
||||
function redSummary(specs, expectations, failed) {
|
||||
summary(redStr, specs, expectations, failed);
|
||||
}
|
||||
|
||||
function lineEnder(columnsPerLine) {
|
||||
var columnsSoFar = 0;
|
||||
return function() {
|
||||
@ -73,21 +119,24 @@ jasmine.TrivialConsoleReporter = function(print, doneCallback) {
|
||||
|
||||
function fullSuiteDescription(suite) {
|
||||
var fullDescription = suite.description;
|
||||
if (suite.parentSuite) fullDescription = fullSuiteDescription(suite.parentSuite) + " " + fullDescription ;
|
||||
if (suite.parentSuite) fullDescription = fullSuiteDescription(suite.parentSuite) + " " + fullDescription;
|
||||
return fullDescription;
|
||||
}
|
||||
|
||||
|
||||
var startNewLineIfNecessary = lineEnder(defaultColumnsPerLine);
|
||||
|
||||
this.now = function() { return new Date().getTime(); };
|
||||
|
||||
|
||||
this.now = function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
this.reportRunnerStarting = function() {
|
||||
this.runnerStartTime = this.now();
|
||||
started();
|
||||
};
|
||||
|
||||
this.reportSpecStarting = function() { /* do nothing */ };
|
||||
|
||||
|
||||
this.reportSpecStarting = function() { /* do nothing */
|
||||
};
|
||||
|
||||
this.reportSpecResults = function(spec) {
|
||||
var results = spec.results();
|
||||
if (results.skipped) {
|
||||
@ -96,49 +145,49 @@ jasmine.TrivialConsoleReporter = function(print, doneCallback) {
|
||||
greenDot();
|
||||
} else {
|
||||
redF();
|
||||
}
|
||||
startNewLineIfNecessary();
|
||||
}
|
||||
// startNewLineIfNecessary();
|
||||
};
|
||||
|
||||
|
||||
this.suiteResults = [];
|
||||
|
||||
|
||||
this.reportSuiteResults = function(suite) {
|
||||
var suiteResult = {
|
||||
description: fullSuiteDescription(suite),
|
||||
failedSpecResults: []
|
||||
};
|
||||
|
||||
suite.results().items_.forEach(function(spec){
|
||||
|
||||
suite.results().items_.forEach(function(spec) {
|
||||
if (spec.failedCount > 0 && spec.description) suiteResult.failedSpecResults.push(spec);
|
||||
});
|
||||
|
||||
|
||||
this.suiteResults.push(suiteResult);
|
||||
};
|
||||
|
||||
|
||||
function eachSpecFailure(suiteResults, callback) {
|
||||
for(var i=0; i<suiteResults.length; i++) {
|
||||
for (var i = 0; i < suiteResults.length; i++) {
|
||||
var suiteResult = suiteResults[i];
|
||||
for(var j=0; j<suiteResult.failedSpecResults.length; j++) {
|
||||
for (var j = 0; j < suiteResult.failedSpecResults.length; j++) {
|
||||
var failedSpecResult = suiteResult.failedSpecResults[j];
|
||||
var stackTraces = [];
|
||||
for(var k=0; k<failedSpecResult.items_.length; k++) stackTraces.push(failedSpecResult.items_[k].trace.stack);
|
||||
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) {
|
||||
newline();
|
||||
|
||||
|
||||
eachSpecFailure(this.suiteResults, function(suiteDescription, specDescription, stackTraces) {
|
||||
specFailureDetails(suiteDescription, specDescription, stackTraces);
|
||||
});
|
||||
|
||||
|
||||
finished(this.now() - this.runnerStartTime);
|
||||
|
||||
|
||||
var results = runner.results();
|
||||
var summaryFunction = results.failedCount === 0 ? greenSummary : redSummary;
|
||||
summaryFunction(results.items_.length, results.totalCount, results.failedCount);
|
||||
summaryFunction(runner.specs().length, results.totalCount, results.failedCount);
|
||||
doneCallback(runner);
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user