Use globalThis to determine the global object during initialization
This slightly simplifies the init code and hardens Jasmine against broken bundlers that assume everything can be wrapped in a "use strict" context. This removes a workaround for incompatible `this` behavior in GJS. GJS was never a supported envronment, but in any case the change is unlikely to cause problems since GJS ha supported globalThis since 2020.
This commit is contained in:
@@ -32,20 +32,10 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
|||||||
module.exports &&
|
module.exports &&
|
||||||
typeof exports !== 'undefined'
|
typeof exports !== 'undefined'
|
||||||
) {
|
) {
|
||||||
if (typeof global !== 'undefined') {
|
// Node
|
||||||
jasmineGlobal = global;
|
|
||||||
} else {
|
|
||||||
jasmineGlobal = {};
|
|
||||||
}
|
|
||||||
jasmineRequire = exports;
|
jasmineRequire = exports;
|
||||||
} else {
|
} else {
|
||||||
if (
|
// Browser
|
||||||
typeof window !== 'undefined' &&
|
|
||||||
typeof window.toString === 'function' &&
|
|
||||||
window.toString() === '[object GjsGlobal]'
|
|
||||||
) {
|
|
||||||
jasmineGlobal = window;
|
|
||||||
}
|
|
||||||
jasmineRequire = jasmineGlobal.jasmineRequire = {};
|
jasmineRequire = jasmineGlobal.jasmineRequire = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +46,7 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
|||||||
getJasmineRequire().core = function(jRequire) {
|
getJasmineRequire().core = function(jRequire) {
|
||||||
const j$ = { private: {} };
|
const j$ = { private: {} };
|
||||||
|
|
||||||
jRequire.base(j$, jasmineGlobal);
|
jRequire.base(j$, globalThis);
|
||||||
j$.private.util = jRequire.util(j$);
|
j$.private.util = jRequire.util(j$);
|
||||||
j$.private.errors = jRequire.errors();
|
j$.private.errors = jRequire.errors();
|
||||||
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
|
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
|
||||||
|
|||||||
@@ -8,20 +8,10 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
|||||||
module.exports &&
|
module.exports &&
|
||||||
typeof exports !== 'undefined'
|
typeof exports !== 'undefined'
|
||||||
) {
|
) {
|
||||||
if (typeof global !== 'undefined') {
|
// Node
|
||||||
jasmineGlobal = global;
|
|
||||||
} else {
|
|
||||||
jasmineGlobal = {};
|
|
||||||
}
|
|
||||||
jasmineRequire = exports;
|
jasmineRequire = exports;
|
||||||
} else {
|
} else {
|
||||||
if (
|
// Browser
|
||||||
typeof window !== 'undefined' &&
|
|
||||||
typeof window.toString === 'function' &&
|
|
||||||
window.toString() === '[object GjsGlobal]'
|
|
||||||
) {
|
|
||||||
jasmineGlobal = window;
|
|
||||||
}
|
|
||||||
jasmineRequire = jasmineGlobal.jasmineRequire = {};
|
jasmineRequire = jasmineGlobal.jasmineRequire = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +22,7 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
|||||||
getJasmineRequire().core = function(jRequire) {
|
getJasmineRequire().core = function(jRequire) {
|
||||||
const j$ = { private: {} };
|
const j$ = { private: {} };
|
||||||
|
|
||||||
jRequire.base(j$, jasmineGlobal);
|
jRequire.base(j$, globalThis);
|
||||||
j$.private.util = jRequire.util(j$);
|
j$.private.util = jRequire.util(j$);
|
||||||
j$.private.errors = jRequire.errors();
|
j$.private.errors = jRequire.errors();
|
||||||
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
|
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
|
||||||
|
|||||||
Reference in New Issue
Block a user