From c8cd2eabe583eec017e6a7dd01c38521c6687f65 Mon Sep 17 00:00:00 2001 From: Gerg Date: Thu, 9 Oct 2014 00:41:17 -0700 Subject: [PATCH] Fixes console check for IE8 - Was causing IE8 to hang for some reason - Also reverts previous commit, not that issue was resolved [#79533268][fixes #80356450] --- lib/jasmine-core/jasmine-html.js | 2 +- spec/core/JsApiReporterSpec.js | 4 ++++ spec/html/HtmlReporterSpec.js | 4 ++-- src/html/HtmlReporter.js | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) 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.'); }