failing spec makes a red dot
This commit is contained in:
parent
528b5abeda
commit
945a9ba638
|
@ -1,13 +1,13 @@
|
||||||
describe("TrivialNodeReporter", function() {
|
describe("TrivialNodeReporter", function() {
|
||||||
|
|
||||||
|
|
||||||
var green = function(str) {
|
function green(str) {
|
||||||
return '\033[32m' + str + '\033[0m'; //keep these literal. otherwise the test loses value as a test.
|
return '\033[32m' + str + '\033[0m'; //keep these literal. otherwise the test loses value as a test.
|
||||||
};
|
}
|
||||||
|
|
||||||
var red = function(str) {
|
function red(str) {
|
||||||
return '\033[31m' + str + '\033[0m';
|
return '\033[31m' + str + '\033[0m';
|
||||||
};
|
}
|
||||||
|
|
||||||
var newline = "\n";
|
var newline = "\n";
|
||||||
|
|
||||||
|
@ -63,6 +63,19 @@ describe("TrivialNodeReporter", function() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("prints a red dot if the spec fails", function(){
|
||||||
|
var failingSpec = {
|
||||||
|
results: function(){
|
||||||
|
return {passed:function(){return false;}};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.reporter.reportSpecResults(failingSpec);
|
||||||
|
|
||||||
|
expect(this.fakeSys.getOutput()).toEqual(
|
||||||
|
red(".")
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,11 +35,16 @@ jasmine.TrivialNodeReporter.prototype._greenStr = function(str) { return this._c
|
||||||
jasmine.TrivialNodeReporter.prototype._redStr = function(str) { return this._coloredStr("red", str); };
|
jasmine.TrivialNodeReporter.prototype._redStr = function(str) { return this._coloredStr("red", str); };
|
||||||
jasmine.TrivialNodeReporter.prototype._yellowStr = function(str) { return this._coloredStr("yellow", str); };
|
jasmine.TrivialNodeReporter.prototype._yellowStr = function(str) { return this._coloredStr("yellow", str); };
|
||||||
|
|
||||||
|
jasmine.TrivialNodeReporter.prototype._redDot = function(str) { return this.sys.print(this._redStr(".")); };
|
||||||
jasmine.TrivialNodeReporter.prototype._greenDot = function(str) { return this.sys.print(this._greenStr(".")); };
|
jasmine.TrivialNodeReporter.prototype._greenDot = function(str) { return this.sys.print(this._greenStr(".")); };
|
||||||
jasmine.TrivialNodeReporter.prototype._newLine = function(str) { return this.sys.print("\n"); };
|
jasmine.TrivialNodeReporter.prototype._newLine = function(str) { return this.sys.print("\n"); };
|
||||||
|
|
||||||
jasmine.TrivialNodeReporter.prototype.reportSpecResults = function(spec) {
|
jasmine.TrivialNodeReporter.prototype.reportSpecResults = function(spec) {
|
||||||
if (spec.results().passed()) this._greenDot();
|
if (spec.results().passed()) {
|
||||||
|
this._greenDot();
|
||||||
|
} else {
|
||||||
|
this._redDot();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue