diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index 3f1ecddd..898108b7 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -101,7 +101,7 @@ jasmineRequire.HtmlReporter = function(j$) { var failures = []; this.specDone = function(result) { - if(noExpectations(result) && console && console.error) { + if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') { console.error('Spec \'' + result.fullName + '\' has no expectations.'); } diff --git a/spec/core/JsApiReporterSpec.js b/spec/core/JsApiReporterSpec.js index 557343b1..3c382a04 100644 --- a/spec/core/JsApiReporterSpec.js +++ b/spec/core/JsApiReporterSpec.js @@ -200,6 +200,10 @@ describe("JsApiReporter", function() { reporter.suiteDone(suiteResult2); }); + it('should not include suite starts', function(){ + expect(reporter.suiteResults(0,3).length).toEqual(2); + }); + it("should return a slice of results", function() { expect(reporter.suiteResults(0, 1)).toEqual([suiteResult1]); expect(reporter.suiteResults(1, 1)).toEqual([suiteResult2]); diff --git a/spec/html/HtmlReporterSpec.js b/spec/html/HtmlReporterSpec.js index 7cb2bfd8..b4f9756e 100644 --- a/spec/html/HtmlReporterSpec.js +++ b/spec/html/HtmlReporterSpec.js @@ -65,8 +65,8 @@ describe("New HtmlReporter", function() { describe("when a spec is done", function() { it("logs errors to the console and prints a special symbol if it is an empty spec", function() { - if (!window.console) { - window.console = { error: function(){} }; + if (typeof console === "undefined") { + console = { error: function(){} }; } var env = new j$.Env(), diff --git a/src/html/HtmlReporter.js b/src/html/HtmlReporter.js index dc91d7f0..990cdbe0 100644 --- a/src/html/HtmlReporter.js +++ b/src/html/HtmlReporter.js @@ -72,7 +72,7 @@ jasmineRequire.HtmlReporter = function(j$) { var failures = []; this.specDone = function(result) { - if(noExpectations(result) && console && console.error) { + if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') { console.error('Spec \'' + result.fullName + '\' has no expectations.'); }