diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index 50b249f5..cc5a44e5 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -2018,65 +2018,61 @@ describe("Env integration", function() { env.execute(); }); - describe("In a browser", function() { - if (typeof document !== 'undefined') { - it('reports errors that occur during loading', function(done) { - var global = { - setTimeout: function(fn, delay) { setTimeout(fn, delay) }, - clearTimeout: function(fn, delay) { clearTimeout(fn, delay) }, - }; - spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global); + it('reports errors that occur during loading', function(done) { + var global = { + setTimeout: function(fn, delay) { setTimeout(fn, delay) }, + clearTimeout: function(fn, delay) { clearTimeout(fn, delay) }, + }; + spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global); - var env = new jasmineUnderTest.Env(), - reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']); + var env = new jasmineUnderTest.Env(), + reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']); - reporter.jasmineDone.and.callFake(function(e) { - expect(e.failedExpectations).toEqual([ - { - passed: false, - globalErrorType: 'load', - message: 'Uncaught SyntaxError: Unexpected end of input' - }, - { - passed: false, - globalErrorType: 'load', - message: 'Uncaught Error: ENOCHEESE' - } - ]); + reporter.jasmineDone.and.callFake(function(e) { + expect(e.failedExpectations).toEqual([ + { + passed: false, + globalErrorType: 'load', + message: 'Uncaught SyntaxError: Unexpected end of input' + }, + { + passed: false, + globalErrorType: 'load', + message: 'Uncaught Error: ENOCHEESE' + } + ]); - done(); - }); + done(); + }); - env.addReporter(reporter); - global.onerror('Uncaught SyntaxError: Unexpected end of input'); - global.onerror('Uncaught Error: ENOCHEESE'); + env.addReporter(reporter); + global.onerror('Uncaught SyntaxError: Unexpected end of input'); + global.onerror('Uncaught Error: ENOCHEESE'); - env.execute(); + env.execute(); + }); + + describe('If suppressLoadErrors was called', function() { + it('does not report errors that occur during loading', function(done) { + var global = { + setTimeout: function(fn, delay) { setTimeout(fn, delay) }, + clearTimeout: function(fn, delay) { clearTimeout(fn, delay) }, + }; + spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global); + + var env = new jasmineUnderTest.Env(), + reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']); + + reporter.jasmineDone.and.callFake(function(e) { + expect(e.failedExpectations).toEqual([]); + done(); }); - } - describe('If suppressLoadErrors was called', function() { - it('does not report errors that occur during loading', function(done) { - var global = { - setTimeout: function(fn, delay) { setTimeout(fn, delay) }, - clearTimeout: function(fn, delay) { clearTimeout(fn, delay) }, - }; - spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global); + env.addReporter(reporter); + env.suppressLoadErrors(true); + global.onerror('Uncaught Error: ENOCHEESE'); - var env = new jasmineUnderTest.Env(), - reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']); - - reporter.jasmineDone.and.callFake(function(e) { - expect(e.failedExpectations).toEqual([]); - done(); - }); - - env.addReporter(reporter); - env.suppressLoadErrors(true); - global.onerror('Uncaught Error: ENOCHEESE'); - - env.execute(); - }); + env.execute(); }); }); });