Updating NPM dependencies
This commit is contained in:
90
node_modules/jest-environment-node/build/index.js
generated
vendored
90
node_modules/jest-environment-node/build/index.js
generated
vendored
@@ -1,29 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
function _vm() {
|
||||
const data = _interopRequireDefault(require('vm'));
|
||||
const data = require('vm');
|
||||
|
||||
_vm = function _vm() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestMock() {
|
||||
const data = require('jest-mock');
|
||||
|
||||
_jestMock = function _jestMock() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function _jestUtil() {
|
||||
_vm = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -33,15 +13,31 @@ function _jestUtil() {
|
||||
function _fakeTimers() {
|
||||
const data = require('@jest/fake-timers');
|
||||
|
||||
_fakeTimers = function _fakeTimers() {
|
||||
_fakeTimers = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
function _jestMock() {
|
||||
const data = require('jest-mock');
|
||||
|
||||
_jestMock = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
@@ -64,26 +60,29 @@ class NodeEnvironment {
|
||||
|
||||
_defineProperty(this, 'fakeTimers', void 0);
|
||||
|
||||
_defineProperty(this, 'fakeTimersModern', void 0);
|
||||
|
||||
_defineProperty(this, 'global', void 0);
|
||||
|
||||
_defineProperty(this, 'moduleMocker', void 0);
|
||||
|
||||
this.context = _vm().default.createContext();
|
||||
|
||||
const global = (this.global = _vm().default.runInContext(
|
||||
this.context = (0, _vm().createContext)();
|
||||
const global = (this.global = (0, _vm().runInContext)(
|
||||
'this',
|
||||
Object.assign(this.context, config.testEnvironmentOptions)
|
||||
));
|
||||
|
||||
global.global = global;
|
||||
global.clearInterval = clearInterval;
|
||||
global.clearTimeout = clearTimeout;
|
||||
global.setInterval = setInterval;
|
||||
global.setTimeout = setTimeout;
|
||||
global.ArrayBuffer = ArrayBuffer; // URL and URLSearchParams are global in Node >= 10
|
||||
global.ArrayBuffer = ArrayBuffer; // TextEncoder (global or via 'util') references a Uint8Array constructor
|
||||
// different than the global one used by users in tests. This makes sure the
|
||||
// same constructor is referenced by both.
|
||||
|
||||
global.Uint8Array = Uint8Array; // URL and URLSearchParams are global in Node >= 10
|
||||
|
||||
if (typeof URL !== 'undefined' && typeof URLSearchParams !== 'undefined') {
|
||||
/* global URL, URLSearchParams */
|
||||
global.URL = URL;
|
||||
global.URLSearchParams = URLSearchParams;
|
||||
} // TextDecoder and TextDecoder are global in Node >= 11
|
||||
@@ -92,13 +91,16 @@ class NodeEnvironment {
|
||||
typeof TextEncoder !== 'undefined' &&
|
||||
typeof TextDecoder !== 'undefined'
|
||||
) {
|
||||
/* global TextEncoder, TextDecoder */
|
||||
global.TextEncoder = TextEncoder;
|
||||
global.TextDecoder = TextDecoder;
|
||||
} // queueMicrotask is global in Node >= 11
|
||||
|
||||
if (typeof queueMicrotask !== 'undefined') {
|
||||
global.queueMicrotask = queueMicrotask;
|
||||
}
|
||||
|
||||
(0, _jestUtil().installCommonGlobals)(global, config.globals);
|
||||
this.moduleMocker = new (_jestMock()).ModuleMocker(global);
|
||||
this.moduleMocker = new (_jestMock().ModuleMocker)(global);
|
||||
|
||||
const timerIdToRef = id => ({
|
||||
id,
|
||||
@@ -118,26 +120,32 @@ class NodeEnvironment {
|
||||
idToRef: timerIdToRef,
|
||||
refToId: timerRefToId
|
||||
};
|
||||
this.fakeTimers = new (_fakeTimers()).JestFakeTimers({
|
||||
this.fakeTimers = new (_fakeTimers().LegacyFakeTimers)({
|
||||
config,
|
||||
global,
|
||||
moduleMocker: this.moduleMocker,
|
||||
timerConfig
|
||||
});
|
||||
this.fakeTimersModern = new (_fakeTimers().ModernFakeTimers)({
|
||||
config,
|
||||
global
|
||||
});
|
||||
}
|
||||
|
||||
setup() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
async setup() {}
|
||||
|
||||
teardown() {
|
||||
async teardown() {
|
||||
if (this.fakeTimers) {
|
||||
this.fakeTimers.dispose();
|
||||
}
|
||||
|
||||
if (this.fakeTimersModern) {
|
||||
this.fakeTimersModern.dispose();
|
||||
}
|
||||
|
||||
this.context = null;
|
||||
this.fakeTimers = null;
|
||||
return Promise.resolve();
|
||||
this.fakeTimersModern = null;
|
||||
} // TS infers the return type to be `any`, since that's what `runInContext`
|
||||
// returns.
|
||||
|
||||
@@ -148,6 +156,10 @@ class NodeEnvironment {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
getVmContext() {
|
||||
return this.context;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NodeEnvironment;
|
||||
|
||||
Reference in New Issue
Block a user