mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
21
web/node_modules/jest-circus/LICENSE
generated
vendored
Normal file
21
web/node_modules/jest-circus/LICENSE
generated
vendored
Normal file
|
@ -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.
|
61
web/node_modules/jest-circus/README.md
generated
vendored
Normal file
61
web/node_modules/jest-circus/README.md
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<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/en/configuration#testenvironment-string). See the [type definitions](https://github.com/facebook/jest/blob/master/packages/jest-circus/src/types.ts) for more information on the events and state data currently available.
|
||||
|
||||
```js
|
||||
import NodeEnvironment from 'jest-environment-node';
|
||||
import {Event, State} from 'jest-circus';
|
||||
|
||||
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](https://github.com/facebook/jest/tree/master/packages/jest-types/src/Circus.ts)). 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
|
||||
|
||||
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/en/configuration#testrunner-string) option:
|
||||
|
||||
```json
|
||||
{
|
||||
"testRunner": "jest-circus/runner"
|
||||
}
|
||||
```
|
||||
|
||||
Or via CLI:
|
||||
|
||||
```bash
|
||||
jest --testRunner='jest-circus/runner'
|
||||
```
|
9
web/node_modules/jest-circus/build/eventHandler.d.ts
generated
vendored
Normal file
9
web/node_modules/jest-circus/build/eventHandler.d.ts
generated
vendored
Normal file
|
@ -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;
|
286
web/node_modules/jest-circus/build/eventHandler.js
generated
vendored
Normal file
286
web/node_modules/jest-circus/build/eventHandler.js
generated
vendored
Normal file
|
@ -0,0 +1,286 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
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': {
|
||||
state.includeTestLocationInResult = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'hook_start': {
|
||||
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.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,
|
||||
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 (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_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;
|
9
web/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts
generated
vendored
Normal file
9
web/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts
generated
vendored
Normal file
|
@ -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;
|
204
web/node_modules/jest-circus/build/formatNodeAssertErrors.js
generated
vendored
Normal file
204
web/node_modules/jest-circus/build/formatNodeAssertErrors.js
generated
vendored
Normal file
|
@ -0,0 +1,204 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _assert = require('assert');
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
var _prettyFormat = _interopRequireDefault(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.default)(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;
|
9
web/node_modules/jest-circus/build/globalErrorHandlers.d.ts
generated
vendored
Normal file
9
web/node_modules/jest-circus/build/globalErrorHandlers.d.ts
generated
vendored
Normal file
|
@ -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;
|
51
web/node_modules/jest-circus/build/globalErrorHandlers.js
generated
vendored
Normal file
51
web/node_modules/jest-circus/build/globalErrorHandlers.js
generated
vendored
Normal file
|
@ -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;
|
50
web/node_modules/jest-circus/build/index.d.ts
generated
vendored
Normal file
50
web/node_modules/jest-circus/build/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* 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';
|
||||
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;
|
223
web/node_modules/jest-circus/build/index.js
generated
vendored
Normal file
223
web/node_modules/jest-circus/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,223 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.it = exports.describe = exports.beforeEach = exports.beforeAll = exports.afterEach = exports.afterAll = void 0;
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
var _jestEach = require('jest-each');
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _state = require('./state');
|
||||
|
||||
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(); // TODO throw in Jest 25
|
||||
|
||||
if ((0, _jestUtil.isPromise)(describeReturn)) {
|
||||
console.log(
|
||||
(0, _jestMessageUtil.formatExecError)(
|
||||
new _jestUtil.ErrorWithStack(
|
||||
_chalk.default.yellow(
|
||||
'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
|
||||
'Returning a value from "describe" will fail the test in a future version of Jest.'
|
||||
),
|
||||
describeFn
|
||||
),
|
||||
{
|
||||
rootDir: '',
|
||||
testMatch: []
|
||||
},
|
||||
{
|
||||
noStackTrace: false
|
||||
}
|
||||
)
|
||||
);
|
||||
} else if (describeReturn !== undefined) {
|
||||
console.log(
|
||||
(0, _jestMessageUtil.formatExecError)(
|
||||
new _jestUtil.ErrorWithStack(
|
||||
_chalk.default.yellow(
|
||||
'A "describe" callback must not return a value.\n' +
|
||||
'Returning a value from "describe" will fail the test in a future version of Jest.'
|
||||
),
|
||||
describeFn
|
||||
),
|
||||
{
|
||||
rootDir: '',
|
||||
testMatch: []
|
||||
},
|
||||
{
|
||||
noStackTrace: false
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
(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;
|
12
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
generated
vendored
Normal file
12
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
generated
vendored
Normal file
|
@ -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 { Config } from '@jest/types';
|
||||
import type { JestEnvironment } from '@jest/environment';
|
||||
import type { TestResult } from '@jest/test-result';
|
||||
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;
|
150
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js
generated
vendored
Normal file
150
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
'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
|
||||
) => {
|
||||
var _runtime$setGlobalsFo, _runtime$unstable_sho2;
|
||||
|
||||
const {
|
||||
initialize,
|
||||
runAndTransformResultsToJestFormat
|
||||
} = runtime.requireInternalModule(FRAMEWORK_INITIALIZER);
|
||||
|
||||
const getPrettier = () =>
|
||||
config.prettierPath ? require(config.prettierPath) : null;
|
||||
|
||||
const getBabelTraverse = () => require('@babel/traverse').default;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
if (config.restoreMocks) {
|
||||
runtime.restoreAllMocks();
|
||||
}
|
||||
});
|
||||
|
||||
for (const path of config.setupFilesAfterEnv) {
|
||||
var _runtime$unstable_sho;
|
||||
|
||||
// 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 (esm) {
|
||||
await runtime.unstable_importModule(path);
|
||||
} else {
|
||||
runtime.requireModule(path);
|
||||
}
|
||||
} // TODO: remove ? in Jest 26
|
||||
|
||||
const esm =
|
||||
(_runtime$unstable_sho2 = runtime.unstable_shouldLoadAsEsm) === null ||
|
||||
_runtime$unstable_sho2 === void 0
|
||||
? void 0
|
||||
: _runtime$unstable_sho2.call(runtime, 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;
|
40
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
generated
vendored
Normal file
40
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* 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 BabelTraverse from '@babel/traverse';
|
||||
import type { Config, Global } from '@jest/types';
|
||||
import type { JestEnvironment } from '@jest/environment';
|
||||
import { TestResult } from '@jest/test-result';
|
||||
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: () => null | any;
|
||||
getBabelTraverse: () => typeof BabelTraverse;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
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>;
|
||||
export {};
|
306
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js
generated
vendored
Normal file
306
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js
generated
vendored
Normal file
|
@ -0,0 +1,306 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.runAndTransformResultsToJestFormat = exports.initialize = void 0;
|
||||
|
||||
var _testResult = require('@jest/test-result');
|
||||
|
||||
var _expect = require('expect');
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestSnapshot = require('jest-snapshot');
|
||||
|
||||
var _jestEach = require('jest-each');
|
||||
|
||||
var _throat = _interopRequireDefault(require('throat'));
|
||||
|
||||
var _state = require('../state');
|
||||
|
||||
var _utils = require('../utils');
|
||||
|
||||
var _run = _interopRequireDefault(require('../run'));
|
||||
|
||||
var _testCaseReportHandler = _interopRequireDefault(
|
||||
require('../testCaseReportHandler')
|
||||
);
|
||||
|
||||
var _ = _interopRequireDefault(require('..'));
|
||||
|
||||
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,
|
||||
getPrettier,
|
||||
getBabelTraverse,
|
||||
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); // @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());
|
||||
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)
|
||||
}; // 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) {
|
||||
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 = (0, _jestSnapshot.buildSnapshotResolver)(config);
|
||||
const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath);
|
||||
const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, {
|
||||
expand,
|
||||
getBabelTraverse,
|
||||
getPrettier,
|
||||
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,
|
||||
sourceMaps: {},
|
||||
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);
|
||||
}
|
||||
};
|
11
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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;
|
||||
declare const _default: (config: Pick<Config.GlobalConfig, 'expand'>) => Expect;
|
||||
export default _default;
|
39
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js
generated
vendored
Normal file
39
web/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
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.
|
||||
*/
|
||||
var _default = 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;
|
||||
};
|
||||
|
||||
exports.default = _default;
|
9
web/node_modules/jest-circus/build/run.d.ts
generated
vendored
Normal file
9
web/node_modules/jest-circus/build/run.d.ts
generated
vendored
Normal file
|
@ -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;
|
230
web/node_modules/jest-circus/build/run.js
generated
vendored
Normal file
230
web/node_modules/jest-circus/build/run.js
generated
vendored
Normal file
|
@ -0,0 +1,230 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _state = require('./state');
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
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 (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;
|
13
web/node_modules/jest-circus/build/state.d.ts
generated
vendored
Normal file
13
web/node_modules/jest-circus/build/state.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* 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 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;
|
75
web/node_modules/jest-circus/build/state.js
generated
vendored
Normal file
75
web/node_modules/jest-circus/build/state.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.addEventHandler = exports.dispatchSync = exports.dispatch = exports.setState = exports.getState = exports.ROOT_DESCRIBE_BLOCK_NAME = void 0;
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _eventHandler = _interopRequireDefault(require('./eventHandler'));
|
||||
|
||||
var _formatNodeAssertErrors = _interopRequireDefault(
|
||||
require('./formatNodeAssertErrors')
|
||||
);
|
||||
|
||||
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 ROOT_DESCRIBE_BLOCK = (0, _utils.makeDescribe)(ROOT_DESCRIBE_BLOCK_NAME);
|
||||
const INITIAL_STATE = {
|
||||
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: []
|
||||
};
|
||||
global[_types.STATE_SYM] = INITIAL_STATE;
|
||||
|
||||
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;
|
10
web/node_modules/jest-circus/build/testCaseReportHandler.d.ts
generated
vendored
Normal file
10
web/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
web/node_modules/jest-circus/build/testCaseReportHandler.js
generated
vendored
Normal file
28
web/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;
|
21
web/node_modules/jest-circus/build/types.d.ts
generated
vendored
Normal file
21
web/node_modules/jest-circus/build/types.d.ts
generated
vendored
Normal file
|
@ -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 expect = require('expect');
|
||||
import type { Circus } from '@jest/types';
|
||||
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 {
|
||||
module NodeJS {
|
||||
interface Global {
|
||||
STATE_SYM_SYMBOL: Circus.State;
|
||||
RETRY_TIMES_SYMBOL: string;
|
||||
TEST_TIMEOUT_SYMBOL: number;
|
||||
expect: typeof expect;
|
||||
}
|
||||
}
|
||||
}
|
21
web/node_modules/jest-circus/build/types.js
generated
vendored
Normal file
21
web/node_modules/jest-circus/build/types.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.TEST_TIMEOUT_SYMBOL = exports.RETRY_TIMES = exports.STATE_SYM = void 0;
|
||||
|
||||
var _expect = _interopRequireDefault(require('expect'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
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;
|
33
web/node_modules/jest-circus/build/utils.d.ts
generated
vendored
Normal file
33
web/node_modules/jest-circus/build/utils.d.ts
generated
vendored
Normal file
|
@ -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 { Circus } from '@jest/types';
|
||||
import type { AssertionResult } from '@jest/test-result';
|
||||
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 {};
|
512
web/node_modules/jest-circus/build/utils.js
generated
vendored
Normal file
512
web/node_modules/jest-circus/build/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,512 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
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 path = _interopRequireWildcard(require('path'));
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn'));
|
||||
|
||||
var _co = _interopRequireDefault(require('co'));
|
||||
|
||||
var _dedent = _interopRequireDefault(require('dedent'));
|
||||
|
||||
var _stackUtils = _interopRequireDefault(require('stack-utils'));
|
||||
|
||||
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
var _state = require('./state');
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
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,
|
||||
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 (fn.length) {
|
||||
let returnedValue = undefined;
|
||||
|
||||
const done = 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
|
||||
|
||||
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 ((0, _isGeneratorFn.default)(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.default)(returnedValue, {
|
||||
maxDepth: 3
|
||||
})}
|
||||
`)
|
||||
);
|
||||
return;
|
||||
} // Otherwise this test is synchronous, and if it didn't throw it means
|
||||
// it passed.
|
||||
|
||||
resolve();
|
||||
})
|
||||
.then(() => {
|
||||
completed = true; // If timeout is not cleared/unrefed the node process won't exit until
|
||||
// it's resolved.
|
||||
|
||||
timeoutID.unref && timeoutID.unref();
|
||||
clearTimeout(timeoutID);
|
||||
})
|
||||
.catch(error => {
|
||||
completed = true;
|
||||
timeoutID.unref && timeoutID.unref();
|
||||
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
|
||||
? void 0
|
||||
: (_parsedLine$file = _parsedLine.file) === null ||
|
||||
_parsedLine$file === void 0
|
||||
? 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 && (error.stack || error.message)) {
|
||||
return error;
|
||||
}
|
||||
|
||||
asyncError.message = `thrown: ${(0, _prettyFormat.default)(error, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
return asyncError;
|
||||
};
|
||||
|
||||
const getErrorStack = error => 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;
|
21
web/node_modules/jest-circus/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
21
web/node_modules/jest-circus/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
|
@ -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.
|
191
web/node_modules/jest-circus/node_modules/@jest/types/build/Circus.d.ts
generated
vendored
Normal file
191
web/node_modules/jest-circus/node_modules/@jest/types/build/Circus.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* 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 * as Global from './Global';
|
||||
declare type Process = NodeJS.Process;
|
||||
export declare type DoneFn = Global.DoneFn;
|
||||
export declare type BlockFn = Global.BlockFn;
|
||||
export declare type BlockName = Global.BlockName;
|
||||
export declare type BlockMode = void | 'skip' | 'only' | 'todo';
|
||||
export declare type TestMode = BlockMode;
|
||||
export declare type TestName = Global.TestName;
|
||||
export declare type TestFn = Global.TestFn;
|
||||
export declare type HookFn = Global.HookFn;
|
||||
export declare type AsyncFn = TestFn | HookFn;
|
||||
export declare type SharedHookType = 'afterAll' | 'beforeAll';
|
||||
export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
|
||||
export declare type TestContext = Record<string, unknown>;
|
||||
export declare type Exception = any;
|
||||
export declare type FormattedError = string;
|
||||
export declare type Hook = {
|
||||
asyncError: Error;
|
||||
fn: HookFn;
|
||||
type: HookType;
|
||||
parent: DescribeBlock;
|
||||
timeout: number | undefined | null;
|
||||
};
|
||||
export interface EventHandler {
|
||||
(event: AsyncEvent, state: State): void | Promise<void>;
|
||||
(event: SyncEvent, state: State): void;
|
||||
}
|
||||
export declare type Event = SyncEvent | AsyncEvent;
|
||||
interface JestGlobals extends Global.TestFrameworkGlobals {
|
||||
expect: unknown;
|
||||
}
|
||||
export declare type SyncEvent = {
|
||||
asyncError: Error;
|
||||
mode: BlockMode;
|
||||
name: 'start_describe_definition';
|
||||
blockName: BlockName;
|
||||
} | {
|
||||
mode: BlockMode;
|
||||
name: 'finish_describe_definition';
|
||||
blockName: BlockName;
|
||||
} | {
|
||||
asyncError: Error;
|
||||
name: 'add_hook';
|
||||
hookType: HookType;
|
||||
fn: HookFn;
|
||||
timeout: number | undefined;
|
||||
} | {
|
||||
asyncError: Error;
|
||||
name: 'add_test';
|
||||
testName: TestName;
|
||||
fn: TestFn;
|
||||
mode?: TestMode;
|
||||
timeout: number | undefined;
|
||||
} | {
|
||||
name: 'error';
|
||||
error: Exception;
|
||||
};
|
||||
export declare type AsyncEvent = {
|
||||
name: 'setup';
|
||||
testNamePattern?: string;
|
||||
runtimeGlobals: JestGlobals;
|
||||
parentProcess: Process;
|
||||
} | {
|
||||
name: 'include_test_location_in_result';
|
||||
} | {
|
||||
name: 'hook_start';
|
||||
hook: Hook;
|
||||
} | {
|
||||
name: 'hook_success';
|
||||
describeBlock?: DescribeBlock;
|
||||
test?: TestEntry;
|
||||
hook: Hook;
|
||||
} | {
|
||||
name: 'hook_failure';
|
||||
error: string | Exception;
|
||||
describeBlock?: DescribeBlock;
|
||||
test?: TestEntry;
|
||||
hook: Hook;
|
||||
} | {
|
||||
name: 'test_fn_start';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_fn_success';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_fn_failure';
|
||||
error: Exception;
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_retry';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_start';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_skip';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_todo';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'test_done';
|
||||
test: TestEntry;
|
||||
} | {
|
||||
name: 'run_describe_start';
|
||||
describeBlock: DescribeBlock;
|
||||
} | {
|
||||
name: 'run_describe_finish';
|
||||
describeBlock: DescribeBlock;
|
||||
} | {
|
||||
name: 'run_start';
|
||||
} | {
|
||||
name: 'run_finish';
|
||||
} | {
|
||||
name: 'teardown';
|
||||
};
|
||||
export declare type MatcherResults = {
|
||||
actual: unknown;
|
||||
expected: unknown;
|
||||
name: string;
|
||||
pass: boolean;
|
||||
};
|
||||
export declare type TestStatus = 'skip' | 'done' | 'todo';
|
||||
export declare type TestResult = {
|
||||
duration?: number | null;
|
||||
errors: Array<FormattedError>;
|
||||
errorsDetailed: Array<MatcherResults | unknown>;
|
||||
invocations: number;
|
||||
status: TestStatus;
|
||||
location?: {
|
||||
column: number;
|
||||
line: number;
|
||||
} | null;
|
||||
testPath: Array<TestName | BlockName>;
|
||||
};
|
||||
export declare type RunResult = {
|
||||
unhandledErrors: Array<FormattedError>;
|
||||
testResults: TestResults;
|
||||
};
|
||||
export declare type TestResults = Array<TestResult>;
|
||||
export declare type GlobalErrorHandlers = {
|
||||
uncaughtException: Array<(exception: Exception) => void>;
|
||||
unhandledRejection: Array<(exception: Exception, promise: Promise<unknown>) => void>;
|
||||
};
|
||||
export declare type State = {
|
||||
currentDescribeBlock: DescribeBlock;
|
||||
currentlyRunningTest?: TestEntry | null;
|
||||
expand?: boolean;
|
||||
hasFocusedTests: boolean;
|
||||
hasStarted: boolean;
|
||||
originalGlobalErrorHandlers?: GlobalErrorHandlers;
|
||||
parentProcess: Process | null;
|
||||
rootDescribeBlock: DescribeBlock;
|
||||
testNamePattern?: RegExp | null;
|
||||
testTimeout: number;
|
||||
unhandledErrors: Array<Exception>;
|
||||
includeTestLocationInResult: boolean;
|
||||
};
|
||||
export declare type DescribeBlock = {
|
||||
type: 'describeBlock';
|
||||
children: Array<DescribeBlock | TestEntry>;
|
||||
hooks: Array<Hook>;
|
||||
mode: BlockMode;
|
||||
name: BlockName;
|
||||
parent?: DescribeBlock;
|
||||
/** @deprecated Please get from `children` array instead */
|
||||
tests: Array<TestEntry>;
|
||||
};
|
||||
export declare type TestError = Exception | [Exception | undefined, Exception];
|
||||
export declare type TestEntry = {
|
||||
type: 'test';
|
||||
asyncError: Exception;
|
||||
errors: Array<TestError>;
|
||||
fn: TestFn;
|
||||
invocations: number;
|
||||
mode: TestMode;
|
||||
name: TestName;
|
||||
parent: DescribeBlock;
|
||||
startedAt?: number | null;
|
||||
duration?: number | null;
|
||||
status?: TestStatus | null;
|
||||
timeout?: number;
|
||||
};
|
||||
export {};
|
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
433
web/node_modules/jest-circus/node_modules/@jest/types/build/Config.d.ts
generated
vendored
Normal file
433
web/node_modules/jest-circus/node_modules/@jest/types/build/Config.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,433 @@
|
|||
/**
|
||||
* 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 { ForegroundColor } from 'chalk';
|
||||
import type { ReportOptions } from 'istanbul-reports';
|
||||
import type { Arguments } from 'yargs';
|
||||
declare type CoverageProvider = 'babel' | 'v8';
|
||||
declare type Timers = 'real' | 'fake' | 'modern' | 'legacy';
|
||||
export declare type Path = string;
|
||||
export declare type Glob = string;
|
||||
export declare type HasteConfig = {
|
||||
/** Whether to hash files using SHA-1. */
|
||||
computeSha1?: boolean;
|
||||
/** The platform to use as the default, e.g. 'ios'. */
|
||||
defaultPlatform?: string | null;
|
||||
/** Path to a custom implementation of Haste. */
|
||||
hasteImplModulePath?: string;
|
||||
/** All platforms to target, e.g ['ios', 'android']. */
|
||||
platforms?: Array<string>;
|
||||
/** Whether to throw on error on module collision. */
|
||||
throwOnModuleCollision?: boolean;
|
||||
};
|
||||
export declare type CoverageReporterName = keyof ReportOptions;
|
||||
export declare type CoverageReporterWithOptions<K = CoverageReporterName> = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial<ReportOptions[K]>] : never;
|
||||
export declare type CoverageReporters = Array<CoverageReporterName | CoverageReporterWithOptions>;
|
||||
export declare type ReporterConfig = [string, Record<string, unknown>];
|
||||
export declare type TransformerConfig = [string, Record<string, unknown>];
|
||||
export interface ConfigGlobals {
|
||||
[K: string]: unknown;
|
||||
}
|
||||
export declare type DefaultOptions = {
|
||||
automock: boolean;
|
||||
bail: number;
|
||||
cache: boolean;
|
||||
cacheDirectory: Path;
|
||||
changedFilesWithAncestor: boolean;
|
||||
clearMocks: boolean;
|
||||
collectCoverage: boolean;
|
||||
coveragePathIgnorePatterns: Array<string>;
|
||||
coverageReporters: Array<CoverageReporterName>;
|
||||
coverageProvider: CoverageProvider;
|
||||
errorOnDeprecated: boolean;
|
||||
expand: boolean;
|
||||
forceCoverageMatch: Array<Glob>;
|
||||
globals: ConfigGlobals;
|
||||
haste: HasteConfig;
|
||||
injectGlobals: boolean;
|
||||
maxConcurrency: number;
|
||||
maxWorkers: number | string;
|
||||
moduleDirectories: Array<string>;
|
||||
moduleFileExtensions: Array<string>;
|
||||
moduleNameMapper: Record<string, string | Array<string>>;
|
||||
modulePathIgnorePatterns: Array<string>;
|
||||
noStackTrace: boolean;
|
||||
notify: boolean;
|
||||
notifyMode: NotifyMode;
|
||||
prettierPath: string;
|
||||
resetMocks: boolean;
|
||||
resetModules: boolean;
|
||||
restoreMocks: boolean;
|
||||
roots: Array<Path>;
|
||||
runTestsByPath: boolean;
|
||||
runner: 'jest-runner';
|
||||
setupFiles: Array<Path>;
|
||||
setupFilesAfterEnv: Array<Path>;
|
||||
skipFilter: boolean;
|
||||
slowTestThreshold: number;
|
||||
snapshotSerializers: Array<Path>;
|
||||
testEnvironment: string;
|
||||
testEnvironmentOptions: Record<string, unknown>;
|
||||
testFailureExitCode: string | number;
|
||||
testLocationInResults: boolean;
|
||||
testMatch: Array<Glob>;
|
||||
testPathIgnorePatterns: Array<string>;
|
||||
testRegex: Array<string>;
|
||||
testRunner: string;
|
||||
testSequencer: string;
|
||||
testURL: string;
|
||||
timers: Timers;
|
||||
transformIgnorePatterns: Array<Glob>;
|
||||
useStderr: boolean;
|
||||
watch: boolean;
|
||||
watchPathIgnorePatterns: Array<string>;
|
||||
watchman: boolean;
|
||||
};
|
||||
export declare type DisplayName = {
|
||||
name: string;
|
||||
color: typeof ForegroundColor;
|
||||
};
|
||||
export declare type InitialOptionsWithRootDir = InitialOptions & Required<Pick<InitialOptions, 'rootDir'>>;
|
||||
export declare type InitialOptions = Partial<{
|
||||
automock: boolean;
|
||||
bail: boolean | number;
|
||||
cache: boolean;
|
||||
cacheDirectory: Path;
|
||||
clearMocks: boolean;
|
||||
changedFilesWithAncestor: boolean;
|
||||
changedSince: string;
|
||||
collectCoverage: boolean;
|
||||
collectCoverageFrom: Array<Glob>;
|
||||
collectCoverageOnlyFrom: {
|
||||
[key: string]: boolean;
|
||||
};
|
||||
coverageDirectory: string;
|
||||
coveragePathIgnorePatterns: Array<string>;
|
||||
coverageProvider: CoverageProvider;
|
||||
coverageReporters: CoverageReporters;
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
[key: string]: number;
|
||||
};
|
||||
};
|
||||
dependencyExtractor: string;
|
||||
detectLeaks: boolean;
|
||||
detectOpenHandles: boolean;
|
||||
displayName: string | DisplayName;
|
||||
expand: boolean;
|
||||
extraGlobals: Array<string>;
|
||||
filter: Path;
|
||||
findRelatedTests: boolean;
|
||||
forceCoverageMatch: Array<Glob>;
|
||||
forceExit: boolean;
|
||||
json: boolean;
|
||||
globals: ConfigGlobals;
|
||||
globalSetup: string | null | undefined;
|
||||
globalTeardown: string | null | undefined;
|
||||
haste: HasteConfig;
|
||||
injectGlobals: boolean;
|
||||
reporters: Array<string | ReporterConfig>;
|
||||
logHeapUsage: boolean;
|
||||
lastCommit: boolean;
|
||||
listTests: boolean;
|
||||
mapCoverage: boolean;
|
||||
maxConcurrency: number;
|
||||
maxWorkers: number | string;
|
||||
moduleDirectories: Array<string>;
|
||||
moduleFileExtensions: Array<string>;
|
||||
moduleLoader: Path;
|
||||
moduleNameMapper: {
|
||||
[key: string]: string | Array<string>;
|
||||
};
|
||||
modulePathIgnorePatterns: Array<string>;
|
||||
modulePaths: Array<string>;
|
||||
name: string;
|
||||
noStackTrace: boolean;
|
||||
notify: boolean;
|
||||
notifyMode: string;
|
||||
onlyChanged: boolean;
|
||||
onlyFailures: boolean;
|
||||
outputFile: Path;
|
||||
passWithNoTests: boolean;
|
||||
preprocessorIgnorePatterns: Array<Glob>;
|
||||
preset: string | null | undefined;
|
||||
prettierPath: string | null | undefined;
|
||||
projects: Array<Glob>;
|
||||
replname: string | null | undefined;
|
||||
resetMocks: boolean;
|
||||
resetModules: boolean;
|
||||
resolver: Path | null | undefined;
|
||||
restoreMocks: boolean;
|
||||
rootDir: Path;
|
||||
roots: Array<Path>;
|
||||
runner: string;
|
||||
runTestsByPath: boolean;
|
||||
scriptPreprocessor: string;
|
||||
setupFiles: Array<Path>;
|
||||
setupTestFrameworkScriptFile: Path;
|
||||
setupFilesAfterEnv: Array<Path>;
|
||||
silent: boolean;
|
||||
skipFilter: boolean;
|
||||
skipNodeResolution: boolean;
|
||||
slowTestThreshold: number;
|
||||
snapshotResolver: Path;
|
||||
snapshotSerializers: Array<Path>;
|
||||
errorOnDeprecated: boolean;
|
||||
testEnvironment: string;
|
||||
testEnvironmentOptions: Record<string, unknown>;
|
||||
testFailureExitCode: string | number;
|
||||
testLocationInResults: boolean;
|
||||
testMatch: Array<Glob>;
|
||||
testNamePattern: string;
|
||||
testPathDirs: Array<Path>;
|
||||
testPathIgnorePatterns: Array<string>;
|
||||
testRegex: string | Array<string>;
|
||||
testResultsProcessor: string;
|
||||
testRunner: string;
|
||||
testSequencer: string;
|
||||
testURL: string;
|
||||
testTimeout: number;
|
||||
timers: Timers;
|
||||
transform: {
|
||||
[regex: string]: Path | TransformerConfig;
|
||||
};
|
||||
transformIgnorePatterns: Array<Glob>;
|
||||
watchPathIgnorePatterns: Array<string>;
|
||||
unmockedModulePathPatterns: Array<string>;
|
||||
updateSnapshot: boolean;
|
||||
useStderr: boolean;
|
||||
verbose?: boolean;
|
||||
watch: boolean;
|
||||
watchAll: boolean;
|
||||
watchman: boolean;
|
||||
watchPlugins: Array<string | [string, Record<string, unknown>]>;
|
||||
}>;
|
||||
export declare type SnapshotUpdateState = 'all' | 'new' | 'none';
|
||||
declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change';
|
||||
export declare type CoverageThresholdValue = {
|
||||
branches?: number;
|
||||
functions?: number;
|
||||
lines?: number;
|
||||
statements?: number;
|
||||
};
|
||||
declare type CoverageThreshold = {
|
||||
[path: string]: CoverageThresholdValue;
|
||||
global: CoverageThresholdValue;
|
||||
};
|
||||
export declare type GlobalConfig = {
|
||||
bail: number;
|
||||
changedSince?: string;
|
||||
changedFilesWithAncestor: boolean;
|
||||
collectCoverage: boolean;
|
||||
collectCoverageFrom: Array<Glob>;
|
||||
collectCoverageOnlyFrom?: {
|
||||
[key: string]: boolean;
|
||||
};
|
||||
coverageDirectory: string;
|
||||
coveragePathIgnorePatterns?: Array<string>;
|
||||
coverageProvider: CoverageProvider;
|
||||
coverageReporters: CoverageReporters;
|
||||
coverageThreshold?: CoverageThreshold;
|
||||
detectLeaks: boolean;
|
||||
detectOpenHandles: boolean;
|
||||
enabledTestsMap?: {
|
||||
[key: string]: {
|
||||
[key: string]: boolean;
|
||||
};
|
||||
};
|
||||
expand: boolean;
|
||||
filter?: Path;
|
||||
findRelatedTests: boolean;
|
||||
forceExit: boolean;
|
||||
json: boolean;
|
||||
globalSetup?: string;
|
||||
globalTeardown?: string;
|
||||
lastCommit: boolean;
|
||||
logHeapUsage: boolean;
|
||||
listTests: boolean;
|
||||
maxConcurrency: number;
|
||||
maxWorkers: number;
|
||||
noStackTrace: boolean;
|
||||
nonFlagArgs: Array<string>;
|
||||
noSCM?: boolean;
|
||||
notify: boolean;
|
||||
notifyMode: NotifyMode;
|
||||
outputFile?: Path;
|
||||
onlyChanged: boolean;
|
||||
onlyFailures: boolean;
|
||||
passWithNoTests: boolean;
|
||||
projects: Array<Glob>;
|
||||
replname?: string;
|
||||
reporters?: Array<string | ReporterConfig>;
|
||||
runTestsByPath: boolean;
|
||||
rootDir: Path;
|
||||
silent?: boolean;
|
||||
skipFilter: boolean;
|
||||
errorOnDeprecated: boolean;
|
||||
testFailureExitCode: number;
|
||||
testNamePattern?: string;
|
||||
testPathPattern: string;
|
||||
testResultsProcessor?: string;
|
||||
testSequencer: string;
|
||||
testTimeout?: number;
|
||||
updateSnapshot: SnapshotUpdateState;
|
||||
useStderr: boolean;
|
||||
verbose?: boolean;
|
||||
watch: boolean;
|
||||
watchAll: boolean;
|
||||
watchman: boolean;
|
||||
watchPlugins?: Array<{
|
||||
path: string;
|
||||
config: Record<string, unknown>;
|
||||
}> | null;
|
||||
};
|
||||
export declare type ProjectConfig = {
|
||||
automock: boolean;
|
||||
cache: boolean;
|
||||
cacheDirectory: Path;
|
||||
clearMocks: boolean;
|
||||
coveragePathIgnorePatterns: Array<string>;
|
||||
cwd: Path;
|
||||
dependencyExtractor?: string;
|
||||
detectLeaks: boolean;
|
||||
detectOpenHandles: boolean;
|
||||
displayName?: DisplayName;
|
||||
errorOnDeprecated: boolean;
|
||||
extraGlobals: Array<keyof NodeJS.Global>;
|
||||
filter?: Path;
|
||||
forceCoverageMatch: Array<Glob>;
|
||||
globalSetup?: string;
|
||||
globalTeardown?: string;
|
||||
globals: ConfigGlobals;
|
||||
haste: HasteConfig;
|
||||
injectGlobals: boolean;
|
||||
moduleDirectories: Array<string>;
|
||||
moduleFileExtensions: Array<string>;
|
||||
moduleLoader?: Path;
|
||||
moduleNameMapper: Array<[string, string]>;
|
||||
modulePathIgnorePatterns: Array<string>;
|
||||
modulePaths?: Array<string>;
|
||||
name: string;
|
||||
prettierPath: string;
|
||||
resetMocks: boolean;
|
||||
resetModules: boolean;
|
||||
resolver?: Path;
|
||||
restoreMocks: boolean;
|
||||
rootDir: Path;
|
||||
roots: Array<Path>;
|
||||
runner: string;
|
||||
setupFiles: Array<Path>;
|
||||
setupFilesAfterEnv: Array<Path>;
|
||||
skipFilter: boolean;
|
||||
skipNodeResolution?: boolean;
|
||||
slowTestThreshold: number;
|
||||
snapshotResolver?: Path;
|
||||
snapshotSerializers: Array<Path>;
|
||||
testEnvironment: string;
|
||||
testEnvironmentOptions: Record<string, unknown>;
|
||||
testMatch: Array<Glob>;
|
||||
testLocationInResults: boolean;
|
||||
testPathIgnorePatterns: Array<string>;
|
||||
testRegex: Array<string | RegExp>;
|
||||
testRunner: string;
|
||||
testURL: string;
|
||||
timers: Timers;
|
||||
transform: Array<[string, Path, Record<string, unknown>]>;
|
||||
transformIgnorePatterns: Array<Glob>;
|
||||
watchPathIgnorePatterns: Array<string>;
|
||||
unmockedModulePathPatterns?: Array<string>;
|
||||
};
|
||||
export declare type Argv = Arguments<Partial<{
|
||||
all: boolean;
|
||||
automock: boolean;
|
||||
bail: boolean | number;
|
||||
cache: boolean;
|
||||
cacheDirectory: string;
|
||||
changedFilesWithAncestor: boolean;
|
||||
changedSince: string;
|
||||
ci: boolean;
|
||||
clearCache: boolean;
|
||||
clearMocks: boolean;
|
||||
collectCoverage: boolean;
|
||||
collectCoverageFrom: string;
|
||||
collectCoverageOnlyFrom: Array<string>;
|
||||
color: boolean;
|
||||
colors: boolean;
|
||||
config: string;
|
||||
coverage: boolean;
|
||||
coverageDirectory: string;
|
||||
coveragePathIgnorePatterns: Array<string>;
|
||||
coverageReporters: Array<string>;
|
||||
coverageThreshold: string;
|
||||
debug: boolean;
|
||||
env: string;
|
||||
expand: boolean;
|
||||
findRelatedTests: boolean;
|
||||
forceExit: boolean;
|
||||
globals: string;
|
||||
globalSetup: string | null | undefined;
|
||||
globalTeardown: string | null | undefined;
|
||||
haste: string;
|
||||
init: boolean;
|
||||
injectGlobals: boolean;
|
||||
json: boolean;
|
||||
lastCommit: boolean;
|
||||
logHeapUsage: boolean;
|
||||
maxWorkers: number | string;
|
||||
moduleDirectories: Array<string>;
|
||||
moduleFileExtensions: Array<string>;
|
||||
moduleNameMapper: string;
|
||||
modulePathIgnorePatterns: Array<string>;
|
||||
modulePaths: Array<string>;
|
||||
noStackTrace: boolean;
|
||||
notify: boolean;
|
||||
notifyMode: string;
|
||||
onlyChanged: boolean;
|
||||
onlyFailures: boolean;
|
||||
outputFile: string;
|
||||
preset: string | null | undefined;
|
||||
projects: Array<string>;
|
||||
prettierPath: string | null | undefined;
|
||||
resetMocks: boolean;
|
||||
resetModules: boolean;
|
||||
resolver: string | null | undefined;
|
||||
restoreMocks: boolean;
|
||||
rootDir: string;
|
||||
roots: Array<string>;
|
||||
runInBand: boolean;
|
||||
selectProjects: Array<string>;
|
||||
setupFiles: Array<string>;
|
||||
setupFilesAfterEnv: Array<string>;
|
||||
showConfig: boolean;
|
||||
silent: boolean;
|
||||
snapshotSerializers: Array<string>;
|
||||
testEnvironment: string;
|
||||
testFailureExitCode: string | null | undefined;
|
||||
testMatch: Array<string>;
|
||||
testNamePattern: string;
|
||||
testPathIgnorePatterns: Array<string>;
|
||||
testPathPattern: Array<string>;
|
||||
testRegex: string | Array<string>;
|
||||
testResultsProcessor: string;
|
||||
testRunner: string;
|
||||
testSequencer: string;
|
||||
testURL: string;
|
||||
testTimeout: number | null | undefined;
|
||||
timers: string;
|
||||
transform: string;
|
||||
transformIgnorePatterns: Array<string>;
|
||||
unmockedModulePathPatterns: Array<string> | null | undefined;
|
||||
updateSnapshot: boolean;
|
||||
useStderr: boolean;
|
||||
verbose: boolean;
|
||||
version: boolean;
|
||||
watch: boolean;
|
||||
watchAll: boolean;
|
||||
watchman: boolean;
|
||||
watchPathIgnorePatterns: Array<string>;
|
||||
}>>;
|
||||
export {};
|
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
88
web/node_modules/jest-circus/node_modules/@jest/types/build/Global.d.ts
generated
vendored
Normal file
88
web/node_modules/jest-circus/node_modules/@jest/types/build/Global.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* 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 { CoverageMapData } from 'istanbul-lib-coverage';
|
||||
export declare type DoneFn = (reason?: string | Error) => void;
|
||||
export declare type TestName = string;
|
||||
export declare type TestFn = (done?: DoneFn) => Promise<void | undefined | unknown> | void | undefined;
|
||||
export declare type ConcurrentTestFn = (done?: DoneFn) => Promise<void | undefined | unknown>;
|
||||
export declare type BlockFn = () => void;
|
||||
export declare type BlockName = string;
|
||||
export declare type HookFn = TestFn;
|
||||
export declare type Col = unknown;
|
||||
export declare type Row = Array<Col>;
|
||||
export declare type Table = Array<Row>;
|
||||
export declare type ArrayTable = Table | Row;
|
||||
export declare type TemplateTable = TemplateStringsArray;
|
||||
export declare type TemplateData = Array<unknown>;
|
||||
export declare type EachTable = ArrayTable | TemplateTable;
|
||||
export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn;
|
||||
export declare type EachTestFn<EachCallback extends TestCallback> = (...args: Array<any>) => ReturnType<EachCallback>;
|
||||
declare type Jasmine = {
|
||||
_DEFAULT_TIMEOUT_INTERVAL?: number;
|
||||
addMatchers: (matchers: Record<string, unknown>) => void;
|
||||
};
|
||||
declare type Each<EachCallback extends TestCallback> = ((table: EachTable, ...taggedTemplateData: Array<unknown>) => (title: string, test: EachTestFn<EachCallback>, timeout?: number) => void) | (() => () => void);
|
||||
export interface HookBase {
|
||||
(fn: HookFn, timeout?: number): void;
|
||||
}
|
||||
export interface ItBase {
|
||||
(testName: TestName, fn: TestFn, timeout?: number): void;
|
||||
each: Each<TestFn>;
|
||||
}
|
||||
export interface It extends ItBase {
|
||||
only: ItBase;
|
||||
skip: ItBase;
|
||||
todo: (testName: TestName) => void;
|
||||
}
|
||||
export interface ItConcurrentBase {
|
||||
(testName: string, testFn: ConcurrentTestFn, timeout?: number): void;
|
||||
each: Each<ConcurrentTestFn>;
|
||||
}
|
||||
export interface ItConcurrentExtended extends ItConcurrentBase {
|
||||
only: ItConcurrentBase;
|
||||
skip: ItConcurrentBase;
|
||||
}
|
||||
export interface ItConcurrent extends It {
|
||||
concurrent: ItConcurrentExtended;
|
||||
}
|
||||
export interface DescribeBase {
|
||||
(blockName: BlockName, blockFn: BlockFn): void;
|
||||
each: Each<BlockFn>;
|
||||
}
|
||||
export interface Describe extends DescribeBase {
|
||||
only: DescribeBase;
|
||||
skip: DescribeBase;
|
||||
}
|
||||
export interface TestFrameworkGlobals {
|
||||
it: ItConcurrent;
|
||||
test: ItConcurrent;
|
||||
fit: ItBase & {
|
||||
concurrent?: ItConcurrentBase;
|
||||
};
|
||||
xit: ItBase;
|
||||
xtest: ItBase;
|
||||
describe: Describe;
|
||||
xdescribe: DescribeBase;
|
||||
fdescribe: DescribeBase;
|
||||
beforeAll: HookBase;
|
||||
beforeEach: HookBase;
|
||||
afterEach: HookBase;
|
||||
afterAll: HookBase;
|
||||
}
|
||||
export interface GlobalAdditions extends TestFrameworkGlobals {
|
||||
__coverage__: CoverageMapData;
|
||||
jasmine: Jasmine;
|
||||
fail: () => void;
|
||||
pending: () => void;
|
||||
spyOn: () => void;
|
||||
spyOnProperty: () => void;
|
||||
}
|
||||
export interface Global extends GlobalAdditions, Omit<NodeJS.Global, keyof GlobalAdditions> {
|
||||
[extras: string]: unknown;
|
||||
}
|
||||
export {};
|
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
31
web/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.d.ts
generated
vendored
Normal file
31
web/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
export declare type Milliseconds = number;
|
||||
declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
|
||||
declare type Callsite = {
|
||||
column: number;
|
||||
line: number;
|
||||
};
|
||||
export declare type AssertionResult = {
|
||||
ancestorTitles: Array<string>;
|
||||
duration?: Milliseconds | null;
|
||||
failureDetails: Array<unknown>;
|
||||
failureMessages: Array<string>;
|
||||
fullName: string;
|
||||
invocations?: number;
|
||||
location?: Callsite | null;
|
||||
numPassingAsserts: number;
|
||||
status: Status;
|
||||
title: string;
|
||||
};
|
||||
export declare type SerializableError = {
|
||||
code?: unknown;
|
||||
message: string;
|
||||
stack: string | null | undefined;
|
||||
type?: string;
|
||||
};
|
||||
export {};
|
1
web/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
12
web/node_modules/jest-circus/node_modules/@jest/types/build/Transform.d.ts
generated
vendored
Normal file
12
web/node_modules/jest-circus/node_modules/@jest/types/build/Transform.d.ts
generated
vendored
Normal file
|
@ -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.
|
||||
*/
|
||||
export declare type TransformResult = {
|
||||
code: string;
|
||||
originalCode: string;
|
||||
mapCoverage?: boolean;
|
||||
sourceMapPath: string | null;
|
||||
};
|
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
12
web/node_modules/jest-circus/node_modules/@jest/types/build/index.d.ts
generated
vendored
Normal file
12
web/node_modules/jest-circus/node_modules/@jest/types/build/index.d.ts
generated
vendored
Normal file
|
@ -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 * as Circus from './Circus';
|
||||
import type * as Config from './Config';
|
||||
import type * as Global from './Global';
|
||||
import type * as TestResult from './TestResult';
|
||||
import type * as TransformTypes from './Transform';
|
||||
export type { Circus, Config, Global, TestResult, TransformTypes };
|
1
web/node_modules/jest-circus/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
26
web/node_modules/jest-circus/node_modules/@jest/types/package.json
generated
vendored
Normal file
26
web/node_modules/jest-circus/node_modules/@jest/types/package.json
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "@jest/types",
|
||||
"version": "26.6.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/jest-types"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"dependencies": {
|
||||
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||
"@types/istanbul-reports": "^3.0.0",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^15.0.0",
|
||||
"chalk": "^4.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5"
|
||||
}
|
21
web/node_modules/jest-circus/node_modules/@types/yargs/LICENSE
generated
vendored
Executable file
21
web/node_modules/jest-circus/node_modules/@types/yargs/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
16
web/node_modules/jest-circus/node_modules/@types/yargs/README.md
generated
vendored
Executable file
16
web/node_modules/jest-circus/node_modules/@types/yargs/README.md
generated
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
# Installation
|
||||
> `npm install --save @types/yargs`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for yargs (https://github.com/chevex/yargs).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v15.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Fri, 02 Jul 2021 16:32:05 GMT
|
||||
* Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen).
|
836
web/node_modules/jest-circus/node_modules/@types/yargs/index.d.ts
generated
vendored
Executable file
836
web/node_modules/jest-circus/node_modules/@types/yargs/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,836 @@
|
|||
// Type definitions for yargs 15.0
|
||||
// Project: https://github.com/chevex/yargs, https://yargs.js.org
|
||||
// Definitions by: Martin Poelstra <https://github.com/poelstra>
|
||||
// Mizunashi Mana <https://github.com/mizunashi-mana>
|
||||
// Jeffery Grajkowski <https://github.com/pushplay>
|
||||
// Jimi (Dimitris) Charalampidis <https://github.com/JimiC>
|
||||
// Steffen Viken Valvåg <https://github.com/steffenvv>
|
||||
// Emily Marigold Klassen <https://github.com/forivall>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Aankhen <https://github.com/Aankhen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
// The following TSLint rules have been disabled:
|
||||
// unified-signatures: Because there is useful information in the argument names of the overloaded signatures
|
||||
|
||||
// Convention:
|
||||
// Use 'union types' when:
|
||||
// - parameter types have similar signature type (i.e. 'string | ReadonlyArray<string>')
|
||||
// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys'])
|
||||
// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters
|
||||
// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter
|
||||
// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray<string>`,
|
||||
// thus it's preferred to use `command: string | ReadonlyArray<string>`
|
||||
// Use parameterless declaration instead of declaring all parameters optional,
|
||||
// when all parameters are optional and more than one
|
||||
|
||||
import { DetailedArguments, Configuration } from 'yargs-parser';
|
||||
|
||||
declare namespace yargs {
|
||||
type BuilderCallback<T, R> = ((args: Argv<T>) => PromiseLike<Argv<R>>) | ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void);
|
||||
|
||||
type ParserConfigurationOptions = Configuration & {
|
||||
/** Sort commands alphabetically. Default is `false` */
|
||||
'sort-commands': boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The type parameter `T` is the expected shape of the parsed options.
|
||||
* `Arguments<T>` is those options plus `_` and `$0`, and an indexer falling
|
||||
* back to `unknown` for unknown options.
|
||||
*
|
||||
* For the return type / `argv` property, we create a mapped type over
|
||||
* `Arguments<T>` to simplify the inferred type signature in client code.
|
||||
*/
|
||||
interface Argv<T = {}> {
|
||||
(): { [key in keyof Arguments<T>]: Arguments<T>[key] };
|
||||
(args: ReadonlyArray<string>, cwd?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa.
|
||||
*
|
||||
* Optionally `.alias()` can take an object that maps keys to aliases.
|
||||
* Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings.
|
||||
*/
|
||||
// Aliases for previously declared options can inherit the types of those options.
|
||||
alias<K1 extends keyof T, K2 extends string>(shortName: K1, longName: K2 | ReadonlyArray<K2>): Argv<T & { [key in K2]: T[K1] }>;
|
||||
alias<K1 extends keyof T, K2 extends string>(shortName: K2, longName: K1 | ReadonlyArray<K1>): Argv<T & { [key in K2]: T[K1] }>;
|
||||
alias(shortName: string | ReadonlyArray<string>, longName: string | ReadonlyArray<string>): Argv<T>;
|
||||
alias(aliases: { [shortName: string]: string | ReadonlyArray<string> }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Get the arguments as a plain old object.
|
||||
*
|
||||
* Arguments without a corresponding flag show up in the `argv._` array.
|
||||
*
|
||||
* The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl.
|
||||
*
|
||||
* If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js),
|
||||
* it will ignore the first parameter since it expects it to be the script name. In order to override
|
||||
* this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored.
|
||||
*/
|
||||
argv: { [key in keyof Arguments<T>]: Arguments<T>[key] };
|
||||
|
||||
/**
|
||||
* Tell the parser to interpret `key` as an array.
|
||||
* If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`.
|
||||
* Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']`
|
||||
*
|
||||
* When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array.
|
||||
*/
|
||||
array<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToArray<T[key]> }>;
|
||||
array<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: Array<string | number> | undefined }>;
|
||||
|
||||
/**
|
||||
* Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`.
|
||||
*
|
||||
* `key` will default to `false`, unless a `default(key, undefined)` is explicitly set.
|
||||
*
|
||||
* If `key` is an array, interpret all the elements as booleans.
|
||||
*/
|
||||
boolean<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: boolean | undefined }>;
|
||||
boolean<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: boolean | undefined }>;
|
||||
|
||||
/**
|
||||
* Check that certain conditions are met in the provided arguments.
|
||||
* @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases.
|
||||
* If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit.
|
||||
* @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command.
|
||||
*/
|
||||
check(func: (argv: Arguments<T>, aliases: { [alias: string]: string }) => any, global?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Limit valid values for key to a predefined set of choices, given as an array or as an individual value.
|
||||
* If this method is called multiple times, all enumerated values will be merged together.
|
||||
* Choices are generally strings or numbers, and value matching is case-sensitive.
|
||||
*
|
||||
* Optionally `.choices()` can take an object that maps multiple keys to their choices.
|
||||
*
|
||||
* Choices can also be specified as choices in the object given to `option()`.
|
||||
*/
|
||||
choices<K extends keyof T, C extends ReadonlyArray<any>>(key: K, values: C): Argv<Omit<T, K> & { [key in K]: C[number] | undefined }>;
|
||||
choices<K extends string, C extends ReadonlyArray<any>>(key: K, values: C): Argv<T & { [key in K]: C[number] | undefined }>;
|
||||
choices<C extends { [key: string]: ReadonlyArray<any> }>(choices: C): Argv<Omit<T, keyof C> & { [key in keyof C]: C[key][number] | undefined }>;
|
||||
|
||||
/**
|
||||
* Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`.
|
||||
*
|
||||
* The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error.
|
||||
* The returned value will be used as the value for `key` (or one of its aliases) in `argv`.
|
||||
*
|
||||
* If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console.
|
||||
*
|
||||
* Coercion will be applied to a value after all other modifications, such as `.normalize()`.
|
||||
*
|
||||
* Optionally `.coerce()` can take an object that maps several keys to their respective coercion function.
|
||||
*
|
||||
* You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`.
|
||||
*
|
||||
* If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed
|
||||
*/
|
||||
coerce<K extends keyof T, V>(key: K | ReadonlyArray<K>, func: (arg: any) => V): Argv<Omit<T, K> & { [key in K]: V | undefined }>;
|
||||
coerce<K extends string, V>(key: K | ReadonlyArray<K>, func: (arg: any) => V): Argv<T & { [key in K]: V | undefined }>;
|
||||
coerce<O extends { [key: string]: (arg: any) => any }>(opts: O): Argv<Omit<T, keyof O> & { [key in keyof O]: ReturnType<O[key]> | undefined }>;
|
||||
|
||||
/**
|
||||
* Define the commands exposed by your application.
|
||||
* @param command Should be a string representing the command or an array of strings representing the command and its aliases.
|
||||
* @param description Use to provide a description for each command your application accepts (the values stored in `argv._`).
|
||||
* Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion.
|
||||
* @param [builder] Object to give hints about the options that your command accepts.
|
||||
* Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command specific help.
|
||||
*
|
||||
* Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments.
|
||||
* @param [handler] Function, which will be executed with the parsed `argv` object.
|
||||
*/
|
||||
command<U = T>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
description: string,
|
||||
builder?: BuilderCallback<T, U>,
|
||||
handler?: (args: Arguments<U>) => void,
|
||||
middlewares?: MiddlewareFunction[],
|
||||
deprecated?: boolean | string,
|
||||
): Argv<U>;
|
||||
command<O extends { [key: string]: Options }>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
description: string,
|
||||
builder?: O,
|
||||
handler?: (args: Arguments<InferredOptionTypes<O>>) => void,
|
||||
middlewares?: MiddlewareFunction[],
|
||||
deprecated?: boolean | string,
|
||||
): Argv<T>;
|
||||
command<U>(command: string | ReadonlyArray<string>, description: string, module: CommandModule<T, U>): Argv<U>;
|
||||
command<U = T>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
showInHelp: false,
|
||||
builder?: BuilderCallback<T, U>,
|
||||
handler?: (args: Arguments<U>) => void,
|
||||
middlewares?: MiddlewareFunction[],
|
||||
deprecated?: boolean | string,
|
||||
): Argv<T>;
|
||||
command<O extends { [key: string]: Options }>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
showInHelp: false,
|
||||
builder?: O,
|
||||
handler?: (args: Arguments<InferredOptionTypes<O>>) => void,
|
||||
): Argv<T>;
|
||||
command<U>(command: string | ReadonlyArray<string>, showInHelp: false, module: CommandModule<T, U>): Argv<U>;
|
||||
command<U>(module: CommandModule<T, U>): Argv<U>;
|
||||
|
||||
// Advanced API
|
||||
/** Apply command modules from a directory relative to the module calling this method. */
|
||||
commandDir(dir: string, opts?: RequireDirectoryOptions): Argv<T>;
|
||||
|
||||
/**
|
||||
* Enable bash/zsh-completion shortcuts for commands and options.
|
||||
*
|
||||
* If invoked without parameters, `.completion()` will make completion the command to output the completion script.
|
||||
*
|
||||
* @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted.
|
||||
* To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh).
|
||||
* @param [description] Provide a description in your usage instructions for the command that generates the completion scripts.
|
||||
* @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method.
|
||||
*/
|
||||
completion(): Argv<T>;
|
||||
completion(cmd: string, func?: AsyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, func?: SyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, func?: PromiseCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv<T>;
|
||||
|
||||
/**
|
||||
* Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file.
|
||||
* The file is loaded and parsed, and its properties are set as arguments.
|
||||
* Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly.
|
||||
*
|
||||
* If invoked without parameters, `.config()` will make --config the option to pass the JSON config file.
|
||||
*
|
||||
* @param [description] Provided to customize the config (`key`) option in the usage string.
|
||||
* @param [explicitConfigurationObject] An explicit configuration `object`
|
||||
*/
|
||||
config(): Argv<T>;
|
||||
config(key: string | ReadonlyArray<string>, description?: string, parseFn?: (configPath: string) => object): Argv<T>;
|
||||
config(key: string | ReadonlyArray<string>, parseFn: (configPath: string) => object): Argv<T>;
|
||||
config(explicitConfigurationObject: object): Argv<T>;
|
||||
|
||||
/**
|
||||
* Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with.
|
||||
*
|
||||
* Optionally `.conflicts()` can accept an object specifying multiple conflicting keys.
|
||||
*/
|
||||
conflicts(key: string, value: string | ReadonlyArray<string>): Argv<T>;
|
||||
conflicts(conflicts: { [key: string]: string | ReadonlyArray<string> }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`.
|
||||
*/
|
||||
count<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: number }>;
|
||||
count<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: number }>;
|
||||
|
||||
/**
|
||||
* Set `argv[key]` to `value` if no option was specified in `process.argv`.
|
||||
*
|
||||
* Optionally `.default()` can take an object that maps keys to default values.
|
||||
*
|
||||
* The default value can be a `function` which returns a value. The name of the function will be used in the usage string.
|
||||
*
|
||||
* Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions.
|
||||
*/
|
||||
default<K extends keyof T, V>(key: K, value: V, description?: string): Argv<Omit<T, K> & { [key in K]: V }>;
|
||||
default<K extends string, V>(key: K, value: V, description?: string): Argv<T & { [key in K]: V }>;
|
||||
default<D extends { [key: string]: any }>(defaults: D, description?: string): Argv<Omit<T, keyof D> & D>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.demandCommand()' or '.demandOption()' instead
|
||||
*/
|
||||
demand<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
demand<K extends string>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<T & { [key in K]: unknown }>;
|
||||
demand(key: string | ReadonlyArray<string>, required?: boolean): Argv<T>;
|
||||
demand(positionals: number, msg: string): Argv<T>;
|
||||
demand(positionals: number, required?: boolean): Argv<T>;
|
||||
demand(positionals: number, max: number, msg?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`.
|
||||
* If is an array, demand each element.
|
||||
* @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message.
|
||||
* @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters.
|
||||
*/
|
||||
demandOption<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
demandOption<K extends string>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<T & { [key in K]: unknown }>;
|
||||
demandOption(key: string | ReadonlyArray<string>, demand?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Demand in context of commands.
|
||||
* You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met.
|
||||
*/
|
||||
demandCommand(): Argv<T>;
|
||||
demandCommand(min: number, minMsg?: string): Argv<T>;
|
||||
demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Shows a [deprecated] notice in front of the option
|
||||
*/
|
||||
deprecateOption(option: string, msg?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Describe a `key` for the generated usage information.
|
||||
*
|
||||
* Optionally `.describe()` can take an object that maps keys to descriptions.
|
||||
*/
|
||||
describe(key: string | ReadonlyArray<string>, description: string): Argv<T>;
|
||||
describe(descriptions: { [key: string]: string }): Argv<T>;
|
||||
|
||||
/** Should yargs attempt to detect the os' locale? Defaults to `true`. */
|
||||
detectLocale(detect: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments.
|
||||
*
|
||||
* Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo)
|
||||
*
|
||||
* If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv.
|
||||
*
|
||||
* Program arguments are defined in this order of precedence:
|
||||
* 1. Command line args
|
||||
* 2. Env vars
|
||||
* 3. Config file/objects
|
||||
* 4. Configured defaults
|
||||
*
|
||||
* Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration.
|
||||
*/
|
||||
env(): Argv<T>;
|
||||
env(prefix: string): Argv<T>;
|
||||
env(enable: boolean): Argv<T>;
|
||||
|
||||
/** A message to print at the end of the usage instructions */
|
||||
epilog(msg: string): Argv<T>;
|
||||
/** A message to print at the end of the usage instructions */
|
||||
epilogue(msg: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Give some example invocations of your program.
|
||||
* Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl.
|
||||
* Examples will be printed out as part of the help message.
|
||||
*/
|
||||
example(command: string, description: string): Argv<T>;
|
||||
example(command: ReadonlyArray<[string, string?]>): Argv<T>;
|
||||
|
||||
/** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */
|
||||
exit(code: number, err: Error): void;
|
||||
|
||||
/**
|
||||
* By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails.
|
||||
* Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated.
|
||||
*/
|
||||
exitProcess(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Method to execute when a failure occurs, rather than printing the failure message.
|
||||
* @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred.
|
||||
*/
|
||||
fail(func: (msg: string, err: Error, yargs: Argv<T>) => any): Argv<T>;
|
||||
|
||||
/**
|
||||
* Allows to programmatically get completion choices for any line.
|
||||
* @param args An array of the words in the command line to complete.
|
||||
* @param done The callback to be called with the resulting completions.
|
||||
*/
|
||||
getCompletion(args: ReadonlyArray<string>, done: (completions: ReadonlyArray<string>) => void): Argv<T>;
|
||||
|
||||
/**
|
||||
* Indicate that an option (or group of options) should not be reset when a command is executed
|
||||
*
|
||||
* Options default to being global.
|
||||
*/
|
||||
global(key: string | ReadonlyArray<string>): Argv<T>;
|
||||
|
||||
/** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */
|
||||
group(key: string | ReadonlyArray<string>, groupName: string): Argv<T>;
|
||||
|
||||
/** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */
|
||||
hide(key: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process.
|
||||
* By default yargs enables help on the `--help` option.
|
||||
*
|
||||
* Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command.
|
||||
* If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command.
|
||||
*
|
||||
* If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output.
|
||||
*
|
||||
* @param [description] Customizes the description of the help option in the usage string.
|
||||
* @param [enableExplicit] If `false` is provided, it will disable --help.
|
||||
*/
|
||||
help(): Argv<T>;
|
||||
help(enableExplicit: boolean): Argv<T>;
|
||||
help(option: string, enableExplicit: boolean): Argv<T>;
|
||||
help(option: string, description?: string, enableExplicit?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Given the key `x` is set, it is required that the key `y` is set.
|
||||
* y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`.
|
||||
*
|
||||
* Optionally `.implies()` can accept an object specifying multiple implications.
|
||||
*/
|
||||
implies(key: string, value: string | ReadonlyArray<string>): Argv<T>;
|
||||
implies(implies: { [key: string]: string | ReadonlyArray<string> }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Return the locale that yargs is currently using.
|
||||
*
|
||||
* By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language.
|
||||
*/
|
||||
locale(): string;
|
||||
/**
|
||||
* Override the auto-detected locale from the user's operating system with a static locale.
|
||||
* Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable.
|
||||
*/
|
||||
locale(loc: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Define global middleware functions to be called first, in list order, for all cli command.
|
||||
* @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv.
|
||||
* @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing.
|
||||
*/
|
||||
middleware(callbacks: MiddlewareFunction<T> | ReadonlyArray<MiddlewareFunction<T>>, applyBeforeValidation?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity.
|
||||
*
|
||||
* Optionally `.nargs()` can take an object of `key`/`narg` pairs.
|
||||
*/
|
||||
nargs(key: string, count: number): Argv<T>;
|
||||
nargs(nargs: { [key: string]: number }): Argv<T>;
|
||||
|
||||
/** The key provided represents a path and should have `path.normalize()` applied. */
|
||||
normalize<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToString<T[key]> }>;
|
||||
normalize<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: string | undefined }>;
|
||||
|
||||
/**
|
||||
* Tell the parser to always interpret key as a number.
|
||||
*
|
||||
* If `key` is an array, all elements will be parsed as numbers.
|
||||
*
|
||||
* If the option is given on the command line without a value, `argv` will be populated with `undefined`.
|
||||
*
|
||||
* If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`.
|
||||
*
|
||||
* Note that decimals, hexadecimals, and scientific notation are all accepted.
|
||||
*/
|
||||
number<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToNumber<T[key]> }>;
|
||||
number<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: number | undefined }>;
|
||||
|
||||
/**
|
||||
* Method to execute when a command finishes successfully.
|
||||
* @param func Is called with the successful result of the command that finished.
|
||||
*/
|
||||
onFinishCommand(func: (result: any) => void): Argv<T>;
|
||||
|
||||
/**
|
||||
* This method can be used to make yargs aware of options that could exist.
|
||||
* You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option.
|
||||
*/
|
||||
option<K extends keyof T, O extends Options>(key: K, options: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
|
||||
option<K extends string, O extends Options>(key: K, options: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
|
||||
option<O extends { [key: string]: Options }>(options: O): Argv<Omit<T, keyof O> & InferredOptionTypes<O>>;
|
||||
|
||||
/**
|
||||
* This method can be used to make yargs aware of options that could exist.
|
||||
* You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option.
|
||||
*/
|
||||
options<K extends keyof T, O extends Options>(key: K, options: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
|
||||
options<K extends string, O extends Options>(key: K, options: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
|
||||
options<O extends { [key: string]: Options }>(options: O): Argv<Omit<T, keyof O> & InferredOptionTypes<O>>;
|
||||
|
||||
/**
|
||||
* Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string.
|
||||
*
|
||||
* Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked.
|
||||
* @param [context] Provides a useful mechanism for passing state information to commands
|
||||
*/
|
||||
parse(): { [key in keyof Arguments<T>]: Arguments<T>[key] };
|
||||
parse(arg: string | ReadonlyArray<string>, context?: object, parseCallback?: ParseCallback<T>): { [key in keyof Arguments<T>]: Arguments<T>[key] };
|
||||
|
||||
/**
|
||||
* If the arguments have not been parsed, this property is `false`.
|
||||
*
|
||||
* If the arguments have been parsed, this contain detailed parsed arguments.
|
||||
*/
|
||||
parsed: DetailedArguments | false;
|
||||
|
||||
/** Allows to configure advanced yargs features. */
|
||||
parserConfiguration(configuration: Partial<ParserConfigurationOptions>): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object.
|
||||
* @param [cwd] If provided, the package.json will be read from this location
|
||||
*/
|
||||
pkgConf(key: string | ReadonlyArray<string>, cwd?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Allows you to configure a command's positional arguments with an API similar to `.option()`.
|
||||
* `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error.
|
||||
*/
|
||||
positional<K extends keyof T, O extends PositionalOptions>(key: K, opt: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
|
||||
positional<K extends string, O extends PositionalOptions>(key: K, opt: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
|
||||
|
||||
/** Should yargs provide suggestions regarding similar commands if no matching command is found? */
|
||||
recommendCommands(): Argv<T>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.demandCommand()' or '.demandOption()' instead
|
||||
*/
|
||||
require<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
require(key: string, msg: string): Argv<T>;
|
||||
require(key: string, required: boolean): Argv<T>;
|
||||
require(keys: ReadonlyArray<number>, msg: string): Argv<T>;
|
||||
require(keys: ReadonlyArray<number>, required: boolean): Argv<T>;
|
||||
require(positionals: number, required: boolean): Argv<T>;
|
||||
require(positionals: number, msg: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.demandCommand()' or '.demandOption()' instead
|
||||
*/
|
||||
required<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
required(key: string, msg: string): Argv<T>;
|
||||
required(key: string, required: boolean): Argv<T>;
|
||||
required(keys: ReadonlyArray<number>, msg: string): Argv<T>;
|
||||
required(keys: ReadonlyArray<number>, required: boolean): Argv<T>;
|
||||
required(positionals: number, required: boolean): Argv<T>;
|
||||
required(positionals: number, msg: string): Argv<T>;
|
||||
|
||||
requiresArg(key: string | ReadonlyArray<string>): Argv<T>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.global()' instead
|
||||
*/
|
||||
reset(): Argv<T>;
|
||||
|
||||
/** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */
|
||||
scriptName($0: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Generate a bash completion script.
|
||||
* Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options.
|
||||
*/
|
||||
showCompletionScript(): Argv<T>;
|
||||
|
||||
/**
|
||||
* Configure the `--show-hidden` option that displays the hidden keys (see `hide()`).
|
||||
* @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`.
|
||||
* If `string` it changes the key name ("--show-hidden").
|
||||
* @param description Changes the default description ("Show hidden options")
|
||||
*/
|
||||
showHidden(option?: string | boolean): Argv<T>;
|
||||
showHidden(option: string, description?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Print the usage data using the console function consoleLevel for printing.
|
||||
* @param [consoleLevel='error']
|
||||
*/
|
||||
showHelp(consoleLevel?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Provide the usage data as a string.
|
||||
* @param printCallback a function with a single argument.
|
||||
*/
|
||||
showHelp(printCallback: (s: string) => void): Argv<T>;
|
||||
|
||||
/**
|
||||
* By default, yargs outputs a usage string if any error is detected.
|
||||
* Use the `.showHelpOnFail()` method to customize this behavior.
|
||||
* @param enable If `false`, the usage string is not output.
|
||||
* @param [message] Message that is output after the error message.
|
||||
*/
|
||||
showHelpOnFail(enable: boolean, message?: string): Argv<T>;
|
||||
|
||||
/** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */
|
||||
skipValidation(key: string | ReadonlyArray<string>): Argv<T>;
|
||||
|
||||
/**
|
||||
* Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error.
|
||||
*
|
||||
* Unrecognized commands will also be reported as errors.
|
||||
*/
|
||||
strict(): Argv<T>;
|
||||
strict(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to .strict(), except that it only applies to unrecognized commands.
|
||||
* A user can still provide arbitrary options, but unknown positional commands
|
||||
* will raise an error.
|
||||
*/
|
||||
strictCommands(): Argv<T>;
|
||||
strictCommands(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input.
|
||||
*
|
||||
* If `key` is an array, interpret all the elements as strings.
|
||||
*
|
||||
* `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers.
|
||||
*/
|
||||
string<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToString<T[key]> }>;
|
||||
string<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: string | undefined }>;
|
||||
|
||||
// Intended to be used with '.wrap()'
|
||||
terminalWidth(): number;
|
||||
|
||||
updateLocale(obj: { [key: string]: string }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Override the default strings used by yargs with the key/value pairs provided in obj
|
||||
*
|
||||
* If you explicitly specify a locale(), you should do so before calling `updateStrings()`.
|
||||
*/
|
||||
updateStrings(obj: { [key: string]: string }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Set a usage message to show which commands to use.
|
||||
* Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl.
|
||||
*
|
||||
* If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`.
|
||||
* This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application
|
||||
* and allows you to provide configuration for the positional arguments accepted by your program:
|
||||
*/
|
||||
usage(message: string): Argv<T>;
|
||||
usage<U>(command: string | ReadonlyArray<string>, description: string, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: Arguments<U>) => void): Argv<T>;
|
||||
usage<U>(command: string | ReadonlyArray<string>, showInHelp: boolean, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: Arguments<U>) => void): Argv<T>;
|
||||
usage<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, description: string, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
|
||||
usage<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, showInHelp: boolean, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
|
||||
|
||||
/**
|
||||
* Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process.
|
||||
* By default yargs enables version for the `--version` option.
|
||||
*
|
||||
* If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value.
|
||||
*
|
||||
* If the boolean argument `false` is provided, it will disable `--version`.
|
||||
*/
|
||||
version(): Argv<T>;
|
||||
version(version: string): Argv<T>;
|
||||
version(enable: boolean): Argv<T>;
|
||||
version(optionKey: string, version: string): Argv<T>;
|
||||
version(optionKey: string, description: string, version: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Format usage output to wrap at columns many columns.
|
||||
*
|
||||
* By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align).
|
||||
* Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions.
|
||||
*/
|
||||
wrap(columns: number | null): Argv<T>;
|
||||
}
|
||||
|
||||
type Arguments<T = {}> = T & {
|
||||
/** Non-option arguments */
|
||||
_: Array<string | number>;
|
||||
/** The script name or node command */
|
||||
$0: string;
|
||||
/** All remaining options */
|
||||
[argName: string]: unknown;
|
||||
};
|
||||
|
||||
interface RequireDirectoryOptions {
|
||||
/** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */
|
||||
recurse?: boolean | undefined;
|
||||
/** The types of files to look for when requiring command modules. */
|
||||
extensions?: ReadonlyArray<string> | undefined;
|
||||
/**
|
||||
* A synchronous function called for each command module encountered.
|
||||
* Accepts `commandObject`, `pathToFile`, and `filename` as arguments.
|
||||
* Returns `commandObject` to include the command; any falsy value to exclude/skip it.
|
||||
*/
|
||||
visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined;
|
||||
/** Whitelist certain modules */
|
||||
include?: RegExp | ((pathToFile: string) => boolean) | undefined;
|
||||
/** Blacklist certain modules. */
|
||||
exclude?: RegExp | ((pathToFile: string) => boolean) | undefined;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/** string or array of strings, alias(es) for the canonical option key, see `alias()` */
|
||||
alias?: string | ReadonlyArray<string> | undefined;
|
||||
/** boolean, interpret option as an array, see `array()` */
|
||||
array?: boolean | undefined;
|
||||
/** boolean, interpret option as a boolean flag, see `boolean()` */
|
||||
boolean?: boolean | undefined;
|
||||
/** value or array of values, limit valid option arguments to a predefined set, see `choices()` */
|
||||
choices?: Choices | undefined;
|
||||
/** function, coerce or transform parsed command line values into another value, see `coerce()` */
|
||||
coerce?: ((arg: any) => any) | undefined;
|
||||
/** boolean, interpret option as a path to a JSON config file, see `config()` */
|
||||
config?: boolean | undefined;
|
||||
/** function, provide a custom config parsing function, see `config()` */
|
||||
configParser?: ((configPath: string) => object) | undefined;
|
||||
/** string or object, require certain keys not to be set, see `conflicts()` */
|
||||
conflicts?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** boolean, interpret option as a count of boolean flags, see `count()` */
|
||||
count?: boolean | undefined;
|
||||
/** value, set a default value for the option, see `default()` */
|
||||
default?: any;
|
||||
/** string, use this description for the default value in help content, see `default()` */
|
||||
defaultDescription?: string | undefined;
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use 'demandOption' instead
|
||||
*/
|
||||
demand?: boolean | string | undefined;
|
||||
/** boolean or string, mark the argument as deprecated, see `deprecateOption()` */
|
||||
deprecate?: boolean | string | undefined;
|
||||
/** boolean or string, mark the argument as deprecated, see `deprecateOption()` */
|
||||
deprecated?: boolean | string | undefined;
|
||||
/** boolean or string, demand the option be given, with optional error message, see `demandOption()` */
|
||||
demandOption?: boolean | string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
desc?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
describe?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
description?: string | undefined;
|
||||
/** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */
|
||||
global?: boolean | undefined;
|
||||
/** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */
|
||||
group?: string | undefined;
|
||||
/** don't display option in help output. */
|
||||
hidden?: boolean | undefined;
|
||||
/** string or object, require certain keys to be set, see `implies()` */
|
||||
implies?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** number, specify how many arguments should be consumed for the option, see `nargs()` */
|
||||
nargs?: number | undefined;
|
||||
/** boolean, apply path.normalize() to the option, see `normalize()` */
|
||||
normalize?: boolean | undefined;
|
||||
/** boolean, interpret option as a number, `number()` */
|
||||
number?: boolean | undefined;
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use 'demandOption' instead
|
||||
*/
|
||||
require?: boolean | string | undefined;
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use 'demandOption' instead
|
||||
*/
|
||||
required?: boolean | string | undefined;
|
||||
/** boolean, require the option be specified with a value, see `requiresArg()` */
|
||||
requiresArg?: boolean | undefined;
|
||||
/** boolean, skips validation if the option is present, see `skipValidation()` */
|
||||
skipValidation?: boolean | undefined;
|
||||
/** boolean, interpret option as a string, see `string()` */
|
||||
string?: boolean | undefined;
|
||||
type?: "array" | "count" | PositionalOptionsType | undefined;
|
||||
}
|
||||
|
||||
interface PositionalOptions {
|
||||
/** string or array of strings, see `alias()` */
|
||||
alias?: string | ReadonlyArray<string> | undefined;
|
||||
/** boolean, interpret option as an array, see `array()` */
|
||||
array?: boolean | undefined;
|
||||
/** value or array of values, limit valid option arguments to a predefined set, see `choices()` */
|
||||
choices?: Choices | undefined;
|
||||
/** function, coerce or transform parsed command line values into another value, see `coerce()` */
|
||||
coerce?: ((arg: any) => any) | undefined;
|
||||
/** string or object, require certain keys not to be set, see `conflicts()` */
|
||||
conflicts?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** value, set a default value for the option, see `default()` */
|
||||
default?: any;
|
||||
/** boolean or string, demand the option be given, with optional error message, see `demandOption()` */
|
||||
demandOption?: boolean | string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
desc?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
describe?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
description?: string | undefined;
|
||||
/** string or object, require certain keys to be set, see `implies()` */
|
||||
implies?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** boolean, apply path.normalize() to the option, see normalize() */
|
||||
normalize?: boolean | undefined;
|
||||
type?: PositionalOptionsType | undefined;
|
||||
}
|
||||
|
||||
/** Remove keys K in T */
|
||||
type Omit<T, K> = { [key in Exclude<keyof T, K>]: T[key] };
|
||||
|
||||
/** Remove undefined as a possible value for keys K in T */
|
||||
type Defined<T, K extends keyof T> = Omit<T, K> & { [key in K]: Exclude<T[key], undefined> };
|
||||
|
||||
/** Convert T to T[] and T | undefined to T[] | undefined */
|
||||
type ToArray<T> = Array<Exclude<T, undefined>> | Extract<T, undefined>;
|
||||
|
||||
/** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */
|
||||
type ToString<T> = (Exclude<T, undefined> extends any[] ? string[] : string) | Extract<T, undefined>;
|
||||
|
||||
/** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */
|
||||
type ToNumber<T> = (Exclude<T, undefined> extends any[] ? number[] : number) | Extract<T, undefined>;
|
||||
|
||||
type InferredOptionType<O extends Options | PositionalOptions> =
|
||||
O extends { default: any, coerce: (arg: any) => infer T } ? T :
|
||||
O extends { default: infer D } ? D :
|
||||
O extends { type: "count" } ? number :
|
||||
O extends { count: true } ? number :
|
||||
O extends { required: string | true } ? RequiredOptionType<O> :
|
||||
O extends { require: string | true } ? RequiredOptionType<O> :
|
||||
O extends { demand: string | true } ? RequiredOptionType<O> :
|
||||
O extends { demandOption: string | true } ? RequiredOptionType<O> :
|
||||
RequiredOptionType<O> | undefined;
|
||||
|
||||
type RequiredOptionType<O extends Options | PositionalOptions> =
|
||||
O extends { type: "array", string: true } ? string[] :
|
||||
O extends { type: "array", number: true } ? number[] :
|
||||
O extends { type: "array", normalize: true } ? string[] :
|
||||
O extends { type: "string", array: true } ? string[] :
|
||||
O extends { type: "number", array: true } ? number[] :
|
||||
O extends { string: true, array: true } ? string[] :
|
||||
O extends { number: true, array: true } ? number[] :
|
||||
O extends { normalize: true, array: true } ? string[] :
|
||||
O extends { type: "array" } ? Array<string | number> :
|
||||
O extends { type: "boolean" } ? boolean :
|
||||
O extends { type: "number" } ? number :
|
||||
O extends { type: "string" } ? string :
|
||||
O extends { array: true } ? Array<string | number> :
|
||||
O extends { boolean: true } ? boolean :
|
||||
O extends { number: true } ? number :
|
||||
O extends { string: true } ? string :
|
||||
O extends { normalize: true } ? string :
|
||||
O extends { choices: ReadonlyArray<infer C> } ? C :
|
||||
O extends { coerce: (arg: any) => infer T } ? T :
|
||||
unknown;
|
||||
|
||||
type InferredOptionTypes<O extends { [key: string]: Options }> = { [key in keyof O]: InferredOptionType<O[key]> };
|
||||
|
||||
interface CommandModule<T = {}, U = {}> {
|
||||
/** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */
|
||||
aliases?: ReadonlyArray<string> | string | undefined;
|
||||
/** object declaring the options the command accepts, or a function accepting and returning a yargs instance */
|
||||
builder?: CommandBuilder<T, U> | undefined;
|
||||
/** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */
|
||||
command?: ReadonlyArray<string> | string | undefined;
|
||||
/** boolean (or string) to show deprecation notice */
|
||||
deprecated?: boolean | string | undefined;
|
||||
/** string used as the description for the command in help text, use `false` for a hidden command */
|
||||
describe?: string | false | undefined;
|
||||
/** a function which will be passed the parsed argv. */
|
||||
handler: (args: Arguments<U>) => void;
|
||||
}
|
||||
|
||||
type ParseCallback<T = {}> = (err: Error | undefined, argv: Arguments<T>, output: string) => void;
|
||||
type CommandBuilder<T = {}, U = {}> = { [key: string]: Options } | ((args: Argv<T>) => Argv<U>) | ((args: Argv<T>) => PromiseLike<Argv<U>>);
|
||||
type SyncCompletionFunction = (current: string, argv: any) => string[];
|
||||
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
|
||||
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>;
|
||||
type MiddlewareFunction<T = {}> = (args: Arguments<T>) => void;
|
||||
type Choices = ReadonlyArray<string | number | true | undefined>;
|
||||
type PositionalOptionsType = "boolean" | "number" | "string";
|
||||
}
|
||||
|
||||
declare var yargs: yargs.Argv;
|
||||
export = yargs;
|
62
web/node_modules/jest-circus/node_modules/@types/yargs/package.json
generated
vendored
Executable file
62
web/node_modules/jest-circus/node_modules/@types/yargs/package.json
generated
vendored
Executable file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"name": "@types/yargs",
|
||||
"version": "15.0.14",
|
||||
"description": "TypeScript definitions for yargs",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Martin Poelstra",
|
||||
"url": "https://github.com/poelstra",
|
||||
"githubUsername": "poelstra"
|
||||
},
|
||||
{
|
||||
"name": "Mizunashi Mana",
|
||||
"url": "https://github.com/mizunashi-mana",
|
||||
"githubUsername": "mizunashi-mana"
|
||||
},
|
||||
{
|
||||
"name": "Jeffery Grajkowski",
|
||||
"url": "https://github.com/pushplay",
|
||||
"githubUsername": "pushplay"
|
||||
},
|
||||
{
|
||||
"name": "Jimi (Dimitris) Charalampidis",
|
||||
"url": "https://github.com/JimiC",
|
||||
"githubUsername": "JimiC"
|
||||
},
|
||||
{
|
||||
"name": "Steffen Viken Valvåg",
|
||||
"url": "https://github.com/steffenvv",
|
||||
"githubUsername": "steffenvv"
|
||||
},
|
||||
{
|
||||
"name": "Emily Marigold Klassen",
|
||||
"url": "https://github.com/forivall",
|
||||
"githubUsername": "forivall"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss",
|
||||
"githubUsername": "ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Aankhen",
|
||||
"url": "https://github.com/Aankhen",
|
||||
"githubUsername": "Aankhen"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/yargs"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/yargs-parser": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "08f18db584d12815700691202627482987b3f369093c020e1539deee222b2a09",
|
||||
"typeScriptVersion": "3.6"
|
||||
}
|
9
web/node_modules/jest-circus/node_modules/@types/yargs/yargs.d.ts
generated
vendored
Executable file
9
web/node_modules/jest-circus/node_modules/@types/yargs/yargs.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
import { Argv } from '.';
|
||||
|
||||
export = Yargs;
|
||||
|
||||
declare function Yargs(
|
||||
processArgs?: ReadonlyArray<string>,
|
||||
cwd?: string,
|
||||
parentRequire?: NodeRequire,
|
||||
): Argv;
|
21
web/node_modules/jest-circus/node_modules/pretty-format/LICENSE
generated
vendored
Normal file
21
web/node_modules/jest-circus/node_modules/pretty-format/LICENSE
generated
vendored
Normal file
|
@ -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.
|
454
web/node_modules/jest-circus/node_modules/pretty-format/README.md
generated
vendored
Executable file
454
web/node_modules/jest-circus/node_modules/pretty-format/README.md
generated
vendored
Executable file
|
@ -0,0 +1,454 @@
|
|||
# pretty-format
|
||||
|
||||
Stringify any JavaScript value.
|
||||
|
||||
- Serialize built-in JavaScript types.
|
||||
- Serialize application-specific data types with built-in or user-defined plugins.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ yarn add pretty-format
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const prettyFormat = require('pretty-format'); // CommonJS
|
||||
```
|
||||
|
||||
```js
|
||||
import prettyFormat from 'pretty-format'; // ES2015 modules
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {object: {}};
|
||||
val.circularReference = val;
|
||||
val[Symbol('foo')] = 'foo';
|
||||
val.map = new Map([['prop', 'value']]);
|
||||
val.array = [-0, Infinity, NaN];
|
||||
|
||||
console.log(prettyFormat(val));
|
||||
/*
|
||||
Object {
|
||||
"array": Array [
|
||||
-0,
|
||||
Infinity,
|
||||
NaN,
|
||||
],
|
||||
"circularReference": [Circular],
|
||||
"map": Map {
|
||||
"prop" => "value",
|
||||
},
|
||||
"object": Object {},
|
||||
Symbol(foo): "foo",
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
## Usage with options
|
||||
|
||||
```js
|
||||
function onClick() {}
|
||||
|
||||
console.log(prettyFormat(onClick));
|
||||
/*
|
||||
[Function onClick]
|
||||
*/
|
||||
|
||||
const options = {
|
||||
printFunctionName: false,
|
||||
};
|
||||
console.log(prettyFormat(onClick, options));
|
||||
/*
|
||||
[Function]
|
||||
*/
|
||||
```
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
| key | type | default | description |
|
||||
| :------------------ | :-------- | :--------- | :------------------------------------------------------ |
|
||||
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
|
||||
| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions |
|
||||
| `escapeString` | `boolean` | `true` | escape special characters in strings |
|
||||
| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) |
|
||||
| `indent` | `number` | `2` | spaces in each level of indentation |
|
||||
| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on |
|
||||
| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks |
|
||||
| `plugins` | `array` | `[]` | plugins to serialize application-specific data types |
|
||||
| `printFunctionName` | `boolean` | `true` | include or omit the name of a function |
|
||||
| `theme` | `object` | | colors to highlight syntax in terminal |
|
||||
|
||||
Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors)
|
||||
|
||||
```js
|
||||
const DEFAULT_THEME = {
|
||||
comment: 'gray',
|
||||
content: 'reset',
|
||||
prop: 'yellow',
|
||||
tag: 'cyan',
|
||||
value: 'green',
|
||||
};
|
||||
```
|
||||
|
||||
## Usage with plugins
|
||||
|
||||
The `pretty-format` package provides some built-in plugins, including:
|
||||
|
||||
- `ReactElement` for elements from `react`
|
||||
- `ReactTestComponent` for test objects from `react-test-renderer`
|
||||
|
||||
```js
|
||||
// CommonJS
|
||||
const React = require('react');
|
||||
const renderer = require('react-test-renderer');
|
||||
const prettyFormat = require('pretty-format');
|
||||
const ReactElement = prettyFormat.plugins.ReactElement;
|
||||
const ReactTestComponent = prettyFormat.plugins.ReactTestComponent;
|
||||
```
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
// ES2015 modules and destructuring assignment
|
||||
import prettyFormat from 'pretty-format';
|
||||
const {ReactElement, ReactTestComponent} = prettyFormat.plugins;
|
||||
```
|
||||
|
||||
```js
|
||||
const onClick = () => {};
|
||||
const element = React.createElement('button', {onClick}, 'Hello World');
|
||||
|
||||
const formatted1 = prettyFormat(element, {
|
||||
plugins: [ReactElement],
|
||||
printFunctionName: false,
|
||||
});
|
||||
const formatted2 = prettyFormat(renderer.create(element).toJSON(), {
|
||||
plugins: [ReactTestComponent],
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
<button
|
||||
onClick=[Function]
|
||||
>
|
||||
Hello World
|
||||
</button>
|
||||
*/
|
||||
```
|
||||
|
||||
## Usage in Jest
|
||||
|
||||
For snapshot tests, Jest uses `pretty-format` with options that include some of its built-in plugins. For this purpose, plugins are also known as **snapshot serializers**.
|
||||
|
||||
To serialize application-specific data types, you can add modules to `devDependencies` of a project, and then:
|
||||
|
||||
In an **individual** test file, you can add a module as follows. It precedes any modules from Jest configuration.
|
||||
|
||||
```js
|
||||
import serializer from 'my-serializer-module';
|
||||
expect.addSnapshotSerializer(serializer);
|
||||
|
||||
// tests which have `expect(value).toMatchSnapshot()` assertions
|
||||
```
|
||||
|
||||
For **all** test files, you can specify modules in Jest configuration. They precede built-in plugins for React, HTML, and Immutable.js data types. For example, in a `package.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"jest": {
|
||||
"snapshotSerializers": ["my-serializer-module"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Writing plugins
|
||||
|
||||
A plugin is a JavaScript object.
|
||||
|
||||
If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either:
|
||||
|
||||
- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later)
|
||||
- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method)
|
||||
|
||||
### test
|
||||
|
||||
Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors:
|
||||
|
||||
- `TypeError: Cannot read property 'whatever' of null`
|
||||
- `TypeError: Cannot read property 'whatever' of undefined`
|
||||
|
||||
For example, `test` method of built-in `ReactElement` plugin:
|
||||
|
||||
```js
|
||||
const elementSymbol = Symbol.for('react.element');
|
||||
const test = val => val && val.$$typeof === elementSymbol;
|
||||
```
|
||||
|
||||
Pay attention to efficiency in `test` because `pretty-format` calls it often.
|
||||
|
||||
### serialize
|
||||
|
||||
The **improved** interface is available in **version 21** or later.
|
||||
|
||||
Write `serialize` to return a string, given the arguments:
|
||||
|
||||
- `val` which “passed the test”
|
||||
- unchanging `config` object: derived from `options`
|
||||
- current `indentation` string: concatenate to `indent` from `config`
|
||||
- current `depth` number: compare to `maxDepth` from `config`
|
||||
- current `refs` array: find circular references in objects
|
||||
- `printer` callback function: serialize children
|
||||
|
||||
### config
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
| key | type | description |
|
||||
| :------------------ | :-------- | :------------------------------------------------------ |
|
||||
| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects |
|
||||
| `colors` | `Object` | escape codes for colors to highlight syntax |
|
||||
| `escapeRegex` | `boolean` | escape special characters in regular expressions |
|
||||
| `escapeString` | `boolean` | escape special characters in strings |
|
||||
| `indent` | `string` | spaces in each level of indentation |
|
||||
| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on |
|
||||
| `min` | `boolean` | minimize added space: no indentation nor line breaks |
|
||||
| `plugins` | `array` | plugins to serialize application-specific data types |
|
||||
| `printFunctionName` | `boolean` | include or omit the name of a function |
|
||||
| `spacingInner` | `strong` | spacing to separate items in a list |
|
||||
| `spacingOuter` | `strong` | spacing to enclose a list of items |
|
||||
|
||||
Each property of `colors` in `config` corresponds to a property of `theme` in `options`:
|
||||
|
||||
- the key is the same (for example, `tag`)
|
||||
- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`)
|
||||
|
||||
Some properties in `config` are derived from `min` in `options`:
|
||||
|
||||
- `spacingInner` and `spacingOuter` are **newline** if `min` is `false`
|
||||
- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true`
|
||||
|
||||
### Example of serialize and test
|
||||
|
||||
This plugin is a pattern you can apply to serialize composite data types. Side note: `pretty-format` does not need a plugin to serialize arrays.
|
||||
|
||||
```js
|
||||
// We reused more code when we factored out a function for child items
|
||||
// that is independent of depth, name, and enclosing punctuation (see below).
|
||||
const SEPARATOR = ',';
|
||||
function serializeItems(items, config, indentation, depth, refs, printer) {
|
||||
if (items.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const indentationItems = indentation + config.indent;
|
||||
return (
|
||||
config.spacingOuter +
|
||||
items
|
||||
.map(
|
||||
item =>
|
||||
indentationItems +
|
||||
printer(item, config, indentationItems, depth, refs), // callback
|
||||
)
|
||||
.join(SEPARATOR + config.spacingInner) +
|
||||
(config.min ? '' : SEPARATOR) + // following the last item
|
||||
config.spacingOuter +
|
||||
indentation
|
||||
);
|
||||
}
|
||||
|
||||
const plugin = {
|
||||
test(val) {
|
||||
return Array.isArray(val);
|
||||
},
|
||||
serialize(array, config, indentation, depth, refs, printer) {
|
||||
const name = array.constructor.name;
|
||||
return ++depth > config.maxDepth
|
||||
? '[' + name + ']'
|
||||
: (config.min ? '' : name + ' ') +
|
||||
'[' +
|
||||
serializeItems(array, config, indentation, depth, refs, printer) +
|
||||
']';
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {
|
||||
filter: 'completed',
|
||||
items: [
|
||||
{
|
||||
text: 'Write test',
|
||||
completed: true,
|
||||
},
|
||||
{
|
||||
text: 'Write serialize',
|
||||
completed: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": Array [
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write test",
|
||||
},
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write serialize",
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
indent: 4,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": Array [
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write test",
|
||||
},
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write serialize",
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
maxDepth: 1,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": [Array],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
min: true,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
{"filter": "completed", "items": [{"completed": true, "text": "Write test"}, {"completed": true, "text": "Write serialize"}]}
|
||||
*/
|
||||
```
|
||||
|
||||
### print
|
||||
|
||||
The **original** interface is adequate for plugins:
|
||||
|
||||
- that **do not** depend on options other than `highlight` or `min`
|
||||
- that **do not** depend on `depth` or `refs` in recursive traversal, and
|
||||
- if values either
|
||||
- do **not** require indentation, or
|
||||
- do **not** occur as children of JavaScript data structures (for example, array)
|
||||
|
||||
Write `print` to return a string, given the arguments:
|
||||
|
||||
- `val` which “passed the test”
|
||||
- current `printer(valChild)` callback function: serialize children
|
||||
- current `indenter(lines)` callback function: indent lines at the next level
|
||||
- unchanging `config` object: derived from `options`
|
||||
- unchanging `colors` object: derived from `options`
|
||||
|
||||
The 3 properties of `config` are `min` in `options` and:
|
||||
|
||||
- `spacing` and `edgeSpacing` are **newline** if `min` is `false`
|
||||
- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true`
|
||||
|
||||
Each property of `colors` corresponds to a property of `theme` in `options`:
|
||||
|
||||
- the key is the same (for example, `tag`)
|
||||
- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`)
|
||||
|
||||
### Example of print and test
|
||||
|
||||
This plugin prints functions with the **number of named arguments** excluding rest argument.
|
||||
|
||||
```js
|
||||
const plugin = {
|
||||
print(val) {
|
||||
return `[Function ${val.name || 'anonymous'} ${val.length}]`;
|
||||
},
|
||||
test(val) {
|
||||
return typeof val === 'function';
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {
|
||||
onClick(event) {},
|
||||
render() {},
|
||||
};
|
||||
|
||||
prettyFormat(val, {
|
||||
plugins: [plugin],
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick 1],
|
||||
"render": [Function render 0],
|
||||
}
|
||||
*/
|
||||
|
||||
prettyFormat(val);
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick],
|
||||
"render": [Function render],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
This plugin **ignores** the `printFunctionName` option. That limitation of the original `print` interface is a reason to use the improved `serialize` interface, described above.
|
||||
|
||||
```js
|
||||
prettyFormat(val, {
|
||||
plugins: [pluginOld],
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick 1],
|
||||
"render": [Function render 0],
|
||||
}
|
||||
*/
|
||||
|
||||
prettyFormat(val, {
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function],
|
||||
"render": [Function],
|
||||
}
|
||||
*/
|
||||
```
|
32
web/node_modules/jest-circus/node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
32
web/node_modules/jest-circus/node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* 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, Printer, Refs } from './types';
|
||||
/**
|
||||
* Return entries (for example, of a map)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
export declare function printIteratorEntries(iterator: Iterator<[unknown, unknown]>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, separator?: string): string;
|
||||
/**
|
||||
* Return values (for example, of a set)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (braces or brackets)
|
||||
*/
|
||||
export declare function printIteratorValues(iterator: Iterator<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
/**
|
||||
* Return items (for example, of an array)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, brackets)
|
||||
**/
|
||||
export declare function printListItems(list: ArrayLike<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
/**
|
||||
* Return properties of an object
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
export declare function printObjectProperties(val: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
185
web/node_modules/jest-circus/node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
185
web/node_modules/jest-circus/node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printIteratorEntries = printIteratorEntries;
|
||||
exports.printIteratorValues = printIteratorValues;
|
||||
exports.printListItems = printListItems;
|
||||
exports.printObjectProperties = printObjectProperties;
|
||||
|
||||
/**
|
||||
* 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 getKeysOfEnumerableProperties = object => {
|
||||
const keys = Object.keys(object).sort();
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
Object.getOwnPropertySymbols(object).forEach(symbol => {
|
||||
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
||||
keys.push(symbol);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
/**
|
||||
* Return entries (for example, of a map)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
|
||||
function printIteratorEntries(
|
||||
iterator,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
|
||||
// What a distracting diff if you change a data structure to/from
|
||||
// ECMAScript Object or Immutable.Map/OrderedMap which use the default.
|
||||
separator = ': '
|
||||
) {
|
||||
let result = '';
|
||||
let current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
while (!current.done) {
|
||||
const name = printer(
|
||||
current.value[0],
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
);
|
||||
const value = printer(
|
||||
current.value[1],
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
);
|
||||
result += indentationNext + name + separator + value;
|
||||
current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return values (for example, of a set)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (braces or brackets)
|
||||
*/
|
||||
|
||||
function printIteratorValues(
|
||||
iterator,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) {
|
||||
let result = '';
|
||||
let current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
while (!current.done) {
|
||||
result +=
|
||||
indentationNext +
|
||||
printer(current.value, config, indentationNext, depth, refs);
|
||||
current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return items (for example, of an array)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, brackets)
|
||||
**/
|
||||
|
||||
function printListItems(list, config, indentation, depth, refs, printer) {
|
||||
let result = '';
|
||||
|
||||
if (list.length) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
result +=
|
||||
indentationNext +
|
||||
printer(list[i], config, indentationNext, depth, refs);
|
||||
|
||||
if (i < list.length - 1) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return properties of an object
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
|
||||
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
||||
let result = '';
|
||||
const keys = getKeysOfEnumerableProperties(val);
|
||||
|
||||
if (keys.length) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const name = printer(key, config, indentationNext, depth, refs);
|
||||
const value = printer(val[key], config, indentationNext, depth, refs);
|
||||
result += indentationNext + name + ': ' + value;
|
||||
|
||||
if (i < keys.length - 1) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
37
web/node_modules/jest-circus/node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
37
web/node_modules/jest-circus/node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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 * as PrettyFormat from './types';
|
||||
/**
|
||||
* Returns a presentation string of your `val` object
|
||||
* @param val any potential JavaScript object
|
||||
* @param options Custom settings
|
||||
*/
|
||||
declare function prettyFormat(val: unknown, options?: PrettyFormat.OptionsReceived): string;
|
||||
declare namespace prettyFormat {
|
||||
var plugins: {
|
||||
AsymmetricMatcher: PrettyFormat.NewPlugin;
|
||||
ConvertAnsi: PrettyFormat.NewPlugin;
|
||||
DOMCollection: PrettyFormat.NewPlugin;
|
||||
DOMElement: PrettyFormat.NewPlugin;
|
||||
Immutable: PrettyFormat.NewPlugin;
|
||||
ReactElement: PrettyFormat.NewPlugin;
|
||||
ReactTestComponent: PrettyFormat.NewPlugin;
|
||||
};
|
||||
}
|
||||
declare namespace prettyFormat {
|
||||
type Colors = PrettyFormat.Colors;
|
||||
type Config = PrettyFormat.Config;
|
||||
type Options = PrettyFormat.Options;
|
||||
type OptionsReceived = PrettyFormat.OptionsReceived;
|
||||
type OldPlugin = PrettyFormat.OldPlugin;
|
||||
type NewPlugin = PrettyFormat.NewPlugin;
|
||||
type Plugin = PrettyFormat.Plugin;
|
||||
type Plugins = PrettyFormat.Plugins;
|
||||
type Refs = PrettyFormat.Refs;
|
||||
type Theme = PrettyFormat.Theme;
|
||||
}
|
||||
export = prettyFormat;
|
560
web/node_modules/jest-circus/node_modules/pretty-format/build/index.js
generated
vendored
Normal file
560
web/node_modules/jest-circus/node_modules/pretty-format/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,560 @@
|
|||
'use strict';
|
||||
|
||||
var _ansiStyles = _interopRequireDefault(require('ansi-styles'));
|
||||
|
||||
var _collections = require('./collections');
|
||||
|
||||
var _AsymmetricMatcher = _interopRequireDefault(
|
||||
require('./plugins/AsymmetricMatcher')
|
||||
);
|
||||
|
||||
var _ConvertAnsi = _interopRequireDefault(require('./plugins/ConvertAnsi'));
|
||||
|
||||
var _DOMCollection = _interopRequireDefault(require('./plugins/DOMCollection'));
|
||||
|
||||
var _DOMElement = _interopRequireDefault(require('./plugins/DOMElement'));
|
||||
|
||||
var _Immutable = _interopRequireDefault(require('./plugins/Immutable'));
|
||||
|
||||
var _ReactElement = _interopRequireDefault(require('./plugins/ReactElement'));
|
||||
|
||||
var _ReactTestComponent = _interopRequireDefault(
|
||||
require('./plugins/ReactTestComponent')
|
||||
);
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
const toString = Object.prototype.toString;
|
||||
const toISOString = Date.prototype.toISOString;
|
||||
const errorToString = Error.prototype.toString;
|
||||
const regExpToString = RegExp.prototype.toString;
|
||||
/**
|
||||
* Explicitly comparing typeof constructor to function avoids undefined as name
|
||||
* when mock identity-obj-proxy returns the key as the value for any key.
|
||||
*/
|
||||
|
||||
const getConstructorName = val =>
|
||||
(typeof val.constructor === 'function' && val.constructor.name) || 'Object';
|
||||
/* global window */
|
||||
|
||||
/** Is val is equal to global window object? Works even if it does not exist :) */
|
||||
|
||||
const isWindow = val => typeof window !== 'undefined' && val === window;
|
||||
|
||||
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
||||
const NEWLINE_REGEXP = /\n/gi;
|
||||
|
||||
class PrettyFormatPluginError extends Error {
|
||||
constructor(message, stack) {
|
||||
super(message);
|
||||
this.stack = stack;
|
||||
this.name = this.constructor.name;
|
||||
}
|
||||
}
|
||||
|
||||
function isToStringedArrayType(toStringed) {
|
||||
return (
|
||||
toStringed === '[object Array]' ||
|
||||
toStringed === '[object ArrayBuffer]' ||
|
||||
toStringed === '[object DataView]' ||
|
||||
toStringed === '[object Float32Array]' ||
|
||||
toStringed === '[object Float64Array]' ||
|
||||
toStringed === '[object Int8Array]' ||
|
||||
toStringed === '[object Int16Array]' ||
|
||||
toStringed === '[object Int32Array]' ||
|
||||
toStringed === '[object Uint8Array]' ||
|
||||
toStringed === '[object Uint8ClampedArray]' ||
|
||||
toStringed === '[object Uint16Array]' ||
|
||||
toStringed === '[object Uint32Array]'
|
||||
);
|
||||
}
|
||||
|
||||
function printNumber(val) {
|
||||
return Object.is(val, -0) ? '-0' : String(val);
|
||||
}
|
||||
|
||||
function printBigInt(val) {
|
||||
return String(`${val}n`);
|
||||
}
|
||||
|
||||
function printFunction(val, printFunctionName) {
|
||||
if (!printFunctionName) {
|
||||
return '[Function]';
|
||||
}
|
||||
|
||||
return '[Function ' + (val.name || 'anonymous') + ']';
|
||||
}
|
||||
|
||||
function printSymbol(val) {
|
||||
return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
|
||||
}
|
||||
|
||||
function printError(val) {
|
||||
return '[' + errorToString.call(val) + ']';
|
||||
}
|
||||
/**
|
||||
* The first port of call for printing an object, handles most of the
|
||||
* data-types in JS.
|
||||
*/
|
||||
|
||||
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
||||
if (val === true || val === false) {
|
||||
return '' + val;
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
const typeOf = typeof val;
|
||||
|
||||
if (typeOf === 'number') {
|
||||
return printNumber(val);
|
||||
}
|
||||
|
||||
if (typeOf === 'bigint') {
|
||||
return printBigInt(val);
|
||||
}
|
||||
|
||||
if (typeOf === 'string') {
|
||||
if (escapeString) {
|
||||
return '"' + val.replace(/"|\\/g, '\\$&') + '"';
|
||||
}
|
||||
|
||||
return '"' + val + '"';
|
||||
}
|
||||
|
||||
if (typeOf === 'function') {
|
||||
return printFunction(val, printFunctionName);
|
||||
}
|
||||
|
||||
if (typeOf === 'symbol') {
|
||||
return printSymbol(val);
|
||||
}
|
||||
|
||||
const toStringed = toString.call(val);
|
||||
|
||||
if (toStringed === '[object WeakMap]') {
|
||||
return 'WeakMap {}';
|
||||
}
|
||||
|
||||
if (toStringed === '[object WeakSet]') {
|
||||
return 'WeakSet {}';
|
||||
}
|
||||
|
||||
if (
|
||||
toStringed === '[object Function]' ||
|
||||
toStringed === '[object GeneratorFunction]'
|
||||
) {
|
||||
return printFunction(val, printFunctionName);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Symbol]') {
|
||||
return printSymbol(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Date]') {
|
||||
return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Error]') {
|
||||
return printError(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object RegExp]') {
|
||||
if (escapeRegex) {
|
||||
// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
|
||||
return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
|
||||
return regExpToString.call(val);
|
||||
}
|
||||
|
||||
if (val instanceof Error) {
|
||||
return printError(val);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Handles more complex objects ( such as objects with circular references.
|
||||
* maps and sets etc )
|
||||
*/
|
||||
|
||||
function printComplexValue(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
hasCalledToJSON
|
||||
) {
|
||||
if (refs.indexOf(val) !== -1) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
refs = refs.slice();
|
||||
refs.push(val);
|
||||
const hitMaxDepth = ++depth > config.maxDepth;
|
||||
const min = config.min;
|
||||
|
||||
if (
|
||||
config.callToJSON &&
|
||||
!hitMaxDepth &&
|
||||
val.toJSON &&
|
||||
typeof val.toJSON === 'function' &&
|
||||
!hasCalledToJSON
|
||||
) {
|
||||
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
||||
}
|
||||
|
||||
const toStringed = toString.call(val);
|
||||
|
||||
if (toStringed === '[object Arguments]') {
|
||||
return hitMaxDepth
|
||||
? '[Arguments]'
|
||||
: (min ? '' : 'Arguments ') +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
}
|
||||
|
||||
if (isToStringedArrayType(toStringed)) {
|
||||
return hitMaxDepth
|
||||
? '[' + val.constructor.name + ']'
|
||||
: (min ? '' : val.constructor.name + ' ') +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
}
|
||||
|
||||
if (toStringed === '[object Map]') {
|
||||
return hitMaxDepth
|
||||
? '[Map]'
|
||||
: 'Map {' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
' => '
|
||||
) +
|
||||
'}';
|
||||
}
|
||||
|
||||
if (toStringed === '[object Set]') {
|
||||
return hitMaxDepth
|
||||
? '[Set]'
|
||||
: 'Set {' +
|
||||
(0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
} // Avoid failure to serialize global window object in jsdom test environment.
|
||||
// For example, not even relevant if window is prop of React element.
|
||||
|
||||
return hitMaxDepth || isWindow(val)
|
||||
? '[' + getConstructorName(val) + ']'
|
||||
: (min ? '' : getConstructorName(val) + ' ') +
|
||||
'{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
}
|
||||
|
||||
function isNewPlugin(plugin) {
|
||||
return plugin.serialize != null;
|
||||
}
|
||||
|
||||
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
||||
let printed;
|
||||
|
||||
try {
|
||||
printed = isNewPlugin(plugin)
|
||||
? plugin.serialize(val, config, indentation, depth, refs, printer)
|
||||
: plugin.print(
|
||||
val,
|
||||
valChild => printer(valChild, config, indentation, depth, refs),
|
||||
str => {
|
||||
const indentationNext = indentation + config.indent;
|
||||
return (
|
||||
indentationNext +
|
||||
str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
|
||||
);
|
||||
},
|
||||
{
|
||||
edgeSpacing: config.spacingOuter,
|
||||
min: config.min,
|
||||
spacing: config.spacingInner
|
||||
},
|
||||
config.colors
|
||||
);
|
||||
} catch (error) {
|
||||
throw new PrettyFormatPluginError(error.message, error.stack);
|
||||
}
|
||||
|
||||
if (typeof printed !== 'string') {
|
||||
throw new Error(
|
||||
`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
|
||||
);
|
||||
}
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
function findPlugin(plugins, val) {
|
||||
for (let p = 0; p < plugins.length; p++) {
|
||||
try {
|
||||
if (plugins[p].test(val)) {
|
||||
return plugins[p];
|
||||
}
|
||||
} catch (error) {
|
||||
throw new PrettyFormatPluginError(error.message, error.stack);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
||||
const plugin = findPlugin(config.plugins, val);
|
||||
|
||||
if (plugin !== null) {
|
||||
return printPlugin(plugin, val, config, indentation, depth, refs);
|
||||
}
|
||||
|
||||
const basicResult = printBasicValue(
|
||||
val,
|
||||
config.printFunctionName,
|
||||
config.escapeRegex,
|
||||
config.escapeString
|
||||
);
|
||||
|
||||
if (basicResult !== null) {
|
||||
return basicResult;
|
||||
}
|
||||
|
||||
return printComplexValue(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
hasCalledToJSON
|
||||
);
|
||||
}
|
||||
|
||||
const DEFAULT_THEME = {
|
||||
comment: 'gray',
|
||||
content: 'reset',
|
||||
prop: 'yellow',
|
||||
tag: 'cyan',
|
||||
value: 'green'
|
||||
};
|
||||
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
||||
const DEFAULT_OPTIONS = {
|
||||
callToJSON: true,
|
||||
escapeRegex: false,
|
||||
escapeString: true,
|
||||
highlight: false,
|
||||
indent: 2,
|
||||
maxDepth: Infinity,
|
||||
min: false,
|
||||
plugins: [],
|
||||
printFunctionName: true,
|
||||
theme: DEFAULT_THEME
|
||||
};
|
||||
|
||||
function validateOptions(options) {
|
||||
Object.keys(options).forEach(key => {
|
||||
if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
|
||||
throw new Error(`pretty-format: Unknown option "${key}".`);
|
||||
}
|
||||
});
|
||||
|
||||
if (options.min && options.indent !== undefined && options.indent !== 0) {
|
||||
throw new Error(
|
||||
'pretty-format: Options "min" and "indent" cannot be used together.'
|
||||
);
|
||||
}
|
||||
|
||||
if (options.theme !== undefined) {
|
||||
if (options.theme === null) {
|
||||
throw new Error(`pretty-format: Option "theme" must not be null.`);
|
||||
}
|
||||
|
||||
if (typeof options.theme !== 'object') {
|
||||
throw new Error(
|
||||
`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getColorsHighlight = options =>
|
||||
DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
||||
const value =
|
||||
options.theme && options.theme[key] !== undefined
|
||||
? options.theme[key]
|
||||
: DEFAULT_THEME[key];
|
||||
const color = value && _ansiStyles.default[value];
|
||||
|
||||
if (
|
||||
color &&
|
||||
typeof color.close === 'string' &&
|
||||
typeof color.open === 'string'
|
||||
) {
|
||||
colors[key] = color;
|
||||
} else {
|
||||
throw new Error(
|
||||
`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
|
||||
);
|
||||
}
|
||||
|
||||
return colors;
|
||||
}, Object.create(null));
|
||||
|
||||
const getColorsEmpty = () =>
|
||||
DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
||||
colors[key] = {
|
||||
close: '',
|
||||
open: ''
|
||||
};
|
||||
return colors;
|
||||
}, Object.create(null));
|
||||
|
||||
const getPrintFunctionName = options =>
|
||||
options && options.printFunctionName !== undefined
|
||||
? options.printFunctionName
|
||||
: DEFAULT_OPTIONS.printFunctionName;
|
||||
|
||||
const getEscapeRegex = options =>
|
||||
options && options.escapeRegex !== undefined
|
||||
? options.escapeRegex
|
||||
: DEFAULT_OPTIONS.escapeRegex;
|
||||
|
||||
const getEscapeString = options =>
|
||||
options && options.escapeString !== undefined
|
||||
? options.escapeString
|
||||
: DEFAULT_OPTIONS.escapeString;
|
||||
|
||||
const getConfig = options => ({
|
||||
callToJSON:
|
||||
options && options.callToJSON !== undefined
|
||||
? options.callToJSON
|
||||
: DEFAULT_OPTIONS.callToJSON,
|
||||
colors:
|
||||
options && options.highlight
|
||||
? getColorsHighlight(options)
|
||||
: getColorsEmpty(),
|
||||
escapeRegex: getEscapeRegex(options),
|
||||
escapeString: getEscapeString(options),
|
||||
indent:
|
||||
options && options.min
|
||||
? ''
|
||||
: createIndent(
|
||||
options && options.indent !== undefined
|
||||
? options.indent
|
||||
: DEFAULT_OPTIONS.indent
|
||||
),
|
||||
maxDepth:
|
||||
options && options.maxDepth !== undefined
|
||||
? options.maxDepth
|
||||
: DEFAULT_OPTIONS.maxDepth,
|
||||
min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
|
||||
plugins:
|
||||
options && options.plugins !== undefined
|
||||
? options.plugins
|
||||
: DEFAULT_OPTIONS.plugins,
|
||||
printFunctionName: getPrintFunctionName(options),
|
||||
spacingInner: options && options.min ? ' ' : '\n',
|
||||
spacingOuter: options && options.min ? '' : '\n'
|
||||
});
|
||||
|
||||
function createIndent(indent) {
|
||||
return new Array(indent + 1).join(' ');
|
||||
}
|
||||
/**
|
||||
* Returns a presentation string of your `val` object
|
||||
* @param val any potential JavaScript object
|
||||
* @param options Custom settings
|
||||
*/
|
||||
|
||||
function prettyFormat(val, options) {
|
||||
if (options) {
|
||||
validateOptions(options);
|
||||
|
||||
if (options.plugins) {
|
||||
const plugin = findPlugin(options.plugins, val);
|
||||
|
||||
if (plugin !== null) {
|
||||
return printPlugin(plugin, val, getConfig(options), '', 0, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const basicResult = printBasicValue(
|
||||
val,
|
||||
getPrintFunctionName(options),
|
||||
getEscapeRegex(options),
|
||||
getEscapeString(options)
|
||||
);
|
||||
|
||||
if (basicResult !== null) {
|
||||
return basicResult;
|
||||
}
|
||||
|
||||
return printComplexValue(val, getConfig(options), '', 0, []);
|
||||
}
|
||||
|
||||
prettyFormat.plugins = {
|
||||
AsymmetricMatcher: _AsymmetricMatcher.default,
|
||||
ConvertAnsi: _ConvertAnsi.default,
|
||||
DOMCollection: _DOMCollection.default,
|
||||
DOMElement: _DOMElement.default,
|
||||
Immutable: _Immutable.default,
|
||||
ReactElement: _ReactElement.default,
|
||||
ReactTestComponent: _ReactTestComponent.default
|
||||
};
|
||||
module.exports = prettyFormat;
|
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
export declare const test: NewPlugin['test'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
103
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
103
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const asymmetricMatcher =
|
||||
typeof Symbol === 'function' && Symbol.for
|
||||
? Symbol.for('jest.asymmetricMatcher')
|
||||
: 0x1357a5;
|
||||
const SPACE = ' ';
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) => {
|
||||
const stringedValue = val.toString();
|
||||
|
||||
if (
|
||||
stringedValue === 'ArrayContaining' ||
|
||||
stringedValue === 'ArrayNotContaining'
|
||||
) {
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + stringedValue + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val.sample,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'ObjectContaining' ||
|
||||
stringedValue === 'ObjectNotContaining'
|
||||
) {
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + stringedValue + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
val.sample,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'StringMatching' ||
|
||||
stringedValue === 'StringNotMatching'
|
||||
) {
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
printer(val.sample, config, indentation, depth, refs)
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'StringContaining' ||
|
||||
stringedValue === 'StringNotContaining'
|
||||
) {
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
printer(val.sample, config, indentation, depth, refs)
|
||||
);
|
||||
}
|
||||
|
||||
return val.toAsymmetricMatcher();
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && val.$$typeof === asymmetricMatcher;
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare const test: NewPlugin['test'];
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
96
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.js
generated
vendored
Normal file
96
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.js
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _ansiRegex = _interopRequireDefault(require('ansi-regex'));
|
||||
|
||||
var _ansiStyles = _interopRequireDefault(require('ansi-styles'));
|
||||
|
||||
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 toHumanReadableAnsi = text =>
|
||||
text.replace((0, _ansiRegex.default)(), match => {
|
||||
switch (match) {
|
||||
case _ansiStyles.default.red.close:
|
||||
case _ansiStyles.default.green.close:
|
||||
case _ansiStyles.default.cyan.close:
|
||||
case _ansiStyles.default.gray.close:
|
||||
case _ansiStyles.default.white.close:
|
||||
case _ansiStyles.default.yellow.close:
|
||||
case _ansiStyles.default.bgRed.close:
|
||||
case _ansiStyles.default.bgGreen.close:
|
||||
case _ansiStyles.default.bgYellow.close:
|
||||
case _ansiStyles.default.inverse.close:
|
||||
case _ansiStyles.default.dim.close:
|
||||
case _ansiStyles.default.bold.close:
|
||||
case _ansiStyles.default.reset.open:
|
||||
case _ansiStyles.default.reset.close:
|
||||
return '</>';
|
||||
|
||||
case _ansiStyles.default.red.open:
|
||||
return '<red>';
|
||||
|
||||
case _ansiStyles.default.green.open:
|
||||
return '<green>';
|
||||
|
||||
case _ansiStyles.default.cyan.open:
|
||||
return '<cyan>';
|
||||
|
||||
case _ansiStyles.default.gray.open:
|
||||
return '<gray>';
|
||||
|
||||
case _ansiStyles.default.white.open:
|
||||
return '<white>';
|
||||
|
||||
case _ansiStyles.default.yellow.open:
|
||||
return '<yellow>';
|
||||
|
||||
case _ansiStyles.default.bgRed.open:
|
||||
return '<bgRed>';
|
||||
|
||||
case _ansiStyles.default.bgGreen.open:
|
||||
return '<bgGreen>';
|
||||
|
||||
case _ansiStyles.default.bgYellow.open:
|
||||
return '<bgYellow>';
|
||||
|
||||
case _ansiStyles.default.inverse.open:
|
||||
return '<inverse>';
|
||||
|
||||
case _ansiStyles.default.dim.open:
|
||||
return '<dim>';
|
||||
|
||||
case _ansiStyles.default.bold.open:
|
||||
return '<bold>';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
const test = val =>
|
||||
typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
|
||||
|
||||
exports.test = test;
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) =>
|
||||
printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
|
||||
|
||||
exports.serialize = serialize;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare const test: NewPlugin['test'];
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
80
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
Normal file
80
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
const SPACE = ' ';
|
||||
const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
|
||||
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
||||
|
||||
const testName = name =>
|
||||
OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
|
||||
|
||||
const test = val =>
|
||||
val &&
|
||||
val.constructor &&
|
||||
!!val.constructor.name &&
|
||||
testName(val.constructor.name);
|
||||
|
||||
exports.test = test;
|
||||
|
||||
const isNamedNodeMap = collection =>
|
||||
collection.constructor.name === 'NamedNodeMap';
|
||||
|
||||
const serialize = (collection, config, indentation, depth, refs, printer) => {
|
||||
const name = collection.constructor.name;
|
||||
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + name + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
(config.min ? '' : name + SPACE) +
|
||||
(OBJECT_NAMES.indexOf(name) !== -1
|
||||
? '{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
isNamedNodeMap(collection)
|
||||
? Array.from(collection).reduce((props, attribute) => {
|
||||
props[attribute.name] = attribute.value;
|
||||
return props;
|
||||
}, {})
|
||||
: {...collection},
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'
|
||||
: '[' +
|
||||
(0, _collections.printListItems)(
|
||||
Array.from(collection),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']')
|
||||
);
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare const test: NewPlugin['test'];
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
125
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
Normal file
125
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _markup = require('./lib/markup');
|
||||
|
||||
/**
|
||||
* 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 ELEMENT_NODE = 1;
|
||||
const TEXT_NODE = 3;
|
||||
const COMMENT_NODE = 8;
|
||||
const FRAGMENT_NODE = 11;
|
||||
const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
|
||||
|
||||
const testNode = val => {
|
||||
var _val$hasAttribute;
|
||||
|
||||
const constructorName = val.constructor.name;
|
||||
const {nodeType, tagName} = val;
|
||||
const isCustomElement =
|
||||
(typeof tagName === 'string' && tagName.includes('-')) ||
|
||||
((_val$hasAttribute = val.hasAttribute) === null ||
|
||||
_val$hasAttribute === void 0
|
||||
? void 0
|
||||
: _val$hasAttribute.call(val, 'is'));
|
||||
return (
|
||||
(nodeType === ELEMENT_NODE &&
|
||||
(ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
|
||||
(nodeType === TEXT_NODE && constructorName === 'Text') ||
|
||||
(nodeType === COMMENT_NODE && constructorName === 'Comment') ||
|
||||
(nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')
|
||||
);
|
||||
};
|
||||
|
||||
const test = val => {
|
||||
var _val$constructor;
|
||||
|
||||
return (
|
||||
(val === null || val === void 0
|
||||
? void 0
|
||||
: (_val$constructor = val.constructor) === null ||
|
||||
_val$constructor === void 0
|
||||
? void 0
|
||||
: _val$constructor.name) && testNode(val)
|
||||
);
|
||||
};
|
||||
|
||||
exports.test = test;
|
||||
|
||||
function nodeIsText(node) {
|
||||
return node.nodeType === TEXT_NODE;
|
||||
}
|
||||
|
||||
function nodeIsComment(node) {
|
||||
return node.nodeType === COMMENT_NODE;
|
||||
}
|
||||
|
||||
function nodeIsFragment(node) {
|
||||
return node.nodeType === FRAGMENT_NODE;
|
||||
}
|
||||
|
||||
const serialize = (node, config, indentation, depth, refs, printer) => {
|
||||
if (nodeIsText(node)) {
|
||||
return (0, _markup.printText)(node.data, config);
|
||||
}
|
||||
|
||||
if (nodeIsComment(node)) {
|
||||
return (0, _markup.printComment)(node.data, config);
|
||||
}
|
||||
|
||||
const type = nodeIsFragment(node)
|
||||
? `DocumentFragment`
|
||||
: node.tagName.toLowerCase();
|
||||
|
||||
if (++depth > config.maxDepth) {
|
||||
return (0, _markup.printElementAsLeaf)(type, config);
|
||||
}
|
||||
|
||||
return (0, _markup.printElement)(
|
||||
type,
|
||||
(0, _markup.printProps)(
|
||||
nodeIsFragment(node)
|
||||
? []
|
||||
: Array.from(node.attributes)
|
||||
.map(attr => attr.name)
|
||||
.sort(),
|
||||
nodeIsFragment(node)
|
||||
? {}
|
||||
: Array.from(node.attributes).reduce((props, attribute) => {
|
||||
props[attribute.name] = attribute.value;
|
||||
return props;
|
||||
}, {}),
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
(0, _markup.printChildren)(
|
||||
Array.prototype.slice.call(node.childNodes || node.children),
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
config,
|
||||
indentation
|
||||
);
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
export declare const test: NewPlugin['test'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
247
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.js
generated
vendored
Normal file
247
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.js
generated
vendored
Normal file
|
@ -0,0 +1,247 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// SENTINEL constants are from https://github.com/facebook/immutable-js
|
||||
const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
|
||||
const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
|
||||
const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
||||
const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
|
||||
const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
||||
const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
|
||||
|
||||
const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
|
||||
const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
||||
const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
|
||||
|
||||
const getImmutableName = name => 'Immutable.' + name;
|
||||
|
||||
const printAsLeaf = name => '[' + name + ']';
|
||||
|
||||
const SPACE = ' ';
|
||||
const LAZY = '…'; // Seq is lazy if it calls a method like filter
|
||||
|
||||
const printImmutableEntries = (
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
type
|
||||
) =>
|
||||
++depth > config.maxDepth
|
||||
? printAsLeaf(getImmutableName(type))
|
||||
: getImmutableName(type) +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'; // Record has an entries method because it is a collection in immutable v3.
|
||||
// Return an iterator for Immutable Record from version v3 or v4.
|
||||
|
||||
function getRecordEntries(val) {
|
||||
let i = 0;
|
||||
return {
|
||||
next() {
|
||||
if (i < val._keys.length) {
|
||||
const key = val._keys[i++];
|
||||
return {
|
||||
done: false,
|
||||
value: [key, val.get(key)]
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
done: true,
|
||||
value: undefined
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const printImmutableRecord = (
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) => {
|
||||
// _name property is defined only for an Immutable Record instance
|
||||
// which was constructed with a second optional descriptive name arg
|
||||
const name = getImmutableName(val._name || 'Record');
|
||||
return ++depth > config.maxDepth
|
||||
? printAsLeaf(name)
|
||||
: name +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
getRecordEntries(val),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
};
|
||||
|
||||
const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
|
||||
const name = getImmutableName('Seq');
|
||||
|
||||
if (++depth > config.maxDepth) {
|
||||
return printAsLeaf(name);
|
||||
}
|
||||
|
||||
if (val[IS_KEYED_SENTINEL]) {
|
||||
return (
|
||||
name +
|
||||
SPACE +
|
||||
'{' + // from Immutable collection of entries or from ECMAScript object
|
||||
(val._iter || val._object
|
||||
? (0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: LAZY) +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
name +
|
||||
SPACE +
|
||||
'[' +
|
||||
(val._iter || // from Immutable collection of values
|
||||
val._array || // from ECMAScript array
|
||||
val._collection || // from ECMAScript collection in immutable v4
|
||||
val._iterable // from ECMAScript collection in immutable v3
|
||||
? (0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: LAZY) +
|
||||
']'
|
||||
);
|
||||
};
|
||||
|
||||
const printImmutableValues = (
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
type
|
||||
) =>
|
||||
++depth > config.maxDepth
|
||||
? printAsLeaf(getImmutableName(type))
|
||||
: getImmutableName(type) +
|
||||
SPACE +
|
||||
'[' +
|
||||
(0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) => {
|
||||
if (val[IS_MAP_SENTINEL]) {
|
||||
return printImmutableEntries(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_LIST_SENTINEL]) {
|
||||
return printImmutableValues(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
'List'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_SET_SENTINEL]) {
|
||||
return printImmutableValues(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_STACK_SENTINEL]) {
|
||||
return printImmutableValues(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
'Stack'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_SEQ_SENTINEL]) {
|
||||
return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
||||
} // For compatibility with immutable v3 and v4, let record be the default.
|
||||
|
||||
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
||||
}; // Explicitly comparing sentinel properties to true avoids false positive
|
||||
// when mock identity-obj-proxy returns the key as the value for any key.
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val =>
|
||||
val &&
|
||||
(val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.d.ts
generated
vendored
Normal file
11
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
export declare const test: NewPlugin['test'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
166
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.js
generated
vendored
Normal file
166
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.js
generated
vendored
Normal file
|
@ -0,0 +1,166 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var ReactIs = _interopRequireWildcard(require('react-is'));
|
||||
|
||||
var _markup = require('./lib/markup');
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// Given element.props.children, or subtree during recursive traversal,
|
||||
// return flattened array of children.
|
||||
const getChildren = (arg, children = []) => {
|
||||
if (Array.isArray(arg)) {
|
||||
arg.forEach(item => {
|
||||
getChildren(item, children);
|
||||
});
|
||||
} else if (arg != null && arg !== false) {
|
||||
children.push(arg);
|
||||
}
|
||||
|
||||
return children;
|
||||
};
|
||||
|
||||
const getType = element => {
|
||||
const type = element.type;
|
||||
|
||||
if (typeof type === 'string') {
|
||||
return type;
|
||||
}
|
||||
|
||||
if (typeof type === 'function') {
|
||||
return type.displayName || type.name || 'Unknown';
|
||||
}
|
||||
|
||||
if (ReactIs.isFragment(element)) {
|
||||
return 'React.Fragment';
|
||||
}
|
||||
|
||||
if (ReactIs.isSuspense(element)) {
|
||||
return 'React.Suspense';
|
||||
}
|
||||
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
if (ReactIs.isContextProvider(element)) {
|
||||
return 'Context.Provider';
|
||||
}
|
||||
|
||||
if (ReactIs.isContextConsumer(element)) {
|
||||
return 'Context.Consumer';
|
||||
}
|
||||
|
||||
if (ReactIs.isForwardRef(element)) {
|
||||
if (type.displayName) {
|
||||
return type.displayName;
|
||||
}
|
||||
|
||||
const functionName = type.render.displayName || type.render.name || '';
|
||||
return functionName !== ''
|
||||
? 'ForwardRef(' + functionName + ')'
|
||||
: 'ForwardRef';
|
||||
}
|
||||
|
||||
if (ReactIs.isMemo(element)) {
|
||||
const functionName =
|
||||
type.displayName || type.type.displayName || type.type.name || '';
|
||||
return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';
|
||||
}
|
||||
}
|
||||
|
||||
return 'UNDEFINED';
|
||||
};
|
||||
|
||||
const getPropKeys = element => {
|
||||
const {props} = element;
|
||||
return Object.keys(props)
|
||||
.filter(key => key !== 'children' && props[key] !== undefined)
|
||||
.sort();
|
||||
};
|
||||
|
||||
const serialize = (element, config, indentation, depth, refs, printer) =>
|
||||
++depth > config.maxDepth
|
||||
? (0, _markup.printElementAsLeaf)(getType(element), config)
|
||||
: (0, _markup.printElement)(
|
||||
getType(element),
|
||||
(0, _markup.printProps)(
|
||||
getPropKeys(element),
|
||||
element.props,
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
(0, _markup.printChildren)(
|
||||
getChildren(element.props.children),
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
config,
|
||||
indentation
|
||||
);
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && ReactIs.isElement(val);
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
18
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts
generated
vendored
Normal file
18
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* 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 { NewPlugin } from '../types';
|
||||
export declare type ReactTestObject = {
|
||||
$$typeof: symbol;
|
||||
type: string;
|
||||
props?: Record<string, unknown>;
|
||||
children?: null | Array<ReactTestChild>;
|
||||
};
|
||||
declare type ReactTestChild = ReactTestObject | string | number;
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
export declare const test: NewPlugin['test'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
65
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.js
generated
vendored
Normal file
65
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _markup = require('./lib/markup');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const testSymbol =
|
||||
typeof Symbol === 'function' && Symbol.for
|
||||
? Symbol.for('react.test.json')
|
||||
: 0xea71357;
|
||||
|
||||
const getPropKeys = object => {
|
||||
const {props} = object;
|
||||
return props
|
||||
? Object.keys(props)
|
||||
.filter(key => props[key] !== undefined)
|
||||
.sort()
|
||||
: [];
|
||||
};
|
||||
|
||||
const serialize = (object, config, indentation, depth, refs, printer) =>
|
||||
++depth > config.maxDepth
|
||||
? (0, _markup.printElementAsLeaf)(object.type, config)
|
||||
: (0, _markup.printElement)(
|
||||
object.type,
|
||||
object.props
|
||||
? (0, _markup.printProps)(
|
||||
getPropKeys(object),
|
||||
object.props,
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: '',
|
||||
object.children
|
||||
? (0, _markup.printChildren)(
|
||||
object.children,
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: '',
|
||||
config,
|
||||
indentation
|
||||
);
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && val.$$typeof === testSymbol;
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
7
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts
generated
vendored
Normal file
7
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
export default function escapeHTML(str: string): string;
|
16
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.js
generated
vendored
Normal file
16
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = escapeHTML;
|
||||
|
||||
/**
|
||||
* 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 escapeHTML(str) {
|
||||
return str.replace(/</g, '<').replace(/>/g, '>');
|
||||
}
|
13
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.d.ts
generated
vendored
Normal file
13
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* 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, Printer, Refs } from '../../types';
|
||||
export declare const printProps: (keys: Array<string>, props: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
export declare const printChildren: (children: Array<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
export declare const printText: (text: string, config: Config) => string;
|
||||
export declare const printComment: (comment: string, config: Config) => string;
|
||||
export declare const printElement: (type: string, printedProps: string, printedChildren: string, config: Config, indentation: string) => string;
|
||||
export declare const printElementAsLeaf: (type: string, config: Config) => string;
|
147
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.js
generated
vendored
Normal file
147
web/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.js
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = void 0;
|
||||
|
||||
var _escapeHTML = _interopRequireDefault(require('./escapeHTML'));
|
||||
|
||||
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.
|
||||
*/
|
||||
// Return empty string if keys is empty.
|
||||
const printProps = (keys, props, config, indentation, depth, refs, printer) => {
|
||||
const indentationNext = indentation + config.indent;
|
||||
const colors = config.colors;
|
||||
return keys
|
||||
.map(key => {
|
||||
const value = props[key];
|
||||
let printed = printer(value, config, indentationNext, depth, refs);
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
if (printed.indexOf('\n') !== -1) {
|
||||
printed =
|
||||
config.spacingOuter +
|
||||
indentationNext +
|
||||
printed +
|
||||
config.spacingOuter +
|
||||
indentation;
|
||||
}
|
||||
|
||||
printed = '{' + printed + '}';
|
||||
}
|
||||
|
||||
return (
|
||||
config.spacingInner +
|
||||
indentation +
|
||||
colors.prop.open +
|
||||
key +
|
||||
colors.prop.close +
|
||||
'=' +
|
||||
colors.value.open +
|
||||
printed +
|
||||
colors.value.close
|
||||
);
|
||||
})
|
||||
.join('');
|
||||
}; // Return empty string if children is empty.
|
||||
|
||||
exports.printProps = printProps;
|
||||
|
||||
const printChildren = (children, config, indentation, depth, refs, printer) =>
|
||||
children
|
||||
.map(
|
||||
child =>
|
||||
config.spacingOuter +
|
||||
indentation +
|
||||
(typeof child === 'string'
|
||||
? printText(child, config)
|
||||
: printer(child, config, indentation, depth, refs))
|
||||
)
|
||||
.join('');
|
||||
|
||||
exports.printChildren = printChildren;
|
||||
|
||||
const printText = (text, config) => {
|
||||
const contentColor = config.colors.content;
|
||||
return (
|
||||
contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close
|
||||
);
|
||||
};
|
||||
|
||||
exports.printText = printText;
|
||||
|
||||
const printComment = (comment, config) => {
|
||||
const commentColor = config.colors.comment;
|
||||
return (
|
||||
commentColor.open +
|
||||
'<!--' +
|
||||
(0, _escapeHTML.default)(comment) +
|
||||
'-->' +
|
||||
commentColor.close
|
||||
);
|
||||
}; // Separate the functions to format props, children, and element,
|
||||
// so a plugin could override a particular function, if needed.
|
||||
// Too bad, so sad: the traditional (but unnecessary) space
|
||||
// in a self-closing tagColor requires a second test of printedProps.
|
||||
|
||||
exports.printComment = printComment;
|
||||
|
||||
const printElement = (
|
||||
type,
|
||||
printedProps,
|
||||
printedChildren,
|
||||
config,
|
||||
indentation
|
||||
) => {
|
||||
const tagColor = config.colors.tag;
|
||||
return (
|
||||
tagColor.open +
|
||||
'<' +
|
||||
type +
|
||||
(printedProps &&
|
||||
tagColor.close +
|
||||
printedProps +
|
||||
config.spacingOuter +
|
||||
indentation +
|
||||
tagColor.open) +
|
||||
(printedChildren
|
||||
? '>' +
|
||||
tagColor.close +
|
||||
printedChildren +
|
||||
config.spacingOuter +
|
||||
indentation +
|
||||
tagColor.open +
|
||||
'</' +
|
||||
type
|
||||
: (printedProps && !config.min ? '' : ' ') + '/') +
|
||||
'>' +
|
||||
tagColor.close
|
||||
);
|
||||
};
|
||||
|
||||
exports.printElement = printElement;
|
||||
|
||||
const printElementAsLeaf = (type, config) => {
|
||||
const tagColor = config.colors.tag;
|
||||
return (
|
||||
tagColor.open +
|
||||
'<' +
|
||||
type +
|
||||
tagColor.close +
|
||||
' …' +
|
||||
tagColor.open +
|
||||
' />' +
|
||||
tagColor.close
|
||||
);
|
||||
};
|
||||
|
||||
exports.printElementAsLeaf = printElementAsLeaf;
|
100
web/node_modules/jest-circus/node_modules/pretty-format/build/types.d.ts
generated
vendored
Normal file
100
web/node_modules/jest-circus/node_modules/pretty-format/build/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
export declare type Colors = {
|
||||
comment: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
content: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
prop: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
tag: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
value: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
};
|
||||
declare type Indent = (arg0: string) => string;
|
||||
export declare type Refs = Array<unknown>;
|
||||
declare type Print = (arg0: unknown) => string;
|
||||
export declare type Theme = {
|
||||
comment: string;
|
||||
content: string;
|
||||
prop: string;
|
||||
tag: string;
|
||||
value: string;
|
||||
};
|
||||
declare type ThemeReceived = {
|
||||
comment?: string;
|
||||
content?: string;
|
||||
prop?: string;
|
||||
tag?: string;
|
||||
value?: string;
|
||||
};
|
||||
export declare type Options = {
|
||||
callToJSON: boolean;
|
||||
escapeRegex: boolean;
|
||||
escapeString: boolean;
|
||||
highlight: boolean;
|
||||
indent: number;
|
||||
maxDepth: number;
|
||||
min: boolean;
|
||||
plugins: Plugins;
|
||||
printFunctionName: boolean;
|
||||
theme: Theme;
|
||||
};
|
||||
export declare type OptionsReceived = {
|
||||
callToJSON?: boolean;
|
||||
escapeRegex?: boolean;
|
||||
escapeString?: boolean;
|
||||
highlight?: boolean;
|
||||
indent?: number;
|
||||
maxDepth?: number;
|
||||
min?: boolean;
|
||||
plugins?: Plugins;
|
||||
printFunctionName?: boolean;
|
||||
theme?: ThemeReceived;
|
||||
};
|
||||
export declare type Config = {
|
||||
callToJSON: boolean;
|
||||
colors: Colors;
|
||||
escapeRegex: boolean;
|
||||
escapeString: boolean;
|
||||
indent: string;
|
||||
maxDepth: number;
|
||||
min: boolean;
|
||||
plugins: Plugins;
|
||||
printFunctionName: boolean;
|
||||
spacingInner: string;
|
||||
spacingOuter: string;
|
||||
};
|
||||
export declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
|
||||
declare type Test = (arg0: any) => boolean;
|
||||
export declare type NewPlugin = {
|
||||
serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
test: Test;
|
||||
};
|
||||
declare type PluginOptions = {
|
||||
edgeSpacing: string;
|
||||
min: boolean;
|
||||
spacing: string;
|
||||
};
|
||||
export declare type OldPlugin = {
|
||||
print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
|
||||
test: Test;
|
||||
};
|
||||
export declare type Plugin = NewPlugin | OldPlugin;
|
||||
export declare type Plugins = Array<Plugin>;
|
||||
export {};
|
1
web/node_modules/jest-circus/node_modules/pretty-format/build/types.js
generated
vendored
Normal file
1
web/node_modules/jest-circus/node_modules/pretty-format/build/types.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
37
web/node_modules/jest-circus/node_modules/pretty-format/package.json
generated
vendored
Normal file
37
web/node_modules/jest-circus/node_modules/pretty-format/package.json
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "pretty-format",
|
||||
"version": "26.6.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/pretty-format"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "Stringify any JavaScript value.",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"author": "James Kyle <me@thejameskyle.com>",
|
||||
"dependencies": {
|
||||
"@jest/types": "^26.6.2",
|
||||
"ansi-regex": "^5.0.0",
|
||||
"ansi-styles": "^4.0.0",
|
||||
"react-is": "^17.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-is": "^16.7.1",
|
||||
"@types/react-test-renderer": "*",
|
||||
"immutable": "4.0.0-rc.9",
|
||||
"jest-util": "^26.6.2",
|
||||
"react": "*",
|
||||
"react-dom": "*",
|
||||
"react-test-renderer": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5"
|
||||
}
|
54
web/node_modules/jest-circus/package.json
generated
vendored
Normal file
54
web/node_modules/jest-circus/package.json
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "jest-circus",
|
||||
"version": "26.6.0",
|
||||
"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",
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.1.0",
|
||||
"@jest/environment": "^26.6.0",
|
||||
"@jest/test-result": "^26.6.0",
|
||||
"@jest/types": "^26.6.0",
|
||||
"@types/babel__traverse": "^7.0.4",
|
||||
"@types/node": "*",
|
||||
"chalk": "^4.0.0",
|
||||
"co": "^4.6.0",
|
||||
"dedent": "^0.7.0",
|
||||
"expect": "^26.6.0",
|
||||
"is-generator-fn": "^2.0.0",
|
||||
"jest-each": "^26.6.0",
|
||||
"jest-matcher-utils": "^26.6.0",
|
||||
"jest-message-util": "^26.6.0",
|
||||
"jest-runner": "^26.6.0",
|
||||
"jest-runtime": "^26.6.0",
|
||||
"jest-snapshot": "^26.6.0",
|
||||
"jest-util": "^26.6.0",
|
||||
"pretty-format": "^26.6.0",
|
||||
"stack-utils": "^2.0.2",
|
||||
"throat": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@jest/test-utils": "^26.5.0",
|
||||
"@types/babel__traverse": "^7.0.4",
|
||||
"@types/co": "^4.6.0",
|
||||
"@types/dedent": "^0.7.0",
|
||||
"@types/graceful-fs": "^4.1.3",
|
||||
"@types/stack-utils": "^2.0.0",
|
||||
"execa": "^4.0.0",
|
||||
"graceful-fs": "^4.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "b254fd82fdedcba200e1c7eddeaab83a09bdaaef"
|
||||
}
|
10
web/node_modules/jest-circus/runner.js
generated
vendored
Normal file
10
web/node_modules/jest-circus/runner.js
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.
|
||||
*/
|
||||
|
||||
// Allow people to use `jest-circus/runner` as a runner.
|
||||
const runner = require('./build/legacy-code-todo-rewrite/jestAdapter');
|
||||
module.exports = runner;
|
Loading…
Add table
Add a link
Reference in a new issue