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) {