diff --git a/jasmine.iws b/jasmine.iws index fc12122..d60ba1d 100644 --- a/jasmine.iws +++ b/jasmine.iws @@ -92,7 +92,7 @@ - + @@ -101,16 +101,16 @@ - + - + - + @@ -137,7 +137,7 @@ - + @@ -534,6 +534,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -541,27 +562,6 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/jasmine.js b/lib/jasmine.js index dadd2ab..9b8854f 100755 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -204,8 +204,7 @@ var it = function (description, func) { finishCallback: function () { if (Jasmine.reporter) { - Jasmine.reporter.addSpecResults(that.results); - Jasmine.reporter.report(); + Jasmine.reporter.reportSpecResults(that.results); } }, @@ -278,6 +277,12 @@ var describe = function (description, spec_definitions) { that.results.description = description; + that.finishCallback = function () { + if (Jasmine.reporter) { + Jasmine.reporter.reportSuiteResults(that.results); + } + } + return that; } @@ -289,8 +294,7 @@ var Runner = function () { that.finishCallback = function () { if (that.reporter) { - that.reporter.addResults(that.results); - that.reporter.report(); + that.reporter.reportRunnerResults(that.results); } } @@ -309,16 +313,12 @@ JasmineReporters.reporter = function (elementId) { element: document.getElementById(elementId), output: '', - addResults: function (results) { that.output = ''; }, + reportRunnerResults: function (results) { that.output += ''; }, - addSpecResults: function (results) { that.output = ''; }, + reportSuiteResults: function (results) { that.output += ''; }, + + reportSpecResults: function (results) { that.output += ''; }, - report: function () { - if (that.element) { - that.element.innerHTML += that.output; - } - return that.output; - } } // TODO: throw if no element? diff --git a/lib/json_reporter.js b/lib/json_reporter.js index b38baf5..58d0338 100644 --- a/lib/json_reporter.js +++ b/lib/json_reporter.js @@ -1,9 +1,13 @@ JasmineReporters.JSON = function (elementId) { var that = JasmineReporters.reporter(elementId); - that.addResults = function (results) { + that.reportRunnerResults = function (results) { that.output = Object.toJSON(results); - } + + if (that.element) { + that.element.innerHTML += that.output; + } + } return that; } @@ -11,9 +15,13 @@ JasmineReporters.JSON = function (elementId) { JasmineReporters.IncrementalJSON = function (elementId) { var that = JasmineReporters.reporter(elementId); - that.addSpecResults = function (results) { + that.reportSpecResults = function (results) { that.output = Object.toJSON(results); + if (that.element) { + that.element.innerHTML += that.output; + } } return that; -} \ No newline at end of file +} +