From fd5b9ce1aebf9e71107e5c07a71c776c01da0775 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Mon, 20 Jan 2020 11:40:26 -0800 Subject: [PATCH] Fixed spec failure in IE --- spec/core/GlobalErrorsSpec.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spec/core/GlobalErrorsSpec.js b/spec/core/GlobalErrorsSpec.js index 16ca8371..3effa537 100644 --- a/spec/core/GlobalErrorsSpec.js +++ b/spec/core/GlobalErrorsSpec.js @@ -249,11 +249,18 @@ describe('GlobalErrors', function() { errors.pushListener(handler); var addedListener = fakeGlobal.addEventListener.calls.argsFor(0)[1]; - var reason = new Error('bar'); + var reason; + + try { + // Throwing ensures that we get a stack property in all browsers + throw new Error('bar'); + } catch (e) { + reason = e; + } + addedListener({ reason: reason }); - var expectedError = Object.create(reason); - expectedError.jasmineMessage = expect(handler).toHaveBeenCalledWith( + expect(handler).toHaveBeenCalledWith( jasmine.objectContaining({ jasmineMessage: 'Unhandled promise rejection: Error: bar', message: reason.message,