From c1d1d69be2416f3854b32017a792249715428cd8 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Mon, 19 Jul 2021 12:02:42 -0700 Subject: [PATCH] Fixed test failures in Chrome and Edge --- lib/jasmine-core/jasmine.js | 8 +++++--- src/core/base.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 06c35e71..8700ca69 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -267,6 +267,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { }; j$.isError_ = function(value) { + if (!value) { + return false; + } + if (value instanceof Error) { return true; } @@ -275,9 +279,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { typeof window.trustedTypes !== 'undefined' ) { return ( - value && - typeof value.stack === 'string' && - typeof value.message === 'string' + typeof value.stack === 'string' && typeof value.message === 'string' ); } if (value && value.constructor && value.constructor.constructor) { diff --git a/src/core/base.js b/src/core/base.js index 1d31d89d..89cd2b6e 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -99,6 +99,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { }; j$.isError_ = function(value) { + if (!value) { + return false; + } + if (value instanceof Error) { return true; } @@ -107,9 +111,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { typeof window.trustedTypes !== 'undefined' ) { return ( - value && - typeof value.stack === 'string' && - typeof value.message === 'string' + typeof value.stack === 'string' && typeof value.message === 'string' ); } if (value && value.constructor && value.constructor.constructor) {