From e6a080039fa4ae42a83600904c00ef8df189e87c Mon Sep 17 00:00:00 2001 From: Steve Conover Date: Mon, 28 Feb 2011 14:56:09 -0800 Subject: [PATCH] print started when the test run starts --- spec/suites/TrivialNodeReporterSpec.js | 12 ++++++++++- src/node/TrivialNodeReporter.js | 28 +++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spec/suites/TrivialNodeReporterSpec.js b/spec/suites/TrivialNodeReporterSpec.js index fdf06aa..9967b07 100644 --- a/spec/suites/TrivialNodeReporterSpec.js +++ b/spec/suites/TrivialNodeReporterSpec.js @@ -38,6 +38,16 @@ describe("TrivialNodeReporter", 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(){ it("prints a green dot if the spec passes", function(){ @@ -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(){ var self = this; repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 49); diff --git a/src/node/TrivialNodeReporter.js b/src/node/TrivialNodeReporter.js index ecae461..4182530 100644 --- a/src/node/TrivialNodeReporter.js +++ b/src/node/TrivialNodeReporter.js @@ -15,10 +15,13 @@ jasmine.TrivialNodeReporter = function(sys) { function redStr(str) { return coloredStr("red", 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 redF() { sys.print(redStr("F")); } function yellowStar() { sys.print(yellowStr("*")); } - function newline() { sys.print("\n"); } + + function lineEnder(columnsPerLine) { @@ -34,6 +37,10 @@ jasmine.TrivialNodeReporter = function(sys) { var startNewLineIfNecessary = lineEnder(defaultColumnsPerLine); + this.reportRunnerStarting = function() { + started(); + }; + this.reportSpecResults = function(spec) { var results = spec.results(); if (results.skipped) { @@ -45,21 +52,4 @@ jasmine.TrivialNodeReporter = function(sys) { } 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'); -// }, +}; \ No newline at end of file