Updating NPM dependencies
This commit is contained in:
3
node_modules/jest-circus/build/eventHandler.d.ts
generated
vendored
3
node_modules/jest-circus/build/eventHandler.d.ts
generated
vendored
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Circus } from '@jest/types';
|
||||
import type { Circus } from '@jest/types';
|
||||
declare const eventHandler: Circus.EventHandler;
|
||||
export default eventHandler;
|
||||
//# sourceMappingURL=eventHandler.d.ts.map
|
||||
1
node_modules/jest-circus/build/eventHandler.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/eventHandler.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"eventHandler.d.ts","sourceRoot":"","sources":["../src/eventHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgBnC,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,YAgL1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
||||
109
node_modules/jest-circus/build/eventHandler.js
generated
vendored
109
node_modules/jest-circus/build/eventHandler.js
generated
vendored
@@ -5,16 +5,17 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _globalErrorHandlers = require('./globalErrorHandlers');
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _globalErrorHandlers = require('./globalErrorHandlers');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now;
|
||||
|
||||
// TODO: investigate why a shorter (event, state) signature results into TS7006 compiler error
|
||||
const eventHandler = (event, state) => {
|
||||
switch (event.name) {
|
||||
case 'include_test_location_in_result': {
|
||||
@@ -27,9 +28,18 @@ const eventHandler = (event, state) => {
|
||||
}
|
||||
|
||||
case 'start_describe_definition': {
|
||||
const blockName = event.blockName,
|
||||
mode = event.mode;
|
||||
const currentDescribeBlock = state.currentDescribeBlock;
|
||||
const {blockName, mode} = event;
|
||||
const {currentDescribeBlock, currentlyRunningTest} = state;
|
||||
|
||||
if (currentlyRunningTest) {
|
||||
currentlyRunningTest.errors.push(
|
||||
new Error(
|
||||
`Cannot nest a describe inside a test. Describe block "${blockName}" cannot run because it is nested within "${currentlyRunningTest.name}".`
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
const describeBlock = (0, _utils.makeDescribe)(
|
||||
blockName,
|
||||
currentDescribeBlock,
|
||||
@@ -41,7 +51,7 @@ const eventHandler = (event, state) => {
|
||||
}
|
||||
|
||||
case 'finish_describe_definition': {
|
||||
const currentDescribeBlock = state.currentDescribeBlock;
|
||||
const {currentDescribeBlock} = state;
|
||||
(0, _utils.invariant)(
|
||||
currentDescribeBlock,
|
||||
`currentDescribeBlock must be there`
|
||||
@@ -52,25 +62,29 @@ const eventHandler = (event, state) => {
|
||||
hook.asyncError.message = `Invalid: ${hook.type}() may not be used in a describe block containing no tests.`;
|
||||
state.unhandledErrors.push(hook.asyncError);
|
||||
});
|
||||
} // inherit mode from its parent describe but
|
||||
// do not inherit "only" mode when there is already tests with "only" mode
|
||||
} // pass mode of currentDescribeBlock to tests
|
||||
// but do not when there is already a single test with "only" mode
|
||||
|
||||
const shouldInheritMode = !(
|
||||
const shouldPassMode = !(
|
||||
currentDescribeBlock.mode === 'only' &&
|
||||
currentDescribeBlock.tests.find(test => test.mode === 'only')
|
||||
currentDescribeBlock.children.some(
|
||||
child => child.type === 'test' && child.mode === 'only'
|
||||
)
|
||||
);
|
||||
|
||||
if (shouldInheritMode) {
|
||||
currentDescribeBlock.tests.forEach(test => {
|
||||
if (!test.mode) {
|
||||
test.mode = currentDescribeBlock.mode;
|
||||
if (shouldPassMode) {
|
||||
currentDescribeBlock.children.forEach(child => {
|
||||
if (child.type === 'test' && !child.mode) {
|
||||
child.mode = currentDescribeBlock.mode;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
!state.hasFocusedTests &&
|
||||
currentDescribeBlock.tests.some(test => test.mode === 'only')
|
||||
currentDescribeBlock.children.some(
|
||||
child => child.type === 'test' && child.mode === 'only'
|
||||
)
|
||||
) {
|
||||
state.hasFocusedTests = true;
|
||||
}
|
||||
@@ -83,11 +97,25 @@ const eventHandler = (event, state) => {
|
||||
}
|
||||
|
||||
case 'add_hook': {
|
||||
const currentDescribeBlock = state.currentDescribeBlock;
|
||||
const asyncError = event.asyncError,
|
||||
fn = event.fn,
|
||||
type = event.hookType,
|
||||
timeout = event.timeout;
|
||||
const {currentDescribeBlock, currentlyRunningTest, hasStarted} = state;
|
||||
const {asyncError, fn, hookType: type, timeout} = event;
|
||||
|
||||
if (currentlyRunningTest) {
|
||||
currentlyRunningTest.errors.push(
|
||||
new Error(
|
||||
`Hooks cannot be defined inside tests. Hook of type "${type}" is nested within "${currentlyRunningTest.name}".`
|
||||
)
|
||||
);
|
||||
break;
|
||||
} else if (hasStarted) {
|
||||
state.unhandledErrors.push(
|
||||
new Error(
|
||||
'Cannot add a hook after tests have started running. Hooks must be defined synchronously.'
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
const parent = currentDescribeBlock;
|
||||
currentDescribeBlock.hooks.push({
|
||||
asyncError,
|
||||
@@ -100,12 +128,25 @@ const eventHandler = (event, state) => {
|
||||
}
|
||||
|
||||
case 'add_test': {
|
||||
const currentDescribeBlock = state.currentDescribeBlock;
|
||||
const asyncError = event.asyncError,
|
||||
fn = event.fn,
|
||||
mode = event.mode,
|
||||
name = event.testName,
|
||||
timeout = event.timeout;
|
||||
const {currentDescribeBlock, currentlyRunningTest, hasStarted} = state;
|
||||
const {asyncError, fn, mode, testName: name, timeout} = event;
|
||||
|
||||
if (currentlyRunningTest) {
|
||||
currentlyRunningTest.errors.push(
|
||||
new Error(
|
||||
`Tests cannot be nested. Test "${name}" cannot run because it is nested within "${currentlyRunningTest.name}".`
|
||||
)
|
||||
);
|
||||
break;
|
||||
} else if (hasStarted) {
|
||||
state.unhandledErrors.push(
|
||||
new Error(
|
||||
'Cannot add a test after tests have started running. Tests must be defined synchronously.'
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
const test = (0, _utils.makeTest)(
|
||||
fn,
|
||||
mode,
|
||||
@@ -119,17 +160,14 @@ const eventHandler = (event, state) => {
|
||||
state.hasFocusedTests = true;
|
||||
}
|
||||
|
||||
currentDescribeBlock.children.push(test);
|
||||
currentDescribeBlock.tests.push(test);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'hook_failure': {
|
||||
const test = event.test,
|
||||
describeBlock = event.describeBlock,
|
||||
error = event.error,
|
||||
hook = event.hook;
|
||||
const asyncError = hook.asyncError,
|
||||
type = hook.type;
|
||||
const {test, describeBlock, error, hook} = event;
|
||||
const {asyncError, type} = hook;
|
||||
|
||||
if (type === 'beforeAll') {
|
||||
(0, _utils.invariant)(describeBlock, 'always present for `*All` hooks');
|
||||
@@ -175,8 +213,10 @@ const eventHandler = (event, state) => {
|
||||
}
|
||||
|
||||
case 'test_fn_failure': {
|
||||
const error = event.error,
|
||||
asyncError = event.test.asyncError;
|
||||
const {
|
||||
error,
|
||||
test: {asyncError}
|
||||
} = event;
|
||||
event.test.errors.push([error, asyncError]);
|
||||
break;
|
||||
}
|
||||
@@ -187,6 +227,7 @@ const eventHandler = (event, state) => {
|
||||
}
|
||||
|
||||
case 'run_start': {
|
||||
state.hasStarted = true;
|
||||
global[_types.TEST_TIMEOUT_SYMBOL] &&
|
||||
(state.testTimeout = global[_types.TEST_TIMEOUT_SYMBOL]);
|
||||
break;
|
||||
|
||||
3
node_modules/jest-circus/build/formatNodeAssertErrors.d.ts
generated
vendored
3
node_modules/jest-circus/build/formatNodeAssertErrors.d.ts
generated
vendored
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Circus } from '@jest/types';
|
||||
import type { Circus } from '@jest/types';
|
||||
declare const formatNodeAssertErrors: (event: Circus.Event, state: Circus.State) => void;
|
||||
export default formatNodeAssertErrors;
|
||||
//# sourceMappingURL=formatNodeAssertErrors.d.ts.map
|
||||
1
node_modules/jest-circus/build/formatNodeAssertErrors.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/formatNodeAssertErrors.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"formatNodeAssertErrors.d.ts","sourceRoot":"","sources":["../src/formatNodeAssertErrors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgCnC,QAAA,MAAM,sBAAsB,oDA4B3B,CAAC;AAsHF,eAAe,sBAAsB,CAAC"}
|
||||
128
node_modules/jest-circus/build/formatNodeAssertErrors.js
generated
vendored
128
node_modules/jest-circus/build/formatNodeAssertErrors.js
generated
vendored
@@ -7,59 +7,22 @@ exports.default = void 0;
|
||||
|
||||
var _assert = require('assert');
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return (
|
||||
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
|
||||
);
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError('Invalid attempt to destructure non-iterable instance');
|
||||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
var _e = undefined;
|
||||
try {
|
||||
for (
|
||||
var _i = arr[Symbol.iterator](), _s;
|
||||
!(_n = (_s = _i.next()).done);
|
||||
_n = true
|
||||
) {
|
||||
_arr.push(_s.value);
|
||||
if (i && _arr.length === i) break;
|
||||
}
|
||||
} catch (err) {
|
||||
_d = true;
|
||||
_e = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_n && _i['return'] != null) _i['return']();
|
||||
} finally {
|
||||
if (_d) throw _e;
|
||||
}
|
||||
}
|
||||
return _arr;
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 assertOperatorsMap = {
|
||||
'!=': 'notEqual',
|
||||
'!==': 'notStrictEqual',
|
||||
@@ -78,41 +41,37 @@ const humanReadableOperators = {
|
||||
};
|
||||
|
||||
const formatNodeAssertErrors = (event, state) => {
|
||||
switch (event.name) {
|
||||
case 'test_done': {
|
||||
event.test.errors = event.test.errors.map(errors => {
|
||||
let error;
|
||||
if (event.name === 'test_done') {
|
||||
event.test.errors = event.test.errors.map(errors => {
|
||||
let error;
|
||||
|
||||
if (Array.isArray(errors)) {
|
||||
const _errors = _slicedToArray(errors, 2),
|
||||
originalError = _errors[0],
|
||||
asyncError = _errors[1];
|
||||
if (Array.isArray(errors)) {
|
||||
const [originalError, asyncError] = errors;
|
||||
|
||||
if (originalError == null) {
|
||||
error = asyncError;
|
||||
} else if (!originalError.stack) {
|
||||
error = asyncError;
|
||||
error.message = originalError.message
|
||||
? originalError.message
|
||||
: `thrown: ${(0, _prettyFormat.default)(originalError, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
} else {
|
||||
error = originalError;
|
||||
}
|
||||
if (originalError == null) {
|
||||
error = asyncError;
|
||||
} else if (!originalError.stack) {
|
||||
error = asyncError;
|
||||
error.message = originalError.message
|
||||
? originalError.message
|
||||
: `thrown: ${(0, _prettyFormat.default)(originalError, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
} else {
|
||||
error = errors;
|
||||
error = originalError;
|
||||
}
|
||||
} else {
|
||||
error = errors;
|
||||
}
|
||||
|
||||
return isAssertionError(error)
|
||||
? {
|
||||
message: assertionErrorMessage(error, {
|
||||
expand: state.expand
|
||||
})
|
||||
}
|
||||
: errors;
|
||||
});
|
||||
}
|
||||
return isAssertionError(error)
|
||||
? {
|
||||
message: assertionErrorMessage(error, {
|
||||
expand: state.expand
|
||||
})
|
||||
}
|
||||
: errors;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -127,6 +86,10 @@ const getOperatorName = (operator, stack) => {
|
||||
|
||||
if (stack.match('.throws')) {
|
||||
return 'throws';
|
||||
} // this fallback is only needed for versions older than node 10
|
||||
|
||||
if (stack.match('.fail')) {
|
||||
return 'fail';
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -171,12 +134,7 @@ const assertMatcherHint = (operator, operatorName, expected) => {
|
||||
};
|
||||
|
||||
function assertionErrorMessage(error, options) {
|
||||
const expected = error.expected,
|
||||
actual = error.actual,
|
||||
generatedMessage = error.generatedMessage,
|
||||
message = error.message,
|
||||
operator = error.operator,
|
||||
stack = error.stack;
|
||||
const {expected, actual, generatedMessage, message, operator, stack} = error;
|
||||
const diffString = (0, _jestMatcherUtils.diff)(expected, actual, options);
|
||||
const hasCustomMessage = !generatedMessage;
|
||||
const operatorName = getOperatorName(operator, stack);
|
||||
@@ -209,6 +167,14 @@ function assertionErrorMessage(error, options) {
|
||||
);
|
||||
}
|
||||
|
||||
if (operatorName === 'fail') {
|
||||
return (
|
||||
buildHintString(assertMatcherHint(operator, operatorName, expected)) +
|
||||
_chalk.default.reset(hasCustomMessage ? 'Message:\n ' + message : '') +
|
||||
trimmedStack
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
buildHintString(assertMatcherHint(operator, operatorName, expected)) +
|
||||
_chalk.default.reset(`Expected value ${operatorMessage(operator)}`) +
|
||||
|
||||
4
node_modules/jest-circus/build/globalErrorHandlers.d.ts
generated
vendored
4
node_modules/jest-circus/build/globalErrorHandlers.d.ts
generated
vendored
@@ -4,8 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { Circus } from '@jest/types';
|
||||
import type { Circus } from '@jest/types';
|
||||
export declare const injectGlobalErrorHandlers: (parentProcess: NodeJS.Process) => Circus.GlobalErrorHandlers;
|
||||
export declare const restoreGlobalErrorHandlers: (parentProcess: NodeJS.Process, originalErrorHandlers: Circus.GlobalErrorHandlers) => void;
|
||||
//# sourceMappingURL=globalErrorHandlers.d.ts.map
|
||||
1
node_modules/jest-circus/build/globalErrorHandlers.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/globalErrorHandlers.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"globalErrorHandlers.d.ts","sourceRoot":"","sources":["../src/globalErrorHandlers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAQnC,eAAO,MAAM,yBAAyB,+DAUrC,CAAC;AAEF,eAAO,MAAM,0BAA0B,4FAatC,CAAC"}
|
||||
71
node_modules/jest-circus/build/globalErrorHandlers.js
generated
vendored
71
node_modules/jest-circus/build/globalErrorHandlers.js
generated
vendored
@@ -7,10 +7,14 @@ exports.restoreGlobalErrorHandlers = exports.injectGlobalErrorHandlers = void 0;
|
||||
|
||||
var _state = require('./state');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
|
||||
/**
|
||||
* 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 uncaught = error => {
|
||||
(0, _state.dispatch)({
|
||||
(0, _state.dispatchSync)({
|
||||
error,
|
||||
name: 'error'
|
||||
});
|
||||
@@ -34,66 +38,13 @@ exports.injectGlobalErrorHandlers = injectGlobalErrorHandlers;
|
||||
const restoreGlobalErrorHandlers = (parentProcess, originalErrorHandlers) => {
|
||||
parentProcess.removeListener('uncaughtException', uncaught);
|
||||
parentProcess.removeListener('unhandledRejection', uncaught);
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = originalErrorHandlers.uncaughtException[
|
||||
Symbol.iterator
|
||||
](),
|
||||
_step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const listener = _step.value;
|
||||
parentProcess.on('uncaughtException', listener);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
for (const listener of originalErrorHandlers.uncaughtException) {
|
||||
parentProcess.on('uncaughtException', listener);
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator2 = originalErrorHandlers.unhandledRejection[
|
||||
Symbol.iterator
|
||||
](),
|
||||
_step2;
|
||||
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
|
||||
_iteratorNormalCompletion2 = true
|
||||
) {
|
||||
const listener = _step2.value;
|
||||
parentProcess.on('unhandledRejection', listener);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
for (const listener of originalErrorHandlers.unhandledRejection) {
|
||||
parentProcess.on('unhandledRejection', listener);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
21
node_modules/jest-circus/build/index.d.ts
generated
vendored
21
node_modules/jest-circus/build/index.d.ts
generated
vendored
@@ -4,18 +4,18 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Circus, Global } from '@jest/types';
|
||||
import type { Circus, Global } from '@jest/types';
|
||||
declare type THook = (fn: Circus.HookFn, timeout?: number) => void;
|
||||
declare const describe: {
|
||||
(blockName: string, blockFn: Global.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
|
||||
(blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, 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;
|
||||
(blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, 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;
|
||||
(blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, timeout?: number | undefined) => void;
|
||||
};
|
||||
};
|
||||
declare const beforeEach: THook;
|
||||
@@ -34,18 +34,17 @@ declare const _default: {
|
||||
beforeEach: THook;
|
||||
describe: {
|
||||
(blockName: string, blockFn: Global.BlockFn): void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, 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;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, 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;
|
||||
each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, timeout?: number | undefined) => void;
|
||||
};
|
||||
};
|
||||
it: Global.It;
|
||||
test: Global.It;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/jest-circus/build/index.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAG3C,aAAK,KAAK,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAM3D,QAAA,MAAM,QAAQ;;;;;;;;;;;CAiBV,CAAC;AA8EL,QAAA,MAAM,UAAU,EAAE,KAC+B,CAAC;AAClD,QAAA,MAAM,SAAS,EAAE,KAC8B,CAAC;AAChD,QAAA,MAAM,SAAS,EAAE,KAC8B,CAAC;AAChD,QAAA,MAAM,QAAQ,EAAE,KAC6B,CAAC;AAE9C,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,EA2Ef,CAAC;AAEL,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,EAAS,CAAC;AAE3B,oBAAY,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AACjC,oBAAY,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAC,CAAC;;;;;;;;;;;;;;;;;;;;;AACxE,wBAQE"}
|
||||
8
node_modules/jest-circus/build/index.js
generated
vendored
8
node_modules/jest-circus/build/index.js
generated
vendored
@@ -58,7 +58,7 @@ const _dispatchDescribe = (blockFn, blockName, describeFn, mode) => {
|
||||
throw asyncError;
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
(0, _state.dispatchSync)({
|
||||
asyncError,
|
||||
blockName,
|
||||
mode,
|
||||
@@ -106,7 +106,7 @@ const _dispatchDescribe = (blockFn, blockName, describeFn, mode) => {
|
||||
);
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
(0, _state.dispatchSync)({
|
||||
blockName,
|
||||
mode,
|
||||
name: 'finish_describe_definition'
|
||||
@@ -122,7 +122,7 @@ const _addHook = (fn, hookType, hookFn, timeout) => {
|
||||
throw asyncError;
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
(0, _state.dispatchSync)({
|
||||
asyncError,
|
||||
fn,
|
||||
hookType,
|
||||
@@ -190,7 +190,7 @@ const test = (() => {
|
||||
throw asyncError;
|
||||
}
|
||||
|
||||
return (0, _state.dispatch)({
|
||||
return (0, _state.dispatchSync)({
|
||||
asyncError,
|
||||
fn,
|
||||
mode,
|
||||
|
||||
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;
|
||||
|
||||
3
node_modules/jest-circus/build/run.d.ts
generated
vendored
3
node_modules/jest-circus/build/run.d.ts
generated
vendored
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Circus } from '@jest/types';
|
||||
import type { Circus } from '@jest/types';
|
||||
declare const run: () => Promise<Circus.RunResult>;
|
||||
export default run;
|
||||
//# sourceMappingURL=run.d.ts.map
|
||||
1
node_modules/jest-circus/build/run.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/run.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAanC,QAAA,MAAM,GAAG,iCASR,CAAC;AAqIF,eAAe,GAAG,CAAC"}
|
||||
574
node_modules/jest-circus/build/run.js
generated
vendored
574
node_modules/jest-circus/build/run.js
generated
vendored
@@ -5,396 +5,196 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _state = require('./state');
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
/**
|
||||
* 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 run = async () => {
|
||||
const {rootDescribeBlock} = (0, _state.getState)();
|
||||
await (0, _state.dispatch)({
|
||||
name: 'run_start'
|
||||
});
|
||||
await _runTestsForDescribeBlock(rootDescribeBlock);
|
||||
await (0, _state.dispatch)({
|
||||
name: 'run_finish'
|
||||
});
|
||||
return (0, _utils.makeRunResult)(
|
||||
(0, _state.getState)().rootDescribeBlock,
|
||||
(0, _state.getState)().unhandledErrors
|
||||
);
|
||||
};
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
const _runTestsForDescribeBlock = async describeBlock => {
|
||||
await (0, _state.dispatch)({
|
||||
describeBlock,
|
||||
name: 'run_describe_start'
|
||||
});
|
||||
const {beforeAll, afterAll} = (0, _utils.getAllHooksForDescribe)(
|
||||
describeBlock
|
||||
);
|
||||
|
||||
for (const hook of beforeAll) {
|
||||
await _callCircusHook({
|
||||
describeBlock,
|
||||
hook
|
||||
});
|
||||
} // Tests that fail and are retried we run after other tests
|
||||
|
||||
const retryTimes = parseInt(global[_types.RETRY_TIMES], 10) || 0;
|
||||
const deferredRetryTests = [];
|
||||
|
||||
for (const child of describeBlock.children) {
|
||||
switch (child.type) {
|
||||
case 'describeBlock': {
|
||||
await _runTestsForDescribeBlock(child);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'test': {
|
||||
const hasErrorsBeforeTestRun = child.errors.length > 0;
|
||||
await _runTest(child);
|
||||
|
||||
if (
|
||||
hasErrorsBeforeTestRun === false &&
|
||||
retryTimes > 0 &&
|
||||
child.errors.length > 0
|
||||
) {
|
||||
deferredRetryTests.push(child);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // Re-run failed tests n-times if configured
|
||||
|
||||
for (const test of deferredRetryTests) {
|
||||
let numRetriesAvailable = retryTimes;
|
||||
|
||||
while (numRetriesAvailable > 0 && test.errors.length > 0) {
|
||||
// Clear errors so retries occur
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_retry',
|
||||
test
|
||||
});
|
||||
await _runTest(test);
|
||||
numRetriesAvailable--;
|
||||
}
|
||||
}
|
||||
|
||||
for (const hook of afterAll) {
|
||||
await _callCircusHook({
|
||||
describeBlock,
|
||||
hook
|
||||
});
|
||||
}
|
||||
|
||||
await (0, _state.dispatch)({
|
||||
describeBlock,
|
||||
name: 'run_describe_finish'
|
||||
});
|
||||
};
|
||||
|
||||
const _runTest = async test => {
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_start',
|
||||
test
|
||||
});
|
||||
const testContext = Object.create(null);
|
||||
const {hasFocusedTests, testNamePattern} = (0, _state.getState)();
|
||||
const isSkipped =
|
||||
test.mode === 'skip' ||
|
||||
(hasFocusedTests && test.mode !== 'only') ||
|
||||
(testNamePattern && !testNamePattern.test((0, _utils.getTestID)(test)));
|
||||
|
||||
if (isSkipped) {
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_skip',
|
||||
test
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
|
||||
if (test.mode === 'todo') {
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_todo',
|
||||
test
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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 {afterEach, beforeEach} = (0, _utils.getEachHooksForTest)(test);
|
||||
|
||||
for (const hook of beforeEach) {
|
||||
if (test.errors.length) {
|
||||
// If any of the before hooks failed already, we don't run any
|
||||
// hooks after that.
|
||||
break;
|
||||
}
|
||||
|
||||
await _callCircusHook({
|
||||
hook,
|
||||
test,
|
||||
testContext
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const run =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref = _asyncToGenerator(function*() {
|
||||
const _getState = (0, _state.getState)(),
|
||||
rootDescribeBlock = _getState.rootDescribeBlock;
|
||||
await _callCircusTest(test, testContext);
|
||||
|
||||
(0, _state.dispatch)({
|
||||
name: 'run_start'
|
||||
});
|
||||
yield _runTestsForDescribeBlock(rootDescribeBlock);
|
||||
(0, _state.dispatch)({
|
||||
name: 'run_finish'
|
||||
});
|
||||
return (0,
|
||||
_utils.makeRunResult)((0, _state.getState)().rootDescribeBlock, (0, _state.getState)().unhandledErrors);
|
||||
for (const hook of afterEach) {
|
||||
await _callCircusHook({
|
||||
hook,
|
||||
test,
|
||||
testContext
|
||||
});
|
||||
} // `afterAll` hooks should not affect test status (pass or fail), because if
|
||||
// we had a global `afterAll` hook it would block all existing tests until
|
||||
// this hook is executed. So we dispatch `test_done` right away.
|
||||
|
||||
return function run() {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_done',
|
||||
test
|
||||
});
|
||||
};
|
||||
|
||||
const _runTestsForDescribeBlock =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref2 = _asyncToGenerator(function*(describeBlock) {
|
||||
(0, _state.dispatch)({
|
||||
describeBlock,
|
||||
name: 'run_describe_start'
|
||||
});
|
||||
|
||||
const _getAllHooksForDescri = (0, _utils.getAllHooksForDescribe)(
|
||||
describeBlock
|
||||
),
|
||||
beforeAll = _getAllHooksForDescri.beforeAll,
|
||||
afterAll = _getAllHooksForDescri.afterAll;
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = beforeAll[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const hook = _step.value;
|
||||
yield _callCircusHook({
|
||||
describeBlock,
|
||||
hook
|
||||
});
|
||||
} // Tests that fail and are retried we run after other tests
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const retryTimes = parseInt(global[_types.RETRY_TIMES], 10) || 0;
|
||||
const deferredRetryTests = [];
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator2 = describeBlock.tests[Symbol.iterator](), _step2;
|
||||
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
|
||||
_iteratorNormalCompletion2 = true
|
||||
) {
|
||||
const test = _step2.value;
|
||||
const hasErrorsBeforeTestRun = test.errors.length > 0;
|
||||
yield _runTest(test);
|
||||
|
||||
if (
|
||||
hasErrorsBeforeTestRun === false &&
|
||||
retryTimes > 0 &&
|
||||
test.errors.length > 0
|
||||
) {
|
||||
deferredRetryTests.push(test);
|
||||
}
|
||||
} // Re-run failed tests n-times if configured
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < deferredRetryTests.length; _i++) {
|
||||
const test = deferredRetryTests[_i];
|
||||
let numRetriesAvailable = retryTimes;
|
||||
|
||||
while (numRetriesAvailable > 0 && test.errors.length > 0) {
|
||||
// Clear errors so retries occur
|
||||
(0, _state.dispatch)({
|
||||
name: 'test_retry',
|
||||
test
|
||||
});
|
||||
yield _runTest(test);
|
||||
numRetriesAvailable--;
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator3 = describeBlock.children[Symbol.iterator](), _step3;
|
||||
!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done);
|
||||
_iteratorNormalCompletion3 = true
|
||||
) {
|
||||
const child = _step3.value;
|
||||
yield _runTestsForDescribeBlock(child);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator4 = afterAll[Symbol.iterator](), _step4;
|
||||
!(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done);
|
||||
_iteratorNormalCompletion4 = true
|
||||
) {
|
||||
const hook = _step4.value;
|
||||
yield _callCircusHook({
|
||||
describeBlock,
|
||||
hook
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
describeBlock,
|
||||
name: 'run_describe_finish'
|
||||
});
|
||||
});
|
||||
|
||||
return function _runTestsForDescribeBlock(_x) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
const _runTest =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref3 = _asyncToGenerator(function*(test) {
|
||||
(0, _state.dispatch)({
|
||||
name: 'test_start',
|
||||
test
|
||||
});
|
||||
const testContext = Object.create(null);
|
||||
|
||||
const _getState2 = (0, _state.getState)(),
|
||||
hasFocusedTests = _getState2.hasFocusedTests,
|
||||
testNamePattern = _getState2.testNamePattern;
|
||||
|
||||
const isSkipped =
|
||||
test.mode === 'skip' ||
|
||||
(hasFocusedTests && test.mode !== 'only') ||
|
||||
(testNamePattern && !testNamePattern.test((0, _utils.getTestID)(test)));
|
||||
|
||||
if (isSkipped) {
|
||||
(0, _state.dispatch)({
|
||||
name: 'test_skip',
|
||||
test
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (test.mode === 'todo') {
|
||||
(0, _state.dispatch)({
|
||||
name: 'test_todo',
|
||||
test
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const _getEachHooksForTest = (0, _utils.getEachHooksForTest)(test),
|
||||
afterEach = _getEachHooksForTest.afterEach,
|
||||
beforeEach = _getEachHooksForTest.beforeEach;
|
||||
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator5 = beforeEach[Symbol.iterator](), _step5;
|
||||
!(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done);
|
||||
_iteratorNormalCompletion5 = true
|
||||
) {
|
||||
const hook = _step5.value;
|
||||
|
||||
if (test.errors.length) {
|
||||
// If any of the before hooks failed already, we don't run any
|
||||
// hooks after that.
|
||||
break;
|
||||
}
|
||||
|
||||
yield _callCircusHook({
|
||||
hook,
|
||||
test,
|
||||
testContext
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yield _callCircusTest(test, testContext);
|
||||
var _iteratorNormalCompletion6 = true;
|
||||
var _didIteratorError6 = false;
|
||||
var _iteratorError6 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator6 = afterEach[Symbol.iterator](), _step6;
|
||||
!(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done);
|
||||
_iteratorNormalCompletion6 = true
|
||||
) {
|
||||
const hook = _step6.value;
|
||||
yield _callCircusHook({
|
||||
hook,
|
||||
test,
|
||||
testContext
|
||||
});
|
||||
} // `afterAll` hooks should not affect test status (pass or fail), because if
|
||||
// we had a global `afterAll` hook it would block all existing tests until
|
||||
// this hook is executed. So we dispatch `test_done` right away.
|
||||
} catch (err) {
|
||||
_didIteratorError6 = true;
|
||||
_iteratorError6 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
||||
_iterator6.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError6) {
|
||||
throw _iteratorError6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(0, _state.dispatch)({
|
||||
name: 'test_done',
|
||||
test
|
||||
});
|
||||
});
|
||||
|
||||
return function _runTest(_x2) {
|
||||
return _ref3.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
const _callCircusHook = ({hook, test, describeBlock, testContext}) => {
|
||||
(0, _state.dispatch)({
|
||||
const _callCircusHook = async ({hook, test, describeBlock, testContext}) => {
|
||||
await (0, _state.dispatch)({
|
||||
hook,
|
||||
name: 'hook_start'
|
||||
});
|
||||
const timeout = hook.timeout || (0, _state.getState)().testTimeout;
|
||||
return (0, _utils.callAsyncCircusFn)(hook.fn, testContext, {
|
||||
isHook: true,
|
||||
timeout
|
||||
})
|
||||
.then(() =>
|
||||
(0, _state.dispatch)({
|
||||
describeBlock,
|
||||
hook,
|
||||
name: 'hook_success',
|
||||
test
|
||||
})
|
||||
)
|
||||
.catch(error =>
|
||||
(0, _state.dispatch)({
|
||||
describeBlock,
|
||||
error,
|
||||
hook,
|
||||
name: 'hook_failure',
|
||||
test
|
||||
})
|
||||
);
|
||||
|
||||
try {
|
||||
await (0, _utils.callAsyncCircusFn)(hook, testContext, {
|
||||
isHook: true,
|
||||
timeout
|
||||
});
|
||||
await (0, _state.dispatch)({
|
||||
describeBlock,
|
||||
hook,
|
||||
name: 'hook_success',
|
||||
test
|
||||
});
|
||||
} catch (error) {
|
||||
await (0, _state.dispatch)({
|
||||
describeBlock,
|
||||
error,
|
||||
hook,
|
||||
name: 'hook_failure',
|
||||
test
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const _callCircusTest = (test, testContext) => {
|
||||
(0, _state.dispatch)({
|
||||
const _callCircusTest = async (test, testContext) => {
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_fn_start',
|
||||
test
|
||||
});
|
||||
@@ -405,27 +205,25 @@ const _callCircusTest = (test, testContext) => {
|
||||
);
|
||||
|
||||
if (test.errors.length) {
|
||||
// We don't run the test if there's already an error in before hooks.
|
||||
return Promise.resolve();
|
||||
return; // We don't run the test if there's already an error in before hooks.
|
||||
}
|
||||
|
||||
return (0, _utils.callAsyncCircusFn)(test.fn, testContext, {
|
||||
isHook: false,
|
||||
timeout
|
||||
})
|
||||
.then(() =>
|
||||
(0, _state.dispatch)({
|
||||
name: 'test_fn_success',
|
||||
test
|
||||
})
|
||||
)
|
||||
.catch(error =>
|
||||
(0, _state.dispatch)({
|
||||
error,
|
||||
name: 'test_fn_failure',
|
||||
test
|
||||
})
|
||||
);
|
||||
try {
|
||||
await (0, _utils.callAsyncCircusFn)(test, testContext, {
|
||||
isHook: false,
|
||||
timeout
|
||||
});
|
||||
await (0, _state.dispatch)({
|
||||
name: 'test_fn_success',
|
||||
test
|
||||
});
|
||||
} catch (error) {
|
||||
await (0, _state.dispatch)({
|
||||
error,
|
||||
name: 'test_fn_failure',
|
||||
test
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var _default = run;
|
||||
|
||||
6
node_modules/jest-circus/build/state.d.ts
generated
vendored
6
node_modules/jest-circus/build/state.d.ts
generated
vendored
@@ -4,10 +4,10 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Circus } from '@jest/types';
|
||||
import type { Circus } from '@jest/types';
|
||||
export declare const ROOT_DESCRIBE_BLOCK_NAME = "ROOT_DESCRIBE_BLOCK";
|
||||
export declare const getState: () => Circus.State;
|
||||
export declare const setState: (state: Circus.State) => Circus.State;
|
||||
export declare const dispatch: (event: Circus.Event) => void;
|
||||
export declare const dispatch: (event: Circus.AsyncEvent) => Promise<void>;
|
||||
export declare const dispatchSync: (event: Circus.SyncEvent) => void;
|
||||
export declare const addEventHandler: (handler: Circus.EventHandler) => void;
|
||||
//# sourceMappingURL=state.d.ts.map
|
||||
1
node_modules/jest-circus/build/state.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/state.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAYnC,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAkB9D,eAAO,MAAM,QAAQ,oBAAwC,CAAC;AAC9D,eAAO,MAAM,QAAQ,uCACQ,CAAC;AAE9B,eAAO,MAAM,QAAQ,+BAIpB,CAAC;AAEF,eAAO,MAAM,eAAe,wCAE3B,CAAC"}
|
||||
27
node_modules/jest-circus/build/state.js
generated
vendored
27
node_modules/jest-circus/build/state.js
generated
vendored
@@ -3,11 +3,7 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.addEventHandler = exports.dispatch = exports.setState = exports.getState = exports.ROOT_DESCRIBE_BLOCK_NAME = void 0;
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _utils = require('./utils');
|
||||
exports.addEventHandler = exports.dispatchSync = exports.dispatch = exports.setState = exports.getState = exports.ROOT_DESCRIBE_BLOCK_NAME = void 0;
|
||||
|
||||
var _eventHandler = _interopRequireDefault(require('./eventHandler'));
|
||||
|
||||
@@ -15,6 +11,10 @@ var _formatNodeAssertErrors = _interopRequireDefault(
|
||||
require('./formatNodeAssertErrors')
|
||||
);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
@@ -34,7 +34,7 @@ const INITIAL_STATE = {
|
||||
currentlyRunningTest: null,
|
||||
expand: undefined,
|
||||
hasFocusedTests: false,
|
||||
// whether .only has been used on any test/describe
|
||||
hasStarted: false,
|
||||
includeTestLocationInResult: false,
|
||||
parentProcess: null,
|
||||
rootDescribeBlock: ROOT_DESCRIBE_BLOCK,
|
||||
@@ -52,15 +52,22 @@ const setState = state => (global[_types.STATE_SYM] = state);
|
||||
|
||||
exports.setState = setState;
|
||||
|
||||
const dispatch = event => {
|
||||
for (var _i = 0; _i < eventHandlers.length; _i++) {
|
||||
const handler = eventHandlers[_i];
|
||||
handler(event, getState());
|
||||
const dispatch = async event => {
|
||||
for (const handler of eventHandlers) {
|
||||
await handler(event, getState());
|
||||
}
|
||||
};
|
||||
|
||||
exports.dispatch = dispatch;
|
||||
|
||||
const dispatchSync = event => {
|
||||
for (const handler of eventHandlers) {
|
||||
handler(event, getState());
|
||||
}
|
||||
};
|
||||
|
||||
exports.dispatchSync = dispatchSync;
|
||||
|
||||
const addEventHandler = handler => {
|
||||
eventHandlers.push(handler);
|
||||
};
|
||||
|
||||
10
node_modules/jest-circus/build/testCaseReportHandler.d.ts
generated
vendored
Normal file
10
node_modules/jest-circus/build/testCaseReportHandler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import type { Circus } from '@jest/types';
|
||||
import type { TestFileEvent } from 'jest-runner';
|
||||
declare const testCaseReportHandler: (testPath: string, sendMessageToJest: TestFileEvent) => (event: Circus.Event) => void;
|
||||
export default testCaseReportHandler;
|
||||
28
node_modules/jest-circus/build/testCaseReportHandler.js
generated
vendored
Normal file
28
node_modules/jest-circus/build/testCaseReportHandler.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
/**
|
||||
* 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 testCaseReportHandler = (testPath, sendMessageToJest) => event => {
|
||||
switch (event.name) {
|
||||
case 'test_done': {
|
||||
const testResult = (0, _utils.makeSingleTestResult)(event.test);
|
||||
const testCaseResult = (0, _utils.parseSingleTestResult)(testResult);
|
||||
sendMessageToJest('test-case-result', [testPath, testCaseResult]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var _default = testCaseReportHandler;
|
||||
exports.default = _default;
|
||||
5
node_modules/jest-circus/build/types.d.ts
generated
vendored
5
node_modules/jest-circus/build/types.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.
|
||||
*/
|
||||
import expect from 'expect';
|
||||
import { Circus } from '@jest/types';
|
||||
import type { Circus } from '@jest/types';
|
||||
import expect = require('expect');
|
||||
export declare const STATE_SYM: "STATE_SYM_SYMBOL";
|
||||
export declare const RETRY_TIMES: "RETRY_TIMES_SYMBOL";
|
||||
export declare const TEST_TIMEOUT_SYMBOL: "TEST_TIMEOUT_SYMBOL";
|
||||
@@ -19,4 +19,3 @@ declare global {
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/jest-circus/build/types.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/types.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,SAAS,oBAEa,CAAC;AACpC,eAAO,MAAM,WAAW,sBAEa,CAAC;AAEtC,eAAO,MAAM,mBAAmB,uBAEM,CAAC;AAEvC,OAAO,CAAC,MAAM,CAAC;IACb,OAAO,MAAM,CAAC;QACZ,UAAU,MAAM;YACd,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC;YAC/B,kBAAkB,EAAE,MAAM,CAAC;YAC3B,mBAAmB,EAAE,MAAM,CAAC;YAC5B,MAAM,EAAE,OAAO,MAAM,CAAC;SACvB;KACF;CACF"}
|
||||
37
node_modules/jest-circus/build/utils.d.ts
generated
vendored
37
node_modules/jest-circus/build/utils.d.ts
generated
vendored
@@ -4,25 +4,30 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Circus } from '@jest/types';
|
||||
export declare const makeDescribe: (name: string, parent?: Circus.DescribeBlock | undefined, mode?: void | "skip" | "only" | "todo" | undefined) => Circus.DescribeBlock;
|
||||
export declare const makeTest: (fn: import("@jest/types/build/Global").TestFn | undefined, mode: Circus.BlockMode, name: string, parent: Circus.DescribeBlock, timeout: number | undefined, asyncError: any) => Circus.TestEntry;
|
||||
export declare const getAllHooksForDescribe: (describe: Circus.DescribeBlock) => {
|
||||
beforeAll: Circus.Hook[];
|
||||
afterAll: Circus.Hook[];
|
||||
import type { AssertionResult } from '@jest/test-result';
|
||||
import type { Circus } from '@jest/types';
|
||||
export declare const makeDescribe: (name: Circus.BlockName, parent?: Circus.DescribeBlock | undefined, mode?: void | "skip" | "only" | "todo" | undefined) => Circus.DescribeBlock;
|
||||
export declare const makeTest: (fn: Circus.TestFn, mode: Circus.TestMode, name: Circus.TestName, parent: Circus.DescribeBlock, timeout: number | undefined, asyncError: Circus.Exception) => Circus.TestEntry;
|
||||
declare type DescribeHooks = {
|
||||
beforeAll: Array<Circus.Hook>;
|
||||
afterAll: Array<Circus.Hook>;
|
||||
};
|
||||
export declare const getEachHooksForTest: (test: Circus.TestEntry) => {
|
||||
beforeEach: Circus.Hook[];
|
||||
afterEach: Circus.Hook[];
|
||||
export declare const getAllHooksForDescribe: (describe: Circus.DescribeBlock) => DescribeHooks;
|
||||
declare type TestHooks = {
|
||||
beforeEach: Array<Circus.Hook>;
|
||||
afterEach: Array<Circus.Hook>;
|
||||
};
|
||||
export declare const getEachHooksForTest: (test: Circus.TestEntry) => TestHooks;
|
||||
export declare const describeBlockHasTests: (describe: Circus.DescribeBlock) => boolean;
|
||||
export declare const callAsyncCircusFn: (fn: Circus.AsyncFn, testContext: Record<string, any> | undefined, { isHook, timeout }: {
|
||||
isHook?: boolean | null | undefined;
|
||||
export declare const callAsyncCircusFn: (testOrHook: Circus.TestEntry | Circus.Hook, testContext: Circus.TestContext | undefined, { isHook, timeout }: {
|
||||
isHook: boolean;
|
||||
timeout: number;
|
||||
}) => Promise<any>;
|
||||
}) => Promise<unknown>;
|
||||
export declare const getTestDuration: (test: Circus.TestEntry) => number | null;
|
||||
export declare const makeRunResult: (describeBlock: Circus.DescribeBlock, unhandledErrors: Error[]) => Circus.RunResult;
|
||||
export declare const makeRunResult: (describeBlock: Circus.DescribeBlock, unhandledErrors: Array<Error>) => Circus.RunResult;
|
||||
export declare const makeSingleTestResult: (test: Circus.TestEntry) => Circus.TestResult;
|
||||
export declare const getTestID: (test: Circus.TestEntry) => string;
|
||||
export declare const addErrorToEachTestUnderDescribe: (describeBlock: Circus.DescribeBlock, error: any, asyncError: any) => void;
|
||||
export declare const invariant: (condition: unknown, message?: string | undefined) => void;
|
||||
//# sourceMappingURL=utils.d.ts.map
|
||||
export declare const addErrorToEachTestUnderDescribe: (describeBlock: Circus.DescribeBlock, error: Circus.Exception, asyncError: Circus.Exception) => void;
|
||||
export declare function invariant(condition: unknown, message?: string): asserts condition;
|
||||
export declare const parseSingleTestResult: (testResult: Circus.TestResult) => AssertionResult;
|
||||
export {};
|
||||
|
||||
1
node_modules/jest-circus/build/utils.d.ts.map
generated
vendored
1
node_modules/jest-circus/build/utils.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAUnC,eAAO,MAAM,YAAY,uIAmBxB,CAAC;AAEF,eAAO,MAAM,QAAQ,mMAmBnB,CAAC;AAkBH,eAAO,MAAM,sBAAsB;;;CAuBlC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAwB/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,6CAG0C,CAAC;AAe7E,eAAO,MAAM,iBAAiB;;;kBAsF7B,CAAC;AAEF,eAAO,MAAM,eAAe,2CAG3B,CAAC;AAEF,eAAO,MAAM,aAAa,qFAMxB,CAAC;AAuDH,eAAO,MAAM,SAAS,oCASrB,CAAC;AA8BF,eAAO,MAAM,+BAA+B,4EAY3C,CAAC;AAEF,eAAO,MAAM,SAAS,4DAIrB,CAAC"}
|
||||
522
node_modules/jest-circus/build/utils.js
generated
vendored
522
node_modules/jest-circus/build/utils.js
generated
vendored
@@ -3,16 +3,21 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.invariant = exports.addErrorToEachTestUnderDescribe = exports.getTestID = exports.makeRunResult = exports.getTestDuration = exports.callAsyncCircusFn = exports.describeBlockHasTests = exports.getEachHooksForTest = exports.getAllHooksForDescribe = exports.makeTest = exports.makeDescribe = void 0;
|
||||
exports.invariant = invariant;
|
||||
exports.parseSingleTestResult = exports.addErrorToEachTestUnderDescribe = exports.getTestID = exports.makeSingleTestResult = exports.makeRunResult = exports.getTestDuration = exports.callAsyncCircusFn = exports.describeBlockHasTests = exports.getEachHooksForTest = exports.getAllHooksForDescribe = exports.makeTest = exports.makeDescribe = void 0;
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn'));
|
||||
var path = _interopRequireWildcard(require('path'));
|
||||
|
||||
var _co = _interopRequireDefault(require('co'));
|
||||
|
||||
var _dedent = _interopRequireDefault(require('dedent'));
|
||||
|
||||
var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn'));
|
||||
|
||||
var _stackUtils = _interopRequireDefault(require('stack-utils'));
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
var _state = require('./state');
|
||||
@@ -21,14 +26,57 @@ function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const stackUtils = new _stackUtils.default({
|
||||
cwd: 'A path that does not exist'
|
||||
});
|
||||
const jestEachBuildDir = path.dirname(require.resolve('jest-each'));
|
||||
|
||||
const makeDescribe = (name, parent, mode) => {
|
||||
let _mode = mode;
|
||||
@@ -39,6 +87,8 @@ const makeDescribe = (name, parent, mode) => {
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'describeBlock',
|
||||
// eslint-disable-next-line sort-keys
|
||||
children: [],
|
||||
hooks: [],
|
||||
mode: _mode,
|
||||
@@ -51,6 +101,8 @@ const makeDescribe = (name, parent, mode) => {
|
||||
exports.makeDescribe = makeDescribe;
|
||||
|
||||
const makeTest = (fn, mode, name, parent, timeout, asyncError) => ({
|
||||
type: 'test',
|
||||
// eslint-disable-next-line sort-keys
|
||||
asyncError,
|
||||
duration: null,
|
||||
errors: [],
|
||||
@@ -68,19 +120,16 @@ const makeTest = (fn, mode, name, parent, timeout, asyncError) => ({
|
||||
exports.makeTest = makeTest;
|
||||
|
||||
const hasEnabledTest = describeBlock => {
|
||||
const _getState = (0, _state.getState)(),
|
||||
hasFocusedTests = _getState.hasFocusedTests,
|
||||
testNamePattern = _getState.testNamePattern;
|
||||
|
||||
const hasOwnEnabledTests = describeBlock.tests.some(
|
||||
test =>
|
||||
!(
|
||||
test.mode === 'skip' ||
|
||||
(hasFocusedTests && test.mode !== 'only') ||
|
||||
(testNamePattern && !testNamePattern.test(getTestID(test)))
|
||||
)
|
||||
const {hasFocusedTests, testNamePattern} = (0, _state.getState)();
|
||||
return describeBlock.children.some(child =>
|
||||
child.type === 'describeBlock'
|
||||
? hasEnabledTest(child)
|
||||
: !(
|
||||
child.mode === 'skip' ||
|
||||
(hasFocusedTests && child.mode !== 'only') ||
|
||||
(testNamePattern && !testNamePattern.test(getTestID(child)))
|
||||
)
|
||||
);
|
||||
return hasOwnEnabledTests || describeBlock.children.some(hasEnabledTest);
|
||||
};
|
||||
|
||||
const getAllHooksForDescribe = describe => {
|
||||
@@ -90,40 +139,15 @@ const getAllHooksForDescribe = describe => {
|
||||
};
|
||||
|
||||
if (hasEnabledTest(describe)) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
for (const hook of describe.hooks) {
|
||||
switch (hook.type) {
|
||||
case 'beforeAll':
|
||||
result.beforeAll.push(hook);
|
||||
break;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = describe.hooks[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const hook = _step.value;
|
||||
|
||||
switch (hook.type) {
|
||||
case 'beforeAll':
|
||||
result.beforeAll.push(hook);
|
||||
break;
|
||||
|
||||
case 'afterAll':
|
||||
result.afterAll.push(hook);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
case 'afterAll':
|
||||
result.afterAll.push(hook);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,44 +165,22 @@ const getEachHooksForTest = test => {
|
||||
let block = test.parent;
|
||||
|
||||
do {
|
||||
const beforeEachForCurrentBlock = [];
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
const beforeEachForCurrentBlock = []; // TODO: inline after https://github.com/microsoft/TypeScript/pull/34840 is released
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator2 = block.hooks[Symbol.iterator](), _step2;
|
||||
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
|
||||
_iteratorNormalCompletion2 = true
|
||||
) {
|
||||
const hook = _step2.value;
|
||||
let hook;
|
||||
|
||||
switch (hook.type) {
|
||||
case 'beforeEach':
|
||||
beforeEachForCurrentBlock.push(hook);
|
||||
break;
|
||||
for (hook of block.hooks) {
|
||||
switch (hook.type) {
|
||||
case 'beforeEach':
|
||||
beforeEachForCurrentBlock.push(hook);
|
||||
break;
|
||||
|
||||
case 'afterEach':
|
||||
result.afterEach.push(hook);
|
||||
break;
|
||||
}
|
||||
} // 'beforeEach' hooks are executed from top to bottom, the opposite of the
|
||||
// way we traversed it.
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
case 'afterEach':
|
||||
result.afterEach.push(hook);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // 'beforeEach' hooks are executed from top to bottom, the opposite of the
|
||||
// way we traversed it.
|
||||
|
||||
result.beforeEach = [...beforeEachForCurrentBlock, ...result.beforeEach];
|
||||
} while ((block = block.parent));
|
||||
@@ -189,55 +191,80 @@ const getEachHooksForTest = test => {
|
||||
exports.getEachHooksForTest = getEachHooksForTest;
|
||||
|
||||
const describeBlockHasTests = describe =>
|
||||
describe.tests.length > 0 || describe.children.some(describeBlockHasTests);
|
||||
describe.children.some(
|
||||
child => child.type === 'test' || describeBlockHasTests(child)
|
||||
);
|
||||
|
||||
exports.describeBlockHasTests = describeBlockHasTests;
|
||||
|
||||
const _makeTimeoutMessage = (timeout, isHook) =>
|
||||
`Exceeded timeout of ${timeout}ms for a ${
|
||||
`Exceeded timeout of ${(0, _jestUtil.formatTime)(timeout)} for a ${
|
||||
isHook ? 'hook' : 'test'
|
||||
}.\nUse jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test.`; // Global values can be overwritten by mocks or tests. We'll capture
|
||||
// the original values in the variables before we require any files.
|
||||
|
||||
const _global = global,
|
||||
setTimeout = _global.setTimeout,
|
||||
clearTimeout = _global.clearTimeout;
|
||||
const {setTimeout, clearTimeout} = global;
|
||||
|
||||
function checkIsError(error) {
|
||||
return !!(error && error.message && error.stack);
|
||||
}
|
||||
|
||||
const callAsyncCircusFn = (fn, testContext, {isHook, timeout}) => {
|
||||
const callAsyncCircusFn = (testOrHook, testContext, {isHook, timeout}) => {
|
||||
let timeoutID;
|
||||
let completed = false;
|
||||
const {fn, asyncError} = testOrHook;
|
||||
return new Promise((resolve, reject) => {
|
||||
timeoutID = setTimeout(
|
||||
() => reject(_makeTimeoutMessage(timeout, !!isHook)),
|
||||
() => reject(_makeTimeoutMessage(timeout, isHook)),
|
||||
timeout
|
||||
); // If this fn accepts `done` callback we return a promise that fulfills as
|
||||
// soon as `done` called.
|
||||
|
||||
if (fn.length) {
|
||||
let returnedValue = undefined;
|
||||
|
||||
const done = reason => {
|
||||
const errorAsErrorObject = checkIsError(reason)
|
||||
? reason
|
||||
: new Error(
|
||||
`Failed: ${(0, _prettyFormat.default)(reason, {
|
||||
// We need to keep a stack here before the promise tick
|
||||
const errorAtDone = new _jestUtil.ErrorWithStack(undefined, done); // Use `Promise.resolve` to allow the event loop to go a single tick in case `done` is called synchronously
|
||||
|
||||
Promise.resolve().then(() => {
|
||||
if (returnedValue !== undefined) {
|
||||
asyncError.message = (0, _dedent.default)`
|
||||
Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.
|
||||
Returned value: ${(0, _prettyFormat.default)(returnedValue, {
|
||||
maxDepth: 3
|
||||
})}
|
||||
`;
|
||||
return reject(asyncError);
|
||||
}
|
||||
|
||||
let errorAsErrorObject;
|
||||
|
||||
if (checkIsError(reason)) {
|
||||
errorAsErrorObject = reason;
|
||||
} else {
|
||||
errorAsErrorObject = errorAtDone;
|
||||
errorAtDone.message = `Failed: ${(0, _prettyFormat.default)(
|
||||
reason,
|
||||
{
|
||||
maxDepth: 3
|
||||
})}`
|
||||
); // Consider always throwing, regardless if `reason` is set or not
|
||||
}
|
||||
)}`;
|
||||
} // Consider always throwing, regardless if `reason` is set or not
|
||||
|
||||
if (completed && reason) {
|
||||
errorAsErrorObject.message =
|
||||
'Caught error after test environment was torn down\n\n' +
|
||||
errorAsErrorObject.message;
|
||||
throw errorAsErrorObject;
|
||||
}
|
||||
if (completed && reason) {
|
||||
errorAsErrorObject.message =
|
||||
'Caught error after test environment was torn down\n\n' +
|
||||
errorAsErrorObject.message;
|
||||
throw errorAsErrorObject;
|
||||
}
|
||||
|
||||
return reason ? reject(errorAsErrorObject) : resolve();
|
||||
return reason ? reject(errorAsErrorObject) : resolve();
|
||||
});
|
||||
};
|
||||
|
||||
return fn.call(testContext, done);
|
||||
returnedValue = fn.call(testContext, done);
|
||||
return;
|
||||
}
|
||||
|
||||
let returnedValue;
|
||||
@@ -248,7 +275,8 @@ const callAsyncCircusFn = (fn, testContext, {isHook, timeout}) => {
|
||||
try {
|
||||
returnedValue = fn.call(testContext);
|
||||
} catch (error) {
|
||||
return reject(error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
} // If it's a Promise, return it. Test for an object with a `then` function
|
||||
// to support custom Promise implementations.
|
||||
@@ -258,20 +286,24 @@ const callAsyncCircusFn = (fn, testContext, {isHook, timeout}) => {
|
||||
returnedValue !== null &&
|
||||
typeof returnedValue.then === 'function'
|
||||
) {
|
||||
return returnedValue.then(resolve, reject);
|
||||
returnedValue.then(resolve, reject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isHook && returnedValue !== void 0) {
|
||||
return reject(
|
||||
new Error(`
|
||||
if (!isHook && returnedValue !== undefined) {
|
||||
reject(
|
||||
new Error((0, _dedent.default)`
|
||||
test functions can only return Promise or undefined.
|
||||
Returned value: ${String(returnedValue)}
|
||||
Returned value: ${(0, _prettyFormat.default)(returnedValue, {
|
||||
maxDepth: 3
|
||||
})}
|
||||
`)
|
||||
);
|
||||
return;
|
||||
} // Otherwise this test is synchronous, and if it didn't throw it means
|
||||
// it passed.
|
||||
|
||||
return resolve();
|
||||
resolve();
|
||||
})
|
||||
.then(() => {
|
||||
completed = true; // If timeout is not cleared/unrefed the node process won't exit until
|
||||
@@ -291,7 +323,7 @@ const callAsyncCircusFn = (fn, testContext, {isHook, timeout}) => {
|
||||
exports.callAsyncCircusFn = callAsyncCircusFn;
|
||||
|
||||
const getTestDuration = test => {
|
||||
const startedAt = test.startedAt;
|
||||
const {startedAt} = test;
|
||||
return typeof startedAt === 'number' ? jestNow() - startedAt : null;
|
||||
};
|
||||
|
||||
@@ -299,106 +331,82 @@ exports.getTestDuration = getTestDuration;
|
||||
|
||||
const makeRunResult = (describeBlock, unhandledErrors) => ({
|
||||
testResults: makeTestResults(describeBlock),
|
||||
unhandledErrors: unhandledErrors.map(_formatError)
|
||||
unhandledErrors: unhandledErrors.map(_getError).map(getErrorStack)
|
||||
});
|
||||
|
||||
exports.makeRunResult = makeRunResult;
|
||||
|
||||
const makeTestResults = describeBlock => {
|
||||
const _getState2 = (0, _state.getState)(),
|
||||
includeTestLocationInResult = _getState2.includeTestLocationInResult;
|
||||
const makeSingleTestResult = test => {
|
||||
const {includeTestLocationInResult} = (0, _state.getState)();
|
||||
const testPath = [];
|
||||
let parent = test;
|
||||
const {status} = test;
|
||||
invariant(status, 'Status should be present after tests are run.');
|
||||
|
||||
let testResults = [];
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
do {
|
||||
testPath.unshift(parent.name);
|
||||
} while ((parent = parent.parent));
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator3 = describeBlock.tests[Symbol.iterator](), _step3;
|
||||
!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done);
|
||||
_iteratorNormalCompletion3 = true
|
||||
let location = null;
|
||||
|
||||
if (includeTestLocationInResult) {
|
||||
var _parsedLine, _parsedLine$file;
|
||||
|
||||
const stackLines = test.asyncError.stack.split('\n');
|
||||
const stackLine = stackLines[1];
|
||||
let parsedLine = stackUtils.parseLine(stackLine);
|
||||
|
||||
if (
|
||||
(_parsedLine = parsedLine) === null || _parsedLine === void 0
|
||||
? void 0
|
||||
: (_parsedLine$file = _parsedLine.file) === null ||
|
||||
_parsedLine$file === void 0
|
||||
? void 0
|
||||
: _parsedLine$file.startsWith(jestEachBuildDir)
|
||||
) {
|
||||
const test = _step3.value;
|
||||
const testPath = [];
|
||||
let parent = test;
|
||||
|
||||
do {
|
||||
testPath.unshift(parent.name);
|
||||
} while ((parent = parent.parent));
|
||||
|
||||
const status = test.status;
|
||||
|
||||
if (!status) {
|
||||
throw new Error('Status should be present after tests are run.');
|
||||
}
|
||||
|
||||
let location = null;
|
||||
|
||||
if (includeTestLocationInResult) {
|
||||
const stackLine = test.asyncError.stack.split('\n')[1];
|
||||
const parsedLine = stackUtils.parseLine(stackLine);
|
||||
|
||||
if (
|
||||
parsedLine &&
|
||||
typeof parsedLine.column === 'number' &&
|
||||
typeof parsedLine.line === 'number'
|
||||
) {
|
||||
location = {
|
||||
column: parsedLine.column,
|
||||
line: parsedLine.line
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
testResults.push({
|
||||
duration: test.duration,
|
||||
errors: test.errors.map(_formatError),
|
||||
invocations: test.invocations,
|
||||
location,
|
||||
status,
|
||||
testPath
|
||||
});
|
||||
const stackLine = stackLines[4];
|
||||
parsedLine = stackUtils.parseLine(stackLine);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
|
||||
if (
|
||||
parsedLine &&
|
||||
typeof parsedLine.column === 'number' &&
|
||||
typeof parsedLine.line === 'number'
|
||||
) {
|
||||
location = {
|
||||
column: parsedLine.column,
|
||||
line: parsedLine.line
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
const errorsDetailed = test.errors.map(_getError);
|
||||
return {
|
||||
duration: test.duration,
|
||||
errors: errorsDetailed.map(getErrorStack),
|
||||
errorsDetailed,
|
||||
invocations: test.invocations,
|
||||
location,
|
||||
status,
|
||||
testPath: Array.from(testPath)
|
||||
};
|
||||
};
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator4 = describeBlock.children[Symbol.iterator](), _step4;
|
||||
!(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done);
|
||||
_iteratorNormalCompletion4 = true
|
||||
) {
|
||||
const child = _step4.value;
|
||||
testResults = testResults.concat(makeTestResults(child));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
||||
_iterator4.return();
|
||||
exports.makeSingleTestResult = makeSingleTestResult;
|
||||
|
||||
const makeTestResults = describeBlock => {
|
||||
const testResults = [];
|
||||
|
||||
for (const child of describeBlock.children) {
|
||||
switch (child.type) {
|
||||
case 'describeBlock': {
|
||||
testResults.push(...makeTestResults(child));
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
|
||||
case 'test': {
|
||||
testResults.push(makeSingleTestResult(child));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,7 +430,7 @@ const getTestID = test => {
|
||||
|
||||
exports.getTestID = getTestID;
|
||||
|
||||
const _formatError = errors => {
|
||||
const _getError = errors => {
|
||||
let error;
|
||||
let asyncError;
|
||||
|
||||
@@ -434,86 +442,72 @@ const _formatError = errors => {
|
||||
asyncError = new Error();
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (error.stack) {
|
||||
return error.stack;
|
||||
}
|
||||
|
||||
if (error.message) {
|
||||
return error.message;
|
||||
}
|
||||
if (error && (typeof error.stack === 'string' || error.message)) {
|
||||
return error;
|
||||
}
|
||||
|
||||
asyncError.message = `thrown: ${(0, _prettyFormat.default)(error, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
return asyncError.stack;
|
||||
return asyncError;
|
||||
};
|
||||
|
||||
const getErrorStack = error =>
|
||||
typeof error.stack === 'string' ? error.stack : error.message;
|
||||
|
||||
const addErrorToEachTestUnderDescribe = (describeBlock, error, asyncError) => {
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
for (const child of describeBlock.children) {
|
||||
switch (child.type) {
|
||||
case 'describeBlock':
|
||||
addErrorToEachTestUnderDescribe(child, error, asyncError);
|
||||
break;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator5 = describeBlock.tests[Symbol.iterator](), _step5;
|
||||
!(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done);
|
||||
_iteratorNormalCompletion5 = true
|
||||
) {
|
||||
const test = _step5.value;
|
||||
test.errors.push([error, asyncError]);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion6 = true;
|
||||
var _didIteratorError6 = false;
|
||||
var _iteratorError6 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator6 = describeBlock.children[Symbol.iterator](), _step6;
|
||||
!(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done);
|
||||
_iteratorNormalCompletion6 = true
|
||||
) {
|
||||
const child = _step6.value;
|
||||
addErrorToEachTestUnderDescribe(child, error, asyncError);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError6 = true;
|
||||
_iteratorError6 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
||||
_iterator6.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError6) {
|
||||
throw _iteratorError6;
|
||||
}
|
||||
case 'test':
|
||||
child.errors.push([error, asyncError]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.addErrorToEachTestUnderDescribe = addErrorToEachTestUnderDescribe;
|
||||
|
||||
const invariant = (condition, message) => {
|
||||
function invariant(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
const parseSingleTestResult = testResult => {
|
||||
let status;
|
||||
|
||||
if (testResult.status === 'skip') {
|
||||
status = 'pending';
|
||||
} else if (testResult.status === 'todo') {
|
||||
status = 'todo';
|
||||
} else if (testResult.errors.length > 0) {
|
||||
status = 'failed';
|
||||
} else {
|
||||
status = 'passed';
|
||||
}
|
||||
|
||||
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: Array.from(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]
|
||||
};
|
||||
};
|
||||
|
||||
exports.invariant = invariant;
|
||||
exports.parseSingleTestResult = parseSingleTestResult;
|
||||
|
||||
Reference in New Issue
Block a user