Add node modules and compiled JavaScript from main
This commit is contained in:
parent
1021f818b9
commit
feeb5f7b58
7748 changed files with 1825934 additions and 2 deletions
21
node_modules/jest-jasmine2/LICENSE
generated
vendored
Normal file
21
node_modules/jest-jasmine2/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.
|
8
node_modules/jest-jasmine2/build/ExpectationFailed.d.ts
generated
vendored
Normal file
8
node_modules/jest-jasmine2/build/ExpectationFailed.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 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 class ExpectationFailed extends Error {
|
||||
}
|
16
node_modules/jest-jasmine2/build/ExpectationFailed.js
generated
vendored
Normal file
16
node_modules/jest-jasmine2/build/ExpectationFailed.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
class ExpectationFailed extends Error {}
|
||||
|
||||
exports.default = ExpectationFailed;
|
17
node_modules/jest-jasmine2/build/PCancelable.d.ts
generated
vendored
Normal file
17
node_modules/jest-jasmine2/build/PCancelable.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* 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 class PCancelable<T> extends Promise<T> {
|
||||
private _pending;
|
||||
private _canceled;
|
||||
private _promise;
|
||||
private _cancel?;
|
||||
private _reject;
|
||||
constructor(executor: (onCancel: (cancelHandler: () => void) => void, resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void);
|
||||
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
||||
catch<TResult>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
||||
cancel(): void;
|
||||
}
|
97
node_modules/jest-jasmine2/build/PCancelable.js
generated
vendored
Normal file
97
node_modules/jest-jasmine2/build/PCancelable.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return 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.
|
||||
*/
|
||||
class CancelError extends Error {
|
||||
constructor() {
|
||||
super('Promise was canceled');
|
||||
this.name = 'CancelError';
|
||||
}
|
||||
}
|
||||
|
||||
class PCancelable extends Promise {
|
||||
constructor(executor) {
|
||||
super(resolve => resolve());
|
||||
|
||||
_defineProperty(this, '_pending', true);
|
||||
|
||||
_defineProperty(this, '_canceled', false);
|
||||
|
||||
_defineProperty(this, '_promise', void 0);
|
||||
|
||||
_defineProperty(this, '_cancel', void 0);
|
||||
|
||||
_defineProperty(this, '_reject', () => {});
|
||||
|
||||
this._promise = new Promise((resolve, reject) => {
|
||||
this._reject = reject;
|
||||
return executor(
|
||||
fn => {
|
||||
this._cancel = fn;
|
||||
},
|
||||
val => {
|
||||
this._pending = false;
|
||||
resolve(val);
|
||||
},
|
||||
err => {
|
||||
this._pending = false;
|
||||
reject(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
then(onFulfilled, onRejected) {
|
||||
return this._promise.then(onFulfilled, onRejected);
|
||||
}
|
||||
|
||||
catch(onRejected) {
|
||||
return this._promise.catch(onRejected);
|
||||
}
|
||||
|
||||
cancel() {
|
||||
if (!this._pending || this._canceled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof this._cancel === 'function') {
|
||||
try {
|
||||
this._cancel();
|
||||
} catch (err) {
|
||||
this._reject(err);
|
||||
}
|
||||
}
|
||||
|
||||
this._canceled = true;
|
||||
|
||||
this._reject(new CancelError());
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = PCancelable;
|
10
node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts
generated
vendored
Normal file
10
node_modules/jest-jasmine2/build/assertionErrorMessage.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 { DiffOptions } from 'jest-matcher-utils';
|
||||
import type { AssertionErrorWithStack } from './types';
|
||||
declare function assertionErrorMessage(error: AssertionErrorWithStack, options: DiffOptions): string;
|
||||
export default assertionErrorMessage;
|
156
node_modules/jest-jasmine2/build/assertionErrorMessage.js
generated
vendored
Normal file
156
node_modules/jest-jasmine2/build/assertionErrorMessage.js
generated
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
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 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 buildHintString(hint) {
|
||||
return hint ? hint + '\n\n' : '';
|
||||
}
|
||||
|
||||
var _default = assertionErrorMessage;
|
||||
exports.default = _default;
|
9
node_modules/jest-jasmine2/build/each.d.ts
generated
vendored
Normal file
9
node_modules/jest-jasmine2/build/each.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 { JestEnvironment } from '@jest/environment';
|
||||
declare const _default: (environment: JestEnvironment) => void;
|
||||
export default _default;
|
46
node_modules/jest-jasmine2/build/each.js
generated
vendored
Normal file
46
node_modules/jest-jasmine2/build/each.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _jestEach = require('jest-each');
|
||||
|
||||
/**
|
||||
* 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 = environment => {
|
||||
environment.global.it.each = (0, _jestEach.bind)(environment.global.it);
|
||||
environment.global.fit.each = (0, _jestEach.bind)(environment.global.fit);
|
||||
environment.global.xit.each = (0, _jestEach.bind)(environment.global.xit);
|
||||
environment.global.describe.each = (0, _jestEach.bind)(
|
||||
environment.global.describe,
|
||||
false
|
||||
);
|
||||
environment.global.xdescribe.each = (0, _jestEach.bind)(
|
||||
environment.global.xdescribe,
|
||||
false
|
||||
);
|
||||
environment.global.fdescribe.each = (0, _jestEach.bind)(
|
||||
environment.global.fdescribe,
|
||||
false
|
||||
);
|
||||
environment.global.it.concurrent.each = (0, _jestEach.bind)(
|
||||
environment.global.it.concurrent,
|
||||
false
|
||||
);
|
||||
environment.global.it.concurrent.only.each = (0, _jestEach.bind)(
|
||||
environment.global.it.concurrent.only,
|
||||
false
|
||||
);
|
||||
environment.global.it.concurrent.skip.each = (0, _jestEach.bind)(
|
||||
environment.global.it.concurrent.skip,
|
||||
false
|
||||
);
|
||||
};
|
||||
|
||||
exports.default = _default;
|
8
node_modules/jest-jasmine2/build/errorOnPrivate.d.ts
generated
vendored
Normal file
8
node_modules/jest-jasmine2/build/errorOnPrivate.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 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 { Global } from '@jest/types';
|
||||
export declare function installErrorOnPrivate(global: Global.Global): void;
|
66
node_modules/jest-jasmine2/build/errorOnPrivate.js
generated
vendored
Normal file
66
node_modules/jest-jasmine2/build/errorOnPrivate.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.installErrorOnPrivate = installErrorOnPrivate;
|
||||
|
||||
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.
|
||||
*/
|
||||
// prettier-ignore
|
||||
const disabledGlobals = {
|
||||
fail: 'Illegal usage of global `fail`, prefer throwing an error, or the `done.fail` callback.',
|
||||
pending: 'Illegal usage of global `pending`, prefer explicitly skipping a test using `test.skip`',
|
||||
spyOn: 'Illegal usage of global `spyOn`, prefer `jest.spyOn`.',
|
||||
spyOnProperty: 'Illegal usage of global `spyOnProperty`, prefer `jest.spyOn`.'
|
||||
};
|
||||
// prettier-ignore
|
||||
const disabledJasmineMethods = {
|
||||
addMatchers: 'Illegal usage of `jasmine.addMatchers`, prefer `expect.extends`.',
|
||||
any: 'Illegal usage of `jasmine.any`, prefer `expect.any`.',
|
||||
anything: 'Illegal usage of `jasmine.anything`, prefer `expect.anything`.',
|
||||
arrayContaining: 'Illegal usage of `jasmine.arrayContaining`, prefer `expect.arrayContaining`.',
|
||||
createSpy: 'Illegal usage of `jasmine.createSpy`, prefer `jest.fn`.',
|
||||
objectContaining: 'Illegal usage of `jasmine.objectContaining`, prefer `expect.objectContaining`.',
|
||||
stringMatching: 'Illegal usage of `jasmine.stringMatching`, prefer `expect.stringMatching`.'
|
||||
};
|
||||
|
||||
function installErrorOnPrivate(global) {
|
||||
const jasmine = global.jasmine;
|
||||
Object.keys(disabledGlobals).forEach(functionName => {
|
||||
global[functionName] = () => {
|
||||
throwAtFunction(disabledGlobals[functionName], global[functionName]);
|
||||
};
|
||||
});
|
||||
Object.keys(disabledJasmineMethods).forEach(methodName => {
|
||||
// @ts-expect-error
|
||||
jasmine[methodName] = () => {
|
||||
throwAtFunction(disabledJasmineMethods[methodName], jasmine[methodName]);
|
||||
};
|
||||
});
|
||||
|
||||
function set() {
|
||||
throwAtFunction(
|
||||
'Illegal usage of `jasmine.DEFAULT_TIMEOUT_INTERVAL`, prefer `jest.setTimeout`.',
|
||||
set
|
||||
);
|
||||
}
|
||||
|
||||
const original = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => original,
|
||||
set
|
||||
});
|
||||
}
|
||||
|
||||
function throwAtFunction(message, fn) {
|
||||
throw new _jestUtil.ErrorWithStack(message, fn);
|
||||
}
|
16
node_modules/jest-jasmine2/build/expectationResultFactory.d.ts
generated
vendored
Normal file
16
node_modules/jest-jasmine2/build/expectationResultFactory.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* 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 { FailedAssertion } from '@jest/test-result';
|
||||
export declare type Options = {
|
||||
matcherName: string;
|
||||
passed: boolean;
|
||||
actual?: any;
|
||||
error?: any;
|
||||
expected?: any;
|
||||
message?: string | null;
|
||||
};
|
||||
export default function expectationResultFactory(options: Options, initError?: Error): FailedAssertion;
|
97
node_modules/jest-jasmine2/build/expectationResultFactory.js
generated
vendored
Normal file
97
node_modules/jest-jasmine2/build/expectationResultFactory.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = expectationResultFactory;
|
||||
|
||||
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.
|
||||
*/
|
||||
function messageFormatter({error, message, passed}) {
|
||||
if (passed) {
|
||||
return 'Passed.';
|
||||
}
|
||||
|
||||
if (message) {
|
||||
return message;
|
||||
}
|
||||
|
||||
if (typeof error === 'string') {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (
|
||||
// duck-type Error, see #2549
|
||||
error &&
|
||||
typeof error === 'object' &&
|
||||
typeof error.message === 'string' &&
|
||||
typeof error.name === 'string'
|
||||
) {
|
||||
if (error.message === '') {
|
||||
return error.name;
|
||||
}
|
||||
|
||||
return `${error.name}: ${error.message}`;
|
||||
}
|
||||
|
||||
return `thrown: ${(0, _prettyFormat.default)(error, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
}
|
||||
|
||||
function stackFormatter(options, initError, errorMessage) {
|
||||
if (options.passed) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (options.error) {
|
||||
if (options.error.stack) {
|
||||
return options.error.stack;
|
||||
}
|
||||
|
||||
if (options.error === errorMessage) {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
if (initError) {
|
||||
return errorMessage.trimRight() + '\n\n' + initError.stack;
|
||||
}
|
||||
|
||||
return new Error(errorMessage).stack;
|
||||
}
|
||||
|
||||
function expectationResultFactory(options, initError) {
|
||||
const message = messageFormatter(options);
|
||||
const stack = stackFormatter(options, initError, message);
|
||||
|
||||
if (options.passed) {
|
||||
return {
|
||||
error: options.error,
|
||||
matcherName: options.matcherName,
|
||||
message,
|
||||
passed: options.passed,
|
||||
stack
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
actual: options.actual,
|
||||
error: options.error,
|
||||
expected: options.expected,
|
||||
matcherName: options.matcherName,
|
||||
message,
|
||||
passed: options.passed,
|
||||
stack
|
||||
};
|
||||
}
|
16
node_modules/jest-jasmine2/build/index.d.ts
generated
vendored
Normal file
16
node_modules/jest-jasmine2/build/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* 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 { TestResult } from '@jest/test-result';
|
||||
import type { JestEnvironment } from '@jest/environment';
|
||||
import type { RuntimeType as Runtime } from 'jest-runtime';
|
||||
import type { Jasmine as JestJasmine } from './types';
|
||||
declare function jasmine2(globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string): Promise<TestResult>;
|
||||
declare namespace jasmine2 {
|
||||
type Jasmine = JestJasmine;
|
||||
}
|
||||
export = jasmine2;
|
265
node_modules/jest-jasmine2/build/index.js
generated
vendored
Normal file
265
node_modules/jest-jasmine2/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,265 @@
|
|||
'use strict';
|
||||
|
||||
var path = _interopRequireWildcard(require('path'));
|
||||
|
||||
var _sourceMap = require('@jest/source-map');
|
||||
|
||||
var _each = _interopRequireDefault(require('./each'));
|
||||
|
||||
var _errorOnPrivate = require('./errorOnPrivate');
|
||||
|
||||
var _reporter = _interopRequireDefault(require('./reporter'));
|
||||
|
||||
var _jasmineAsyncInstall = _interopRequireDefault(
|
||||
require('./jasmineAsyncInstall')
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 JASMINE = require.resolve('./jasmine/jasmineLight');
|
||||
|
||||
async function jasmine2(globalConfig, config, environment, runtime, testPath) {
|
||||
var _runtime$unstable_sho2;
|
||||
|
||||
const reporter = new _reporter.default(globalConfig, config, testPath);
|
||||
const jasmineFactory = runtime.requireInternalModule(JASMINE);
|
||||
const jasmine = jasmineFactory.create({
|
||||
process,
|
||||
testPath,
|
||||
testTimeout: globalConfig.testTimeout
|
||||
});
|
||||
const env = jasmine.getEnv();
|
||||
|
||||
const jasmineInterface = jasmineFactory._interface(jasmine, env);
|
||||
|
||||
Object.assign(environment.global, jasmineInterface);
|
||||
env.addReporter(jasmineInterface.jsApiReporter); // TODO: Remove config option if V8 exposes some way of getting location of caller
|
||||
// in a future version
|
||||
|
||||
if (config.testLocationInResults === true) {
|
||||
const originalIt = environment.global.it;
|
||||
|
||||
environment.global.it = (...args) => {
|
||||
const stack = (0, _sourceMap.getCallsite)(1, runtime.getSourceMaps());
|
||||
const it = originalIt(...args); // @ts-expect-error
|
||||
|
||||
it.result.__callsite = stack;
|
||||
return it;
|
||||
};
|
||||
|
||||
const originalXit = environment.global.xit;
|
||||
|
||||
environment.global.xit = (...args) => {
|
||||
const stack = (0, _sourceMap.getCallsite)(1, runtime.getSourceMaps());
|
||||
const xit = originalXit(...args); // @ts-expect-error
|
||||
|
||||
xit.result.__callsite = stack;
|
||||
return xit;
|
||||
};
|
||||
|
||||
const originalFit = environment.global.fit;
|
||||
|
||||
environment.global.fit = (...args) => {
|
||||
const stack = (0, _sourceMap.getCallsite)(1, runtime.getSourceMaps());
|
||||
const fit = originalFit(...args); // @ts-expect-error
|
||||
|
||||
fit.result.__callsite = stack;
|
||||
return fit;
|
||||
};
|
||||
}
|
||||
|
||||
(0, _jasmineAsyncInstall.default)(globalConfig, environment.global);
|
||||
(0, _each.default)(environment);
|
||||
environment.global.test = environment.global.it;
|
||||
environment.global.it.only = environment.global.fit;
|
||||
environment.global.it.todo = env.todo;
|
||||
environment.global.it.skip = environment.global.xit;
|
||||
environment.global.xtest = environment.global.xit;
|
||||
environment.global.describe.skip = environment.global.xdescribe;
|
||||
environment.global.describe.only = environment.global.fdescribe;
|
||||
|
||||
if (config.timers === 'fake' || config.timers === 'legacy') {
|
||||
environment.fakeTimers.useFakeTimers();
|
||||
} else if (config.timers === 'modern') {
|
||||
environment.fakeTimersModern.useFakeTimers();
|
||||
}
|
||||
|
||||
env.beforeEach(() => {
|
||||
if (config.resetModules) {
|
||||
runtime.resetModules();
|
||||
}
|
||||
|
||||
if (config.clearMocks) {
|
||||
runtime.clearAllMocks();
|
||||
}
|
||||
|
||||
if (config.resetMocks) {
|
||||
runtime.resetAllMocks();
|
||||
|
||||
if (config.timers === 'fake' || config.timers === 'legacy') {
|
||||
environment.fakeTimers.useFakeTimers();
|
||||
}
|
||||
}
|
||||
|
||||
if (config.restoreMocks) {
|
||||
runtime.restoreAllMocks();
|
||||
}
|
||||
});
|
||||
env.addReporter(reporter);
|
||||
runtime
|
||||
.requireInternalModule(path.resolve(__dirname, './jestExpect.js'))
|
||||
.default({
|
||||
expand: globalConfig.expand
|
||||
});
|
||||
|
||||
if (globalConfig.errorOnDeprecated) {
|
||||
(0, _errorOnPrivate.installErrorOnPrivate)(environment.global);
|
||||
} else {
|
||||
Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
|
||||
get() {
|
||||
return this._DEFAULT_TIMEOUT_INTERVAL;
|
||||
},
|
||||
|
||||
set(value) {
|
||||
this._DEFAULT_TIMEOUT_INTERVAL = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const snapshotState = runtime
|
||||
.requireInternalModule(path.resolve(__dirname, './setup_jest_globals.js'))
|
||||
.default({
|
||||
config,
|
||||
globalConfig,
|
||||
localRequire: runtime.requireModule.bind(runtime),
|
||||
testPath
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (globalConfig.enabledTestsMap) {
|
||||
env.specFilter = spec => {
|
||||
const suiteMap =
|
||||
globalConfig.enabledTestsMap &&
|
||||
globalConfig.enabledTestsMap[spec.result.testPath];
|
||||
return (suiteMap && suiteMap[spec.result.fullName]) || false;
|
||||
};
|
||||
} else if (globalConfig.testNamePattern) {
|
||||
const testNameRegex = new RegExp(globalConfig.testNamePattern, 'i');
|
||||
|
||||
env.specFilter = spec => testNameRegex.test(spec.getFullName());
|
||||
} // 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);
|
||||
}
|
||||
|
||||
await env.execute();
|
||||
const results = await reporter.getResults();
|
||||
return addSnapshotData(results, snapshotState);
|
||||
}
|
||||
|
||||
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);
|
||||
return results;
|
||||
}; // eslint-disable-next-line no-redeclare
|
||||
|
||||
module.exports = jasmine2;
|
10
node_modules/jest-jasmine2/build/isError.d.ts
generated
vendored
Normal file
10
node_modules/jest-jasmine2/build/isError.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.
|
||||
*/
|
||||
export default function isError(potentialError: any): {
|
||||
isError: boolean;
|
||||
message: string | null;
|
||||
};
|
37
node_modules/jest-jasmine2/build/isError.js
generated
vendored
Normal file
37
node_modules/jest-jasmine2/build/isError.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = isError;
|
||||
|
||||
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.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
function isError(potentialError) {
|
||||
// duck-type Error, see #2549
|
||||
const isError =
|
||||
potentialError !== null &&
|
||||
typeof potentialError === 'object' &&
|
||||
typeof potentialError.message === 'string' &&
|
||||
typeof potentialError.name === 'string';
|
||||
const message = isError
|
||||
? null
|
||||
: `Failed: ${(0, _prettyFormat.default)(potentialError, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
return {
|
||||
isError,
|
||||
message
|
||||
};
|
||||
}
|
25
node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts
generated
vendored
Normal file
25
node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* 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 Context = {
|
||||
object: unknown;
|
||||
args: Array<unknown>;
|
||||
returnValue?: unknown;
|
||||
};
|
||||
declare class CallTracker {
|
||||
track: (context: Context) => void;
|
||||
any: () => boolean;
|
||||
count: () => number;
|
||||
argsFor: (index: number) => Array<unknown>;
|
||||
all: () => Array<Context>;
|
||||
allArgs: () => Array<unknown>;
|
||||
first: () => Context;
|
||||
mostRecent: () => Context;
|
||||
reset: () => void;
|
||||
constructor();
|
||||
}
|
||||
export default CallTracker;
|
121
node_modules/jest-jasmine2/build/jasmine/CallTracker.js
generated
vendored
Normal file
121
node_modules/jest-jasmine2/build/jasmine/CallTracker.js
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return 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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
class CallTracker {
|
||||
constructor() {
|
||||
_defineProperty(this, 'track', void 0);
|
||||
|
||||
_defineProperty(this, 'any', void 0);
|
||||
|
||||
_defineProperty(this, 'count', void 0);
|
||||
|
||||
_defineProperty(this, 'argsFor', void 0);
|
||||
|
||||
_defineProperty(this, 'all', void 0);
|
||||
|
||||
_defineProperty(this, 'allArgs', void 0);
|
||||
|
||||
_defineProperty(this, 'first', void 0);
|
||||
|
||||
_defineProperty(this, 'mostRecent', void 0);
|
||||
|
||||
_defineProperty(this, 'reset', void 0);
|
||||
|
||||
let calls = [];
|
||||
|
||||
this.track = function (context) {
|
||||
calls.push(context);
|
||||
};
|
||||
|
||||
this.any = function () {
|
||||
return !!calls.length;
|
||||
};
|
||||
|
||||
this.count = function () {
|
||||
return calls.length;
|
||||
};
|
||||
|
||||
this.argsFor = function (index) {
|
||||
const call = calls[index];
|
||||
return call ? call.args : [];
|
||||
};
|
||||
|
||||
this.all = function () {
|
||||
return calls;
|
||||
};
|
||||
|
||||
this.allArgs = function () {
|
||||
const callArgs = [];
|
||||
|
||||
for (let i = 0; i < calls.length; i++) {
|
||||
callArgs.push(calls[i].args);
|
||||
}
|
||||
|
||||
return callArgs;
|
||||
};
|
||||
|
||||
this.first = function () {
|
||||
return calls[0];
|
||||
};
|
||||
|
||||
this.mostRecent = function () {
|
||||
return calls[calls.length - 1];
|
||||
};
|
||||
|
||||
this.reset = function () {
|
||||
calls = [];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var _default = CallTracker;
|
||||
exports.default = _default;
|
43
node_modules/jest-jasmine2/build/jasmine/Env.d.ts
generated
vendored
Normal file
43
node_modules/jest-jasmine2/build/jasmine/Env.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* 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 { QueueableFn } from '../queueRunner';
|
||||
import type { AssertionErrorWithStack, Jasmine, Reporter, SpecDefinitionsFn, Spy } from '../types';
|
||||
import type { default as Spec } from './Spec';
|
||||
import type Suite from './Suite';
|
||||
export default function (j$: Jasmine): {
|
||||
new (_options?: Record<string, unknown> | undefined): {
|
||||
specFilter: (spec: Spec) => boolean;
|
||||
catchExceptions: (value: unknown) => boolean;
|
||||
throwOnExpectationFailure: (value: unknown) => void;
|
||||
catchingExceptions: () => boolean;
|
||||
topSuite: () => Suite;
|
||||
fail: (error: Error | AssertionErrorWithStack) => void;
|
||||
pending: (message: string) => void;
|
||||
afterAll: (afterAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
|
||||
fit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
|
||||
throwingExpectationFailures: () => boolean;
|
||||
randomizeTests: (value: unknown) => void;
|
||||
randomTests: () => boolean;
|
||||
seed: (value: unknown) => unknown;
|
||||
execute: (runnablesToRun?: string[] | undefined, suiteTree?: Suite | undefined) => Promise<void>;
|
||||
fdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
|
||||
spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: "configurable" | "enumerable" | "value" | "writable" | "get" | "set" | undefined) => Spy;
|
||||
beforeEach: (beforeEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
|
||||
afterEach: (afterEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
|
||||
clearReporters: () => void;
|
||||
addReporter: (reporterToAdd: Reporter) => void;
|
||||
it: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
|
||||
xdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
|
||||
xit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
|
||||
beforeAll: (beforeAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
|
||||
todo: () => Spec;
|
||||
provideFallbackReporter: (reporterToAdd: Reporter) => void;
|
||||
allowRespy: (allow: boolean) => void;
|
||||
describe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
|
||||
};
|
||||
};
|
745
node_modules/jest-jasmine2/build/jasmine/Env.js
generated
vendored
Normal file
745
node_modules/jest-jasmine2/build/jasmine/Env.js
generated
vendored
Normal file
|
@ -0,0 +1,745 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var _assert = require('assert');
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _queueRunner = _interopRequireDefault(require('../queueRunner'));
|
||||
|
||||
var _treeProcessor = _interopRequireDefault(require('../treeProcessor'));
|
||||
|
||||
var _isError = _interopRequireDefault(require('../isError'));
|
||||
|
||||
var _assertionErrorMessage = _interopRequireDefault(
|
||||
require('../assertionErrorMessage')
|
||||
);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function _default(j$) {
|
||||
var _temp;
|
||||
|
||||
return (
|
||||
(_temp = class Env {
|
||||
constructor(_options) {
|
||||
_defineProperty(this, 'specFilter', void 0);
|
||||
|
||||
_defineProperty(this, 'catchExceptions', void 0);
|
||||
|
||||
_defineProperty(this, 'throwOnExpectationFailure', void 0);
|
||||
|
||||
_defineProperty(this, 'catchingExceptions', void 0);
|
||||
|
||||
_defineProperty(this, 'topSuite', void 0);
|
||||
|
||||
_defineProperty(this, 'fail', void 0);
|
||||
|
||||
_defineProperty(this, 'pending', void 0);
|
||||
|
||||
_defineProperty(this, 'afterAll', void 0);
|
||||
|
||||
_defineProperty(this, 'fit', void 0);
|
||||
|
||||
_defineProperty(this, 'throwingExpectationFailures', void 0);
|
||||
|
||||
_defineProperty(this, 'randomizeTests', void 0);
|
||||
|
||||
_defineProperty(this, 'randomTests', void 0);
|
||||
|
||||
_defineProperty(this, 'seed', void 0);
|
||||
|
||||
_defineProperty(this, 'execute', void 0);
|
||||
|
||||
_defineProperty(this, 'fdescribe', void 0);
|
||||
|
||||
_defineProperty(this, 'spyOn', void 0);
|
||||
|
||||
_defineProperty(this, 'beforeEach', void 0);
|
||||
|
||||
_defineProperty(this, 'afterEach', void 0);
|
||||
|
||||
_defineProperty(this, 'clearReporters', void 0);
|
||||
|
||||
_defineProperty(this, 'addReporter', void 0);
|
||||
|
||||
_defineProperty(this, 'it', void 0);
|
||||
|
||||
_defineProperty(this, 'xdescribe', void 0);
|
||||
|
||||
_defineProperty(this, 'xit', void 0);
|
||||
|
||||
_defineProperty(this, 'beforeAll', void 0);
|
||||
|
||||
_defineProperty(this, 'todo', void 0);
|
||||
|
||||
_defineProperty(this, 'provideFallbackReporter', void 0);
|
||||
|
||||
_defineProperty(this, 'allowRespy', void 0);
|
||||
|
||||
_defineProperty(this, 'describe', void 0);
|
||||
|
||||
let totalSpecsDefined = 0;
|
||||
let catchExceptions = true;
|
||||
const realSetTimeout = global.setTimeout;
|
||||
const realClearTimeout = global.clearTimeout;
|
||||
const runnableResources = {};
|
||||
const currentlyExecutingSuites = [];
|
||||
let currentSpec = null;
|
||||
let throwOnExpectationFailure = false;
|
||||
let random = false;
|
||||
let seed = null;
|
||||
let nextSpecId = 0;
|
||||
let nextSuiteId = 0;
|
||||
|
||||
const getNextSpecId = function () {
|
||||
return 'spec' + nextSpecId++;
|
||||
};
|
||||
|
||||
const getNextSuiteId = function () {
|
||||
return 'suite' + nextSuiteId++;
|
||||
};
|
||||
|
||||
const topSuite = new j$.Suite({
|
||||
id: getNextSuiteId(),
|
||||
description: '',
|
||||
|
||||
getTestPath() {
|
||||
return j$.testPath;
|
||||
}
|
||||
});
|
||||
let currentDeclarationSuite = topSuite;
|
||||
|
||||
const currentSuite = function () {
|
||||
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
||||
};
|
||||
|
||||
const currentRunnable = function () {
|
||||
return currentSpec || currentSuite();
|
||||
};
|
||||
|
||||
const reporter = new j$.ReportDispatcher([
|
||||
'jasmineStarted',
|
||||
'jasmineDone',
|
||||
'suiteStarted',
|
||||
'suiteDone',
|
||||
'specStarted',
|
||||
'specDone'
|
||||
]);
|
||||
|
||||
this.specFilter = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
const defaultResourcesForRunnable = function (id, _parentRunnableId) {
|
||||
const resources = {
|
||||
spies: []
|
||||
};
|
||||
runnableResources[id] = resources;
|
||||
};
|
||||
|
||||
const clearResourcesForRunnable = function (id) {
|
||||
spyRegistry.clearSpies();
|
||||
delete runnableResources[id];
|
||||
};
|
||||
|
||||
const beforeAndAfterFns = function (suite) {
|
||||
return function () {
|
||||
let afters = [];
|
||||
let befores = [];
|
||||
|
||||
while (suite) {
|
||||
befores = befores.concat(suite.beforeFns);
|
||||
afters = afters.concat(suite.afterFns);
|
||||
suite = suite.parentSuite;
|
||||
}
|
||||
|
||||
return {
|
||||
befores: befores.reverse(),
|
||||
afters
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
const getSpecName = function (spec, suite) {
|
||||
const fullName = [spec.description];
|
||||
const suiteFullName = suite.getFullName();
|
||||
|
||||
if (suiteFullName !== '') {
|
||||
fullName.unshift(suiteFullName);
|
||||
}
|
||||
|
||||
return fullName.join(' ');
|
||||
};
|
||||
|
||||
this.catchExceptions = function (value) {
|
||||
catchExceptions = !!value;
|
||||
return catchExceptions;
|
||||
};
|
||||
|
||||
this.catchingExceptions = function () {
|
||||
return catchExceptions;
|
||||
};
|
||||
|
||||
this.throwOnExpectationFailure = function (value) {
|
||||
throwOnExpectationFailure = !!value;
|
||||
};
|
||||
|
||||
this.throwingExpectationFailures = function () {
|
||||
return throwOnExpectationFailure;
|
||||
};
|
||||
|
||||
this.randomizeTests = function (value) {
|
||||
random = !!value;
|
||||
};
|
||||
|
||||
this.randomTests = function () {
|
||||
return random;
|
||||
};
|
||||
|
||||
this.seed = function (value) {
|
||||
if (value) {
|
||||
seed = value;
|
||||
}
|
||||
|
||||
return seed;
|
||||
};
|
||||
|
||||
const queueRunnerFactory = options => {
|
||||
options.clearTimeout = realClearTimeout;
|
||||
options.fail = this.fail;
|
||||
options.setTimeout = realSetTimeout;
|
||||
return (0, _queueRunner.default)(options);
|
||||
};
|
||||
|
||||
this.topSuite = function () {
|
||||
return topSuite;
|
||||
};
|
||||
|
||||
const uncaught = err => {
|
||||
if (currentSpec) {
|
||||
currentSpec.onException(err);
|
||||
currentSpec.cancel();
|
||||
} else {
|
||||
console.error('Unhandled error');
|
||||
console.error(err.stack);
|
||||
}
|
||||
};
|
||||
|
||||
let oldListenersException;
|
||||
let oldListenersRejection;
|
||||
|
||||
const executionSetup = function () {
|
||||
// Need to ensure we are the only ones handling these exceptions.
|
||||
oldListenersException = process
|
||||
.listeners('uncaughtException')
|
||||
.slice();
|
||||
oldListenersRejection = process
|
||||
.listeners('unhandledRejection')
|
||||
.slice();
|
||||
j$.process.removeAllListeners('uncaughtException');
|
||||
j$.process.removeAllListeners('unhandledRejection');
|
||||
j$.process.on('uncaughtException', uncaught);
|
||||
j$.process.on('unhandledRejection', uncaught);
|
||||
};
|
||||
|
||||
const executionTeardown = function () {
|
||||
j$.process.removeListener('uncaughtException', uncaught);
|
||||
j$.process.removeListener('unhandledRejection', uncaught); // restore previous exception handlers
|
||||
|
||||
oldListenersException.forEach(listener => {
|
||||
j$.process.on('uncaughtException', listener);
|
||||
});
|
||||
oldListenersRejection.forEach(listener => {
|
||||
j$.process.on('unhandledRejection', listener);
|
||||
});
|
||||
};
|
||||
|
||||
this.execute = async function (runnablesToRun, suiteTree = topSuite) {
|
||||
if (!runnablesToRun) {
|
||||
if (focusedRunnables.length) {
|
||||
runnablesToRun = focusedRunnables;
|
||||
} else {
|
||||
runnablesToRun = [suiteTree.id];
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyExecutingSuites.length === 0) {
|
||||
executionSetup();
|
||||
}
|
||||
|
||||
const lastDeclarationSuite = currentDeclarationSuite;
|
||||
await (0, _treeProcessor.default)({
|
||||
nodeComplete(suite) {
|
||||
if (!suite.disabled) {
|
||||
clearResourcesForRunnable(suite.id);
|
||||
}
|
||||
|
||||
currentlyExecutingSuites.pop();
|
||||
|
||||
if (suite === topSuite) {
|
||||
reporter.jasmineDone({
|
||||
failedExpectations: topSuite.result.failedExpectations
|
||||
});
|
||||
} else {
|
||||
reporter.suiteDone(suite.getResult());
|
||||
}
|
||||
},
|
||||
|
||||
nodeStart(suite) {
|
||||
currentlyExecutingSuites.push(suite);
|
||||
defaultResourcesForRunnable(
|
||||
suite.id,
|
||||
suite.parentSuite && suite.parentSuite.id
|
||||
);
|
||||
|
||||
if (suite === topSuite) {
|
||||
reporter.jasmineStarted({
|
||||
totalSpecsDefined
|
||||
});
|
||||
} else {
|
||||
reporter.suiteStarted(suite.result);
|
||||
}
|
||||
},
|
||||
|
||||
queueRunnerFactory,
|
||||
runnableIds: runnablesToRun,
|
||||
tree: suiteTree
|
||||
});
|
||||
currentDeclarationSuite = lastDeclarationSuite;
|
||||
|
||||
if (currentlyExecutingSuites.length === 0) {
|
||||
executionTeardown();
|
||||
}
|
||||
};
|
||||
|
||||
this.addReporter = function (reporterToAdd) {
|
||||
reporter.addReporter(reporterToAdd);
|
||||
};
|
||||
|
||||
this.provideFallbackReporter = function (reporterToAdd) {
|
||||
reporter.provideFallbackReporter(reporterToAdd);
|
||||
};
|
||||
|
||||
this.clearReporters = function () {
|
||||
reporter.clearReporters();
|
||||
};
|
||||
|
||||
const spyRegistry = new j$.SpyRegistry({
|
||||
currentSpies() {
|
||||
if (!currentRunnable()) {
|
||||
throw new Error(
|
||||
'Spies must be created in a before function or a spec'
|
||||
);
|
||||
}
|
||||
|
||||
return runnableResources[currentRunnable().id].spies;
|
||||
}
|
||||
});
|
||||
|
||||
this.allowRespy = function (allow) {
|
||||
spyRegistry.allowRespy(allow);
|
||||
};
|
||||
|
||||
this.spyOn = function (...args) {
|
||||
return spyRegistry.spyOn.apply(spyRegistry, args);
|
||||
};
|
||||
|
||||
const suiteFactory = function (description) {
|
||||
const suite = new j$.Suite({
|
||||
id: getNextSuiteId(),
|
||||
description,
|
||||
parentSuite: currentDeclarationSuite,
|
||||
throwOnExpectationFailure,
|
||||
|
||||
getTestPath() {
|
||||
return j$.testPath;
|
||||
}
|
||||
});
|
||||
return suite;
|
||||
};
|
||||
|
||||
this.describe = function (description, specDefinitions) {
|
||||
const suite = suiteFactory(description);
|
||||
|
||||
if (specDefinitions === undefined) {
|
||||
throw new Error(
|
||||
`Missing second argument. It must be a callback function.`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof specDefinitions !== 'function') {
|
||||
throw new Error(
|
||||
`Invalid second argument, ${specDefinitions}. It must be a callback function.`
|
||||
);
|
||||
}
|
||||
|
||||
if (specDefinitions.length > 0) {
|
||||
throw new Error('describe does not expect any arguments');
|
||||
}
|
||||
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
suite.pend();
|
||||
}
|
||||
|
||||
if (currentDeclarationSuite.markedTodo) {
|
||||
// @ts-expect-error TODO Possible error: Suite does not have todo method
|
||||
suite.todo();
|
||||
}
|
||||
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
|
||||
this.xdescribe = function (description, specDefinitions) {
|
||||
const suite = suiteFactory(description);
|
||||
suite.pend();
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
|
||||
const focusedRunnables = [];
|
||||
|
||||
this.fdescribe = function (description, specDefinitions) {
|
||||
const suite = suiteFactory(description);
|
||||
suite.isFocused = true;
|
||||
focusedRunnables.push(suite.id);
|
||||
unfocusAncestor();
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
|
||||
const addSpecsToSuite = (suite, specDefinitions) => {
|
||||
const parentSuite = currentDeclarationSuite;
|
||||
parentSuite.addChild(suite);
|
||||
currentDeclarationSuite = suite;
|
||||
let declarationError = undefined;
|
||||
let describeReturnValue;
|
||||
|
||||
try {
|
||||
describeReturnValue = specDefinitions.call(suite);
|
||||
} catch (e) {
|
||||
declarationError = e;
|
||||
} // TODO throw in Jest 25: declarationError = new Error
|
||||
|
||||
if ((0, _jestUtil.isPromise)(describeReturnValue)) {
|
||||
console.log(
|
||||
(0, _jestMessageUtil.formatExecError)(
|
||||
new Error(
|
||||
_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.'
|
||||
)
|
||||
),
|
||||
{
|
||||
rootDir: '',
|
||||
testMatch: []
|
||||
},
|
||||
{
|
||||
noStackTrace: false
|
||||
}
|
||||
)
|
||||
);
|
||||
} else if (describeReturnValue !== undefined) {
|
||||
console.log(
|
||||
(0, _jestMessageUtil.formatExecError)(
|
||||
new Error(
|
||||
_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.'
|
||||
)
|
||||
),
|
||||
{
|
||||
rootDir: '',
|
||||
testMatch: []
|
||||
},
|
||||
{
|
||||
noStackTrace: false
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (declarationError) {
|
||||
this.it('encountered a declaration exception', () => {
|
||||
throw declarationError;
|
||||
});
|
||||
}
|
||||
|
||||
currentDeclarationSuite = parentSuite;
|
||||
};
|
||||
|
||||
function findFocusedAncestor(suite) {
|
||||
while (suite) {
|
||||
if (suite.isFocused) {
|
||||
return suite.id;
|
||||
}
|
||||
|
||||
suite = suite.parentSuite;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function unfocusAncestor() {
|
||||
const focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
|
||||
|
||||
if (focusedAncestor) {
|
||||
for (let i = 0; i < focusedRunnables.length; i++) {
|
||||
if (focusedRunnables[i] === focusedAncestor) {
|
||||
focusedRunnables.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const specFactory = (description, fn, suite, timeout) => {
|
||||
totalSpecsDefined++;
|
||||
const spec = new j$.Spec({
|
||||
id: getNextSpecId(),
|
||||
beforeAndAfterFns: beforeAndAfterFns(suite),
|
||||
resultCallback: specResultCallback,
|
||||
|
||||
getSpecName(spec) {
|
||||
return getSpecName(spec, suite);
|
||||
},
|
||||
|
||||
getTestPath() {
|
||||
return j$.testPath;
|
||||
},
|
||||
|
||||
onStart: specStarted,
|
||||
description,
|
||||
queueRunnerFactory,
|
||||
|
||||
userContext() {
|
||||
return suite.clonedSharedUserContext();
|
||||
},
|
||||
|
||||
queueableFn: {
|
||||
fn,
|
||||
|
||||
timeout() {
|
||||
return timeout || j$._DEFAULT_TIMEOUT_INTERVAL;
|
||||
}
|
||||
},
|
||||
throwOnExpectationFailure
|
||||
});
|
||||
|
||||
if (!this.specFilter(spec)) {
|
||||
spec.disable();
|
||||
}
|
||||
|
||||
return spec;
|
||||
|
||||
function specResultCallback(result) {
|
||||
clearResourcesForRunnable(spec.id);
|
||||
currentSpec = null;
|
||||
reporter.specDone(result);
|
||||
}
|
||||
|
||||
function specStarted(spec) {
|
||||
currentSpec = spec;
|
||||
defaultResourcesForRunnable(spec.id, suite.id);
|
||||
reporter.specStarted(spec.result);
|
||||
}
|
||||
};
|
||||
|
||||
this.it = function (description, fn, timeout) {
|
||||
if (typeof description !== 'string') {
|
||||
throw new Error(
|
||||
`Invalid first argument, ${description}. It must be a string.`
|
||||
);
|
||||
}
|
||||
|
||||
if (fn === undefined) {
|
||||
throw new Error(
|
||||
'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.'
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error(
|
||||
`Invalid second argument, ${fn}. It must be a callback function.`
|
||||
);
|
||||
}
|
||||
|
||||
const spec = specFactory(
|
||||
description,
|
||||
fn,
|
||||
currentDeclarationSuite,
|
||||
timeout
|
||||
);
|
||||
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
spec.pend();
|
||||
} // When a test is defined inside another, jasmine will not run it.
|
||||
// This check throws an error to warn the user about the edge-case.
|
||||
|
||||
if (currentSpec !== null) {
|
||||
throw new Error(
|
||||
`Tests cannot be nested. Test "${spec.description}" cannot run because it is nested within "${currentSpec.description}".`
|
||||
);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.xit = function (...args) {
|
||||
const spec = this.it.apply(this, args);
|
||||
spec.pend('Temporarily disabled with xit');
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.todo = function () {
|
||||
const description = arguments[0];
|
||||
|
||||
if (arguments.length !== 1 || typeof description !== 'string') {
|
||||
throw new _jestUtil.ErrorWithStack(
|
||||
'Todo must be called with only a description.',
|
||||
this.todo
|
||||
);
|
||||
}
|
||||
|
||||
const spec = specFactory(
|
||||
description,
|
||||
() => {},
|
||||
currentDeclarationSuite
|
||||
);
|
||||
spec.todo();
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.fit = function (description, fn, timeout) {
|
||||
const spec = specFactory(
|
||||
description,
|
||||
fn,
|
||||
currentDeclarationSuite,
|
||||
timeout
|
||||
);
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
focusedRunnables.push(spec.id);
|
||||
unfocusAncestor();
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.beforeEach = function (beforeEachFunction, timeout) {
|
||||
currentDeclarationSuite.beforeEach({
|
||||
fn: beforeEachFunction,
|
||||
|
||||
timeout() {
|
||||
return timeout || j$._DEFAULT_TIMEOUT_INTERVAL;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.beforeAll = function (beforeAllFunction, timeout) {
|
||||
currentDeclarationSuite.beforeAll({
|
||||
fn: beforeAllFunction,
|
||||
|
||||
timeout() {
|
||||
return timeout || j$._DEFAULT_TIMEOUT_INTERVAL;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.afterEach = function (afterEachFunction, timeout) {
|
||||
currentDeclarationSuite.afterEach({
|
||||
fn: afterEachFunction,
|
||||
|
||||
timeout() {
|
||||
return timeout || j$._DEFAULT_TIMEOUT_INTERVAL;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.afterAll = function (afterAllFunction, timeout) {
|
||||
currentDeclarationSuite.afterAll({
|
||||
fn: afterAllFunction,
|
||||
|
||||
timeout() {
|
||||
return timeout || j$._DEFAULT_TIMEOUT_INTERVAL;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.pending = function (message) {
|
||||
let fullMessage = j$.Spec.pendingSpecExceptionMessage;
|
||||
|
||||
if (message) {
|
||||
fullMessage += message;
|
||||
}
|
||||
|
||||
throw fullMessage;
|
||||
};
|
||||
|
||||
this.fail = function (error) {
|
||||
let checkIsError;
|
||||
let message;
|
||||
|
||||
if (
|
||||
error instanceof _assert.AssertionError ||
|
||||
(error && error.name === _assert.AssertionError.name)
|
||||
) {
|
||||
checkIsError = false; // @ts-expect-error TODO Possible error: j$.Spec does not have expand property
|
||||
|
||||
message = (0, _assertionErrorMessage.default)(error, {
|
||||
expand: j$.Spec.expand
|
||||
});
|
||||
} else {
|
||||
const check = (0, _isError.default)(error);
|
||||
checkIsError = check.isError;
|
||||
message = check.message;
|
||||
}
|
||||
|
||||
const errorAsErrorObject = checkIsError ? error : new Error(message);
|
||||
const runnable = currentRunnable();
|
||||
|
||||
if (!runnable) {
|
||||
errorAsErrorObject.message =
|
||||
'Caught error after test environment was torn down\n\n' +
|
||||
errorAsErrorObject.message;
|
||||
throw errorAsErrorObject;
|
||||
}
|
||||
|
||||
runnable.addExpectationResult(false, {
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: '',
|
||||
message,
|
||||
error: errorAsErrorObject
|
||||
});
|
||||
};
|
||||
}
|
||||
}),
|
||||
_temp
|
||||
);
|
||||
}
|
31
node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts
generated
vendored
Normal file
31
node_modules/jest-jasmine2/build/jasmine/JsApiReporter.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.
|
||||
*
|
||||
*/
|
||||
import type { Reporter, RunDetails } from '../types';
|
||||
import type { SpecResult } from './Spec';
|
||||
import type { SuiteResult } from './Suite';
|
||||
import type Timer from './Timer';
|
||||
export default class JsApiReporter implements Reporter {
|
||||
started: boolean;
|
||||
finished: boolean;
|
||||
runDetails: RunDetails;
|
||||
jasmineStarted: (runDetails: RunDetails) => void;
|
||||
jasmineDone: (runDetails: RunDetails) => void;
|
||||
status: () => unknown;
|
||||
executionTime: () => unknown;
|
||||
suiteStarted: (result: SuiteResult) => void;
|
||||
suiteDone: (result: SuiteResult) => void;
|
||||
suiteResults: (index: number, length: number) => Array<SuiteResult>;
|
||||
suites: () => Record<string, SuiteResult>;
|
||||
specResults: (index: number, length: number) => Array<SpecResult>;
|
||||
specDone: (result: SpecResult) => void;
|
||||
specs: () => Array<SpecResult>;
|
||||
specStarted: (spec: SpecResult) => void;
|
||||
constructor(options: {
|
||||
timer?: Timer;
|
||||
});
|
||||
}
|
173
node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js
generated
vendored
Normal file
173
node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js
generated
vendored
Normal file
|
@ -0,0 +1,173 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return 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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
const noopTimer = {
|
||||
start() {},
|
||||
|
||||
elapsed() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class JsApiReporter {
|
||||
constructor(options) {
|
||||
_defineProperty(this, 'started', void 0);
|
||||
|
||||
_defineProperty(this, 'finished', void 0);
|
||||
|
||||
_defineProperty(this, 'runDetails', void 0);
|
||||
|
||||
_defineProperty(this, 'jasmineStarted', void 0);
|
||||
|
||||
_defineProperty(this, 'jasmineDone', void 0);
|
||||
|
||||
_defineProperty(this, 'status', void 0);
|
||||
|
||||
_defineProperty(this, 'executionTime', void 0);
|
||||
|
||||
_defineProperty(this, 'suiteStarted', void 0);
|
||||
|
||||
_defineProperty(this, 'suiteDone', void 0);
|
||||
|
||||
_defineProperty(this, 'suiteResults', void 0);
|
||||
|
||||
_defineProperty(this, 'suites', void 0);
|
||||
|
||||
_defineProperty(this, 'specResults', void 0);
|
||||
|
||||
_defineProperty(this, 'specDone', void 0);
|
||||
|
||||
_defineProperty(this, 'specs', void 0);
|
||||
|
||||
_defineProperty(this, 'specStarted', void 0);
|
||||
|
||||
const timer = options.timer || noopTimer;
|
||||
let status = 'loaded';
|
||||
this.started = false;
|
||||
this.finished = false;
|
||||
this.runDetails = {};
|
||||
|
||||
this.jasmineStarted = () => {
|
||||
this.started = true;
|
||||
status = 'started';
|
||||
timer.start();
|
||||
};
|
||||
|
||||
let executionTime;
|
||||
|
||||
function validateAfterAllExceptions({failedExpectations}) {
|
||||
if (failedExpectations && failedExpectations.length > 0) {
|
||||
throw failedExpectations[0];
|
||||
}
|
||||
}
|
||||
|
||||
this.jasmineDone = function (runDetails) {
|
||||
validateAfterAllExceptions(runDetails);
|
||||
this.finished = true;
|
||||
this.runDetails = runDetails;
|
||||
executionTime = timer.elapsed();
|
||||
status = 'done';
|
||||
};
|
||||
|
||||
this.status = function () {
|
||||
return status;
|
||||
};
|
||||
|
||||
const suites = [];
|
||||
const suites_hash = {};
|
||||
|
||||
this.specStarted = function () {};
|
||||
|
||||
this.suiteStarted = function (result) {
|
||||
suites_hash[result.id] = result;
|
||||
};
|
||||
|
||||
this.suiteDone = function (result) {
|
||||
storeSuite(result);
|
||||
};
|
||||
|
||||
this.suiteResults = function (index, length) {
|
||||
return suites.slice(index, index + length);
|
||||
};
|
||||
|
||||
function storeSuite(result) {
|
||||
suites.push(result);
|
||||
suites_hash[result.id] = result;
|
||||
}
|
||||
|
||||
this.suites = function () {
|
||||
return suites_hash;
|
||||
};
|
||||
|
||||
const specs = [];
|
||||
|
||||
this.specDone = function (result) {
|
||||
specs.push(result);
|
||||
};
|
||||
|
||||
this.specResults = function (index, length) {
|
||||
return specs.slice(index, index + length);
|
||||
};
|
||||
|
||||
this.specs = function () {
|
||||
return specs;
|
||||
};
|
||||
|
||||
this.executionTime = function () {
|
||||
return executionTime;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = JsApiReporter;
|
22
node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts
generated
vendored
Normal file
22
node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* 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 { Reporter, RunDetails } from '../types';
|
||||
import type { SpecResult } from './Spec';
|
||||
import type { SuiteResult } from './Suite';
|
||||
export default class ReportDispatcher implements Reporter {
|
||||
addReporter: (reporter: Reporter) => void;
|
||||
provideFallbackReporter: (reporter: Reporter) => void;
|
||||
clearReporters: () => void;
|
||||
jasmineDone: (runDetails: RunDetails) => void;
|
||||
jasmineStarted: (runDetails: RunDetails) => void;
|
||||
specDone: (result: SpecResult) => void;
|
||||
specStarted: (spec: SpecResult) => void;
|
||||
suiteDone: (result: SuiteResult) => void;
|
||||
suiteStarted: (result: SuiteResult) => void;
|
||||
constructor(methods: Array<keyof Reporter>);
|
||||
}
|
125
node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js
generated
vendored
Normal file
125
node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return 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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
class ReportDispatcher {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error
|
||||
constructor(methods) {
|
||||
_defineProperty(this, 'addReporter', void 0);
|
||||
|
||||
_defineProperty(this, 'provideFallbackReporter', void 0);
|
||||
|
||||
_defineProperty(this, 'clearReporters', void 0);
|
||||
|
||||
_defineProperty(this, 'jasmineDone', void 0);
|
||||
|
||||
_defineProperty(this, 'jasmineStarted', void 0);
|
||||
|
||||
_defineProperty(this, 'specDone', void 0);
|
||||
|
||||
_defineProperty(this, 'specStarted', void 0);
|
||||
|
||||
_defineProperty(this, 'suiteDone', void 0);
|
||||
|
||||
_defineProperty(this, 'suiteStarted', void 0);
|
||||
|
||||
const dispatchedMethods = methods || [];
|
||||
|
||||
for (let i = 0; i < dispatchedMethods.length; i++) {
|
||||
const method = dispatchedMethods[i];
|
||||
|
||||
this[method] = (function (m) {
|
||||
return function () {
|
||||
dispatch(m, arguments);
|
||||
};
|
||||
})(method);
|
||||
}
|
||||
|
||||
let reporters = [];
|
||||
let fallbackReporter = null;
|
||||
|
||||
this.addReporter = function (reporter) {
|
||||
reporters.push(reporter);
|
||||
};
|
||||
|
||||
this.provideFallbackReporter = function (reporter) {
|
||||
fallbackReporter = reporter;
|
||||
};
|
||||
|
||||
this.clearReporters = function () {
|
||||
reporters = [];
|
||||
};
|
||||
|
||||
return this;
|
||||
|
||||
function dispatch(method, args) {
|
||||
if (reporters.length === 0 && fallbackReporter !== null) {
|
||||
reporters.push(fallbackReporter);
|
||||
}
|
||||
|
||||
for (let i = 0; i < reporters.length; i++) {
|
||||
const reporter = reporters[i];
|
||||
|
||||
if (reporter[method]) {
|
||||
// @ts-expect-error
|
||||
reporter[method].apply(reporter, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = ReportDispatcher;
|
81
node_modules/jest-jasmine2/build/jasmine/Spec.d.ts
generated
vendored
Normal file
81
node_modules/jest-jasmine2/build/jasmine/Spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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 { FailedAssertion, Milliseconds, Status } from '@jest/test-result';
|
||||
import ExpectationFailed from '../ExpectationFailed';
|
||||
import expectationResultFactory, { Options as ExpectationResultFactoryOptions } from '../expectationResultFactory';
|
||||
import type { QueueableFn, default as queueRunner } from '../queueRunner';
|
||||
import type { AssertionErrorWithStack } from '../types';
|
||||
export declare type Attributes = {
|
||||
id: string;
|
||||
resultCallback: (result: Spec['result']) => void;
|
||||
description: string;
|
||||
throwOnExpectationFailure: unknown;
|
||||
getTestPath: () => Config.Path;
|
||||
queueableFn: QueueableFn;
|
||||
beforeAndAfterFns: () => {
|
||||
befores: Array<QueueableFn>;
|
||||
afters: Array<QueueableFn>;
|
||||
};
|
||||
userContext: () => unknown;
|
||||
onStart: (context: Spec) => void;
|
||||
getSpecName: (spec: Spec) => string;
|
||||
queueRunnerFactory: typeof queueRunner;
|
||||
};
|
||||
export declare type SpecResult = {
|
||||
id: string;
|
||||
description: string;
|
||||
fullName: string;
|
||||
duration?: Milliseconds;
|
||||
failedExpectations: Array<FailedAssertion>;
|
||||
testPath: Config.Path;
|
||||
passedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
|
||||
pendingReason: string;
|
||||
status: Status;
|
||||
__callsite?: {
|
||||
getColumnNumber: () => number;
|
||||
getLineNumber: () => number;
|
||||
};
|
||||
};
|
||||
export default class Spec {
|
||||
id: string;
|
||||
description: string;
|
||||
resultCallback: (result: SpecResult) => void;
|
||||
queueableFn: QueueableFn;
|
||||
beforeAndAfterFns: () => {
|
||||
befores: Array<QueueableFn>;
|
||||
afters: Array<QueueableFn>;
|
||||
};
|
||||
userContext: () => unknown;
|
||||
onStart: (spec: Spec) => void;
|
||||
getSpecName: (spec: Spec) => string;
|
||||
queueRunnerFactory: typeof queueRunner;
|
||||
throwOnExpectationFailure: boolean;
|
||||
initError: Error;
|
||||
result: SpecResult;
|
||||
disabled?: boolean;
|
||||
currentRun?: ReturnType<typeof queueRunner>;
|
||||
markedTodo?: boolean;
|
||||
markedPending?: boolean;
|
||||
expand?: boolean;
|
||||
static pendingSpecExceptionMessage: string;
|
||||
static isPendingSpecException(e: Error): boolean;
|
||||
constructor(attrs: Attributes);
|
||||
addExpectationResult(passed: boolean, data: ExpectationResultFactoryOptions, isError?: boolean): void;
|
||||
execute(onComplete?: () => void, enabled?: boolean): void;
|
||||
cancel(): void;
|
||||
onException(error: ExpectationFailed | AssertionErrorWithStack): void;
|
||||
disable(): void;
|
||||
pend(message?: string): void;
|
||||
todo(): void;
|
||||
getResult(): SpecResult;
|
||||
status(enabled?: boolean): "todo" | "passed" | "failed" | "pending" | "disabled";
|
||||
isExecutable(): boolean;
|
||||
getFullName(): string;
|
||||
isAssertionError(error: Error): boolean;
|
||||
}
|
298
node_modules/jest-jasmine2/build/jasmine/Spec.js
generated
vendored
Normal file
298
node_modules/jest-jasmine2/build/jasmine/Spec.js
generated
vendored
Normal file
|
@ -0,0 +1,298 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _assert = require('assert');
|
||||
|
||||
var _ExpectationFailed = _interopRequireDefault(
|
||||
require('../ExpectationFailed')
|
||||
);
|
||||
|
||||
var _expectationResultFactory = _interopRequireDefault(
|
||||
require('../expectationResultFactory')
|
||||
);
|
||||
|
||||
var _assertionErrorMessage = _interopRequireDefault(
|
||||
require('../assertionErrorMessage')
|
||||
);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
class Spec {
|
||||
static isPendingSpecException(e) {
|
||||
return !!(
|
||||
e &&
|
||||
e.toString &&
|
||||
e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1
|
||||
);
|
||||
}
|
||||
|
||||
constructor(attrs) {
|
||||
_defineProperty(this, 'id', void 0);
|
||||
|
||||
_defineProperty(this, 'description', void 0);
|
||||
|
||||
_defineProperty(this, 'resultCallback', void 0);
|
||||
|
||||
_defineProperty(this, 'queueableFn', void 0);
|
||||
|
||||
_defineProperty(this, 'beforeAndAfterFns', void 0);
|
||||
|
||||
_defineProperty(this, 'userContext', void 0);
|
||||
|
||||
_defineProperty(this, 'onStart', void 0);
|
||||
|
||||
_defineProperty(this, 'getSpecName', void 0);
|
||||
|
||||
_defineProperty(this, 'queueRunnerFactory', void 0);
|
||||
|
||||
_defineProperty(this, 'throwOnExpectationFailure', void 0);
|
||||
|
||||
_defineProperty(this, 'initError', void 0);
|
||||
|
||||
_defineProperty(this, 'result', void 0);
|
||||
|
||||
_defineProperty(this, 'disabled', void 0);
|
||||
|
||||
_defineProperty(this, 'currentRun', void 0);
|
||||
|
||||
_defineProperty(this, 'markedTodo', void 0);
|
||||
|
||||
_defineProperty(this, 'markedPending', void 0);
|
||||
|
||||
_defineProperty(this, 'expand', void 0);
|
||||
|
||||
this.resultCallback = attrs.resultCallback || function () {};
|
||||
|
||||
this.id = attrs.id;
|
||||
this.description = attrs.description || '';
|
||||
this.queueableFn = attrs.queueableFn;
|
||||
|
||||
this.beforeAndAfterFns =
|
||||
attrs.beforeAndAfterFns ||
|
||||
function () {
|
||||
return {
|
||||
befores: [],
|
||||
afters: []
|
||||
};
|
||||
};
|
||||
|
||||
this.userContext =
|
||||
attrs.userContext ||
|
||||
function () {
|
||||
return {};
|
||||
};
|
||||
|
||||
this.onStart = attrs.onStart || function () {};
|
||||
|
||||
this.getSpecName =
|
||||
attrs.getSpecName ||
|
||||
function () {
|
||||
return '';
|
||||
};
|
||||
|
||||
this.queueRunnerFactory = attrs.queueRunnerFactory || function () {};
|
||||
|
||||
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
||||
this.initError = new Error();
|
||||
this.initError.name = ''; // Without this line v8 stores references to all closures
|
||||
// in the stack in the Error object. This line stringifies the stack
|
||||
// property to allow garbage-collecting objects on the stack
|
||||
// https://crbug.com/v8/7142
|
||||
|
||||
this.initError.stack = this.initError.stack;
|
||||
this.queueableFn.initError = this.initError; // @ts-expect-error
|
||||
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
passedExpectations: [],
|
||||
pendingReason: '',
|
||||
testPath: attrs.getTestPath()
|
||||
};
|
||||
}
|
||||
|
||||
addExpectationResult(passed, data, isError) {
|
||||
const expectationResult = (0, _expectationResultFactory.default)(
|
||||
data,
|
||||
this.initError
|
||||
);
|
||||
|
||||
if (passed) {
|
||||
this.result.passedExpectations.push(expectationResult);
|
||||
} else {
|
||||
this.result.failedExpectations.push(expectationResult);
|
||||
|
||||
if (this.throwOnExpectationFailure && !isError) {
|
||||
throw new _ExpectationFailed.default();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
execute(onComplete, enabled) {
|
||||
const self = this;
|
||||
this.onStart(this);
|
||||
|
||||
if (
|
||||
!this.isExecutable() ||
|
||||
this.markedPending ||
|
||||
this.markedTodo ||
|
||||
enabled === false
|
||||
) {
|
||||
complete(enabled);
|
||||
return;
|
||||
}
|
||||
|
||||
const fns = this.beforeAndAfterFns();
|
||||
const allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
|
||||
this.currentRun = this.queueRunnerFactory({
|
||||
queueableFns: allFns,
|
||||
|
||||
onException() {
|
||||
// @ts-expect-error
|
||||
self.onException.apply(self, arguments);
|
||||
},
|
||||
|
||||
userContext: this.userContext(),
|
||||
setTimeout,
|
||||
clearTimeout,
|
||||
fail: () => {}
|
||||
});
|
||||
this.currentRun.then(() => complete(true));
|
||||
|
||||
function complete(enabledAgain) {
|
||||
self.result.status = self.status(enabledAgain);
|
||||
self.resultCallback(self.result);
|
||||
|
||||
if (onComplete) {
|
||||
onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cancel() {
|
||||
if (this.currentRun) {
|
||||
this.currentRun.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
onException(error) {
|
||||
if (Spec.isPendingSpecException(error)) {
|
||||
this.pend(extractCustomPendingMessage(error));
|
||||
return;
|
||||
}
|
||||
|
||||
if (error instanceof _ExpectationFailed.default) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.addExpectationResult(
|
||||
false,
|
||||
{
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: '',
|
||||
error: this.isAssertionError(error)
|
||||
? (0, _assertionErrorMessage.default)(error, {
|
||||
expand: this.expand
|
||||
})
|
||||
: error
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
disable() {
|
||||
this.disabled = true;
|
||||
}
|
||||
|
||||
pend(message) {
|
||||
this.markedPending = true;
|
||||
|
||||
if (message) {
|
||||
this.result.pendingReason = message;
|
||||
}
|
||||
}
|
||||
|
||||
todo() {
|
||||
this.markedTodo = true;
|
||||
}
|
||||
|
||||
getResult() {
|
||||
this.result.status = this.status();
|
||||
return this.result;
|
||||
}
|
||||
|
||||
status(enabled) {
|
||||
if (this.disabled || enabled === false) {
|
||||
return 'disabled';
|
||||
}
|
||||
|
||||
if (this.markedTodo) {
|
||||
return 'todo';
|
||||
}
|
||||
|
||||
if (this.markedPending) {
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
if (this.result.failedExpectations.length > 0) {
|
||||
return 'failed';
|
||||
} else {
|
||||
return 'passed';
|
||||
}
|
||||
}
|
||||
|
||||
isExecutable() {
|
||||
return !this.disabled;
|
||||
}
|
||||
|
||||
getFullName() {
|
||||
return this.getSpecName(this);
|
||||
}
|
||||
|
||||
isAssertionError(error) {
|
||||
return (
|
||||
error instanceof _assert.AssertionError ||
|
||||
(error && error.name === _assert.AssertionError.name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = Spec;
|
||||
|
||||
_defineProperty(Spec, 'pendingSpecExceptionMessage', void 0);
|
||||
|
||||
Spec.pendingSpecExceptionMessage = '=> marked Pending';
|
||||
|
||||
const extractCustomPendingMessage = function (e) {
|
||||
const fullMessage = e.toString();
|
||||
const boilerplateStart = fullMessage.indexOf(
|
||||
Spec.pendingSpecExceptionMessage
|
||||
);
|
||||
const boilerplateEnd =
|
||||
boilerplateStart + Spec.pendingSpecExceptionMessage.length;
|
||||
return fullMessage.substr(boilerplateEnd);
|
||||
};
|
22
node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts
generated
vendored
Normal file
22
node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* 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 class SpyStrategy {
|
||||
identity: () => string;
|
||||
exec: (...args: Array<any>) => unknown;
|
||||
callThrough: () => unknown;
|
||||
returnValue: (value: unknown) => unknown;
|
||||
returnValues: () => unknown;
|
||||
throwError: (something: string | Error) => unknown;
|
||||
callFake: (fn: Function) => unknown;
|
||||
stub: (fn: Function) => unknown;
|
||||
constructor({ name, fn, getSpy, }?: {
|
||||
name?: string;
|
||||
fn?: Function;
|
||||
getSpy?: () => unknown;
|
||||
});
|
||||
}
|
141
node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js
generated
vendored
Normal file
141
node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js
generated
vendored
Normal file
|
@ -0,0 +1,141 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return 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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
class SpyStrategy {
|
||||
constructor({
|
||||
name = 'unknown',
|
||||
fn = function () {},
|
||||
getSpy = function () {}
|
||||
} = {}) {
|
||||
_defineProperty(this, 'identity', void 0);
|
||||
|
||||
_defineProperty(this, 'exec', void 0);
|
||||
|
||||
_defineProperty(this, 'callThrough', void 0);
|
||||
|
||||
_defineProperty(this, 'returnValue', void 0);
|
||||
|
||||
_defineProperty(this, 'returnValues', void 0);
|
||||
|
||||
_defineProperty(this, 'throwError', void 0);
|
||||
|
||||
_defineProperty(this, 'callFake', void 0);
|
||||
|
||||
_defineProperty(this, 'stub', void 0);
|
||||
|
||||
const identity = name;
|
||||
const originalFn = fn;
|
||||
|
||||
let plan = function () {};
|
||||
|
||||
this.identity = function () {
|
||||
return identity;
|
||||
};
|
||||
|
||||
this.exec = function () {
|
||||
return plan.apply(this, arguments);
|
||||
};
|
||||
|
||||
this.callThrough = function () {
|
||||
plan = originalFn;
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.returnValue = function (value) {
|
||||
plan = function () {
|
||||
return value;
|
||||
};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.returnValues = function () {
|
||||
const values = Array.prototype.slice.call(arguments);
|
||||
|
||||
plan = function () {
|
||||
return values.shift();
|
||||
};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.throwError = function (something) {
|
||||
const error =
|
||||
something instanceof Error ? something : new Error(something);
|
||||
|
||||
plan = function () {
|
||||
throw error;
|
||||
};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.callFake = function (fn) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error(
|
||||
'Argument passed to callFake should be a function, got ' + fn
|
||||
);
|
||||
}
|
||||
|
||||
plan = fn;
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.stub = function (_fn) {
|
||||
plan = function () {};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = SpyStrategy;
|
61
node_modules/jest-jasmine2/build/jasmine/Suite.d.ts
generated
vendored
Normal file
61
node_modules/jest-jasmine2/build/jasmine/Suite.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* 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 expectationResultFactory from '../expectationResultFactory';
|
||||
import type { QueueableFn } from '../queueRunner';
|
||||
import type Spec from './Spec';
|
||||
export declare type SuiteResult = {
|
||||
id: string;
|
||||
description: string;
|
||||
fullName: string;
|
||||
failedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
|
||||
testPath: Config.Path;
|
||||
status?: string;
|
||||
};
|
||||
export declare type Attributes = {
|
||||
id: string;
|
||||
parentSuite?: Suite;
|
||||
description: string;
|
||||
throwOnExpectationFailure?: boolean;
|
||||
getTestPath: () => Config.Path;
|
||||
};
|
||||
export default class Suite {
|
||||
id: string;
|
||||
parentSuite?: Suite;
|
||||
description: string;
|
||||
throwOnExpectationFailure: boolean;
|
||||
beforeFns: Array<QueueableFn>;
|
||||
afterFns: Array<QueueableFn>;
|
||||
beforeAllFns: Array<QueueableFn>;
|
||||
afterAllFns: Array<QueueableFn>;
|
||||
disabled: boolean;
|
||||
children: Array<Suite | Spec>;
|
||||
result: SuiteResult;
|
||||
sharedContext?: object;
|
||||
markedPending: boolean;
|
||||
markedTodo: boolean;
|
||||
isFocused: boolean;
|
||||
constructor(attrs: Attributes);
|
||||
getFullName(): string;
|
||||
disable(): void;
|
||||
pend(_message?: string): void;
|
||||
beforeEach(fn: QueueableFn): void;
|
||||
beforeAll(fn: QueueableFn): void;
|
||||
afterEach(fn: QueueableFn): void;
|
||||
afterAll(fn: QueueableFn): void;
|
||||
addChild(child: Suite | Spec): void;
|
||||
status(): "failed" | "pending" | "disabled" | "finished";
|
||||
isExecutable(): boolean;
|
||||
canBeReentered(): boolean;
|
||||
getResult(): SuiteResult;
|
||||
sharedUserContext(): object;
|
||||
clonedSharedUserContext(): object;
|
||||
onException(...args: Parameters<Spec['onException']>): void;
|
||||
addExpectationResult(...args: Parameters<Spec['addExpectationResult']>): void;
|
||||
execute(..._args: Array<any>): void;
|
||||
}
|
235
node_modules/jest-jasmine2/build/jasmine/Suite.js
generated
vendored
Normal file
235
node_modules/jest-jasmine2/build/jasmine/Suite.js
generated
vendored
Normal file
|
@ -0,0 +1,235 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _ExpectationFailed = _interopRequireDefault(
|
||||
require('../ExpectationFailed')
|
||||
);
|
||||
|
||||
var _expectationResultFactory = _interopRequireDefault(
|
||||
require('../expectationResultFactory')
|
||||
);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
class Suite {
|
||||
constructor(attrs) {
|
||||
_defineProperty(this, 'id', void 0);
|
||||
|
||||
_defineProperty(this, 'parentSuite', void 0);
|
||||
|
||||
_defineProperty(this, 'description', void 0);
|
||||
|
||||
_defineProperty(this, 'throwOnExpectationFailure', void 0);
|
||||
|
||||
_defineProperty(this, 'beforeFns', void 0);
|
||||
|
||||
_defineProperty(this, 'afterFns', void 0);
|
||||
|
||||
_defineProperty(this, 'beforeAllFns', void 0);
|
||||
|
||||
_defineProperty(this, 'afterAllFns', void 0);
|
||||
|
||||
_defineProperty(this, 'disabled', void 0);
|
||||
|
||||
_defineProperty(this, 'children', void 0);
|
||||
|
||||
_defineProperty(this, 'result', void 0);
|
||||
|
||||
_defineProperty(this, 'sharedContext', void 0);
|
||||
|
||||
_defineProperty(this, 'markedPending', void 0);
|
||||
|
||||
_defineProperty(this, 'markedTodo', void 0);
|
||||
|
||||
_defineProperty(this, 'isFocused', void 0);
|
||||
|
||||
this.markedPending = false;
|
||||
this.markedTodo = false;
|
||||
this.isFocused = false;
|
||||
this.id = attrs.id;
|
||||
this.parentSuite = attrs.parentSuite;
|
||||
this.description = (0, _jestUtil.convertDescriptorToString)(
|
||||
attrs.description
|
||||
);
|
||||
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
||||
this.beforeFns = [];
|
||||
this.afterFns = [];
|
||||
this.beforeAllFns = [];
|
||||
this.afterAllFns = [];
|
||||
this.disabled = false;
|
||||
this.children = [];
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
testPath: attrs.getTestPath()
|
||||
};
|
||||
}
|
||||
|
||||
getFullName() {
|
||||
const fullName = [];
|
||||
|
||||
for (
|
||||
let parentSuite = this;
|
||||
parentSuite;
|
||||
parentSuite = parentSuite.parentSuite
|
||||
) {
|
||||
if (parentSuite.parentSuite) {
|
||||
fullName.unshift(parentSuite.description);
|
||||
}
|
||||
}
|
||||
|
||||
return fullName.join(' ');
|
||||
}
|
||||
|
||||
disable() {
|
||||
this.disabled = true;
|
||||
}
|
||||
|
||||
pend(_message) {
|
||||
this.markedPending = true;
|
||||
}
|
||||
|
||||
beforeEach(fn) {
|
||||
this.beforeFns.unshift(fn);
|
||||
}
|
||||
|
||||
beforeAll(fn) {
|
||||
this.beforeAllFns.push(fn);
|
||||
}
|
||||
|
||||
afterEach(fn) {
|
||||
this.afterFns.unshift(fn);
|
||||
}
|
||||
|
||||
afterAll(fn) {
|
||||
this.afterAllFns.unshift(fn);
|
||||
}
|
||||
|
||||
addChild(child) {
|
||||
this.children.push(child);
|
||||
}
|
||||
|
||||
status() {
|
||||
if (this.disabled) {
|
||||
return 'disabled';
|
||||
}
|
||||
|
||||
if (this.markedPending) {
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
if (this.result.failedExpectations.length > 0) {
|
||||
return 'failed';
|
||||
} else {
|
||||
return 'finished';
|
||||
}
|
||||
}
|
||||
|
||||
isExecutable() {
|
||||
return !this.disabled;
|
||||
}
|
||||
|
||||
canBeReentered() {
|
||||
return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0;
|
||||
}
|
||||
|
||||
getResult() {
|
||||
this.result.status = this.status();
|
||||
return this.result;
|
||||
}
|
||||
|
||||
sharedUserContext() {
|
||||
if (!this.sharedContext) {
|
||||
this.sharedContext = {};
|
||||
}
|
||||
|
||||
return this.sharedContext;
|
||||
}
|
||||
|
||||
clonedSharedUserContext() {
|
||||
return this.sharedUserContext();
|
||||
}
|
||||
|
||||
onException(...args) {
|
||||
if (args[0] instanceof _ExpectationFailed.default) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAfterAll(this.children)) {
|
||||
const data = {
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: '',
|
||||
error: arguments[0]
|
||||
};
|
||||
this.result.failedExpectations.push(
|
||||
(0, _expectationResultFactory.default)(data)
|
||||
);
|
||||
} else {
|
||||
for (let i = 0; i < this.children.length; i++) {
|
||||
const child = this.children[i];
|
||||
child.onException.apply(child, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addExpectationResult(...args) {
|
||||
if (isAfterAll(this.children) && isFailure(args)) {
|
||||
const data = args[1];
|
||||
this.result.failedExpectations.push(
|
||||
(0, _expectationResultFactory.default)(data)
|
||||
);
|
||||
|
||||
if (this.throwOnExpectationFailure) {
|
||||
throw new _ExpectationFailed.default();
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < this.children.length; i++) {
|
||||
const child = this.children[i];
|
||||
|
||||
try {
|
||||
child.addExpectationResult.apply(child, args);
|
||||
} catch {
|
||||
// keep going
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
execute(..._args) {}
|
||||
}
|
||||
|
||||
exports.default = Suite;
|
||||
|
||||
function isAfterAll(children) {
|
||||
return children && children[0] && children[0].result.status;
|
||||
}
|
||||
|
||||
function isFailure(args) {
|
||||
return !args[0];
|
||||
}
|
14
node_modules/jest-jasmine2/build/jasmine/Timer.d.ts
generated
vendored
Normal file
14
node_modules/jest-jasmine2/build/jasmine/Timer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
export default class Timer {
|
||||
start: () => void;
|
||||
elapsed: () => number;
|
||||
constructor(options?: {
|
||||
now?: () => number;
|
||||
});
|
||||
}
|
79
node_modules/jest-jasmine2/build/jasmine/Timer.js
generated
vendored
Normal file
79
node_modules/jest-jasmine2/build/jasmine/Timer.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return 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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
const defaultNow = (function (Date) {
|
||||
return function () {
|
||||
return new Date().getTime();
|
||||
};
|
||||
})(Date);
|
||||
|
||||
class Timer {
|
||||
constructor(options) {
|
||||
_defineProperty(this, 'start', void 0);
|
||||
|
||||
_defineProperty(this, 'elapsed', void 0);
|
||||
|
||||
options = options || {};
|
||||
const now = options.now || defaultNow;
|
||||
let startTime;
|
||||
|
||||
this.start = function () {
|
||||
startTime = now();
|
||||
};
|
||||
|
||||
this.elapsed = function () {
|
||||
return now() - startTime;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = Timer;
|
13
node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts
generated
vendored
Normal file
13
node_modules/jest-jasmine2/build/jasmine/createSpy.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 { Spy } from '../types';
|
||||
interface Fn extends Record<string, any> {
|
||||
(): any;
|
||||
}
|
||||
declare function createSpy(name: string, originalFn: Fn): Spy;
|
||||
export default createSpy;
|
88
node_modules/jest-jasmine2/build/jasmine/createSpy.js
generated
vendored
Normal file
88
node_modules/jest-jasmine2/build/jasmine/createSpy.js
generated
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _CallTracker = _interopRequireDefault(require('./CallTracker'));
|
||||
|
||||
var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy'));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
function createSpy(name, originalFn) {
|
||||
const spyStrategy = new _SpyStrategy.default({
|
||||
name,
|
||||
fn: originalFn,
|
||||
|
||||
getSpy() {
|
||||
return spy;
|
||||
}
|
||||
});
|
||||
const callTracker = new _CallTracker.default();
|
||||
|
||||
const spy = function (...args) {
|
||||
const callData = {
|
||||
object: this,
|
||||
args: Array.prototype.slice.apply(arguments)
|
||||
};
|
||||
callTracker.track(callData);
|
||||
const returnValue = spyStrategy.exec.apply(this, args);
|
||||
callData.returnValue = returnValue;
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
for (const prop in originalFn) {
|
||||
if (prop === 'and' || prop === 'calls') {
|
||||
throw new Error(
|
||||
"Jasmine spies would overwrite the 'and' and 'calls' properties " +
|
||||
'on the object being spied upon'
|
||||
);
|
||||
}
|
||||
|
||||
spy[prop] = originalFn[prop];
|
||||
}
|
||||
|
||||
spy.and = spyStrategy;
|
||||
spy.calls = callTracker;
|
||||
return spy;
|
||||
}
|
||||
|
||||
var _default = createSpy;
|
||||
exports.default = _default;
|
27
node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts
generated
vendored
Normal file
27
node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* 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 { Jasmine, SpecDefinitionsFn } from '../types';
|
||||
import JsApiReporter from './JsApiReporter';
|
||||
export declare const create: (createOptions: Record<string, any>) => Jasmine;
|
||||
export declare const _interface: (jasmine: Jasmine, env: any) => {
|
||||
describe(description: string, specDefinitions: SpecDefinitionsFn): any;
|
||||
xdescribe(description: string, specDefinitions: SpecDefinitionsFn): any;
|
||||
fdescribe(description: string, specDefinitions: SpecDefinitionsFn): any;
|
||||
it(): any;
|
||||
xit(): any;
|
||||
fit(): any;
|
||||
beforeEach(): any;
|
||||
afterEach(): any;
|
||||
beforeAll(): any;
|
||||
afterAll(): any;
|
||||
pending(): any;
|
||||
fail(): any;
|
||||
spyOn(obj: Record<string, any>, methodName: string, accessType?: string | undefined): any;
|
||||
jsApiReporter: JsApiReporter;
|
||||
jasmine: Jasmine;
|
||||
};
|
171
node_modules/jest-jasmine2/build/jasmine/jasmineLight.js
generated
vendored
Normal file
171
node_modules/jest-jasmine2/build/jasmine/jasmineLight.js
generated
vendored
Normal file
|
@ -0,0 +1,171 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports._interface = exports.create = void 0;
|
||||
|
||||
var _createSpy = _interopRequireDefault(require('./createSpy'));
|
||||
|
||||
var _Env = _interopRequireDefault(require('./Env'));
|
||||
|
||||
var _JsApiReporter = _interopRequireDefault(require('./JsApiReporter'));
|
||||
|
||||
var _ReportDispatcher = _interopRequireDefault(require('./ReportDispatcher'));
|
||||
|
||||
var _Spec = _interopRequireDefault(require('./Spec'));
|
||||
|
||||
var _spyRegistry = _interopRequireDefault(require('./spyRegistry'));
|
||||
|
||||
var _Suite = _interopRequireDefault(require('./Suite'));
|
||||
|
||||
var _Timer = _interopRequireDefault(require('./Timer'));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
// This file is a heavily modified fork of Jasmine. Original license:
|
||||
|
||||
/*
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
const create = function (createOptions) {
|
||||
const j$ = {...createOptions};
|
||||
j$._DEFAULT_TIMEOUT_INTERVAL = createOptions.testTimeout || 5000;
|
||||
|
||||
j$.getEnv = function (options) {
|
||||
const env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options)); //jasmine. singletons in here (setTimeout blah blah).
|
||||
|
||||
return env;
|
||||
};
|
||||
|
||||
j$.createSpy = _createSpy.default;
|
||||
j$.Env = (0, _Env.default)(j$);
|
||||
j$.JsApiReporter = _JsApiReporter.default;
|
||||
j$.ReportDispatcher = _ReportDispatcher.default;
|
||||
j$.Spec = _Spec.default;
|
||||
j$.SpyRegistry = _spyRegistry.default;
|
||||
j$.Suite = _Suite.default;
|
||||
j$.Timer = _Timer.default;
|
||||
j$.version = '2.5.2-light';
|
||||
return j$;
|
||||
}; // Interface is a reserved word in strict mode, so can't export it as ESM
|
||||
|
||||
exports.create = create;
|
||||
|
||||
const _interface = function (jasmine, env) {
|
||||
const jasmineInterface = {
|
||||
describe(description, specDefinitions) {
|
||||
return env.describe(description, specDefinitions);
|
||||
},
|
||||
|
||||
xdescribe(description, specDefinitions) {
|
||||
return env.xdescribe(description, specDefinitions);
|
||||
},
|
||||
|
||||
fdescribe(description, specDefinitions) {
|
||||
return env.fdescribe(description, specDefinitions);
|
||||
},
|
||||
|
||||
it() {
|
||||
return env.it.apply(env, arguments);
|
||||
},
|
||||
|
||||
xit() {
|
||||
return env.xit.apply(env, arguments);
|
||||
},
|
||||
|
||||
fit() {
|
||||
return env.fit.apply(env, arguments);
|
||||
},
|
||||
|
||||
beforeEach() {
|
||||
if (typeof arguments[0] !== 'function') {
|
||||
throw new Error(
|
||||
'Invalid first argument. It must be a callback function.'
|
||||
);
|
||||
}
|
||||
|
||||
return env.beforeEach.apply(env, arguments);
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
if (typeof arguments[0] !== 'function') {
|
||||
throw new Error(
|
||||
'Invalid first argument. It must be a callback function.'
|
||||
);
|
||||
}
|
||||
|
||||
return env.afterEach.apply(env, arguments);
|
||||
},
|
||||
|
||||
beforeAll() {
|
||||
if (typeof arguments[0] !== 'function') {
|
||||
throw new Error(
|
||||
'Invalid first argument. It must be a callback function.'
|
||||
);
|
||||
}
|
||||
|
||||
return env.beforeAll.apply(env, arguments);
|
||||
},
|
||||
|
||||
afterAll() {
|
||||
if (typeof arguments[0] !== 'function') {
|
||||
throw new Error(
|
||||
'Invalid first argument. It must be a callback function.'
|
||||
);
|
||||
}
|
||||
|
||||
return env.afterAll.apply(env, arguments);
|
||||
},
|
||||
|
||||
pending() {
|
||||
return env.pending.apply(env, arguments);
|
||||
},
|
||||
|
||||
fail() {
|
||||
return env.fail.apply(env, arguments);
|
||||
},
|
||||
|
||||
spyOn(obj, methodName, accessType) {
|
||||
return env.spyOn(obj, methodName, accessType);
|
||||
},
|
||||
|
||||
jsApiReporter: new jasmine.JsApiReporter({
|
||||
timer: new jasmine.Timer()
|
||||
}),
|
||||
jasmine
|
||||
};
|
||||
return jasmineInterface;
|
||||
};
|
||||
|
||||
exports._interface = _interface;
|
18
node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts
generated
vendored
Normal file
18
node_modules/jest-jasmine2/build/jasmine/spyRegistry.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 { Spy } from '../types';
|
||||
export default class SpyRegistry {
|
||||
allowRespy: (allow: unknown) => void;
|
||||
spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: keyof PropertyDescriptor) => Spy;
|
||||
clearSpies: () => void;
|
||||
respy: unknown;
|
||||
private _spyOnProperty;
|
||||
constructor({ currentSpies, }?: {
|
||||
currentSpies?: () => Array<Spy>;
|
||||
});
|
||||
}
|
222
node_modules/jest-jasmine2/build/jasmine/spyRegistry.js
generated
vendored
Normal file
222
node_modules/jest-jasmine2/build/jasmine/spyRegistry.js
generated
vendored
Normal file
|
@ -0,0 +1,222 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _CallTracker = _interopRequireDefault(require('./CallTracker'));
|
||||
|
||||
var _createSpy = _interopRequireDefault(require('./createSpy'));
|
||||
|
||||
var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
const formatErrorMsg = (domain, usage) => {
|
||||
const usageDefinition = usage ? '\nUsage: ' + usage : '';
|
||||
return msg => domain + ' : ' + msg + usageDefinition;
|
||||
};
|
||||
|
||||
function isSpy(putativeSpy) {
|
||||
if (!putativeSpy) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
putativeSpy.and instanceof _SpyStrategy.default &&
|
||||
putativeSpy.calls instanceof _CallTracker.default
|
||||
);
|
||||
}
|
||||
|
||||
const getErrorMsg = formatErrorMsg('<spyOn>', 'spyOn(<object>, <methodName>)');
|
||||
|
||||
class SpyRegistry {
|
||||
constructor({currentSpies = () => []} = {}) {
|
||||
_defineProperty(this, 'allowRespy', void 0);
|
||||
|
||||
_defineProperty(this, 'spyOn', void 0);
|
||||
|
||||
_defineProperty(this, 'clearSpies', void 0);
|
||||
|
||||
_defineProperty(this, 'respy', void 0);
|
||||
|
||||
_defineProperty(this, '_spyOnProperty', void 0);
|
||||
|
||||
this.allowRespy = function (allow) {
|
||||
this.respy = allow;
|
||||
};
|
||||
|
||||
this.spyOn = (obj, methodName, accessType) => {
|
||||
if (accessType) {
|
||||
return this._spyOnProperty(obj, methodName, accessType);
|
||||
}
|
||||
|
||||
if (obj === void 0) {
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'could not find an object to spy upon for ' + methodName + '()'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (methodName === void 0) {
|
||||
throw new Error(getErrorMsg('No method name supplied'));
|
||||
}
|
||||
|
||||
if (obj[methodName] === void 0) {
|
||||
throw new Error(getErrorMsg(methodName + '() method does not exist'));
|
||||
}
|
||||
|
||||
if (obj[methodName] && isSpy(obj[methodName])) {
|
||||
if (this.respy) {
|
||||
return obj[methodName];
|
||||
} else {
|
||||
throw new Error(
|
||||
getErrorMsg(methodName + ' has already been spied upon')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let descriptor;
|
||||
|
||||
try {
|
||||
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
|
||||
} catch {
|
||||
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||
}
|
||||
|
||||
if (descriptor && !(descriptor.writable || descriptor.set)) {
|
||||
throw new Error(
|
||||
getErrorMsg(methodName + ' is not declared writable or has no setter')
|
||||
);
|
||||
}
|
||||
|
||||
const originalMethod = obj[methodName];
|
||||
const spiedMethod = (0, _createSpy.default)(methodName, originalMethod);
|
||||
let restoreStrategy;
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(obj, methodName)) {
|
||||
restoreStrategy = function () {
|
||||
obj[methodName] = originalMethod;
|
||||
};
|
||||
} else {
|
||||
restoreStrategy = function () {
|
||||
if (!delete obj[methodName]) {
|
||||
obj[methodName] = originalMethod;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
currentSpies().push({
|
||||
restoreObjectToOriginalState: restoreStrategy
|
||||
});
|
||||
obj[methodName] = spiedMethod;
|
||||
return spiedMethod;
|
||||
};
|
||||
|
||||
this._spyOnProperty = function (obj, propertyName, accessType = 'get') {
|
||||
if (!obj) {
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'could not find an object to spy upon for ' + propertyName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (!propertyName) {
|
||||
throw new Error(getErrorMsg('No property name supplied'));
|
||||
}
|
||||
|
||||
let descriptor;
|
||||
|
||||
try {
|
||||
descriptor = Object.getOwnPropertyDescriptor(obj, propertyName);
|
||||
} catch {
|
||||
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||
}
|
||||
|
||||
if (!descriptor) {
|
||||
throw new Error(getErrorMsg(propertyName + ' property does not exist'));
|
||||
}
|
||||
|
||||
if (!descriptor.configurable) {
|
||||
throw new Error(
|
||||
getErrorMsg(propertyName + ' is not declared configurable')
|
||||
);
|
||||
}
|
||||
|
||||
if (!descriptor[accessType]) {
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'Property ' +
|
||||
propertyName +
|
||||
' does not have access type ' +
|
||||
accessType
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (obj[propertyName] && isSpy(obj[propertyName])) {
|
||||
if (this.respy) {
|
||||
return obj[propertyName];
|
||||
} else {
|
||||
throw new Error(
|
||||
getErrorMsg(propertyName + ' has already been spied upon')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const originalDescriptor = descriptor;
|
||||
const spiedProperty = (0, _createSpy.default)(
|
||||
propertyName,
|
||||
descriptor[accessType]
|
||||
);
|
||||
let restoreStrategy;
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(obj, propertyName)) {
|
||||
restoreStrategy = function () {
|
||||
Object.defineProperty(obj, propertyName, originalDescriptor);
|
||||
};
|
||||
} else {
|
||||
restoreStrategy = function () {
|
||||
delete obj[propertyName];
|
||||
};
|
||||
}
|
||||
|
||||
currentSpies().push({
|
||||
restoreObjectToOriginalState: restoreStrategy
|
||||
});
|
||||
const spiedDescriptor = {...descriptor, [accessType]: spiedProperty};
|
||||
Object.defineProperty(obj, propertyName, spiedDescriptor);
|
||||
return spiedProperty;
|
||||
};
|
||||
|
||||
this.clearSpies = function () {
|
||||
const spies = currentSpies();
|
||||
|
||||
for (let i = spies.length - 1; i >= 0; i--) {
|
||||
const spyEntry = spies[i];
|
||||
spyEntry.restoreObjectToOriginalState();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = SpyRegistry;
|
12
node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts
generated
vendored
Normal file
12
node_modules/jest-jasmine2/build/jasmineAsyncInstall.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.
|
||||
*/
|
||||
/**
|
||||
* This module adds ability to test async promise code with jasmine by
|
||||
* returning a promise from `it/test` and `before/afterEach/All` blocks.
|
||||
*/
|
||||
import type { Config, Global } from '@jest/types';
|
||||
export default function jasmineAsyncInstall(globalConfig: Config.GlobalConfig, global: Global.Global): void;
|
190
node_modules/jest-jasmine2/build/jasmineAsyncInstall.js
generated
vendored
Normal file
190
node_modules/jest-jasmine2/build/jasmineAsyncInstall.js
generated
vendored
Normal file
|
@ -0,0 +1,190 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = jasmineAsyncInstall;
|
||||
|
||||
var _co = _interopRequireDefault(require('co'));
|
||||
|
||||
var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn'));
|
||||
|
||||
var _throat = _interopRequireDefault(require('throat'));
|
||||
|
||||
var _isError = _interopRequireDefault(require('./isError'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
function isPromise(obj) {
|
||||
return obj && typeof obj.then === 'function';
|
||||
}
|
||||
|
||||
const doneFnNoop = () => {};
|
||||
|
||||
doneFnNoop.fail = () => {};
|
||||
|
||||
function promisifyLifeCycleFunction(originalFn, env) {
|
||||
return function (fn, timeout) {
|
||||
if (!fn) {
|
||||
// @ts-expect-error: missing fn arg is handled by originalFn
|
||||
return originalFn.call(env);
|
||||
}
|
||||
|
||||
const hasDoneCallback = typeof fn === 'function' && fn.length > 0;
|
||||
|
||||
if (hasDoneCallback) {
|
||||
// Jasmine will handle it
|
||||
return originalFn.call(env, fn, timeout);
|
||||
}
|
||||
|
||||
const extraError = new Error(); // Without this line v8 stores references to all closures
|
||||
// in the stack in the Error object. This line stringifies the stack
|
||||
// property to allow garbage-collecting objects on the stack
|
||||
// https://crbug.com/v8/7142
|
||||
|
||||
extraError.stack = extraError.stack; // We make *all* functions async and run `done` right away if they
|
||||
// didn't return a promise.
|
||||
|
||||
const asyncJestLifecycle = function (done) {
|
||||
const wrappedFn = (0, _isGeneratorFn.default)(fn)
|
||||
? _co.default.wrap(fn)
|
||||
: fn;
|
||||
const returnValue = wrappedFn.call({}, doneFnNoop);
|
||||
|
||||
if (isPromise(returnValue)) {
|
||||
returnValue.then(done.bind(null, null), error => {
|
||||
const {isError: checkIsError, message} = (0, _isError.default)(error);
|
||||
|
||||
if (message) {
|
||||
extraError.message = message;
|
||||
}
|
||||
|
||||
done.fail(checkIsError ? error : extraError);
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
return originalFn.call(env, asyncJestLifecycle, timeout);
|
||||
};
|
||||
} // Similar to promisifyLifeCycleFunction but throws an error
|
||||
// when the return value is neither a Promise nor `undefined`
|
||||
|
||||
function promisifyIt(originalFn, env, jasmine) {
|
||||
return function (specName, fn, timeout) {
|
||||
if (!fn) {
|
||||
// @ts-expect-error: missing fn arg is handled by originalFn
|
||||
const spec = originalFn.call(env, specName);
|
||||
spec.pend('not implemented');
|
||||
return spec;
|
||||
}
|
||||
|
||||
const hasDoneCallback = fn.length > 0;
|
||||
|
||||
if (hasDoneCallback) {
|
||||
return originalFn.call(env, specName, fn, timeout);
|
||||
}
|
||||
|
||||
const extraError = new Error(); // Without this line v8 stores references to all closures
|
||||
// in the stack in the Error object. This line stringifies the stack
|
||||
// property to allow garbage-collecting objects on the stack
|
||||
// https://crbug.com/v8/7142
|
||||
|
||||
extraError.stack = extraError.stack;
|
||||
|
||||
const asyncJestTest = function (done) {
|
||||
const wrappedFn = (0, _isGeneratorFn.default)(fn)
|
||||
? _co.default.wrap(fn)
|
||||
: fn;
|
||||
const returnValue = wrappedFn.call({}, doneFnNoop);
|
||||
|
||||
if (isPromise(returnValue)) {
|
||||
returnValue.then(done.bind(null, null), error => {
|
||||
const {isError: checkIsError, message} = (0, _isError.default)(error);
|
||||
|
||||
if (message) {
|
||||
extraError.message = message;
|
||||
}
|
||||
|
||||
if (jasmine.Spec.isPendingSpecException(error)) {
|
||||
env.pending(message);
|
||||
done();
|
||||
} else {
|
||||
done.fail(checkIsError ? error : extraError);
|
||||
}
|
||||
});
|
||||
} else if (returnValue === undefined) {
|
||||
done();
|
||||
} else {
|
||||
done.fail(
|
||||
new Error(
|
||||
'Jest: `it` and `test` must return either a Promise or undefined.'
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return originalFn.call(env, specName, asyncJestTest, timeout);
|
||||
};
|
||||
}
|
||||
|
||||
function makeConcurrent(originalFn, env, mutex) {
|
||||
const concurrentFn = function (specName, fn, timeout) {
|
||||
let promise = Promise.resolve();
|
||||
const spec = originalFn.call(env, specName, () => promise, timeout);
|
||||
|
||||
if (env != null && !env.specFilter(spec)) {
|
||||
return spec;
|
||||
}
|
||||
|
||||
try {
|
||||
promise = mutex(() => {
|
||||
const promise = fn();
|
||||
|
||||
if (isPromise(promise)) {
|
||||
return promise;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Jest: concurrent test "${spec.getFullName()}" must return a Promise.`
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
promise = Promise.reject(error);
|
||||
}
|
||||
|
||||
return spec;
|
||||
}; // each is binded after the function is made concurrent, so for now it is made noop
|
||||
|
||||
concurrentFn.each = () => {};
|
||||
|
||||
return concurrentFn;
|
||||
}
|
||||
|
||||
function jasmineAsyncInstall(globalConfig, global) {
|
||||
const jasmine = global.jasmine;
|
||||
const mutex = (0, _throat.default)(globalConfig.maxConcurrency);
|
||||
const env = jasmine.getEnv();
|
||||
env.it = promisifyIt(env.it, env, jasmine);
|
||||
env.fit = promisifyIt(env.fit, env, jasmine);
|
||||
|
||||
global.it.concurrent = (env => {
|
||||
const concurrent = makeConcurrent(env.it, env, mutex);
|
||||
concurrent.only = makeConcurrent(env.fit, env, mutex);
|
||||
concurrent.skip = makeConcurrent(env.xit, env, mutex);
|
||||
return concurrent;
|
||||
})(env);
|
||||
|
||||
global.fit.concurrent = makeConcurrent(env.fit, env, mutex);
|
||||
env.afterAll = promisifyLifeCycleFunction(env.afterAll, env);
|
||||
env.afterEach = promisifyLifeCycleFunction(env.afterEach, env);
|
||||
env.beforeAll = promisifyLifeCycleFunction(env.beforeAll, env);
|
||||
env.beforeEach = promisifyLifeCycleFunction(env.beforeEach, env);
|
||||
}
|
10
node_modules/jest-jasmine2/build/jestExpect.d.ts
generated
vendored
Normal file
10
node_modules/jest-jasmine2/build/jestExpect.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.
|
||||
*/
|
||||
declare const _default: (config: {
|
||||
expand: boolean;
|
||||
}) => void;
|
||||
export default _default;
|
69
node_modules/jest-jasmine2/build/jestExpect.js
generated
vendored
Normal file
69
node_modules/jest-jasmine2/build/jestExpect.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
'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 => {
|
||||
global.expect = _expect.default;
|
||||
|
||||
_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;
|
||||
const jasmine = global.jasmine;
|
||||
jasmine.anything = _expect.default.anything;
|
||||
jasmine.any = _expect.default.any;
|
||||
jasmine.objectContaining = _expect.default.objectContaining;
|
||||
jasmine.arrayContaining = _expect.default.arrayContaining;
|
||||
jasmine.stringMatching = _expect.default.stringMatching;
|
||||
|
||||
jasmine.addMatchers = jasmineMatchersObject => {
|
||||
const jestMatchersObject = Object.create(null);
|
||||
Object.keys(jasmineMatchersObject).forEach(name => {
|
||||
jestMatchersObject[name] = function (...args) {
|
||||
// use "expect.extend" if you need to use equality testers (via this.equal)
|
||||
const result = jasmineMatchersObject[name](null, null); // if there is no 'negativeCompare', both should be handled by `compare`
|
||||
|
||||
const negativeCompare = result.negativeCompare || result.compare;
|
||||
return this.isNot
|
||||
? negativeCompare.apply(
|
||||
null, // @ts-expect-error
|
||||
args
|
||||
)
|
||||
: result.compare.apply(
|
||||
null, // @ts-expect-error
|
||||
args
|
||||
);
|
||||
};
|
||||
});
|
||||
const expect = global.expect;
|
||||
expect.extend(jestMatchersObject);
|
||||
};
|
||||
};
|
||||
|
||||
exports.default = _default;
|
7
node_modules/jest-jasmine2/build/pTimeout.d.ts
generated
vendored
Normal file
7
node_modules/jest-jasmine2/build/pTimeout.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 pTimeout(promise: Promise<void>, ms: number, clearTimeout: NodeJS.Global['clearTimeout'], setTimeout: NodeJS.Global['setTimeout'], onTimeout: () => void): Promise<void>;
|
33
node_modules/jest-jasmine2/build/pTimeout.js
generated
vendored
Normal file
33
node_modules/jest-jasmine2/build/pTimeout.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = pTimeout;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// A specialized version of `p-timeout` that does not touch globals.
|
||||
// It does not throw on timeout.
|
||||
function pTimeout(promise, ms, clearTimeout, setTimeout, onTimeout) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => resolve(onTimeout()), ms);
|
||||
promise.then(
|
||||
val => {
|
||||
clearTimeout(timer);
|
||||
resolve(val);
|
||||
},
|
||||
err => {
|
||||
clearTimeout(timer);
|
||||
reject(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
30
node_modules/jest-jasmine2/build/queueRunner.d.ts
generated
vendored
Normal file
30
node_modules/jest-jasmine2/build/queueRunner.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
declare type Global = NodeJS.Global;
|
||||
export declare type Options = {
|
||||
clearTimeout: Global['clearTimeout'];
|
||||
fail: (error: Error) => void;
|
||||
onException: (error: Error) => void;
|
||||
queueableFns: Array<QueueableFn>;
|
||||
setTimeout: Global['setTimeout'];
|
||||
userContext: any;
|
||||
};
|
||||
export interface DoneFn {
|
||||
(error?: any): void;
|
||||
fail: (error: Error) => void;
|
||||
}
|
||||
export declare type QueueableFn = {
|
||||
fn: (done: DoneFn) => void;
|
||||
timeout?: () => number;
|
||||
initError?: Error;
|
||||
};
|
||||
declare type PromiseCallback = (() => void | PromiseLike<void>) | undefined | null;
|
||||
export default function queueRunner(options: Options): PromiseLike<void> & {
|
||||
cancel: () => void;
|
||||
catch: (onRejected?: PromiseCallback) => Promise<void>;
|
||||
};
|
||||
export {};
|
83
node_modules/jest-jasmine2/build/queueRunner.js
generated
vendored
Normal file
83
node_modules/jest-jasmine2/build/queueRunner.js
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = queueRunner;
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _PCancelable = _interopRequireDefault(require('./PCancelable'));
|
||||
|
||||
var _pTimeout = _interopRequireDefault(require('./pTimeout'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
function queueRunner(options) {
|
||||
const token = new _PCancelable.default((onCancel, resolve) => {
|
||||
onCancel(resolve);
|
||||
});
|
||||
|
||||
const mapper = ({fn, timeout, initError = new Error()}) => {
|
||||
let promise = new Promise(resolve => {
|
||||
const next = function (...args) {
|
||||
const err = args[0];
|
||||
|
||||
if (err) {
|
||||
options.fail.apply(null, args);
|
||||
}
|
||||
|
||||
resolve();
|
||||
};
|
||||
|
||||
next.fail = function (...args) {
|
||||
options.fail.apply(null, args);
|
||||
resolve();
|
||||
};
|
||||
|
||||
try {
|
||||
fn.call(options.userContext, next);
|
||||
} catch (e) {
|
||||
options.onException(e);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
promise = Promise.race([promise, token]);
|
||||
|
||||
if (!timeout) {
|
||||
return promise;
|
||||
}
|
||||
|
||||
const timeoutMs = timeout();
|
||||
return (0, _pTimeout.default)(
|
||||
promise,
|
||||
timeoutMs,
|
||||
options.clearTimeout,
|
||||
options.setTimeout,
|
||||
() => {
|
||||
initError.message =
|
||||
'Timeout - Async callback was not invoked within the ' +
|
||||
(0, _jestUtil.formatTime)(timeoutMs) +
|
||||
' timeout specified by jest.setTimeout.';
|
||||
initError.stack = initError.message + initError.stack;
|
||||
options.onException(initError);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const result = options.queueableFns.reduce(
|
||||
(promise, fn) => promise.then(() => mapper(fn)),
|
||||
Promise.resolve()
|
||||
);
|
||||
return {
|
||||
cancel: token.cancel.bind(token),
|
||||
catch: result.catch.bind(result),
|
||||
then: result.then.bind(result)
|
||||
};
|
||||
}
|
31
node_modules/jest-jasmine2/build/reporter.d.ts
generated
vendored
Normal file
31
node_modules/jest-jasmine2/build/reporter.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.
|
||||
*/
|
||||
import type { Config } from '@jest/types';
|
||||
import { TestResult } from '@jest/test-result';
|
||||
import type { SpecResult } from './jasmine/Spec';
|
||||
import type { SuiteResult } from './jasmine/Suite';
|
||||
import type { Reporter, RunDetails } from './types';
|
||||
export default class Jasmine2Reporter implements Reporter {
|
||||
private _testResults;
|
||||
private _globalConfig;
|
||||
private _config;
|
||||
private _currentSuites;
|
||||
private _resolve;
|
||||
private _resultsPromise;
|
||||
private _startTimes;
|
||||
private _testPath;
|
||||
constructor(globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, testPath: Config.Path);
|
||||
jasmineStarted(_runDetails: RunDetails): void;
|
||||
specStarted(spec: SpecResult): void;
|
||||
specDone(result: SpecResult): void;
|
||||
suiteStarted(suite: SuiteResult): void;
|
||||
suiteDone(_result: SuiteResult): void;
|
||||
jasmineDone(_runDetails: RunDetails): void;
|
||||
getResults(): Promise<TestResult>;
|
||||
private _addMissingMessageToStack;
|
||||
private _extractSpecResults;
|
||||
}
|
177
node_modules/jest-jasmine2/build/reporter.js
generated
vendored
Normal file
177
node_modules/jest-jasmine2/build/reporter.js
generated
vendored
Normal file
|
@ -0,0 +1,177 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _testResult = require('@jest/test-result');
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
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;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
class Jasmine2Reporter {
|
||||
constructor(globalConfig, config, testPath) {
|
||||
_defineProperty(this, '_testResults', void 0);
|
||||
|
||||
_defineProperty(this, '_globalConfig', void 0);
|
||||
|
||||
_defineProperty(this, '_config', void 0);
|
||||
|
||||
_defineProperty(this, '_currentSuites', void 0);
|
||||
|
||||
_defineProperty(this, '_resolve', void 0);
|
||||
|
||||
_defineProperty(this, '_resultsPromise', void 0);
|
||||
|
||||
_defineProperty(this, '_startTimes', void 0);
|
||||
|
||||
_defineProperty(this, '_testPath', void 0);
|
||||
|
||||
this._globalConfig = globalConfig;
|
||||
this._config = config;
|
||||
this._testPath = testPath;
|
||||
this._testResults = [];
|
||||
this._currentSuites = [];
|
||||
this._resolve = null;
|
||||
this._resultsPromise = new Promise(resolve => (this._resolve = resolve));
|
||||
this._startTimes = new Map();
|
||||
}
|
||||
|
||||
jasmineStarted(_runDetails) {}
|
||||
|
||||
specStarted(spec) {
|
||||
this._startTimes.set(spec.id, jestNow());
|
||||
}
|
||||
|
||||
specDone(result) {
|
||||
this._testResults.push(
|
||||
this._extractSpecResults(result, this._currentSuites.slice(0))
|
||||
);
|
||||
}
|
||||
|
||||
suiteStarted(suite) {
|
||||
this._currentSuites.push(suite.description);
|
||||
}
|
||||
|
||||
suiteDone(_result) {
|
||||
this._currentSuites.pop();
|
||||
}
|
||||
|
||||
jasmineDone(_runDetails) {
|
||||
let numFailingTests = 0;
|
||||
let numPassingTests = 0;
|
||||
let numPendingTests = 0;
|
||||
let numTodoTests = 0;
|
||||
const testResults = this._testResults;
|
||||
testResults.forEach(testResult => {
|
||||
if (testResult.status === 'failed') {
|
||||
numFailingTests++;
|
||||
} else if (testResult.status === 'pending') {
|
||||
numPendingTests++;
|
||||
} else if (testResult.status === 'todo') {
|
||||
numTodoTests++;
|
||||
} else {
|
||||
numPassingTests++;
|
||||
}
|
||||
});
|
||||
const testResult = {
|
||||
...(0, _testResult.createEmptyTestResult)(),
|
||||
console: null,
|
||||
failureMessage: (0, _jestMessageUtil.formatResultsErrors)(
|
||||
testResults,
|
||||
this._config,
|
||||
this._globalConfig,
|
||||
this._testPath
|
||||
),
|
||||
numFailingTests,
|
||||
numPassingTests,
|
||||
numPendingTests,
|
||||
numTodoTests,
|
||||
snapshot: {
|
||||
added: 0,
|
||||
fileDeleted: false,
|
||||
matched: 0,
|
||||
unchecked: 0,
|
||||
unmatched: 0,
|
||||
updated: 0
|
||||
},
|
||||
testFilePath: this._testPath,
|
||||
testResults
|
||||
};
|
||||
|
||||
this._resolve(testResult);
|
||||
}
|
||||
|
||||
getResults() {
|
||||
return this._resultsPromise;
|
||||
}
|
||||
|
||||
_addMissingMessageToStack(stack, message) {
|
||||
// Some errors (e.g. Angular injection error) don't prepend error.message
|
||||
// to stack, instead the first line of the stack is just plain 'Error'
|
||||
const ERROR_REGEX = /^Error:?\s*\n/;
|
||||
|
||||
if (stack && message && !stack.includes(message)) {
|
||||
return message + stack.replace(ERROR_REGEX, '\n');
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
_extractSpecResults(specResult, ancestorTitles) {
|
||||
const start = this._startTimes.get(specResult.id);
|
||||
|
||||
const duration = start ? jestNow() - start : undefined;
|
||||
const status =
|
||||
specResult.status === 'disabled' ? 'pending' : specResult.status;
|
||||
const location = specResult.__callsite
|
||||
? {
|
||||
column: specResult.__callsite.getColumnNumber(),
|
||||
line: specResult.__callsite.getLineNumber()
|
||||
}
|
||||
: null;
|
||||
const results = {
|
||||
ancestorTitles,
|
||||
duration,
|
||||
failureDetails: [],
|
||||
failureMessages: [],
|
||||
fullName: specResult.fullName,
|
||||
location,
|
||||
numPassingAsserts: 0,
|
||||
// Jasmine2 only returns an array of failed asserts.
|
||||
status,
|
||||
title: specResult.description
|
||||
};
|
||||
specResult.failedExpectations.forEach(failed => {
|
||||
const message =
|
||||
!failed.matcherName && failed.stack
|
||||
? this._addMissingMessageToStack(failed.stack, failed.message)
|
||||
: failed.message || '';
|
||||
results.failureMessages.push(message);
|
||||
results.failureDetails.push(failed);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = Jasmine2Reporter;
|
17
node_modules/jest-jasmine2/build/setup_jest_globals.d.ts
generated
vendored
Normal file
17
node_modules/jest-jasmine2/build/setup_jest_globals.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* 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 { Plugin } from 'pretty-format';
|
||||
import { SnapshotStateType } from 'jest-snapshot';
|
||||
export declare type SetupOptions = {
|
||||
config: Config.ProjectConfig;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
localRequire: (moduleName: string) => Plugin;
|
||||
testPath: Config.Path;
|
||||
};
|
||||
declare const _default: ({ config, globalConfig, localRequire, testPath, }: SetupOptions) => SnapshotStateType;
|
||||
export default _default;
|
114
node_modules/jest-jasmine2/build/setup_jest_globals.js
generated
vendored
Normal file
114
node_modules/jest-jasmine2/build/setup_jest_globals.js
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _expect = require('expect');
|
||||
|
||||
var _jestSnapshot = require('jest-snapshot');
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// Get suppressed errors form jest-matchers that weren't throw during
|
||||
// test execution and add them to the test result, potentially failing
|
||||
// a passing test.
|
||||
const addSuppressedErrors = result => {
|
||||
const {suppressedErrors} = (0, _expect.getState)();
|
||||
(0, _expect.setState)({
|
||||
suppressedErrors: []
|
||||
});
|
||||
|
||||
if (suppressedErrors.length) {
|
||||
result.status = 'failed';
|
||||
result.failedExpectations = suppressedErrors.map(error => ({
|
||||
actual: '',
|
||||
// passing error for custom test reporters
|
||||
error,
|
||||
expected: '',
|
||||
matcherName: '',
|
||||
message: error.message,
|
||||
passed: false,
|
||||
stack: error.stack
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const addAssertionErrors = result => {
|
||||
const assertionErrors = (0, _expect.extractExpectedAssertionsErrors)();
|
||||
|
||||
if (assertionErrors.length) {
|
||||
const jasmineErrors = assertionErrors.map(({actual, error, expected}) => ({
|
||||
actual,
|
||||
expected,
|
||||
message: error.stack,
|
||||
passed: false
|
||||
}));
|
||||
result.status = 'failed';
|
||||
result.failedExpectations = result.failedExpectations.concat(jasmineErrors);
|
||||
}
|
||||
};
|
||||
|
||||
const patchJasmine = () => {
|
||||
global.jasmine.Spec = (realSpec => {
|
||||
class Spec extends realSpec {
|
||||
constructor(attr) {
|
||||
const resultCallback = attr.resultCallback;
|
||||
|
||||
attr.resultCallback = function (result) {
|
||||
addSuppressedErrors(result);
|
||||
addAssertionErrors(result);
|
||||
resultCallback.call(attr, result);
|
||||
};
|
||||
|
||||
const onStart = attr.onStart;
|
||||
|
||||
attr.onStart = context => {
|
||||
(0, _expect.setState)({
|
||||
currentTestName: context.getFullName()
|
||||
});
|
||||
onStart && onStart.call(attr, context);
|
||||
};
|
||||
|
||||
super(attr);
|
||||
}
|
||||
}
|
||||
|
||||
return Spec;
|
||||
})(global.jasmine.Spec);
|
||||
};
|
||||
|
||||
var _default = ({config, globalConfig, localRequire, testPath}) => {
|
||||
// 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));
|
||||
});
|
||||
patchJasmine();
|
||||
const {expand, updateSnapshot} = globalConfig;
|
||||
const snapshotResolver = (0, _jestSnapshot.buildSnapshotResolver)(config);
|
||||
const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath);
|
||||
const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, {
|
||||
expand,
|
||||
getBabelTraverse: () => require('@babel/traverse').default,
|
||||
getPrettier: () =>
|
||||
config.prettierPath ? require(config.prettierPath) : null,
|
||||
updateSnapshot
|
||||
});
|
||||
(0, _expect.setState)({
|
||||
snapshotState,
|
||||
testPath
|
||||
}); // Return it back to the outer scope (test runner outside the VM).
|
||||
|
||||
return snapshotState;
|
||||
};
|
||||
|
||||
exports.default = _default;
|
26
node_modules/jest-jasmine2/build/treeProcessor.d.ts
generated
vendored
Normal file
26
node_modules/jest-jasmine2/build/treeProcessor.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* 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 Suite from './jasmine/Suite';
|
||||
declare type Options = {
|
||||
nodeComplete: (suite: TreeNode) => void;
|
||||
nodeStart: (suite: TreeNode) => void;
|
||||
queueRunnerFactory: any;
|
||||
runnableIds: Array<string>;
|
||||
tree: TreeNode;
|
||||
};
|
||||
export declare type TreeNode = {
|
||||
afterAllFns: Array<any>;
|
||||
beforeAllFns: Array<any>;
|
||||
disabled?: boolean;
|
||||
execute: (onComplete: () => void, enabled: boolean) => void;
|
||||
id: string;
|
||||
onException: (error: Error) => void;
|
||||
sharedUserContext: () => any;
|
||||
children?: Array<TreeNode>;
|
||||
} & Pick<Suite, 'getResult' | 'parentSuite' | 'result' | 'markedPending'>;
|
||||
export default function treeProcessor(options: Options): void;
|
||||
export {};
|
79
node_modules/jest-jasmine2/build/treeProcessor.js
generated
vendored
Normal file
79
node_modules/jest-jasmine2/build/treeProcessor.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = treeProcessor;
|
||||
|
||||
/**
|
||||
* 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 treeProcessor(options) {
|
||||
const {
|
||||
nodeComplete,
|
||||
nodeStart,
|
||||
queueRunnerFactory,
|
||||
runnableIds,
|
||||
tree
|
||||
} = options;
|
||||
|
||||
function isEnabled(node, parentEnabled) {
|
||||
return parentEnabled || runnableIds.indexOf(node.id) !== -1;
|
||||
}
|
||||
|
||||
function getNodeHandler(node, parentEnabled) {
|
||||
const enabled = isEnabled(node, parentEnabled);
|
||||
return node.children
|
||||
? getNodeWithChildrenHandler(node, enabled)
|
||||
: getNodeWithoutChildrenHandler(node, enabled);
|
||||
}
|
||||
|
||||
function getNodeWithoutChildrenHandler(node, enabled) {
|
||||
return function fn(done = () => {}) {
|
||||
node.execute(done, enabled);
|
||||
};
|
||||
}
|
||||
|
||||
function getNodeWithChildrenHandler(node, enabled) {
|
||||
return async function fn(done = () => {}) {
|
||||
nodeStart(node);
|
||||
await queueRunnerFactory({
|
||||
onException: error => node.onException(error),
|
||||
queueableFns: wrapChildren(node, enabled),
|
||||
userContext: node.sharedUserContext()
|
||||
});
|
||||
nodeComplete(node);
|
||||
done();
|
||||
};
|
||||
}
|
||||
|
||||
function hasNoEnabledTest(node) {
|
||||
if (node.children) {
|
||||
return node.children.every(hasNoEnabledTest);
|
||||
}
|
||||
|
||||
return node.disabled || node.markedPending;
|
||||
}
|
||||
|
||||
function wrapChildren(node, enabled) {
|
||||
if (!node.children) {
|
||||
throw new Error('`node.children` is not defined.');
|
||||
}
|
||||
|
||||
const children = node.children.map(child => ({
|
||||
fn: getNodeHandler(child, enabled)
|
||||
}));
|
||||
|
||||
if (hasNoEnabledTest(node)) {
|
||||
return children;
|
||||
}
|
||||
|
||||
return node.beforeAllFns.concat(children).concat(node.afterAllFns);
|
||||
}
|
||||
|
||||
const treeHandler = getNodeHandler(tree, false);
|
||||
return treeHandler();
|
||||
}
|
82
node_modules/jest-jasmine2/build/types.d.ts
generated
vendored
Normal file
82
node_modules/jest-jasmine2/build/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* 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 { AssertionError } from 'assert';
|
||||
import type { Config } from '@jest/types';
|
||||
import expect = require('expect');
|
||||
import type { default as Spec, SpecResult } from './jasmine/Spec';
|
||||
import type JsApiReporter from './jasmine/JsApiReporter';
|
||||
import type Timer from './jasmine/Timer';
|
||||
import type Env from './jasmine/Env';
|
||||
import type createSpy from './jasmine/createSpy';
|
||||
import type ReportDispatcher from './jasmine/ReportDispatcher';
|
||||
import type SpyRegistry from './jasmine/spyRegistry';
|
||||
import type { default as Suite, SuiteResult } from './jasmine/Suite';
|
||||
import type SpyStrategy from './jasmine/SpyStrategy';
|
||||
import type CallTracker from './jasmine/CallTracker';
|
||||
export declare type SpecDefinitionsFn = () => void;
|
||||
export interface AssertionErrorWithStack extends AssertionError {
|
||||
stack: string;
|
||||
}
|
||||
export declare type SyncExpectationResult = {
|
||||
pass: boolean;
|
||||
message: () => string;
|
||||
};
|
||||
export declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
||||
export declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
||||
export declare type RawMatcherFn = (expected: any, actual: any, options?: any) => ExpectationResult;
|
||||
export declare type RunDetails = {
|
||||
totalSpecsDefined?: number;
|
||||
failedExpectations?: SuiteResult['failedExpectations'];
|
||||
};
|
||||
export declare type Reporter = {
|
||||
jasmineDone: (runDetails: RunDetails) => void;
|
||||
jasmineStarted: (runDetails: RunDetails) => void;
|
||||
specDone: (result: SpecResult) => void;
|
||||
specStarted: (spec: SpecResult) => void;
|
||||
suiteDone: (result: SuiteResult) => void;
|
||||
suiteStarted: (result: SuiteResult) => void;
|
||||
};
|
||||
export interface Spy extends Record<string, any> {
|
||||
(this: Record<string, unknown>, ...args: Array<any>): unknown;
|
||||
and: SpyStrategy;
|
||||
calls: CallTracker;
|
||||
restoreObjectToOriginalState?: () => void;
|
||||
}
|
||||
declare type JasmineMatcher = {
|
||||
(matchersUtil: unknown, context: unknown): JasmineMatcher;
|
||||
compare: () => RawMatcherFn;
|
||||
negativeCompare: () => RawMatcherFn;
|
||||
};
|
||||
export declare type JasmineMatchersObject = {
|
||||
[id: string]: JasmineMatcher;
|
||||
};
|
||||
export declare type Jasmine = {
|
||||
_DEFAULT_TIMEOUT_INTERVAL: number;
|
||||
DEFAULT_TIMEOUT_INTERVAL: number;
|
||||
currentEnv_: ReturnType<typeof Env>['prototype'];
|
||||
getEnv: (options?: Record<string, unknown>) => ReturnType<typeof Env>['prototype'];
|
||||
createSpy: typeof createSpy;
|
||||
Env: ReturnType<typeof Env>;
|
||||
JsApiReporter: typeof JsApiReporter;
|
||||
ReportDispatcher: typeof ReportDispatcher;
|
||||
Spec: typeof Spec;
|
||||
SpyRegistry: typeof SpyRegistry;
|
||||
Suite: typeof Suite;
|
||||
Timer: typeof Timer;
|
||||
version: string;
|
||||
testPath: Config.Path;
|
||||
addMatchers: (matchers: JasmineMatchersObject) => void;
|
||||
} & typeof expect & NodeJS.Global;
|
||||
declare global {
|
||||
module NodeJS {
|
||||
interface Global {
|
||||
expect: typeof expect;
|
||||
}
|
||||
}
|
||||
}
|
||||
export {};
|
7
node_modules/jest-jasmine2/build/types.js
generated
vendored
Normal file
7
node_modules/jest-jasmine2/build/types.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var _expect = _interopRequireDefault(require('expect'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
21
node_modules/jest-jasmine2/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
21
node_modules/jest-jasmine2/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.
|
187
node_modules/jest-jasmine2/node_modules/@jest/types/build/Circus.d.ts
generated
vendored
Normal file
187
node_modules/jest-jasmine2/node_modules/@jest/types/build/Circus.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,187 @@
|
|||
/**
|
||||
* 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, any>;
|
||||
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;
|
||||
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;
|
||||
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<any>) => 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
node_modules/jest-jasmine2/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
421
node_modules/jest-jasmine2/node_modules/@jest/types/build/Config.d.ts
generated
vendored
Normal file
421
node_modules/jest-jasmine2/node_modules/@jest/types/build/Config.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,421 @@
|
|||
/**
|
||||
* 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 { Arguments } from 'yargs';
|
||||
import type { ReportOptions } from 'istanbul-reports';
|
||||
import type { ForegroundColor } from 'chalk';
|
||||
declare type CoverageProvider = 'babel' | 'v8';
|
||||
export declare type Path = string;
|
||||
export declare type Glob = string;
|
||||
export declare type HasteConfig = {
|
||||
computeSha1?: boolean;
|
||||
defaultPlatform?: string | null;
|
||||
hasteImplModulePath?: string;
|
||||
platforms?: Array<string>;
|
||||
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;
|
||||
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, any>;
|
||||
testFailureExitCode: string | number;
|
||||
testLocationInResults: boolean;
|
||||
testMatch: Array<Glob>;
|
||||
testPathIgnorePatterns: Array<string>;
|
||||
testRegex: Array<string>;
|
||||
testRunner: string;
|
||||
testSequencer: string;
|
||||
testURL: string;
|
||||
timers: 'real' | 'fake';
|
||||
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;
|
||||
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;
|
||||
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, any>;
|
||||
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: 'real' | 'fake';
|
||||
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, any>]>;
|
||||
}>;
|
||||
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, any>;
|
||||
}> | 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;
|
||||
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, any>;
|
||||
testMatch: Array<Glob>;
|
||||
testLocationInResults: boolean;
|
||||
testPathIgnorePatterns: Array<string>;
|
||||
testRegex: Array<string | RegExp>;
|
||||
testRunner: string;
|
||||
testURL: string;
|
||||
timers: 'real' | 'fake' | 'modern' | 'legacy';
|
||||
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;
|
||||
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;
|
||||
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
node_modules/jest-jasmine2/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
85
node_modules/jest-jasmine2/node_modules/@jest/types/build/Global.d.ts
generated
vendored
Normal file
85
node_modules/jest-jasmine2/node_modules/@jest/types/build/Global.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* 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: Function;
|
||||
};
|
||||
declare type Each<EachCallback extends TestCallback> = ((table: EachTable, ...taggedTemplateData: Array<unknown>) => (title: string, test: EachTestFn<EachCallback>, timeout?: number) => void) | (() => 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, ...rest: Array<any>) => 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: HookFn;
|
||||
beforeEach: HookFn;
|
||||
afterEach: HookFn;
|
||||
afterAll: HookFn;
|
||||
}
|
||||
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]: any;
|
||||
}
|
||||
export {};
|
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
31
node_modules/jest-jasmine2/node_modules/@jest/types/build/TestResult.d.ts
generated
vendored
Normal file
31
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
12
node_modules/jest-jasmine2/node_modules/@jest/types/build/Transform.d.ts
generated
vendored
Normal file
12
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
12
node_modules/jest-jasmine2/node_modules/@jest/types/build/index.d.ts
generated
vendored
Normal file
12
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
1
node_modules/jest-jasmine2/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
26
node_modules/jest-jasmine2/node_modules/@jest/types/package.json
generated
vendored
Normal file
26
node_modules/jest-jasmine2/node_modules/@jest/types/package.json
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "@jest/types",
|
||||
"version": "26.3.0",
|
||||
"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": "3a7e06fe855515a848241bb06a6f6e117847443d"
|
||||
}
|
21
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/LICENSE
generated
vendored
Normal file
21
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/LICENSE
generated
vendored
Normal 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
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/README.md
generated
vendored
Normal file
16
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/README.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Installation
|
||||
> `npm install --save @types/istanbul-reports`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for istanbul-reports (https://github.com/istanbuljs/istanbuljs).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 20 Jul 2020 21:55:27 GMT
|
||||
* Dependencies: [@types/istanbul-lib-report](https://npmjs.com/package/@types/istanbul-lib-report)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Jason Cheatham](https://github.com/jason0x43), and [Elena Shcherbakova](https://github.com/not-a-doctor).
|
74
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/index.d.ts
generated
vendored
Normal file
74
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Type definitions for istanbul-reports 3.0
|
||||
// Project: https://github.com/istanbuljs/istanbuljs, https://istanbul.js.org
|
||||
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
||||
// Elena Shcherbakova <https://github.com/not-a-doctor>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { Node, Visitor } from 'istanbul-lib-report';
|
||||
|
||||
export function create<T extends keyof ReportOptions>(name: T, options?: Partial<ReportOptions[T]>): Visitor;
|
||||
|
||||
export interface FileOptions {
|
||||
file: string;
|
||||
}
|
||||
|
||||
export interface ProjectOptions {
|
||||
projectRoot: string;
|
||||
}
|
||||
|
||||
export interface ReportOptions {
|
||||
clover: CloverOptions;
|
||||
cobertura: CoberturaOptions;
|
||||
'html-spa': HtmlSpaOptions;
|
||||
html: HtmlOptions;
|
||||
json: JsonOptions;
|
||||
'json-summary': JsonSummaryOptions;
|
||||
lcov: LcovOptions;
|
||||
lcovonly: LcovOnlyOptions;
|
||||
none: never;
|
||||
teamcity: TeamcityOptions;
|
||||
text: TextOptions;
|
||||
'text-lcov': TextLcovOptions;
|
||||
'text-summary': TextSummaryOptions;
|
||||
}
|
||||
|
||||
export type ReportType = keyof ReportOptions;
|
||||
|
||||
export interface CloverOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface CoberturaOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface HtmlSpaOptions extends HtmlOptions {
|
||||
metricsToShow: Array<'lines' | 'branches' | 'functions' | 'statements'>;
|
||||
}
|
||||
export interface HtmlOptions {
|
||||
verbose: boolean;
|
||||
skipEmpty: boolean;
|
||||
subdir: string;
|
||||
linkMapper: LinkMapper;
|
||||
}
|
||||
|
||||
export type JsonOptions = FileOptions;
|
||||
export type JsonSummaryOptions = FileOptions;
|
||||
|
||||
export interface LcovOptions extends FileOptions, ProjectOptions {}
|
||||
export interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface TeamcityOptions extends FileOptions {
|
||||
blockName: string;
|
||||
}
|
||||
|
||||
export interface TextOptions extends FileOptions {
|
||||
maxCols: number;
|
||||
skipEmpty: boolean;
|
||||
skipFull: boolean;
|
||||
}
|
||||
export type TextLcovOptions = ProjectOptions;
|
||||
export type TextSummaryOptions = FileOptions;
|
||||
|
||||
export interface LinkMapper {
|
||||
getPath(node: string | Node): string;
|
||||
relativePath(source: string | Node, target: string | Node): string;
|
||||
assetPath(node: Node, name: string): string;
|
||||
}
|
31
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/package.json
generated
vendored
Normal file
31
node_modules/jest-jasmine2/node_modules/@types/istanbul-reports/package.json
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "@types/istanbul-reports",
|
||||
"version": "3.0.0",
|
||||
"description": "TypeScript definitions for istanbul-reports",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jason Cheatham",
|
||||
"url": "https://github.com/jason0x43",
|
||||
"githubUsername": "jason0x43"
|
||||
},
|
||||
{
|
||||
"name": "Elena Shcherbakova",
|
||||
"url": "https://github.com/not-a-doctor",
|
||||
"githubUsername": "not-a-doctor"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/istanbul-reports"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/istanbul-lib-report": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "71342edcc57e7212d17e794fa519955e496dd3b6696e2738904679ef3aa59d70",
|
||||
"typeScriptVersion": "3.0"
|
||||
}
|
415
node_modules/jest-jasmine2/node_modules/chalk/index.d.ts
generated
vendored
Normal file
415
node_modules/jest-jasmine2/node_modules/chalk/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,415 @@
|
|||
/**
|
||||
Basic foreground colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type ForegroundColor =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright';
|
||||
|
||||
/**
|
||||
Basic background colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type BackgroundColor =
|
||||
| 'bgBlack'
|
||||
| 'bgRed'
|
||||
| 'bgGreen'
|
||||
| 'bgYellow'
|
||||
| 'bgBlue'
|
||||
| 'bgMagenta'
|
||||
| 'bgCyan'
|
||||
| 'bgWhite'
|
||||
| 'bgGray'
|
||||
| 'bgGrey'
|
||||
| 'bgBlackBright'
|
||||
| 'bgRedBright'
|
||||
| 'bgGreenBright'
|
||||
| 'bgYellowBright'
|
||||
| 'bgBlueBright'
|
||||
| 'bgMagentaBright'
|
||||
| 'bgCyanBright'
|
||||
| 'bgWhiteBright';
|
||||
|
||||
/**
|
||||
Basic colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type Color = ForegroundColor | BackgroundColor;
|
||||
|
||||
declare type Modifiers =
|
||||
| 'reset'
|
||||
| 'bold'
|
||||
| 'dim'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'inverse'
|
||||
| 'hidden'
|
||||
| 'strikethrough'
|
||||
| 'visible';
|
||||
|
||||
declare namespace chalk {
|
||||
/**
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
type Level = 0 | 1 | 2 | 3;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Specify the color support for Chalk.
|
||||
|
||||
By default, color support is automatically detected based on the environment.
|
||||
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
type Instance = new (options?: Options) => Chalk;
|
||||
|
||||
/**
|
||||
Detect whether the terminal supports color.
|
||||
*/
|
||||
interface ColorSupport {
|
||||
/**
|
||||
The color level used by Chalk.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports basic 16 colors.
|
||||
*/
|
||||
hasBasic: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports ANSI 256 colors.
|
||||
*/
|
||||
has256: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports Truecolor 16 million colors.
|
||||
*/
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
interface ChalkFunction {
|
||||
/**
|
||||
Use a template string.
|
||||
|
||||
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
|
||||
```
|
||||
*/
|
||||
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||
|
||||
(...text: unknown[]): string;
|
||||
}
|
||||
|
||||
interface Chalk extends ChalkFunction {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
Instance: Instance;
|
||||
|
||||
/**
|
||||
The color support for Chalk.
|
||||
|
||||
By default, color support is automatically detected based on the environment.
|
||||
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Use HEX value to set text color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.hex('#DEADED');
|
||||
```
|
||||
*/
|
||||
hex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set text color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.keyword('orange');
|
||||
```
|
||||
*/
|
||||
keyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set text color.
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set text color.
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set text color.
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set text color.
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
*/
|
||||
ansi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HEX value to set background color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgHex('#DEADED');
|
||||
```
|
||||
*/
|
||||
bgHex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set background color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgKeyword('orange');
|
||||
```
|
||||
*/
|
||||
bgKeyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set background color.
|
||||
*/
|
||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set background color.
|
||||
*/
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set background color.
|
||||
*/
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set background color.
|
||||
*/
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||
*/
|
||||
bgAnsi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||
*/
|
||||
bgAnsi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Resets the current color chain.
|
||||
*/
|
||||
readonly reset: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text bold.
|
||||
*/
|
||||
readonly bold: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||
Can be useful for things that are purely cosmetic.
|
||||
*/
|
||||
readonly visible: Chalk;
|
||||
|
||||
readonly black: Chalk;
|
||||
readonly red: Chalk;
|
||||
readonly green: Chalk;
|
||||
readonly yellow: Chalk;
|
||||
readonly blue: Chalk;
|
||||
readonly magenta: Chalk;
|
||||
readonly cyan: Chalk;
|
||||
readonly white: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: Chalk;
|
||||
|
||||
readonly blackBright: Chalk;
|
||||
readonly redBright: Chalk;
|
||||
readonly greenBright: Chalk;
|
||||
readonly yellowBright: Chalk;
|
||||
readonly blueBright: Chalk;
|
||||
readonly magentaBright: Chalk;
|
||||
readonly cyanBright: Chalk;
|
||||
readonly whiteBright: Chalk;
|
||||
|
||||
readonly bgBlack: Chalk;
|
||||
readonly bgRed: Chalk;
|
||||
readonly bgGreen: Chalk;
|
||||
readonly bgYellow: Chalk;
|
||||
readonly bgBlue: Chalk;
|
||||
readonly bgMagenta: Chalk;
|
||||
readonly bgCyan: Chalk;
|
||||
readonly bgWhite: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: Chalk;
|
||||
|
||||
readonly bgBlackBright: Chalk;
|
||||
readonly bgRedBright: Chalk;
|
||||
readonly bgGreenBright: Chalk;
|
||||
readonly bgYellowBright: Chalk;
|
||||
readonly bgBlueBright: Chalk;
|
||||
readonly bgMagentaBright: Chalk;
|
||||
readonly bgCyanBright: Chalk;
|
||||
readonly bgWhiteBright: Chalk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Main Chalk object that allows to chain styles together.
|
||||
Call the last one as a method with a string argument.
|
||||
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
*/
|
||||
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||
supportsColor: chalk.ColorSupport | false;
|
||||
Level: chalk.Level;
|
||||
Color: Color;
|
||||
ForegroundColor: ForegroundColor;
|
||||
BackgroundColor: BackgroundColor;
|
||||
Modifiers: Modifiers;
|
||||
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||
};
|
||||
|
||||
export = chalk;
|
9
node_modules/jest-jasmine2/node_modules/chalk/license
generated
vendored
Normal file
9
node_modules/jest-jasmine2/node_modules/chalk/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
68
node_modules/jest-jasmine2/node_modules/chalk/package.json
generated
vendored
Normal file
68
node_modules/jest-jasmine2/node_modules/chalk/package.json
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"name": "chalk",
|
||||
"version": "4.1.0",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"funding": "https://github.com/chalk/chalk?sponsor=1",
|
||||
"main": "source",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"coveralls": "^3.0.7",
|
||||
"execa": "^4.0.0",
|
||||
"import-fresh": "^3.1.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^15.0.0",
|
||||
"resolve-from": "^5.0.0",
|
||||
"tsd": "^0.7.4",
|
||||
"xo": "^0.28.2"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"unicorn/prefer-includes": "off",
|
||||
"@typescript-eslint/member-ordering": "off",
|
||||
"no-redeclare": "off",
|
||||
"unicorn/string-content": "off",
|
||||
"unicorn/better-regex": "off"
|
||||
}
|
||||
}
|
||||
}
|
293
node_modules/jest-jasmine2/node_modules/chalk/readme.md
generated
vendored
Normal file
293
node_modules/jest-jasmine2/node_modules/chalk/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,293 @@
|
|||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo)  [](https://repl.it/github/chalk/chalk)
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.Instance({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalk.stderr and chalk.stderr.supportsColor
|
||||
|
||||
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Resets the current color chain.
|
||||
- `bold` - Make text bold.
|
||||
- `dim` - Emitting only a small amount of light.
|
||||
- `italic` - Make text italic. *(Not widely supported)*
|
||||
- `underline` - Make text underline. *(Not widely supported)*
|
||||
- `inverse`- Inverse background and foreground colors.
|
||||
- `hidden` - Prints the text, but makes it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
## chalk for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
229
node_modules/jest-jasmine2/node_modules/chalk/source/index.js
generated
vendored
Normal file
229
node_modules/jest-jasmine2/node_modules/chalk/source/index.js
generated
vendored
Normal file
|
@ -0,0 +1,229 @@
|
|||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./util');
|
||||
|
||||
const {isArray} = Array;
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
'ansi',
|
||||
'ansi',
|
||||
'ansi256',
|
||||
'ansi16m'
|
||||
];
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
const applyOptions = (object, options = {}) => {
|
||||
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
||||
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||
}
|
||||
|
||||
// Detect level if not set manually
|
||||
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
object.level = options.level === undefined ? colorLevel : options.level;
|
||||
};
|
||||
|
||||
class ChalkClass {
|
||||
constructor(options) {
|
||||
// eslint-disable-next-line no-constructor-return
|
||||
return chalkFactory(options);
|
||||
}
|
||||
}
|
||||
|
||||
const chalkFactory = options => {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||
};
|
||||
|
||||
chalk.template.Instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
};
|
||||
|
||||
function Chalk(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
|
||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||
styles[styleName] = {
|
||||
get() {
|
||||
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||
Object.defineProperty(this, styleName, {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
const builder = createBuilder(this, this._styler, true);
|
||||
Object.defineProperty(this, 'visible', {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||
|
||||
for (const model of usedModels) {
|
||||
styles[model] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const model of usedModels) {
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, {
|
||||
...styles,
|
||||
level: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this._generator.level;
|
||||
},
|
||||
set(level) {
|
||||
this._generator.level = level;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const createStyler = (open, close, parent) => {
|
||||
let openAll;
|
||||
let closeAll;
|
||||
if (parent === undefined) {
|
||||
openAll = open;
|
||||
closeAll = close;
|
||||
} else {
|
||||
openAll = parent.openAll + open;
|
||||
closeAll = close + parent.closeAll;
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openAll,
|
||||
closeAll,
|
||||
parent
|
||||
};
|
||||
};
|
||||
|
||||
const createBuilder = (self, _styler, _isEmpty) => {
|
||||
const builder = (...arguments_) => {
|
||||
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
||||
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
|
||||
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
||||
}
|
||||
|
||||
// Single argument is hot path, implicit coercion is faster than anything
|
||||
// eslint-disable-next-line no-implicit-coercion
|
||||
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||
};
|
||||
|
||||
// We alter the prototype because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
Object.setPrototypeOf(builder, proto);
|
||||
|
||||
builder._generator = self;
|
||||
builder._styler = _styler;
|
||||
builder._isEmpty = _isEmpty;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const applyStyle = (self, string) => {
|
||||
if (self.level <= 0 || !string) {
|
||||
return self._isEmpty ? '' : string;
|
||||
}
|
||||
|
||||
let styler = self._styler;
|
||||
|
||||
if (styler === undefined) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const {openAll, closeAll} = styler;
|
||||
if (string.indexOf('\u001B') !== -1) {
|
||||
while (styler !== undefined) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
string = stringReplaceAll(string, styler.close, styler.open);
|
||||
|
||||
styler = styler.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||
const lfIndex = string.indexOf('\n');
|
||||
if (lfIndex !== -1) {
|
||||
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||
}
|
||||
|
||||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return strings.join(' ');
|
||||
}
|
||||
|
||||
const arguments_ = strings.slice(1);
|
||||
const parts = [firstString.raw[0]];
|
||||
|
||||
for (let i = 1; i < firstString.length; i++) {
|
||||
parts.push(
|
||||
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||
String(firstString.raw[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||
chalk.supportsColor = stdoutColor;
|
||||
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||
chalk.stderr.supportsColor = stderrColor;
|
||||
|
||||
module.exports = chalk;
|
134
node_modules/jest-jasmine2/node_modules/chalk/source/templates.js
generated
vendored
Normal file
134
node_modules/jest-jasmine2/node_modules/chalk/source/templates.js
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
const u = c[0] === 'u';
|
||||
const bracket = c[1] === '{';
|
||||
|
||||
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
if (u && bracket) {
|
||||
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, arguments_) {
|
||||
const results = [];
|
||||
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
const number = Number(chunk);
|
||||
if (!Number.isNaN(number)) {
|
||||
results.push(number);
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const [styleName, styles] of Object.entries(enabled)) {
|
||||
if (!Array.isArray(styles)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, temporary) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
||||
if (escapeCharacter) {
|
||||
chunk.push(unescape(escapeCharacter));
|
||||
} else if (style) {
|
||||
const string = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(character);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMessage);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
39
node_modules/jest-jasmine2/node_modules/chalk/source/util.js
generated
vendored
Normal file
39
node_modules/jest-jasmine2/node_modules/chalk/source/util.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const substringLength = substring.length;
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||
endIndex = index + substringLength;
|
||||
index = string.indexOf(substring, endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
const gotCR = string[index - 1] === '\r';
|
||||
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||
endIndex = index + 1;
|
||||
index = string.indexOf('\n', endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
};
|
21
node_modules/jest-jasmine2/node_modules/pretty-format/LICENSE
generated
vendored
Normal file
21
node_modules/jest-jasmine2/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.
|
456
node_modules/jest-jasmine2/node_modules/pretty-format/README.md
generated
vendored
Executable file
456
node_modules/jest-jasmine2/node_modules/pretty-format/README.md
generated
vendored
Executable file
|
@ -0,0 +1,456 @@
|
|||
# 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 prettyFormat = require('pretty-format');
|
||||
const ReactElement = prettyFormat.plugins.ReactElement;
|
||||
const ReactTestComponent = prettyFormat.plugins.ReactTestComponent;
|
||||
|
||||
const React = require('react');
|
||||
const renderer = require('react-test-renderer');
|
||||
```
|
||||
|
||||
```js
|
||||
// ES2015 modules and destructuring assignment
|
||||
import prettyFormat from 'pretty-format';
|
||||
const {ReactElement, ReactTestComponent} = prettyFormat.plugins;
|
||||
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
```
|
||||
|
||||
```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
node_modules/jest-jasmine2/node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
32
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
185
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
37
node_modules/jest-jasmine2/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;
|
559
node_modules/jest-jasmine2/node_modules/pretty-format/build/index.js
generated
vendored
Normal file
559
node_modules/jest-jasmine2/node_modules/pretty-format/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,559 @@
|
|||
'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.
|
||||
*/
|
||||
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
|
||||
}; // eslint-disable-next-line no-redeclare
|
||||
|
||||
module.exports = prettyFormat;
|
11
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
11
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
103
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts
generated
vendored
Normal file
11
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/ConvertAnsi.js
generated
vendored
Normal file
96
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/DOMCollection.d.ts
generated
vendored
Normal file
11
node_modules/jest-jasmine2/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;
|
78
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
Normal file
78
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
'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.
|
||||
*/
|
||||
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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/DOMElement.d.ts
generated
vendored
Normal file
11
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
Normal file
125
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/Immutable.d.ts
generated
vendored
Normal file
11
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/Immutable.js
generated
vendored
Normal file
247
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/ReactElement.d.ts
generated
vendored
Normal file
11
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/ReactElement.js
generated
vendored
Normal file
166
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts
generated
vendored
Normal file
18
node_modules/jest-jasmine2/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
node_modules/jest-jasmine2/node_modules/pretty-format/build/plugins/ReactTestComponent.js
generated
vendored
Normal file
65
node_modules/jest-jasmine2/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;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue