Prevent GloablErrors from being monkey patched
All current shipped versions of zone.js contain a monkey patch that fails to pass constructor arguments on to GlobalErrors. That would crash Jasmine if it was applied early enough to have any effect. See <https://github.com/angular/angular/issues/63072>.
This commit is contained in:
@@ -90,7 +90,19 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
||||
j$.NullDiffBuilder = jRequire.NullDiffBuilder(j$);
|
||||
j$.ObjectPath = jRequire.ObjectPath(j$);
|
||||
j$.MismatchTree = jRequire.MismatchTree(j$);
|
||||
j$.GlobalErrors = jRequire.GlobalErrors(j$);
|
||||
|
||||
// zone.js tries to monkey patch GlobalErrors in a way that is either a
|
||||
// no-op or causes Jasmine to crash, depending on whether it's done before
|
||||
// or after env creation. Prevent that.
|
||||
const GlobalErrors = jRequire.GlobalErrors(j$);
|
||||
Object.defineProperty(j$, 'GlobalErrors', {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get() {
|
||||
return GlobalErrors;
|
||||
},
|
||||
set() {}
|
||||
});
|
||||
|
||||
j$.Truthy = jRequire.Truthy(j$);
|
||||
j$.Falsy = jRequire.Falsy(j$);
|
||||
|
||||
Reference in New Issue
Block a user