print started when the test run starts

This commit is contained in:
Steve Conover 2011-02-28 14:56:09 -08:00
parent c485c33a3c
commit e6a080039f
2 changed files with 20 additions and 20 deletions

View File

@ -39,6 +39,16 @@ describe("TrivialNodeReporter", function() {
describe('A Test Run', function(){ describe('A Test Run', function(){
describe('Starts', function(){
it("prints Started", function(){
this.reporter.reportRunnerStarting();
expect(this.fakeSys.getOutput()).toEqual(
"Started" + newline
);
});
});
describe('A spec runs', function(){ describe('A spec runs', function(){
it("prints a green dot if the spec passes", function(){ it("prints a green dot if the spec passes", function(){
this.reporter.reportSpecResults(passingSpec); this.reporter.reportSpecResults(passingSpec);
@ -66,7 +76,7 @@ describe("TrivialNodeReporter", function() {
}); });
describe('many specs run', function(){ describe('Many specs run', function(){
it("starts a new line every 50 specs", function(){ it("starts a new line every 50 specs", function(){
var self = this; var self = this;
repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 49); repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 49);

View File

@ -15,10 +15,13 @@ jasmine.TrivialNodeReporter = function(sys) {
function redStr(str) { return coloredStr("red", str); } function redStr(str) { return coloredStr("red", str); }
function yellowStr(str) { return coloredStr("yellow", str); } function yellowStr(str) { return coloredStr("yellow", str); }
function newline() { sys.print("\n"); }
function started() { sys.print("Started"); newline(); }
function greenDot() { sys.print(greenStr(".")); } function greenDot() { sys.print(greenStr(".")); }
function redF() { sys.print(redStr("F")); } function redF() { sys.print(redStr("F")); }
function yellowStar() { sys.print(yellowStr("*")); } function yellowStar() { sys.print(yellowStr("*")); }
function newline() { sys.print("\n"); }
function lineEnder(columnsPerLine) { function lineEnder(columnsPerLine) {
@ -34,6 +37,10 @@ jasmine.TrivialNodeReporter = function(sys) {
var startNewLineIfNecessary = lineEnder(defaultColumnsPerLine); var startNewLineIfNecessary = lineEnder(defaultColumnsPerLine);
this.reportRunnerStarting = function() {
started();
};
this.reportSpecResults = function(spec) { this.reportSpecResults = function(spec) {
var results = spec.results(); var results = spec.results();
if (results.skipped) { if (results.skipped) {
@ -46,20 +53,3 @@ jasmine.TrivialNodeReporter = function(sys) {
startNewLineIfNecessary(); startNewLineIfNecessary();
}; };
}; };
// reportSpecResults: function(spec) {
// var result = spec.results();
// var msg = '';
// if (result.passed())
// {
// msg = (colors) ? (ansi.green + '.' + ansi.none) : '.';
// // } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec?
// // msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*';
// } else {
// msg = (colors) ? (ansi.red + 'F' + ansi.none) : 'F';
// }
// sys.print(msg);
// if (columnCounter++ < 50) return;
// columnCounter = 0;
// sys.print('\n');
// },