From 882c28719118c0079c1d7945790bfc3061c650bb Mon Sep 17 00:00:00 2001 From: Steve Conover Date: Mon, 28 Feb 2011 16:50:54 -0800 Subject: [PATCH] specs/assertions/failures --- spec/suites/TrivialNodeReporterSpec.js | 141 ++++++++++++++----------- src/node/TrivialNodeReporter.js | 33 +++--- 2 files changed, 97 insertions(+), 77 deletions(-) diff --git a/spec/suites/TrivialNodeReporterSpec.js b/spec/suites/TrivialNodeReporterSpec.js index 7c42ce7..f159a87 100644 --- a/spec/suites/TrivialNodeReporterSpec.js +++ b/spec/suites/TrivialNodeReporterSpec.js @@ -11,11 +11,11 @@ describe("TrivialNodeReporter", function() { var newline = "\n"; - 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}; } }, - failingRun = { results: function(){ return {failedCount: 7}; } }; + 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, specs: function(){return [null, null, null];}}; } }, + failingRun = { results: function(){ return {failedCount: 7, specs: function(){return [null, null, null];}}; } }; function repeatedlyInvoke(f, times) { for(var i=0; i 0 && spec.description) suiteResult.failedSpecResults.push(spec) + if (spec.failedCount > 0 && spec.description) suiteResult.failedSpecResults.push(spec); }); - this.suiteResults.push(suiteResult) + this.suiteResults.push(suiteResult); }; this.reportRunnerResults = function(runner) { - var elapsed = this.now() - this.runnerStartTime; + finished(this.now() - this.runnerStartTime); - if (runner.results().failedCount === 0) { - greenFinished(elapsed); + var results = runner.results(); + if (results.failedCount === 0) { + greenSummary(results.specs().length, results.totalCount, results.failedCount); } else { - redFinished(elapsed); + redSummary(results.specs().length, results.totalCount, results.failedCount); } }; }; \ No newline at end of file