This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

View File

@@ -862,12 +862,10 @@ class Runtime {
process.exitCode = 1;
return;
}
} //Wrapper
const wrapper =
runScript[_transform().ScriptTransformer.EVAL_RESULT_VARIABLE];
const moduleArguments = new Set([
runScript[_transform().ScriptTransformer.EVAL_RESULT_VARIABLE].call(
localModule.exports,
localModule, // module object
localModule.exports, // module exports
localModule.require, // require implementation
@@ -884,8 +882,8 @@ class Runtime {
`You have requested '${globalVariable}' as a global variable, but it was not present. Please check your config or your global environment.`
);
})
]);
wrapper.call(localModule.exports, ...Array.from(moduleArguments));
);
this._isCurrentlyExecutingManualMock = origCurrExecutingManualMock;
this._currentlyExecutingModulePath = lastExecutingModulePath;
}
@@ -906,7 +904,8 @@ class Runtime {
if (!(modulePath in this._mockMetaDataCache)) {
// This allows us to handle circular dependencies while generating an
// automock
this._mockMetaDataCache[modulePath] = this._moduleMocker.getMetadata({}); // In order to avoid it being possible for automocking to potentially
this._mockMetaDataCache[modulePath] =
this._moduleMocker.getMetadata({}) || {}; // In order to avoid it being possible for automocking to potentially
// cause side-effects within the module environment, we need to execute
// the module in isolation. This could cause issues if the module being
// mocked has calls into side-effectful APIs on another module.
@@ -1170,6 +1169,8 @@ class Runtime {
this._environment.global.jasmine.addMatchers(matchers),
advanceTimersByTime: msToRun =>
_getFakeTimers().advanceTimersByTime(msToRun),
advanceTimersToNextTimer: steps =>
_getFakeTimers().advanceTimersToNextTimer(steps),
autoMockOff: disableAutomock,
autoMockOn: enableAutomock,
clearAllMocks,