aboutsummaryrefslogtreecommitdiff
path: root/node_modules/jest-circus
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/jest-circus')
-rw-r--r--node_modules/jest-circus/LICENSE21
-rw-r--r--node_modules/jest-circus/README.md65
-rw-r--r--node_modules/jest-circus/build/eventHandler.d.ts9
-rw-r--r--node_modules/jest-circus/build/eventHandler.js338
-rw-r--r--node_modules/jest-circus/build/formatNodeAssertErrors.d.ts9
-rw-r--r--node_modules/jest-circus/build/formatNodeAssertErrors.js204
-rw-r--r--node_modules/jest-circus/build/globalErrorHandlers.d.ts9
-rw-r--r--node_modules/jest-circus/build/globalErrorHandlers.js51
-rw-r--r--node_modules/jest-circus/build/index.d.ts52
-rw-r--r--node_modules/jest-circus/build/index.js226
-rw-r--r--node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts12
-rw-r--r--node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js123
-rw-r--r--node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts36
-rw-r--r--node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js299
-rw-r--r--node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts10
-rw-r--r--node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js37
-rw-r--r--node_modules/jest-circus/build/run.d.ts9
-rw-r--r--node_modules/jest-circus/build/run.js236
-rw-r--r--node_modules/jest-circus/build/state.d.ts14
-rw-r--r--node_modules/jest-circus/build/state.js93
-rw-r--r--node_modules/jest-circus/build/testCaseReportHandler.d.ts10
-rw-r--r--node_modules/jest-circus/build/testCaseReportHandler.js28
-rw-r--r--node_modules/jest-circus/build/types.d.ts21
-rw-r--r--node_modules/jest-circus/build/types.js35
-rw-r--r--node_modules/jest-circus/build/utils.d.ts33
-rw-r--r--node_modules/jest-circus/build/utils.js637
-rw-r--r--node_modules/jest-circus/package.json58
-rw-r--r--node_modules/jest-circus/runner.js10
28 files changed, 2685 insertions, 0 deletions
diff --git a/node_modules/jest-circus/LICENSE b/node_modules/jest-circus/LICENSE
new file mode 100644
index 0000000..b96dcb0
--- /dev/null
+++ b/node_modules/jest-circus/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) Facebook, Inc. and its affiliates.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/jest-circus/README.md b/node_modules/jest-circus/README.md
new file mode 100644
index 0000000..67305ed
--- /dev/null
+++ b/node_modules/jest-circus/README.md
@@ -0,0 +1,65 @@
+[type-definitions]: https://github.com/facebook/jest/blob/main/packages/jest-types/src/Circus.ts
+
+<h1 align="center">
+ <img src="https://jestjs.io/img/jest.png" height="150" width="150"/>
+ <img src="https://jestjs.io/img/circus.png" height="150" width="150"/>
+ <p align="center">jest-circus</p>
+ <p align="center">The next-gen test runner for Jest</p>
+</h1>
+
+## Overview
+
+Circus is a flux-based test runner for Jest that is fast, maintainable, and simple to extend.
+
+Circus allows you to bind to events via an optional event handler on any [custom environment](https://jestjs.io/docs/configuration#testenvironment-string). See the [type definitions][type-definitions] for more information on the events and state data currently available.
+
+```js
+import {Event, State} from 'jest-circus';
+import NodeEnvironment from 'jest-environment-node';
+
+class MyCustomEnvironment extends NodeEnvironment {
+ //...
+
+ async handleTestEvent(event: Event, state: State) {
+ if (event.name === 'test_start') {
+ // ...
+ }
+ }
+}
+```
+
+Mutating event or state data is currently unsupported and may cause unexpected behavior or break in a future release without warning. New events, event data, and/or state data will not be considered a breaking change and may be added in any minor release.
+
+Note, that `jest-circus` test runner would pause until a promise returned from `handleTestEvent` gets fulfilled. **However, there are a few events that do not conform to this rule, namely**: `start_describe_definition`, `finish_describe_definition`, `add_hook`, `add_test` or `error` (for the up-to-date list you can look at [SyncEvent type in the types definitions][type-definitions]). That is caused by backward compatibility reasons and `process.on('unhandledRejection', callback)` signature, but that usually should not be a problem for most of the use cases.
+
+## Installation
+
+> Note: As of Jest 27, `jest-circus` is the default test runner, so you do not have to install it to use it.
+
+Install `jest-circus` using yarn:
+
+```bash
+yarn add --dev jest-circus
+```
+
+Or via npm:
+
+```bash
+npm install --save-dev jest-circus
+```
+
+## Configure
+
+Configure Jest to use `jest-circus` via the [`testRunner`](https://jestjs.io/docs/configuration#testrunner-string) option:
+
+```json
+{
+ "testRunner": "jest-circus/runner"
+}
+```
+
+Or via CLI:
+
+```bash
+jest --testRunner='jest-circus/runner'
+```
diff --git a/node_modules/jest-circus/build/eventHandler.d.ts b/node_modules/jest-circus/build/eventHandler.d.ts
new file mode 100644
index 0000000..666bd20
--- /dev/null
+++ b/node_modules/jest-circus/build/eventHandler.d.ts
@@ -0,0 +1,9 @@
+/**
+ * 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';
+declare const eventHandler: Circus.EventHandler;
+export default eventHandler;
diff --git a/node_modules/jest-circus/build/eventHandler.js b/node_modules/jest-circus/build/eventHandler.js
new file mode 100644
index 0000000..1dac46b
--- /dev/null
+++ b/node_modules/jest-circus/build/eventHandler.js
@@ -0,0 +1,338 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.default = void 0;
+
+var _globalErrorHandlers = require('./globalErrorHandlers');
+
+var _types = require('./types');
+
+var _utils = require('./utils');
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+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': {
+ state.includeTestLocationInResult = true;
+ break;
+ }
+
+ case 'hook_start': {
+ event.hook.seenDone = false;
+ break;
+ }
+
+ case 'start_describe_definition': {
+ 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,
+ mode
+ );
+ currentDescribeBlock.children.push(describeBlock);
+ state.currentDescribeBlock = describeBlock;
+ break;
+ }
+
+ case 'finish_describe_definition': {
+ const {currentDescribeBlock} = state;
+ (0, _utils.invariant)(
+ currentDescribeBlock,
+ 'currentDescribeBlock must be there'
+ );
+
+ if (!(0, _utils.describeBlockHasTests)(currentDescribeBlock)) {
+ currentDescribeBlock.hooks.forEach(hook => {
+ hook.asyncError.message = `Invalid: ${hook.type}() may not be used in a describe block containing no tests.`;
+ state.unhandledErrors.push(hook.asyncError);
+ });
+ } // pass mode of currentDescribeBlock to tests
+ // but do not when there is already a single test with "only" mode
+
+ const shouldPassMode = !(
+ currentDescribeBlock.mode === 'only' &&
+ currentDescribeBlock.children.some(
+ child => child.type === 'test' && child.mode === 'only'
+ )
+ );
+
+ if (shouldPassMode) {
+ currentDescribeBlock.children.forEach(child => {
+ if (child.type === 'test' && !child.mode) {
+ child.mode = currentDescribeBlock.mode;
+ }
+ });
+ }
+
+ if (
+ !state.hasFocusedTests &&
+ currentDescribeBlock.mode !== 'skip' &&
+ currentDescribeBlock.children.some(
+ child => child.type === 'test' && child.mode === 'only'
+ )
+ ) {
+ state.hasFocusedTests = true;
+ }
+
+ if (currentDescribeBlock.parent) {
+ state.currentDescribeBlock = currentDescribeBlock.parent;
+ }
+
+ break;
+ }
+
+ case 'add_hook': {
+ 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,
+ fn,
+ parent,
+ seenDone: false,
+ timeout,
+ type
+ });
+ break;
+ }
+
+ case 'add_test': {
+ 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,
+ name,
+ currentDescribeBlock,
+ timeout,
+ asyncError
+ );
+
+ if (currentDescribeBlock.mode !== 'skip' && test.mode === 'only') {
+ state.hasFocusedTests = true;
+ }
+
+ currentDescribeBlock.children.push(test);
+ currentDescribeBlock.tests.push(test);
+ break;
+ }
+
+ case 'hook_failure': {
+ const {test, describeBlock, error, hook} = event;
+ const {asyncError, type} = hook;
+
+ if (type === 'beforeAll') {
+ (0, _utils.invariant)(describeBlock, 'always present for `*All` hooks');
+ (0, _utils.addErrorToEachTestUnderDescribe)(
+ describeBlock,
+ error,
+ asyncError
+ );
+ } else if (type === 'afterAll') {
+ // Attaching `afterAll` errors to each test makes execution flow
+ // too complicated, so we'll consider them to be global.
+ state.unhandledErrors.push([error, asyncError]);
+ } else {
+ (0, _utils.invariant)(test, 'always present for `*Each` hooks');
+ test.errors.push([error, asyncError]);
+ }
+
+ break;
+ }
+
+ case 'test_skip': {
+ event.test.status = 'skip';
+ break;
+ }
+
+ case 'test_todo': {
+ event.test.status = 'todo';
+ break;
+ }
+
+ case 'test_done': {
+ event.test.duration = (0, _utils.getTestDuration)(event.test);
+ event.test.status = 'done';
+ state.currentlyRunningTest = null;
+ break;
+ }
+
+ case 'test_start': {
+ state.currentlyRunningTest = event.test;
+ event.test.startedAt = jestNow();
+ event.test.invocations += 1;
+ break;
+ }
+
+ case 'test_fn_start': {
+ event.test.seenDone = false;
+ break;
+ }
+
+ case 'test_fn_failure': {
+ const {
+ error,
+ test: {asyncError}
+ } = event;
+ event.test.errors.push([error, asyncError]);
+ break;
+ }
+
+ case 'test_retry': {
+ event.test.errors = [];
+ break;
+ }
+
+ case 'run_start': {
+ state.hasStarted = true;
+ global[_types.TEST_TIMEOUT_SYMBOL] &&
+ (state.testTimeout = global[_types.TEST_TIMEOUT_SYMBOL]);
+ break;
+ }
+
+ case 'run_finish': {
+ break;
+ }
+
+ case 'setup': {
+ // Uncaught exception handlers should be defined on the parent process
+ // object. If defined on the VM's process object they just no op and let
+ // the parent process crash. It might make sense to return a `dispatch`
+ // function to the parent process and register handlers there instead, but
+ // i'm not sure if this is works. For now i just replicated whatever
+ // jasmine was doing -- dabramov
+ state.parentProcess = event.parentProcess;
+ (0, _utils.invariant)(state.parentProcess);
+ state.originalGlobalErrorHandlers = (0,
+ _globalErrorHandlers.injectGlobalErrorHandlers)(state.parentProcess);
+
+ if (event.testNamePattern) {
+ state.testNamePattern = new RegExp(event.testNamePattern, 'i');
+ }
+
+ break;
+ }
+
+ case 'teardown': {
+ (0, _utils.invariant)(state.originalGlobalErrorHandlers);
+ (0, _utils.invariant)(state.parentProcess);
+ (0, _globalErrorHandlers.restoreGlobalErrorHandlers)(
+ state.parentProcess,
+ state.originalGlobalErrorHandlers
+ );
+ break;
+ }
+
+ case 'error': {
+ // It's very likely for long-running async tests to throw errors. In this
+ // case we want to catch them and fail the current test. At the same time
+ // there's a possibility that one test sets a long timeout, that will
+ // eventually throw after this test finishes but during some other test
+ // execution, which will result in one test's error failing another test.
+ // In any way, it should be possible to track where the error was thrown
+ // from.
+ state.currentlyRunningTest
+ ? state.currentlyRunningTest.errors.push(event.error)
+ : state.unhandledErrors.push(event.error);
+ break;
+ }
+ }
+};
+
+var _default = eventHandler;
+exports.default = _default;
diff --git a/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts b/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts
new file mode 100644
index 0000000..0e70ecb
--- /dev/null
+++ b/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts
@@ -0,0 +1,9 @@
+/**
+ * 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';
+declare const formatNodeAssertErrors: (event: Circus.Event, state: Circus.State) => void;
+export default formatNodeAssertErrors;
diff --git a/node_modules/jest-circus/build/formatNodeAssertErrors.js b/node_modules/jest-circus/build/formatNodeAssertErrors.js
new file mode 100644
index 0000000..38d5799
--- /dev/null
+++ b/node_modules/jest-circus/build/formatNodeAssertErrors.js
@@ -0,0 +1,204 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.default = void 0;
+
+var _assert = require('assert');
+
+var _chalk = _interopRequireDefault(require('chalk'));
+
+var _jestMatcherUtils = require('jest-matcher-utils');
+
+var _prettyFormat = require('pretty-format');
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : {default: obj};
+}
+
+/**
+ * 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',
+ '==': 'equal',
+ '===': 'strictEqual'
+};
+const humanReadableOperators = {
+ deepEqual: 'to deeply equal',
+ deepStrictEqual: 'to deeply and strictly equal',
+ equal: 'to be equal',
+ notDeepEqual: 'not to deeply equal',
+ notDeepStrictEqual: 'not to deeply and strictly equal',
+ notEqual: 'to not be equal',
+ notStrictEqual: 'not be strictly equal',
+ strictEqual: 'to strictly be equal'
+};
+
+const formatNodeAssertErrors = (event, state) => {
+ if (event.name === 'test_done') {
+ event.test.errors = event.test.errors.map(errors => {
+ let error;
+
+ 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.format)(originalError, {
+ maxDepth: 3
+ })}`;
+ } else {
+ error = originalError;
+ }
+ } else {
+ error = errors;
+ }
+
+ return isAssertionError(error)
+ ? {
+ message: assertionErrorMessage(error, {
+ expand: state.expand
+ })
+ }
+ : errors;
+ });
+ }
+};
+
+const getOperatorName = (operator, stack) => {
+ if (typeof operator === 'string') {
+ return assertOperatorsMap[operator] || operator;
+ }
+
+ if (stack.match('.doesNotThrow')) {
+ return 'doesNotThrow';
+ }
+
+ if (stack.match('.throws')) {
+ return 'throws';
+ } // this fallback is only needed for versions older than node 10
+
+ if (stack.match('.fail')) {
+ return 'fail';
+ }
+
+ return '';
+};
+
+const operatorMessage = operator => {
+ const niceOperatorName = getOperatorName(operator, '');
+ const humanReadableOperator = humanReadableOperators[niceOperatorName];
+ return typeof operator === 'string'
+ ? `${humanReadableOperator || niceOperatorName} to:\n`
+ : '';
+};
+
+const assertThrowingMatcherHint = operatorName =>
+ operatorName
+ ? _chalk.default.dim('assert') +
+ _chalk.default.dim('.' + operatorName + '(') +
+ _chalk.default.red('function') +
+ _chalk.default.dim(')')
+ : '';
+
+const assertMatcherHint = (operator, operatorName, expected) => {
+ let message = '';
+
+ if (operator === '==' && expected === true) {
+ message =
+ _chalk.default.dim('assert') +
+ _chalk.default.dim('(') +
+ _chalk.default.red('received') +
+ _chalk.default.dim(')');
+ } else if (operatorName) {
+ message =
+ _chalk.default.dim('assert') +
+ _chalk.default.dim('.' + operatorName + '(') +
+ _chalk.default.red('received') +
+ _chalk.default.dim(', ') +
+ _chalk.default.green('expected') +
+ _chalk.default.dim(')');
+ }
+
+ return message;
+};
+
+function assertionErrorMessage(error, options) {
+ const {expected, actual, generatedMessage, message, operator, stack} = error;
+ const diffString = (0, _jestMatcherUtils.diff)(expected, actual, options);
+ const hasCustomMessage = !generatedMessage;
+ const operatorName = getOperatorName(operator, stack);
+ const trimmedStack = stack
+ .replace(message, '')
+ .replace(/AssertionError(.*)/g, '');
+
+ if (operatorName === 'doesNotThrow') {
+ return (
+ buildHintString(assertThrowingMatcherHint(operatorName)) +
+ _chalk.default.reset('Expected the function not to throw an error.\n') +
+ _chalk.default.reset('Instead, it threw:\n') +
+ ` ${(0, _jestMatcherUtils.printReceived)(actual)}` +
+ _chalk.default.reset(
+ hasCustomMessage ? '\n\nMessage:\n ' + message : ''
+ ) +
+ trimmedStack
+ );
+ }
+
+ if (operatorName === 'throws') {
+ return (
+ buildHintString(assertThrowingMatcherHint(operatorName)) +
+ _chalk.default.reset('Expected the function to throw an error.\n') +
+ _chalk.default.reset("But it didn't throw anything.") +
+ _chalk.default.reset(
+ hasCustomMessage ? '\n\nMessage:\n ' + message : ''
+ ) +
+ trimmedStack
+ );
+ }
+
+ 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)}`) +
+ ` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
+ _chalk.default.reset('Received:\n') +
+ ` ${(0, _jestMatcherUtils.printReceived)(actual)}` +
+ _chalk.default.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') +
+ (diffString ? `\n\nDifference:\n\n${diffString}` : '') +
+ trimmedStack
+ );
+}
+
+function isAssertionError(error) {
+ return (
+ error &&
+ (error instanceof _assert.AssertionError ||
+ error.name === _assert.AssertionError.name ||
+ error.code === 'ERR_ASSERTION')
+ );
+}
+
+function buildHintString(hint) {
+ return hint ? hint + '\n\n' : '';
+}
+
+var _default = formatNodeAssertErrors;
+exports.default = _default;
diff --git a/node_modules/jest-circus/build/globalErrorHandlers.d.ts b/node_modules/jest-circus/build/globalErrorHandlers.d.ts
new file mode 100644
index 0000000..d25393f
--- /dev/null
+++ b/node_modules/jest-circus/build/globalErrorHandlers.d.ts
@@ -0,0 +1,9 @@
+/**
+ * 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';
+export declare const injectGlobalErrorHandlers: (parentProcess: NodeJS.Process) => Circus.GlobalErrorHandlers;
+export declare const restoreGlobalErrorHandlers: (parentProcess: NodeJS.Process, originalErrorHandlers: Circus.GlobalErrorHandlers) => void;
diff --git a/node_modules/jest-circus/build/globalErrorHandlers.js b/node_modules/jest-circus/build/globalErrorHandlers.js
new file mode 100644
index 0000000..bc889f3
--- /dev/null
+++ b/node_modules/jest-circus/build/globalErrorHandlers.js
@@ -0,0 +1,51 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.restoreGlobalErrorHandlers = exports.injectGlobalErrorHandlers = void 0;
+
+var _state = require('./state');
+
+/**
+ * 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.dispatchSync)({
+ error,
+ name: 'error'
+ });
+};
+
+const injectGlobalErrorHandlers = parentProcess => {
+ const uncaughtException = process.listeners('uncaughtException').slice();
+ const unhandledRejection = process.listeners('unhandledRejection').slice();
+ parentProcess.removeAllListeners('uncaughtException');
+ parentProcess.removeAllListeners('unhandledRejection');
+ parentProcess.on('uncaughtException', uncaught);
+ parentProcess.on('unhandledRejection', uncaught);
+ return {
+ uncaughtException,
+ unhandledRejection
+ };
+};
+
+exports.injectGlobalErrorHandlers = injectGlobalErrorHandlers;
+
+const restoreGlobalErrorHandlers = (parentProcess, originalErrorHandlers) => {
+ parentProcess.removeListener('uncaughtException', uncaught);
+ parentProcess.removeListener('unhandledRejection', uncaught);
+
+ for (const listener of originalErrorHandlers.uncaughtException) {
+ parentProcess.on('uncaughtException', listener);
+ }
+
+ for (const listener of originalErrorHandlers.unhandledRejection) {
+ parentProcess.on('unhandledRejection', listener);
+ }
+};
+
+exports.restoreGlobalErrorHandlers = restoreGlobalErrorHandlers;
diff --git a/node_modules/jest-circus/build/index.d.ts b/node_modules/jest-circus/build/index.d.ts
new file mode 100644
index 0000000..d51b3bc
--- /dev/null
+++ b/node_modules/jest-circus/build/index.d.ts
@@ -0,0 +1,52 @@
+/**
+ * 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, Global } from '@jest/types';
+export { setState, getState, resetState } from './state';
+export { default as run } from './run';
+declare type THook = (fn: Circus.HookFn, timeout?: number) => void;
+declare const describe: {
+ (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: 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: 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;
+declare const beforeAll: THook;
+declare const afterEach: THook;
+declare const afterAll: THook;
+declare const test: Global.It;
+declare const it: Global.It;
+export declare type Event = Circus.Event;
+export declare type State = Circus.State;
+export { afterAll, afterEach, beforeAll, beforeEach, describe, it, test };
+declare const _default: {
+ afterAll: THook;
+ afterEach: THook;
+ beforeAll: THook;
+ beforeEach: THook;
+ describe: {
+ (blockName: string, blockFn: Global.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: 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: Global.TemplateData) => (title: string, test: Global.EachTestFn<Global.TestCallback>, timeout?: number | undefined) => void;
+ };
+ };
+ it: Global.It;
+ test: Global.It;
+};
+export default _default;
diff --git a/node_modules/jest-circus/build/index.js b/node_modules/jest-circus/build/index.js
new file mode 100644
index 0000000..4155567
--- /dev/null
+++ b/node_modules/jest-circus/build/index.js
@@ -0,0 +1,226 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.describe =
+ exports.default =
+ exports.beforeEach =
+ exports.beforeAll =
+ exports.afterEach =
+ exports.afterAll =
+ void 0;
+Object.defineProperty(exports, 'getState', {
+ enumerable: true,
+ get: function () {
+ return _state.getState;
+ }
+});
+exports.it = void 0;
+Object.defineProperty(exports, 'resetState', {
+ enumerable: true,
+ get: function () {
+ return _state.resetState;
+ }
+});
+Object.defineProperty(exports, 'run', {
+ enumerable: true,
+ get: function () {
+ return _run.default;
+ }
+});
+Object.defineProperty(exports, 'setState', {
+ enumerable: true,
+ get: function () {
+ return _state.setState;
+ }
+});
+exports.test = void 0;
+
+var _jestEach = require('jest-each');
+
+var _jestUtil = require('jest-util');
+
+var _state = require('./state');
+
+var _run = _interopRequireDefault(require('./run'));
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : {default: obj};
+}
+
+/**
+ * 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 describe = (() => {
+ const describe = (blockName, blockFn) =>
+ _dispatchDescribe(blockFn, blockName, describe);
+
+ const only = (blockName, blockFn) =>
+ _dispatchDescribe(blockFn, blockName, only, 'only');
+
+ const skip = (blockName, blockFn) =>
+ _dispatchDescribe(blockFn, blockName, skip, 'skip');
+
+ describe.each = (0, _jestEach.bind)(describe, false);
+ only.each = (0, _jestEach.bind)(only, false);
+ skip.each = (0, _jestEach.bind)(skip, false);
+ describe.only = only;
+ describe.skip = skip;
+ return describe;
+})();
+
+exports.describe = describe;
+
+const _dispatchDescribe = (blockFn, blockName, describeFn, mode) => {
+ const asyncError = new _jestUtil.ErrorWithStack(undefined, describeFn);
+
+ if (blockFn === undefined) {
+ asyncError.message =
+ 'Missing second argument. It must be a callback function.';
+ throw asyncError;
+ }
+
+ if (typeof blockFn !== 'function') {
+ asyncError.message = `Invalid second argument, ${blockFn}. It must be a callback function.`;
+ throw asyncError;
+ }
+
+ (0, _state.dispatchSync)({
+ asyncError,
+ blockName,
+ mode,
+ name: 'start_describe_definition'
+ });
+ const describeReturn = blockFn();
+
+ if ((0, _jestUtil.isPromise)(describeReturn)) {
+ throw new _jestUtil.ErrorWithStack(
+ 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.',
+ describeFn
+ );
+ } else if (describeReturn !== undefined) {
+ throw new _jestUtil.ErrorWithStack(
+ 'A "describe" callback must not return a value.',
+ describeFn
+ );
+ }
+
+ (0, _state.dispatchSync)({
+ blockName,
+ mode,
+ name: 'finish_describe_definition'
+ });
+};
+
+const _addHook = (fn, hookType, hookFn, timeout) => {
+ const asyncError = new _jestUtil.ErrorWithStack(undefined, hookFn);
+
+ if (typeof fn !== 'function') {
+ asyncError.message =
+ 'Invalid first argument. It must be a callback function.';
+ throw asyncError;
+ }
+
+ (0, _state.dispatchSync)({
+ asyncError,
+ fn,
+ hookType,
+ name: 'add_hook',
+ timeout
+ });
+}; // Hooks have to pass themselves to the HOF in order for us to trim stack traces.
+
+const beforeEach = (fn, timeout) =>
+ _addHook(fn, 'beforeEach', beforeEach, timeout);
+
+exports.beforeEach = beforeEach;
+
+const beforeAll = (fn, timeout) =>
+ _addHook(fn, 'beforeAll', beforeAll, timeout);
+
+exports.beforeAll = beforeAll;
+
+const afterEach = (fn, timeout) =>
+ _addHook(fn, 'afterEach', afterEach, timeout);
+
+exports.afterEach = afterEach;
+
+const afterAll = (fn, timeout) => _addHook(fn, 'afterAll', afterAll, timeout);
+
+exports.afterAll = afterAll;
+
+const test = (() => {
+ const test = (testName, fn, timeout) =>
+ _addTest(testName, undefined, fn, test, timeout);
+
+ const skip = (testName, fn, timeout) =>
+ _addTest(testName, 'skip', fn, skip, timeout);
+
+ const only = (testName, fn, timeout) =>
+ _addTest(testName, 'only', fn, test.only, timeout);
+
+ test.todo = (testName, ...rest) => {
+ if (rest.length > 0 || typeof testName !== 'string') {
+ throw new _jestUtil.ErrorWithStack(
+ 'Todo must be called with only a description.',
+ test.todo
+ );
+ }
+
+ return _addTest(testName, 'todo', () => {}, test.todo);
+ };
+
+ const _addTest = (testName, mode, fn, testFn, timeout) => {
+ const asyncError = new _jestUtil.ErrorWithStack(undefined, testFn);
+
+ if (typeof testName !== 'string') {
+ asyncError.message = `Invalid first argument, ${testName}. It must be a string.`;
+ throw asyncError;
+ }
+
+ if (fn === undefined) {
+ asyncError.message =
+ 'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.';
+ throw asyncError;
+ }
+
+ if (typeof fn !== 'function') {
+ asyncError.message = `Invalid second argument, ${fn}. It must be a callback function.`;
+ throw asyncError;
+ }
+
+ return (0, _state.dispatchSync)({
+ asyncError,
+ fn,
+ mode,
+ name: 'add_test',
+ testName,
+ timeout
+ });
+ };
+
+ test.each = (0, _jestEach.bind)(test);
+ only.each = (0, _jestEach.bind)(only);
+ skip.each = (0, _jestEach.bind)(skip);
+ test.only = only;
+ test.skip = skip;
+ return test;
+})();
+
+exports.test = test;
+const it = test;
+exports.it = it;
+var _default = {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ describe,
+ it,
+ test
+};
+exports.default = _default;
diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
new file mode 100644
index 0000000..7aa430a
--- /dev/null
+++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
@@ -0,0 +1,12 @@
+/**
+ * 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 { JestEnvironment } from '@jest/environment';
+import type { TestFileEvent, TestResult } from '@jest/test-result';
+import type { Config } from '@jest/types';
+import type Runtime from 'jest-runtime';
+declare const jestAdapter: (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string, sendMessageToJest?: TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined) => Promise<TestResult>;
+export = jestAdapter;
diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js
new file mode 100644
index 0000000..1c36d4e
--- /dev/null
+++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js
@@ -0,0 +1,123 @@
+'use strict';
+
+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 = async (
+ globalConfig,
+ config,
+ environment,
+ runtime,
+ testPath,
+ sendMessageToJest
+) => {
+ const {initialize, runAndTransformResultsToJestFormat} =
+ runtime.requireInternalModule(FRAMEWORK_INITIALIZER);
+ const {globals, snapshotState} = await initialize({
+ config,
+ environment,
+ globalConfig,
+ localRequire: runtime.requireModule.bind(runtime),
+ parentProcess: process,
+ sendMessageToJest,
+ setGlobalsForRuntime: runtime.setGlobalsForRuntime.bind(runtime),
+ testPath
+ });
+
+ if (config.timers === 'fake' || config.timers === 'modern') {
+ // during setup, this cannot be null (and it's fine to explode if it is)
+ environment.fakeTimersModern.useFakeTimers();
+ } else if (config.timers === 'legacy') {
+ environment.fakeTimers.useFakeTimers();
+ }
+
+ globals.beforeEach(() => {
+ if (config.resetModules) {
+ runtime.resetModules();
+ }
+
+ if (config.clearMocks) {
+ runtime.clearAllMocks();
+ }
+
+ if (config.resetMocks) {
+ runtime.resetAllMocks();
+
+ if (config.timers === 'legacy') {
+ // during setup, this cannot be null (and it's fine to explode if it is)
+ environment.fakeTimers.useFakeTimers();
+ }
+ }
+
+ if (config.restoreMocks) {
+ runtime.restoreAllMocks();
+ }
+ });
+
+ for (const path of config.setupFilesAfterEnv) {
+ const esm = runtime.unstable_shouldLoadAsEsm(path);
+
+ if (esm) {
+ await runtime.unstable_importModule(path);
+ } else {
+ runtime.requireModule(path);
+ }
+ }
+
+ const esm = runtime.unstable_shouldLoadAsEsm(testPath);
+
+ 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}) => {
+ if (status === 'pending' || status === 'failed') {
+ // if test is skipped or failed, we don't want to mark
+ // its snapshots as obsolete.
+ snapshotState.markSnapshotsAsCheckedForTest(fullName);
+ }
+ });
+ const uncheckedCount = snapshotState.getUncheckedCount();
+ const uncheckedKeys = snapshotState.getUncheckedKeys();
+
+ if (uncheckedCount) {
+ snapshotState.removeUncheckedKeys();
+ }
+
+ const status = snapshotState.save();
+ results.snapshot.fileDeleted = status.deleted;
+ results.snapshot.added = snapshotState.added;
+ results.snapshot.matched = snapshotState.matched;
+ results.snapshot.unmatched = snapshotState.unmatched;
+ results.snapshot.updated = snapshotState.updated;
+ results.snapshot.unchecked = !status.deleted ? uncheckedCount : 0; // Copy the array to prevent memory leaks
+
+ results.snapshot.uncheckedKeys = Array.from(uncheckedKeys);
+};
+
+module.exports = jestAdapter;
diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
new file mode 100644
index 0000000..b09ec31
--- /dev/null
+++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+/// <reference types="node" />
+import type { JestEnvironment } from '@jest/environment';
+import { TestFileEvent, TestResult } from '@jest/test-result';
+import type { Config, Global } from '@jest/types';
+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, globalConfig, localRequire, parentProcess, sendMessageToJest, setGlobalsForRuntime, testPath, }: {
+ config: Config.ProjectConfig;
+ environment: JestEnvironment;
+ globalConfig: Config.GlobalConfig;
+ localRequire: <T = unknown>(path: Config.Path) => T;
+ testPath: Config.Path;
+ parentProcess: Process;
+ sendMessageToJest?: TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined;
+ setGlobalsForRuntime: (globals: JestGlobals) => void;
+}) => Promise<{
+ globals: Global.TestFrameworkGlobals;
+ snapshotState: SnapshotStateType;
+}>;
+export declare const runAndTransformResultsToJestFormat: ({ config, globalConfig, testPath, }: {
+ config: Config.ProjectConfig;
+ globalConfig: Config.GlobalConfig;
+ testPath: string;
+}) => Promise<TestResult>;
+export {};
diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js
new file mode 100644
index 0000000..7059ad2
--- /dev/null
+++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js
@@ -0,0 +1,299 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+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 _ = _interopRequireDefault(require('..'));
+
+var _run = _interopRequireDefault(require('../run'));
+
+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};
+}
+
+/**
+ * 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,
+ globalConfig,
+ localRequire,
+ parentProcess,
+ sendMessageToJest,
+ setGlobalsForRuntime,
+ testPath
+}) => {
+ if (globalConfig.testTimeout) {
+ (0, _state.getState)().testTimeout = globalConfig.testTimeout;
+ }
+
+ const mutex = (0, _throat.default)(globalConfig.maxConcurrency); // @ts-expect-error
+
+ 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
+ // 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()); // Avoid triggering the uncaught promise rejection handler in case the test errors before
+ // being awaited on.
+
+ promise.catch(() => {});
+ globalsObject.test(testName, () => promise, 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;
+ })(globalsObject.test);
+
+ (0, _state.addEventHandler)(eventHandler);
+
+ if (environment.handleTestEvent) {
+ (0, _state.addEventHandler)(environment.handleTestEvent.bind(environment));
+ }
+
+ const runtimeGlobals = {
+ ...globalsObject,
+ expect: (0, _jestExpect.default)(globalConfig)
+ };
+ setGlobalsForRuntime(runtimeGlobals);
+
+ if (config.injectGlobals) {
+ Object.assign(environment.global, runtimeGlobals);
+ }
+
+ await (0, _state.dispatch)({
+ name: 'setup',
+ parentProcess,
+ runtimeGlobals,
+ testNamePattern: globalConfig.testNamePattern
+ });
+
+ if (config.testLocationInResults) {
+ await (0, _state.dispatch)({
+ name: 'include_test_location_in_result'
+ });
+ } // Jest tests snapshotSerializers in order preceding built-in serializers.
+ // Therefore, add in reverse because the last added is the first tested.
+
+ config.snapshotSerializers
+ .concat()
+ .reverse()
+ .forEach(path => (0, _jestSnapshot.addSerializer)(localRequire(path)));
+ const {expand, updateSnapshot} = globalConfig;
+ const snapshotResolver = await (0, _jestSnapshot.buildSnapshotResolver)(
+ config,
+ localRequire
+ );
+ const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath);
+ const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, {
+ expand,
+ prettierPath: config.prettierPath,
+ snapshotFormat: config.snapshotFormat,
+ updateSnapshot
+ }); // @ts-expect-error: snapshotState is a jest extension of `expect`
+
+ (0, _expect.setState)({
+ snapshotState,
+ testPath
+ });
+ (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: globalsObject,
+ snapshotState
+ };
+};
+
+exports.initialize = initialize;
+
+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;
+ }
+
+ 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,
+ testExecError,
+ testFilePath: testPath,
+ testResults: assertionResults
+ };
+};
+
+exports.runAndTransformResultsToJestFormat = runAndTransformResultsToJestFormat;
+
+const handleSnapshotStateAfterRetry = snapshotState => event => {
+ switch (event.name) {
+ case 'test_retry': {
+ // Clear any snapshot data that occurred in previous test run
+ snapshotState.clear();
+ }
+ }
+};
+
+const eventHandler = async event => {
+ switch (event.name) {
+ case 'test_start': {
+ (0, _expect.setState)({
+ currentTestName: (0, _utils.getTestID)(event.test)
+ });
+ break;
+ }
+
+ case 'test_done': {
+ _addSuppressedErrors(event.test);
+
+ _addExpectedAssertionErrors(event.test);
+
+ break;
+ }
+ }
+};
+
+const _addExpectedAssertionErrors = test => {
+ const failures = (0, _expect.extractExpectedAssertionsErrors)();
+ const errors = failures.map(failure => failure.error);
+ test.errors = test.errors.concat(errors);
+}; // Get suppressed errors from ``jest-matchers`` that weren't throw during
+// test execution and add them to the test result, potentially failing
+// a passing test.
+
+const _addSuppressedErrors = test => {
+ const {suppressedErrors} = (0, _expect.getState)();
+ (0, _expect.setState)({
+ suppressedErrors: []
+ });
+
+ if (suppressedErrors.length) {
+ test.errors = test.errors.concat(suppressedErrors);
+ }
+};
diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
new file mode 100644
index 0000000..8902dc0
--- /dev/null
+++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
@@ -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 { Config } from '@jest/types';
+import expect = require('expect');
+export declare type Expect = typeof expect;
+export default function jestExpect(config: Pick<Config.GlobalConfig, 'expand'>): Expect;
diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js
new file mode 100644
index 0000000..d361766
--- /dev/null
+++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js
@@ -0,0 +1,37 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.default = jestExpect;
+
+var _expect = _interopRequireDefault(require('expect'));
+
+var _jestSnapshot = require('jest-snapshot');
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : {default: obj};
+}
+
+/**
+ * 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.
+ */
+function jestExpect(config) {
+ _expect.default.setState({
+ expand: config.expand
+ });
+
+ _expect.default.extend({
+ toMatchInlineSnapshot: _jestSnapshot.toMatchInlineSnapshot,
+ toMatchSnapshot: _jestSnapshot.toMatchSnapshot,
+ toThrowErrorMatchingInlineSnapshot:
+ _jestSnapshot.toThrowErrorMatchingInlineSnapshot,
+ toThrowErrorMatchingSnapshot: _jestSnapshot.toThrowErrorMatchingSnapshot
+ });
+
+ _expect.default.addSnapshotSerializer = _jestSnapshot.addSerializer;
+ return _expect.default;
+}
diff --git a/node_modules/jest-circus/build/run.d.ts b/node_modules/jest-circus/build/run.d.ts
new file mode 100644
index 0000000..6e83136
--- /dev/null
+++ b/node_modules/jest-circus/build/run.d.ts
@@ -0,0 +1,9 @@
+/**
+ * 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';
+declare const run: () => Promise<Circus.RunResult>;
+export default run;
diff --git a/node_modules/jest-circus/build/run.js b/node_modules/jest-circus/build/run.js
new file mode 100644
index 0000000..c12ee96
--- /dev/null
+++ b/node_modules/jest-circus/build/run.js
@@ -0,0 +1,236 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.default = void 0;
+
+var _state = require('./state');
+
+var _types = require('./types');
+
+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 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
+ );
+};
+
+const _runTestsForDescribeBlock = async describeBlock => {
+ await (0, _state.dispatch)({
+ describeBlock,
+ name: 'run_describe_start'
+ });
+ const {beforeAll, afterAll} = (0, _utils.getAllHooksForDescribe)(
+ describeBlock
+ );
+ const isSkipped = describeBlock.mode === 'skip';
+
+ if (!isSkipped) {
+ 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, isSkipped);
+
+ 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, isSkipped);
+ numRetriesAvailable--;
+ }
+ }
+
+ if (!isSkipped) {
+ for (const hook of afterAll) {
+ await _callCircusHook({
+ describeBlock,
+ hook
+ });
+ }
+ }
+
+ await (0, _state.dispatch)({
+ describeBlock,
+ name: 'run_describe_finish'
+ });
+};
+
+const _runTest = async (test, parentSkipped) => {
+ await (0, _state.dispatch)({
+ name: 'test_start',
+ test
+ });
+ const testContext = Object.create(null);
+ const {hasFocusedTests, testNamePattern} = (0, _state.getState)();
+ const isSkipped =
+ parentSkipped ||
+ 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 (test.mode === 'todo') {
+ await (0, _state.dispatch)({
+ name: 'test_todo',
+ test
+ });
+ return;
+ }
+
+ 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
+ });
+ }
+
+ await _callCircusTest(test, testContext);
+
+ 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.
+
+ await (0, _state.dispatch)({
+ name: 'test_done',
+ test
+ });
+};
+
+const _callCircusHook = async ({hook, test, describeBlock, testContext}) => {
+ await (0, _state.dispatch)({
+ hook,
+ name: 'hook_start'
+ });
+ const timeout = hook.timeout || (0, _state.getState)().testTimeout;
+
+ 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 = async (test, testContext) => {
+ await (0, _state.dispatch)({
+ name: 'test_fn_start',
+ test
+ });
+ const timeout = test.timeout || (0, _state.getState)().testTimeout;
+ (0, _utils.invariant)(
+ test.fn,
+ "Tests with no 'fn' should have 'mode' set to 'skipped'"
+ );
+
+ if (test.errors.length) {
+ return; // We don't run the test if there's already an error in before hooks.
+ }
+
+ 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;
+exports.default = _default;
diff --git a/node_modules/jest-circus/build/state.d.ts b/node_modules/jest-circus/build/state.d.ts
new file mode 100644
index 0000000..e686aef
--- /dev/null
+++ b/node_modules/jest-circus/build/state.d.ts
@@ -0,0 +1,14 @@
+/**
+ * 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';
+export declare const ROOT_DESCRIBE_BLOCK_NAME = "ROOT_DESCRIBE_BLOCK";
+export declare const resetState: () => void;
+export declare const getState: () => Circus.State;
+export declare const setState: (state: Circus.State) => Circus.State;
+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;
diff --git a/node_modules/jest-circus/build/state.js b/node_modules/jest-circus/build/state.js
new file mode 100644
index 0000000..d9d3ca2
--- /dev/null
+++ b/node_modules/jest-circus/build/state.js
@@ -0,0 +1,93 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.setState =
+ exports.resetState =
+ exports.getState =
+ exports.dispatchSync =
+ exports.dispatch =
+ exports.addEventHandler =
+ exports.ROOT_DESCRIBE_BLOCK_NAME =
+ void 0;
+
+var _eventHandler = _interopRequireDefault(require('./eventHandler'));
+
+var _formatNodeAssertErrors = _interopRequireDefault(
+ require('./formatNodeAssertErrors')
+);
+
+var _types = require('./types');
+
+var _utils = require('./utils');
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : {default: obj};
+}
+
+/**
+ * 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 eventHandlers = [_eventHandler.default, _formatNodeAssertErrors.default];
+const ROOT_DESCRIBE_BLOCK_NAME = 'ROOT_DESCRIBE_BLOCK';
+exports.ROOT_DESCRIBE_BLOCK_NAME = ROOT_DESCRIBE_BLOCK_NAME;
+
+const createState = () => {
+ const ROOT_DESCRIBE_BLOCK = (0, _utils.makeDescribe)(
+ ROOT_DESCRIBE_BLOCK_NAME
+ );
+ return {
+ currentDescribeBlock: ROOT_DESCRIBE_BLOCK,
+ currentlyRunningTest: null,
+ expand: undefined,
+ hasFocusedTests: false,
+ hasStarted: false,
+ includeTestLocationInResult: false,
+ parentProcess: null,
+ rootDescribeBlock: ROOT_DESCRIBE_BLOCK,
+ testNamePattern: null,
+ testTimeout: 5000,
+ unhandledErrors: []
+ };
+};
+
+const resetState = () => {
+ global[_types.STATE_SYM] = createState();
+};
+
+exports.resetState = resetState;
+resetState();
+
+const getState = () => global[_types.STATE_SYM];
+
+exports.getState = getState;
+
+const setState = state => (global[_types.STATE_SYM] = state);
+
+exports.setState = setState;
+
+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);
+};
+
+exports.addEventHandler = addEventHandler;
diff --git a/node_modules/jest-circus/build/testCaseReportHandler.d.ts b/node_modules/jest-circus/build/testCaseReportHandler.d.ts
new file mode 100644
index 0000000..093fe9b
--- /dev/null
+++ b/node_modules/jest-circus/build/testCaseReportHandler.d.ts
@@ -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 { TestFileEvent } from '@jest/test-result';
+import type { Circus } from '@jest/types';
+declare const testCaseReportHandler: (testPath: string, sendMessageToJest: TestFileEvent) => (event: Circus.Event) => void;
+export default testCaseReportHandler;
diff --git a/node_modules/jest-circus/build/testCaseReportHandler.js b/node_modules/jest-circus/build/testCaseReportHandler.js
new file mode 100644
index 0000000..4c8beb1
--- /dev/null
+++ b/node_modules/jest-circus/build/testCaseReportHandler.js
@@ -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;
diff --git a/node_modules/jest-circus/build/types.d.ts b/node_modules/jest-circus/build/types.d.ts
new file mode 100644
index 0000000..930a49c
--- /dev/null
+++ b/node_modules/jest-circus/build/types.d.ts
@@ -0,0 +1,21 @@
+/**
+ * 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 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";
+declare global {
+ namespace NodeJS {
+ interface Global {
+ STATE_SYM_SYMBOL: Circus.State;
+ RETRY_TIMES_SYMBOL: string;
+ TEST_TIMEOUT_SYMBOL: number;
+ expect: typeof expect;
+ }
+ }
+}
diff --git a/node_modules/jest-circus/build/types.js b/node_modules/jest-circus/build/types.js
new file mode 100644
index 0000000..2b2ade0
--- /dev/null
+++ b/node_modules/jest-circus/build/types.js
@@ -0,0 +1,35 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.TEST_TIMEOUT_SYMBOL = exports.STATE_SYM = exports.RETRY_TIMES = void 0;
+
+var _expect = _interopRequireDefault(require('expect'));
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : {default: obj};
+}
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
+const STATE_SYM = Symbol('JEST_STATE_SYMBOL');
+exports.STATE_SYM = STATE_SYM;
+const RETRY_TIMES = Symbol.for('RETRY_TIMES'); // To pass this value from Runtime object to state we need to use global[sym]
+
+exports.RETRY_TIMES = RETRY_TIMES;
+const TEST_TIMEOUT_SYMBOL = Symbol.for('TEST_TIMEOUT_SYMBOL');
+exports.TEST_TIMEOUT_SYMBOL = TEST_TIMEOUT_SYMBOL;
diff --git a/node_modules/jest-circus/build/utils.d.ts b/node_modules/jest-circus/build/utils.d.ts
new file mode 100644
index 0000000..f22b4fc
--- /dev/null
+++ b/node_modules/jest-circus/build/utils.d.ts
@@ -0,0 +1,33 @@
+/**
+ * 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 { 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 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: (testOrHook: Circus.TestEntry | Circus.Hook, testContext: Circus.TestContext | undefined, { isHook, timeout }: {
+ isHook: boolean;
+ timeout: number;
+}) => Promise<unknown>;
+export declare const getTestDuration: (test: Circus.TestEntry) => number | null;
+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: 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 {};
diff --git a/node_modules/jest-circus/build/utils.js b/node_modules/jest-circus/build/utils.js
new file mode 100644
index 0000000..521a296
--- /dev/null
+++ b/node_modules/jest-circus/build/utils.js
@@ -0,0 +1,637 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.getTestID =
+ exports.getTestDuration =
+ exports.getEachHooksForTest =
+ exports.getAllHooksForDescribe =
+ exports.describeBlockHasTests =
+ exports.callAsyncCircusFn =
+ exports.addErrorToEachTestUnderDescribe =
+ void 0;
+exports.invariant = invariant;
+exports.parseSingleTestResult =
+ exports.makeTest =
+ exports.makeSingleTestResult =
+ exports.makeRunResult =
+ exports.makeDescribe =
+ void 0;
+
+var path = _interopRequireWildcard(require('path'));
+
+var _co = _interopRequireDefault(require('co'));
+
+var _dedent = _interopRequireDefault(require('dedent'));
+
+var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn'));
+
+var _slash = _interopRequireDefault(require('slash'));
+
+var _stackUtils = _interopRequireDefault(require('stack-utils'));
+
+var _jestUtil = require('jest-util');
+
+var _prettyFormat = require('pretty-format');
+
+var _state = require('./state');
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : {default: obj};
+}
+
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== 'function') return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function (nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+
+function _interopRequireWildcard(obj, nodeInterop) {
+ if (!nodeInterop && obj && obj.__esModule) {
+ return obj;
+ }
+ if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
+ return {default: obj};
+ }
+ var cache = _getRequireWildcardCache(nodeInterop);
+ if (cache && cache.has(obj)) {
+ return cache.get(obj);
+ }
+ var newObj = {};
+ var hasPropertyDescriptor =
+ Object.defineProperty && Object.getOwnPropertyDescriptor;
+ for (var key in obj) {
+ if (key !== 'default' && 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 global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now;
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
+
+var global = (function () {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ } else if (typeof global !== 'undefined') {
+ return global;
+ } else if (typeof self !== 'undefined') {
+ return self;
+ } else if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this')();
+ }
+})();
+
+var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
+const stackUtils = new _stackUtils.default({
+ cwd: 'A path that does not exist'
+});
+const jestEachBuildDir = (0, _slash.default)(
+ path.dirname(require.resolve('jest-each'))
+);
+
+function takesDoneCallback(fn) {
+ return fn.length > 0;
+}
+
+function isGeneratorFunction(fn) {
+ return (0, _isGeneratorFn.default)(fn);
+}
+
+const makeDescribe = (name, parent, mode) => {
+ let _mode = mode;
+
+ if (parent && !mode) {
+ // If not set explicitly, inherit from the parent describe.
+ _mode = parent.mode;
+ }
+
+ return {
+ type: 'describeBlock',
+ // eslint-disable-next-line sort-keys
+ children: [],
+ hooks: [],
+ mode: _mode,
+ name: (0, _jestUtil.convertDescriptorToString)(name),
+ parent,
+ tests: []
+ };
+};
+
+exports.makeDescribe = makeDescribe;
+
+const makeTest = (fn, mode, name, parent, timeout, asyncError) => ({
+ type: 'test',
+ // eslint-disable-next-line sort-keys
+ asyncError,
+ duration: null,
+ errors: [],
+ fn,
+ invocations: 0,
+ mode,
+ name: (0, _jestUtil.convertDescriptorToString)(name),
+ parent,
+ seenDone: false,
+ startedAt: null,
+ status: null,
+ timeout
+}); // Traverse the tree of describe blocks and return true if at least one describe
+// block has an enabled test.
+
+exports.makeTest = makeTest;
+
+const hasEnabledTest = describeBlock => {
+ 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)))
+ )
+ );
+};
+
+const getAllHooksForDescribe = describe => {
+ const result = {
+ afterAll: [],
+ beforeAll: []
+ };
+
+ if (hasEnabledTest(describe)) {
+ for (const hook of describe.hooks) {
+ switch (hook.type) {
+ case 'beforeAll':
+ result.beforeAll.push(hook);
+ break;
+
+ case 'afterAll':
+ result.afterAll.push(hook);
+ break;
+ }
+ }
+ }
+
+ return result;
+};
+
+exports.getAllHooksForDescribe = getAllHooksForDescribe;
+
+const getEachHooksForTest = test => {
+ const result = {
+ afterEach: [],
+ beforeEach: []
+ };
+ let block = test.parent;
+
+ do {
+ const beforeEachForCurrentBlock = []; // TODO: inline after https://github.com/microsoft/TypeScript/pull/34840 is released
+
+ let hook;
+
+ 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.
+
+ result.beforeEach = [...beforeEachForCurrentBlock, ...result.beforeEach];
+ } while ((block = block.parent));
+
+ return result;
+};
+
+exports.getEachHooksForTest = getEachHooksForTest;
+
+const describeBlockHasTests = describe =>
+ describe.children.some(
+ child => child.type === 'test' || describeBlockHasTests(child)
+ );
+
+exports.describeBlockHasTests = describeBlockHasTests;
+
+const _makeTimeoutMessage = (timeout, isHook) =>
+ `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 {setTimeout, clearTimeout} = global;
+
+function checkIsError(error) {
+ return !!(error && error.message && error.stack);
+}
+
+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)),
+ timeout
+ ); // If this fn accepts `done` callback we return a promise that fulfills as
+ // soon as `done` called.
+
+ if (takesDoneCallback(fn)) {
+ let returnedValue = undefined;
+
+ const done = reason => {
+ // We need to keep a stack here before the promise tick
+ const errorAtDone = new _jestUtil.ErrorWithStack(undefined, done);
+
+ if (!completed && testOrHook.seenDone) {
+ errorAtDone.message =
+ 'Expected done to be called once, but it was called multiple times.';
+
+ if (reason) {
+ errorAtDone.message +=
+ ' Reason: ' +
+ (0, _prettyFormat.format)(reason, {
+ maxDepth: 3
+ });
+ }
+
+ reject(errorAtDone);
+ throw errorAtDone;
+ } else {
+ testOrHook.seenDone = true;
+ } // 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.format)(returnedValue, {
+ maxDepth: 3
+ })}
+ `;
+ return reject(asyncError);
+ }
+
+ let errorAsErrorObject;
+
+ if (checkIsError(reason)) {
+ errorAsErrorObject = reason;
+ } else {
+ errorAsErrorObject = errorAtDone;
+ errorAtDone.message = `Failed: ${(0, _prettyFormat.format)(reason, {
+ maxDepth: 3
+ })}`;
+ } // 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;
+ }
+
+ return reason ? reject(errorAsErrorObject) : resolve();
+ });
+ };
+
+ returnedValue = fn.call(testContext, done);
+ return;
+ }
+
+ let returnedValue;
+
+ if (isGeneratorFunction(fn)) {
+ returnedValue = _co.default.wrap(fn).call({});
+ } else {
+ try {
+ returnedValue = fn.call(testContext);
+ } catch (error) {
+ reject(error);
+ return;
+ }
+ } // If it's a Promise, return it. Test for an object with a `then` function
+ // to support custom Promise implementations.
+
+ if (
+ typeof returnedValue === 'object' &&
+ returnedValue !== null &&
+ typeof returnedValue.then === 'function'
+ ) {
+ returnedValue.then(() => resolve(), reject);
+ return;
+ }
+
+ if (!isHook && returnedValue !== undefined) {
+ reject(
+ new Error((0, _dedent.default)`
+ test functions can only return Promise or undefined.
+ Returned value: ${(0, _prettyFormat.format)(returnedValue, {
+ maxDepth: 3
+ })}
+ `)
+ );
+ return;
+ } // Otherwise this test is synchronous, and if it didn't throw it means
+ // it passed.
+
+ resolve();
+ })
+ .then(() => {
+ var _timeoutID$unref, _timeoutID;
+
+ completed = true; // If timeout is not cleared/unrefed the node process won't exit until
+ // it's resolved.
+
+ (_timeoutID$unref = (_timeoutID = timeoutID).unref) === null ||
+ _timeoutID$unref === void 0
+ ? void 0
+ : _timeoutID$unref.call(_timeoutID);
+ clearTimeout(timeoutID);
+ })
+ .catch(error => {
+ var _timeoutID$unref2, _timeoutID2;
+
+ completed = true;
+ (_timeoutID$unref2 = (_timeoutID2 = timeoutID).unref) === null ||
+ _timeoutID$unref2 === void 0
+ ? void 0
+ : _timeoutID$unref2.call(_timeoutID2);
+ clearTimeout(timeoutID);
+ throw error;
+ });
+};
+
+exports.callAsyncCircusFn = callAsyncCircusFn;
+
+const getTestDuration = test => {
+ const {startedAt} = test;
+ return typeof startedAt === 'number' ? jestNow() - startedAt : null;
+};
+
+exports.getTestDuration = getTestDuration;
+
+const makeRunResult = (describeBlock, unhandledErrors) => ({
+ testResults: makeTestResults(describeBlock),
+ unhandledErrors: unhandledErrors.map(_getError).map(getErrorStack)
+});
+
+exports.makeRunResult = makeRunResult;
+
+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.');
+
+ do {
+ testPath.unshift(parent.name);
+ } while ((parent = parent.parent));
+
+ 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 &&
+ (_parsedLine$file = _parsedLine.file) !== null &&
+ _parsedLine$file !== void 0 &&
+ _parsedLine$file.startsWith(jestEachBuildDir)
+ ) {
+ const stackLine = stackLines[4];
+ parsedLine = stackUtils.parseLine(stackLine);
+ }
+
+ if (
+ parsedLine &&
+ typeof parsedLine.column === 'number' &&
+ typeof parsedLine.line === 'number'
+ ) {
+ location = {
+ column: parsedLine.column,
+ line: parsedLine.line
+ };
+ }
+ }
+
+ const errorsDetailed = test.errors.map(_getError);
+ return {
+ duration: test.duration,
+ errors: errorsDetailed.map(getErrorStack),
+ errorsDetailed,
+ invocations: test.invocations,
+ location,
+ status,
+ testPath: Array.from(testPath)
+ };
+};
+
+exports.makeSingleTestResult = makeSingleTestResult;
+
+const makeTestResults = describeBlock => {
+ const testResults = [];
+
+ for (const child of describeBlock.children) {
+ switch (child.type) {
+ case 'describeBlock': {
+ testResults.push(...makeTestResults(child));
+ break;
+ }
+
+ case 'test': {
+ testResults.push(makeSingleTestResult(child));
+ break;
+ }
+ }
+ }
+
+ return testResults;
+}; // Return a string that identifies the test (concat of parent describe block
+// names + test title)
+
+const getTestID = test => {
+ const titles = [];
+ let parent = test;
+
+ do {
+ titles.unshift(parent.name);
+ } while ((parent = parent.parent));
+
+ titles.shift(); // remove TOP_DESCRIBE_BLOCK_NAME
+
+ return titles.join(' ');
+};
+
+exports.getTestID = getTestID;
+
+const _getError = errors => {
+ let error;
+ let asyncError;
+
+ if (Array.isArray(errors)) {
+ error = errors[0];
+ asyncError = errors[1];
+ } else {
+ error = errors;
+ asyncError = new Error();
+ }
+
+ if (error && (typeof error.stack === 'string' || error.message)) {
+ return error;
+ }
+
+ asyncError.message = `thrown: ${(0, _prettyFormat.format)(error, {
+ maxDepth: 3
+ })}`;
+ return asyncError;
+};
+
+const getErrorStack = error =>
+ typeof error.stack === 'string' ? error.stack : error.message;
+
+const addErrorToEachTestUnderDescribe = (describeBlock, error, asyncError) => {
+ for (const child of describeBlock.children) {
+ switch (child.type) {
+ case 'describeBlock':
+ addErrorToEachTestUnderDescribe(child, error, asyncError);
+ break;
+
+ case 'test':
+ child.errors.push([error, asyncError]);
+ break;
+ }
+ }
+};
+
+exports.addErrorToEachTestUnderDescribe = addErrorToEachTestUnderDescribe;
+
+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.parseSingleTestResult = parseSingleTestResult;
diff --git a/node_modules/jest-circus/package.json b/node_modules/jest-circus/package.json
new file mode 100644
index 0000000..8ea4112
--- /dev/null
+++ b/node_modules/jest-circus/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "jest-circus",
+ "version": "27.5.1",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/facebook/jest.git",
+ "directory": "packages/jest-circus"
+ },
+ "license": "MIT",
+ "main": "./build/index.js",
+ "types": "./build/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./build/index.d.ts",
+ "default": "./build/index.js"
+ },
+ "./package.json": "./package.json",
+ "./runner": "./runner.js"
+ },
+ "dependencies": {
+ "@jest/environment": "^27.5.1",
+ "@jest/test-result": "^27.5.1",
+ "@jest/types": "^27.5.1",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "co": "^4.6.0",
+ "dedent": "^0.7.0",
+ "expect": "^27.5.1",
+ "is-generator-fn": "^2.0.0",
+ "jest-each": "^27.5.1",
+ "jest-matcher-utils": "^27.5.1",
+ "jest-message-util": "^27.5.1",
+ "jest-runtime": "^27.5.1",
+ "jest-snapshot": "^27.5.1",
+ "jest-util": "^27.5.1",
+ "pretty-format": "^27.5.1",
+ "slash": "^3.0.0",
+ "stack-utils": "^2.0.3",
+ "throat": "^6.0.1"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.1.0",
+ "@babel/register": "^7.0.0",
+ "@types/co": "^4.6.0",
+ "@types/dedent": "^0.7.0",
+ "@types/graceful-fs": "^4.1.3",
+ "@types/stack-utils": "^2.0.0",
+ "execa": "^5.0.0",
+ "graceful-fs": "^4.2.9"
+ },
+ "engines": {
+ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850"
+}
diff --git a/node_modules/jest-circus/runner.js b/node_modules/jest-circus/runner.js
new file mode 100644
index 0000000..cb1360d
--- /dev/null
+++ b/node_modules/jest-circus/runner.js
@@ -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.
+ */
+
+// Allow people to use `jest-circus/runner` as a runner.
+const runner = require('./build/legacy-code-todo-rewrite/jestAdapter');
+module.exports = runner;