Updating NPM dependencies
This commit is contained in:
11
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
generated
vendored
11
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
generated
vendored
@@ -4,10 +4,9 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import { JestEnvironment } from '@jest/environment';
|
||||
import { TestResult } from '@jest/test-result';
|
||||
import Runtime from 'jest-runtime';
|
||||
declare const jestAdapter: (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string) => Promise<TestResult>;
|
||||
import type { JestEnvironment } from '@jest/environment';
|
||||
import type { TestResult } from '@jest/test-result';
|
||||
import type { Config } from '@jest/types';
|
||||
import type { RuntimeType as Runtime } from 'jest-runtime';
|
||||
declare const jestAdapter: (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string, sendMessageToJest?: import("jest-runner/build/types").TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined) => Promise<TestResult>;
|
||||
export = jestAdapter;
|
||||
//# sourceMappingURL=jestAdapter.d.ts.map
|
||||
1
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"jestAdapter.d.ts","sourceRoot":"","sources":["../../src/legacy-code-todo-rewrite/jestAdapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,OAAO,MAAM,cAAc,CAAC;AAKnC,QAAA,MAAM,WAAW,4JAsEhB,CAAC;AAgCF,SAAS,WAAW,CAAC"}
|
||||
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;
|
||||
|
||||
56
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
generated
vendored
56
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
generated
vendored
@@ -5,44 +5,36 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { Circus, Config, Global } from '@jest/types';
|
||||
import { JestEnvironment } from '@jest/environment';
|
||||
import type BabelTraverse from '@babel/traverse';
|
||||
import type { JestEnvironment } from '@jest/environment';
|
||||
import { TestResult } from '@jest/test-result';
|
||||
export declare const initialize: ({ config, environment, getPrettier, getBabelTraverse, globalConfig, localRequire, parentProcess, testPath, }: {
|
||||
import type { Config, Global } from '@jest/types';
|
||||
import type { TestFileEvent } from 'jest-runner';
|
||||
import { SnapshotStateType } from 'jest-snapshot';
|
||||
import globals from '..';
|
||||
import { Expect } from './jestExpect';
|
||||
declare type Process = NodeJS.Process;
|
||||
interface JestGlobals extends Global.TestFrameworkGlobals {
|
||||
expect: Expect;
|
||||
}
|
||||
export declare const initialize: ({ config, environment, getPrettier, getBabelTraverse, globalConfig, localRequire, parentProcess, sendMessageToJest, setGlobalsForRuntime, testPath, }: {
|
||||
config: Config.ProjectConfig;
|
||||
environment: JestEnvironment;
|
||||
getPrettier: () => any;
|
||||
getBabelTraverse: () => Function;
|
||||
getPrettier: () => null | any;
|
||||
getBabelTraverse: () => typeof BabelTraverse;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
localRequire: (path: string) => any;
|
||||
testPath: string;
|
||||
parentProcess: NodeJS.Process;
|
||||
}) => {
|
||||
globals: {
|
||||
afterAll: (fn: Circus.HookFn, timeout?: number | undefined) => void;
|
||||
afterEach: (fn: Circus.HookFn, timeout?: number | undefined) => void;
|
||||
beforeAll: (fn: Circus.HookFn, timeout?: number | undefined) => void;
|
||||
beforeEach: (fn: Circus.HookFn, timeout?: number | undefined) => void;
|
||||
describe: {
|
||||
(blockName: string, blockFn: Global.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
|
||||
only: {
|
||||
(blockName: string, blockFn: Global.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
|
||||
};
|
||||
skip: {
|
||||
(blockName: string, blockFn: Global.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
|
||||
};
|
||||
};
|
||||
it: Global.It;
|
||||
test: Global.It;
|
||||
};
|
||||
snapshotState: import("jest-snapshot/build/State").default;
|
||||
};
|
||||
localRequire: <T = unknown>(path: Config.Path) => T;
|
||||
testPath: Config.Path;
|
||||
parentProcess: Process;
|
||||
sendMessageToJest?: import("jest-runner/build/types").TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined;
|
||||
setGlobalsForRuntime?: ((globals: JestGlobals) => void) | undefined;
|
||||
}) => Promise<{
|
||||
globals: Global.TestFrameworkGlobals;
|
||||
snapshotState: SnapshotStateType;
|
||||
}>;
|
||||
export declare const runAndTransformResultsToJestFormat: ({ config, globalConfig, testPath, }: {
|
||||
config: Config.ProjectConfig;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
testPath: string;
|
||||
}) => Promise<TestResult>;
|
||||
//# sourceMappingURL=jestAdapterInit.d.ts.map
|
||||
export {};
|
||||
|
||||
1
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"jestAdapterInit.d.ts","sourceRoot":"","sources":["../../src/legacy-code-todo-rewrite/jestAdapterInit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAA0B,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAsBtE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GtB,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;yBA0G9C,CAAC"}
|
||||
339
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js
generated
vendored
339
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js
generated
vendored
@@ -5,63 +5,43 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.runAndTransformResultsToJestFormat = exports.initialize = void 0;
|
||||
|
||||
var _throat = _interopRequireDefault(require('throat'));
|
||||
|
||||
var _testResult = require('@jest/test-result');
|
||||
|
||||
var _expect = require('expect');
|
||||
|
||||
var _jestEach = require('jest-each');
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestSnapshot = require('jest-snapshot');
|
||||
|
||||
var _throat = _interopRequireDefault(require('throat'));
|
||||
|
||||
var _state = require('../state');
|
||||
|
||||
var _utils = require('../utils');
|
||||
var _ = _interopRequireDefault(require('..'));
|
||||
|
||||
var _run = _interopRequireDefault(require('../run'));
|
||||
|
||||
var _ = _interopRequireDefault(require('..'));
|
||||
var _state = require('../state');
|
||||
|
||||
var _testCaseReportHandler = _interopRequireDefault(
|
||||
require('../testCaseReportHandler')
|
||||
);
|
||||
|
||||
var _utils = require('../utils');
|
||||
|
||||
var _jestExpect = _interopRequireDefault(require('./jestExpect'));
|
||||
|
||||
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);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const initialize = ({
|
||||
/**
|
||||
* 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 initialize = async ({
|
||||
config,
|
||||
environment,
|
||||
getPrettier,
|
||||
@@ -69,42 +49,52 @@ const initialize = ({
|
||||
globalConfig,
|
||||
localRequire,
|
||||
parentProcess,
|
||||
sendMessageToJest,
|
||||
setGlobalsForRuntime,
|
||||
testPath
|
||||
}) => {
|
||||
var _config$injectGlobals;
|
||||
|
||||
if (globalConfig.testTimeout) {
|
||||
(0, _state.getState)().testTimeout = globalConfig.testTimeout;
|
||||
}
|
||||
|
||||
const mutex = (0, _throat.default)(globalConfig.maxConcurrency);
|
||||
const nodeGlobal = global;
|
||||
Object.assign(nodeGlobal, _.default);
|
||||
nodeGlobal.xit = nodeGlobal.it.skip;
|
||||
nodeGlobal.xtest = nodeGlobal.it.skip;
|
||||
nodeGlobal.xdescribe = nodeGlobal.describe.skip;
|
||||
nodeGlobal.fit = nodeGlobal.it.only;
|
||||
nodeGlobal.fdescribe = nodeGlobal.describe.only;
|
||||
const mutex = (0, _throat.default)(globalConfig.maxConcurrency); // @ts-expect-error
|
||||
|
||||
nodeGlobal.test.concurrent = (test => {
|
||||
const globalsObject = {
|
||||
..._.default,
|
||||
fdescribe: _.default.describe.only,
|
||||
fit: _.default.it.only,
|
||||
xdescribe: _.default.describe.skip,
|
||||
xit: _.default.it.skip,
|
||||
xtest: _.default.it.skip
|
||||
};
|
||||
|
||||
globalsObject.test.concurrent = (test => {
|
||||
const concurrent = (testName, testFn, timeout) => {
|
||||
// For concurrent tests we first run the function that returns promise, and then register a
|
||||
// nomral test that will be waiting on the returned promise (when we start the test, the promise
|
||||
// normal test that will be waiting on the returned promise (when we start the test, the promise
|
||||
// will already be in the process of execution).
|
||||
// Unfortunately at this stage there's no way to know if there are any `.only` tests in the suite
|
||||
// that will result in this test to be skipped, so we'll be executing the promise function anyway,
|
||||
// even if it ends up being skipped.
|
||||
const promise = mutex(() => testFn());
|
||||
nodeGlobal.test(testName, () => promise, timeout);
|
||||
globalsObject.test(testName, () => promise, timeout);
|
||||
};
|
||||
|
||||
concurrent.only = (testName, testFn, timeout) => {
|
||||
const only = (testName, testFn, timeout) => {
|
||||
const promise = mutex(() => testFn()); // eslint-disable-next-line jest/no-focused-tests
|
||||
|
||||
test.only(testName, () => promise, timeout);
|
||||
};
|
||||
|
||||
concurrent.only = only;
|
||||
concurrent.skip = test.skip;
|
||||
concurrent.each = (0, _jestEach.bind)(test, false);
|
||||
concurrent.skip.each = (0, _jestEach.bind)(test.skip, false);
|
||||
only.each = (0, _jestEach.bind)(test.only, false);
|
||||
return concurrent;
|
||||
})(nodeGlobal.test);
|
||||
})(globalsObject.test);
|
||||
|
||||
(0, _state.addEventHandler)(eventHandler);
|
||||
|
||||
@@ -112,14 +102,33 @@ const initialize = ({
|
||||
(0, _state.addEventHandler)(environment.handleTestEvent.bind(environment));
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
const runtimeGlobals = {
|
||||
...globalsObject,
|
||||
expect: (0, _jestExpect.default)(globalConfig)
|
||||
}; // TODO: `jest-circus` might be newer than `jest-runtime` - remove `?.` for Jest 27
|
||||
|
||||
setGlobalsForRuntime === null || setGlobalsForRuntime === void 0
|
||||
? void 0
|
||||
: setGlobalsForRuntime(runtimeGlobals); // TODO: `jest-circus` might be newer than `jest-config` - remove `??` for Jest 27
|
||||
|
||||
if (
|
||||
(_config$injectGlobals = config.injectGlobals) !== null &&
|
||||
_config$injectGlobals !== void 0
|
||||
? _config$injectGlobals
|
||||
: true
|
||||
) {
|
||||
Object.assign(environment.global, runtimeGlobals);
|
||||
}
|
||||
|
||||
await (0, _state.dispatch)({
|
||||
name: 'setup',
|
||||
parentProcess,
|
||||
runtimeGlobals,
|
||||
testNamePattern: globalConfig.testNamePattern
|
||||
});
|
||||
|
||||
if (config.testLocationInResults) {
|
||||
(0, _state.dispatch)({
|
||||
await (0, _state.dispatch)({
|
||||
name: 'include_test_location_in_result'
|
||||
});
|
||||
} // Jest tests snapshotSerializers in order preceding built-in serializers.
|
||||
@@ -128,11 +137,8 @@ const initialize = ({
|
||||
config.snapshotSerializers
|
||||
.concat()
|
||||
.reverse()
|
||||
.forEach(path => {
|
||||
(0, _jestSnapshot.addSerializer)(localRequire(path));
|
||||
});
|
||||
const expand = globalConfig.expand,
|
||||
updateSnapshot = globalConfig.updateSnapshot;
|
||||
.forEach(path => (0, _jestSnapshot.addSerializer)(localRequire(path)));
|
||||
const {expand, updateSnapshot} = globalConfig;
|
||||
const snapshotResolver = (0, _jestSnapshot.buildSnapshotResolver)(config);
|
||||
const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath);
|
||||
const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, {
|
||||
@@ -140,128 +146,115 @@ const initialize = ({
|
||||
getBabelTraverse,
|
||||
getPrettier,
|
||||
updateSnapshot
|
||||
});
|
||||
}); // @ts-expect-error: snapshotState is a jest extension of `expect`
|
||||
|
||||
(0, _expect.setState)({
|
||||
snapshotState,
|
||||
testPath
|
||||
});
|
||||
(0, _state.addEventHandler)(handleSnapshotStateAfterRetry(snapshotState)); // Return it back to the outer scope (test runner outside the VM).
|
||||
(0, _state.addEventHandler)(handleSnapshotStateAfterRetry(snapshotState));
|
||||
|
||||
if (sendMessageToJest) {
|
||||
(0, _state.addEventHandler)(
|
||||
(0, _testCaseReportHandler.default)(testPath, sendMessageToJest)
|
||||
);
|
||||
} // Return it back to the outer scope (test runner outside the VM).
|
||||
|
||||
return {
|
||||
globals: _.default,
|
||||
globals: globalsObject,
|
||||
snapshotState
|
||||
};
|
||||
};
|
||||
|
||||
exports.initialize = initialize;
|
||||
|
||||
const runAndTransformResultsToJestFormat =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref = _asyncToGenerator(function*({config, globalConfig, testPath}) {
|
||||
const runResult = yield (0, _run.default)();
|
||||
let numFailingTests = 0;
|
||||
let numPassingTests = 0;
|
||||
let numPendingTests = 0;
|
||||
let numTodoTests = 0;
|
||||
const assertionResults = runResult.testResults.map(testResult => {
|
||||
let status;
|
||||
const runAndTransformResultsToJestFormat = async ({
|
||||
config,
|
||||
globalConfig,
|
||||
testPath
|
||||
}) => {
|
||||
const runResult = await (0, _run.default)();
|
||||
let numFailingTests = 0;
|
||||
let numPassingTests = 0;
|
||||
let numPendingTests = 0;
|
||||
let numTodoTests = 0;
|
||||
const assertionResults = runResult.testResults.map(testResult => {
|
||||
let status;
|
||||
|
||||
if (testResult.status === 'skip') {
|
||||
status = 'pending';
|
||||
numPendingTests += 1;
|
||||
} else if (testResult.status === 'todo') {
|
||||
status = 'todo';
|
||||
numTodoTests += 1;
|
||||
} else if (testResult.errors.length) {
|
||||
status = 'failed';
|
||||
numFailingTests += 1;
|
||||
} else {
|
||||
status = 'passed';
|
||||
numPassingTests += 1;
|
||||
}
|
||||
if (testResult.status === 'skip') {
|
||||
status = 'pending';
|
||||
numPendingTests += 1;
|
||||
} else if (testResult.status === 'todo') {
|
||||
status = 'todo';
|
||||
numTodoTests += 1;
|
||||
} else if (testResult.errors.length) {
|
||||
status = 'failed';
|
||||
numFailingTests += 1;
|
||||
} else {
|
||||
status = 'passed';
|
||||
numPassingTests += 1;
|
||||
}
|
||||
|
||||
const ancestorTitles = testResult.testPath.filter(
|
||||
name => name !== _state.ROOT_DESCRIBE_BLOCK_NAME
|
||||
);
|
||||
const title = ancestorTitles.pop();
|
||||
return {
|
||||
ancestorTitles,
|
||||
duration: testResult.duration,
|
||||
failureMessages: testResult.errors,
|
||||
fullName: title
|
||||
? ancestorTitles.concat(title).join(' ')
|
||||
: ancestorTitles.join(' '),
|
||||
invocations: testResult.invocations,
|
||||
location: testResult.location,
|
||||
numPassingAsserts: 0,
|
||||
status,
|
||||
title: testResult.testPath[testResult.testPath.length - 1]
|
||||
};
|
||||
});
|
||||
let failureMessage = (0, _jestMessageUtil.formatResultsErrors)(
|
||||
assertionResults,
|
||||
config,
|
||||
globalConfig,
|
||||
testPath
|
||||
);
|
||||
let testExecError;
|
||||
|
||||
if (runResult.unhandledErrors.length) {
|
||||
testExecError = {
|
||||
message: '',
|
||||
stack: runResult.unhandledErrors.join('\n')
|
||||
};
|
||||
failureMessage =
|
||||
(failureMessage || '') +
|
||||
'\n\n' +
|
||||
runResult.unhandledErrors
|
||||
.map(err =>
|
||||
(0, _jestMessageUtil.formatExecError)(err, config, globalConfig)
|
||||
)
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
name: 'teardown'
|
||||
});
|
||||
return {
|
||||
console: undefined,
|
||||
displayName: config.displayName,
|
||||
failureMessage,
|
||||
leaks: false,
|
||||
// That's legacy code, just adding it so Flow is happy.
|
||||
numFailingTests,
|
||||
numPassingTests,
|
||||
numPendingTests,
|
||||
numTodoTests,
|
||||
openHandles: [],
|
||||
perfStats: {
|
||||
// populated outside
|
||||
end: 0,
|
||||
start: 0
|
||||
},
|
||||
skipped: false,
|
||||
snapshot: {
|
||||
added: 0,
|
||||
fileDeleted: false,
|
||||
matched: 0,
|
||||
unchecked: 0,
|
||||
uncheckedKeys: [],
|
||||
unmatched: 0,
|
||||
updated: 0
|
||||
},
|
||||
sourceMaps: {},
|
||||
testExecError,
|
||||
testFilePath: testPath,
|
||||
testResults: assertionResults
|
||||
};
|
||||
});
|
||||
|
||||
return function runAndTransformResultsToJestFormat(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
const ancestorTitles = testResult.testPath.filter(
|
||||
name => name !== _state.ROOT_DESCRIBE_BLOCK_NAME
|
||||
);
|
||||
const title = ancestorTitles.pop();
|
||||
return {
|
||||
ancestorTitles,
|
||||
duration: testResult.duration,
|
||||
failureDetails: testResult.errorsDetailed,
|
||||
failureMessages: testResult.errors,
|
||||
fullName: title
|
||||
? ancestorTitles.concat(title).join(' ')
|
||||
: ancestorTitles.join(' '),
|
||||
invocations: testResult.invocations,
|
||||
location: testResult.location,
|
||||
numPassingAsserts: 0,
|
||||
status,
|
||||
title: testResult.testPath[testResult.testPath.length - 1]
|
||||
};
|
||||
})();
|
||||
});
|
||||
let failureMessage = (0, _jestMessageUtil.formatResultsErrors)(
|
||||
assertionResults,
|
||||
config,
|
||||
globalConfig,
|
||||
testPath
|
||||
);
|
||||
let testExecError;
|
||||
|
||||
if (runResult.unhandledErrors.length) {
|
||||
testExecError = {
|
||||
message: '',
|
||||
stack: runResult.unhandledErrors.join('\n')
|
||||
};
|
||||
failureMessage =
|
||||
(failureMessage || '') +
|
||||
'\n\n' +
|
||||
runResult.unhandledErrors
|
||||
.map(err =>
|
||||
(0, _jestMessageUtil.formatExecError)(err, config, globalConfig)
|
||||
)
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
await (0, _state.dispatch)({
|
||||
name: 'teardown'
|
||||
});
|
||||
return {
|
||||
...(0, _testResult.createEmptyTestResult)(),
|
||||
console: undefined,
|
||||
displayName: config.displayName,
|
||||
failureMessage,
|
||||
numFailingTests,
|
||||
numPassingTests,
|
||||
numPendingTests,
|
||||
numTodoTests,
|
||||
sourceMaps: {},
|
||||
testExecError,
|
||||
testFilePath: testPath,
|
||||
testResults: assertionResults
|
||||
};
|
||||
};
|
||||
|
||||
exports.runAndTransformResultsToJestFormat = runAndTransformResultsToJestFormat;
|
||||
|
||||
@@ -274,7 +267,7 @@ const handleSnapshotStateAfterRetry = snapshotState => event => {
|
||||
}
|
||||
};
|
||||
|
||||
const eventHandler = event => {
|
||||
const eventHandler = async event => {
|
||||
switch (event.name) {
|
||||
case 'test_start': {
|
||||
(0, _expect.setState)({
|
||||
@@ -302,9 +295,7 @@ const _addExpectedAssertionErrors = test => {
|
||||
// a passing test.
|
||||
|
||||
const _addSuppressedErrors = test => {
|
||||
const _getState = (0, _expect.getState)(),
|
||||
suppressedErrors = _getState.suppressedErrors;
|
||||
|
||||
const {suppressedErrors} = (0, _expect.getState)();
|
||||
(0, _expect.setState)({
|
||||
suppressedErrors: []
|
||||
});
|
||||
|
||||
8
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
generated
vendored
8
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
generated
vendored
@@ -4,8 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
declare const _default: (config: {
|
||||
expand: boolean;
|
||||
}) => void;
|
||||
import type { Config } from '@jest/types';
|
||||
import expect = require('expect');
|
||||
export declare type Expect = typeof expect;
|
||||
declare const _default: (config: Pick<Config.GlobalConfig, 'expand'>) => Expect;
|
||||
export default _default;
|
||||
//# sourceMappingURL=jestExpect.d.ts.map
|
||||
1
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"jestExpect.d.ts","sourceRoot":"","sources":["../../src/legacy-code-todo-rewrite/jestExpect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;AAYH,wBAaE"}
|
||||
3
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js
generated
vendored
3
node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js
generated
vendored
@@ -20,8 +20,6 @@ function _interopRequireDefault(obj) {
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
var _default = config => {
|
||||
global.expect = _expect.default;
|
||||
|
||||
_expect.default.setState({
|
||||
expand: config.expand
|
||||
});
|
||||
@@ -35,6 +33,7 @@ var _default = config => {
|
||||
});
|
||||
|
||||
_expect.default.addSnapshotSerializer = _jestSnapshot.addSerializer;
|
||||
return _expect.default;
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
Reference in New Issue
Block a user