Updating NPM dependencies
This commit is contained in:
213
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js
generated
vendored
213
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js
generated
vendored
@@ -1,133 +1,125 @@
|
||||
'use strict';
|
||||
|
||||
var _path = _interopRequireDefault(require('path'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
|
||||
function _asyncToGenerator(fn) {
|
||||
return function() {
|
||||
var self = this,
|
||||
args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
};
|
||||
}
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const FRAMEWORK_INITIALIZER = require.resolve('./jestAdapterInit');
|
||||
|
||||
const jestAdapter =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref = _asyncToGenerator(function*(
|
||||
globalConfig,
|
||||
config,
|
||||
environment,
|
||||
runtime,
|
||||
testPath
|
||||
) {
|
||||
const _runtime$requireInter = runtime.requireInternalModule(
|
||||
FRAMEWORK_INITIALIZER
|
||||
),
|
||||
initialize = _runtime$requireInter.initialize,
|
||||
runAndTransformResultsToJestFormat =
|
||||
_runtime$requireInter.runAndTransformResultsToJestFormat;
|
||||
const jestAdapter = async (
|
||||
globalConfig,
|
||||
config,
|
||||
environment,
|
||||
runtime,
|
||||
testPath,
|
||||
sendMessageToJest
|
||||
) => {
|
||||
var _runtime$setGlobalsFo, _runtime$unstable_sho2;
|
||||
|
||||
runtime
|
||||
.requireInternalModule(
|
||||
_path.default.resolve(__dirname, './jestExpect.js')
|
||||
)
|
||||
.default({
|
||||
expand: globalConfig.expand
|
||||
});
|
||||
const {
|
||||
initialize,
|
||||
runAndTransformResultsToJestFormat
|
||||
} = runtime.requireInternalModule(FRAMEWORK_INITIALIZER);
|
||||
|
||||
const getPrettier = () =>
|
||||
config.prettierPath ? require(config.prettierPath) : null;
|
||||
const getPrettier = () =>
|
||||
config.prettierPath ? require(config.prettierPath) : null;
|
||||
|
||||
const getBabelTraverse = () => require('@babel/traverse').default;
|
||||
const getBabelTraverse = () => require('@babel/traverse').default;
|
||||
|
||||
const _initialize = initialize({
|
||||
config,
|
||||
environment,
|
||||
getBabelTraverse,
|
||||
getPrettier,
|
||||
globalConfig,
|
||||
localRequire: runtime.requireModule.bind(runtime),
|
||||
parentProcess: process,
|
||||
testPath
|
||||
}),
|
||||
globals = _initialize.globals,
|
||||
snapshotState = _initialize.snapshotState;
|
||||
const {globals, snapshotState} = await initialize({
|
||||
config,
|
||||
environment,
|
||||
getBabelTraverse,
|
||||
getPrettier,
|
||||
globalConfig,
|
||||
localRequire: runtime.requireModule.bind(runtime),
|
||||
parentProcess: process,
|
||||
sendMessageToJest,
|
||||
setGlobalsForRuntime:
|
||||
(_runtime$setGlobalsFo = runtime.setGlobalsForRuntime) === null ||
|
||||
_runtime$setGlobalsFo === void 0
|
||||
? void 0
|
||||
: _runtime$setGlobalsFo.bind(runtime),
|
||||
testPath
|
||||
});
|
||||
|
||||
if (config.timers === 'fake' || config.timers === 'legacy') {
|
||||
// during setup, this cannot be null (and it's fine to explode if it is)
|
||||
environment.fakeTimers.useFakeTimers();
|
||||
} else if (config.timers === 'modern') {
|
||||
environment.fakeTimersModern.useFakeTimers();
|
||||
}
|
||||
|
||||
globals.beforeEach(() => {
|
||||
if (config.resetModules) {
|
||||
runtime.resetModules();
|
||||
}
|
||||
|
||||
if (config.clearMocks) {
|
||||
runtime.clearAllMocks();
|
||||
}
|
||||
|
||||
if (config.resetMocks) {
|
||||
runtime.resetAllMocks();
|
||||
|
||||
if (config.timers === 'fake') {
|
||||
// during setup, this cannot be null (and it's fine to explode if it is)
|
||||
environment.fakeTimers.useFakeTimers();
|
||||
}
|
||||
}
|
||||
|
||||
globals.beforeEach(() => {
|
||||
if (config.resetModules) {
|
||||
runtime.resetModules();
|
||||
}
|
||||
if (config.restoreMocks) {
|
||||
runtime.restoreAllMocks();
|
||||
}
|
||||
});
|
||||
|
||||
if (config.clearMocks) {
|
||||
runtime.clearAllMocks();
|
||||
}
|
||||
for (const path of config.setupFilesAfterEnv) {
|
||||
var _runtime$unstable_sho;
|
||||
|
||||
if (config.resetMocks) {
|
||||
runtime.resetAllMocks();
|
||||
// TODO: remove ? in Jest 26
|
||||
const esm =
|
||||
(_runtime$unstable_sho = runtime.unstable_shouldLoadAsEsm) === null ||
|
||||
_runtime$unstable_sho === void 0
|
||||
? void 0
|
||||
: _runtime$unstable_sho.call(runtime, path);
|
||||
|
||||
if (config.timers === 'fake') {
|
||||
// during setup, this cannot be null (and it's fine to explode if it is)
|
||||
environment.fakeTimers.useFakeTimers();
|
||||
}
|
||||
}
|
||||
if (esm) {
|
||||
await runtime.unstable_importModule(path);
|
||||
} else {
|
||||
runtime.requireModule(path);
|
||||
}
|
||||
} // TODO: remove ? in Jest 26
|
||||
|
||||
if (config.restoreMocks) {
|
||||
runtime.restoreAllMocks();
|
||||
}
|
||||
});
|
||||
config.setupFilesAfterEnv.forEach(path => runtime.requireModule(path));
|
||||
runtime.requireModule(testPath);
|
||||
const results = yield runAndTransformResultsToJestFormat({
|
||||
config,
|
||||
globalConfig,
|
||||
testPath
|
||||
});
|
||||
return _addSnapshotData(results, snapshotState);
|
||||
});
|
||||
const esm =
|
||||
(_runtime$unstable_sho2 = runtime.unstable_shouldLoadAsEsm) === null ||
|
||||
_runtime$unstable_sho2 === void 0
|
||||
? void 0
|
||||
: _runtime$unstable_sho2.call(runtime, testPath);
|
||||
|
||||
return function jestAdapter(_x, _x2, _x3, _x4, _x5) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
if (esm) {
|
||||
await runtime.unstable_importModule(testPath);
|
||||
} else {
|
||||
runtime.requireModule(testPath);
|
||||
}
|
||||
|
||||
const results = await runAndTransformResultsToJestFormat({
|
||||
config,
|
||||
globalConfig,
|
||||
testPath
|
||||
});
|
||||
|
||||
_addSnapshotData(results, snapshotState); // We need to copy the results object to ensure we don't leaks the prototypes
|
||||
// from the VM. Jasmine creates the result objects in the parent process, we
|
||||
// should consider doing that for circus as well.
|
||||
|
||||
return (0, _jestUtil.deepCyclicCopy)(results, {
|
||||
keepPrototype: false
|
||||
});
|
||||
};
|
||||
|
||||
const _addSnapshotData = (results, snapshotState) => {
|
||||
results.testResults.forEach(({fullName, status}) => {
|
||||
@@ -153,7 +145,6 @@ const _addSnapshotData = (results, snapshotState) => {
|
||||
results.snapshot.unchecked = !status.deleted ? uncheckedCount : 0; // Copy the array to prevent memory leaks
|
||||
|
||||
results.snapshot.uncheckedKeys = Array.from(uncheckedKeys);
|
||||
return results;
|
||||
};
|
||||
|
||||
module.exports = jestAdapter;
|
||||
|
||||
Reference in New Issue
Block a user