Add node modules and new code for release (#39)
Co-authored-by: tbarnes94 <tbarnes94@users.noreply.github.com>
This commit is contained in:
parent
a10d84bc2e
commit
7ad2aa66bb
7655 changed files with 1763577 additions and 14 deletions
21
node_modules/expect/LICENSE
generated
vendored
Normal file
21
node_modules/expect/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.
|
3
node_modules/expect/README.md
generated
vendored
Normal file
3
node_modules/expect/README.md
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# expect
|
||||
|
||||
This package exports the `expect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/en/expect.html).
|
60
node_modules/expect/build/asymmetricMatchers.d.ts
generated
vendored
Normal file
60
node_modules/expect/build/asymmetricMatchers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* 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 class AsymmetricMatcher<T> {
|
||||
protected sample: T;
|
||||
$$typeof: symbol;
|
||||
inverse?: boolean;
|
||||
constructor(sample: T);
|
||||
}
|
||||
declare class Any extends AsymmetricMatcher<any> {
|
||||
constructor(sample: unknown);
|
||||
asymmetricMatch(other: unknown): boolean;
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
toAsymmetricMatcher(): string;
|
||||
}
|
||||
declare class Anything extends AsymmetricMatcher<void> {
|
||||
asymmetricMatch(other: unknown): boolean;
|
||||
toString(): string;
|
||||
toAsymmetricMatcher(): string;
|
||||
}
|
||||
declare class ArrayContaining extends AsymmetricMatcher<Array<unknown>> {
|
||||
constructor(sample: Array<unknown>, inverse?: boolean);
|
||||
asymmetricMatch(other: Array<unknown>): boolean;
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
}
|
||||
declare class ObjectContaining extends AsymmetricMatcher<Record<string, any>> {
|
||||
constructor(sample: Record<string, any>, inverse?: boolean);
|
||||
asymmetricMatch(other: any): boolean;
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
}
|
||||
declare class StringContaining extends AsymmetricMatcher<string> {
|
||||
constructor(sample: string, inverse?: boolean);
|
||||
asymmetricMatch(other: string): boolean;
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
}
|
||||
declare class StringMatching extends AsymmetricMatcher<RegExp> {
|
||||
constructor(sample: string | RegExp, inverse?: boolean);
|
||||
asymmetricMatch(other: string): boolean;
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
}
|
||||
export declare const any: (expectedObject: unknown) => Any;
|
||||
export declare const anything: () => Anything;
|
||||
export declare const arrayContaining: (sample: Array<unknown>) => ArrayContaining;
|
||||
export declare const arrayNotContaining: (sample: Array<unknown>) => ArrayContaining;
|
||||
export declare const objectContaining: (sample: Record<string, any>) => ObjectContaining;
|
||||
export declare const objectNotContaining: (sample: Record<string, any>) => ObjectContaining;
|
||||
export declare const stringContaining: (expected: string) => StringContaining;
|
||||
export declare const stringNotContaining: (expected: string) => StringContaining;
|
||||
export declare const stringMatching: (expected: string | RegExp) => StringMatching;
|
||||
export declare const stringNotMatching: (expected: string | RegExp) => StringMatching;
|
||||
export {};
|
310
node_modules/expect/build/asymmetricMatchers.js
generated
vendored
Normal file
310
node_modules/expect/build/asymmetricMatchers.js
generated
vendored
Normal file
|
@ -0,0 +1,310 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.stringNotMatching = exports.stringMatching = exports.stringNotContaining = exports.stringContaining = exports.objectNotContaining = exports.objectContaining = exports.arrayNotContaining = exports.arrayContaining = exports.anything = exports.any = exports.AsymmetricMatcher = void 0;
|
||||
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
|
||||
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 AsymmetricMatcher {
|
||||
constructor(sample) {
|
||||
_defineProperty(this, 'sample', void 0);
|
||||
|
||||
_defineProperty(this, '$$typeof', void 0);
|
||||
|
||||
_defineProperty(this, 'inverse', void 0);
|
||||
|
||||
this.$$typeof = Symbol.for('jest.asymmetricMatcher');
|
||||
this.sample = sample;
|
||||
}
|
||||
}
|
||||
|
||||
exports.AsymmetricMatcher = AsymmetricMatcher;
|
||||
|
||||
class Any extends AsymmetricMatcher {
|
||||
constructor(sample) {
|
||||
if (typeof sample === 'undefined') {
|
||||
throw new TypeError(
|
||||
'any() expects to be passed a constructor function. ' +
|
||||
'Please pass one or use anything() to match any object.'
|
||||
);
|
||||
}
|
||||
|
||||
super(sample);
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
if (this.sample == String) {
|
||||
return typeof other == 'string' || other instanceof String;
|
||||
}
|
||||
|
||||
if (this.sample == Number) {
|
||||
return typeof other == 'number' || other instanceof Number;
|
||||
}
|
||||
|
||||
if (this.sample == Function) {
|
||||
return typeof other == 'function' || other instanceof Function;
|
||||
}
|
||||
|
||||
if (this.sample == Object) {
|
||||
return typeof other == 'object';
|
||||
}
|
||||
|
||||
if (this.sample == Boolean) {
|
||||
return typeof other == 'boolean';
|
||||
}
|
||||
/* global BigInt */
|
||||
|
||||
if (this.sample == BigInt) {
|
||||
return typeof other == 'bigint';
|
||||
}
|
||||
|
||||
if (this.sample == Symbol) {
|
||||
return typeof other == 'symbol';
|
||||
}
|
||||
|
||||
return other instanceof this.sample;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return 'Any';
|
||||
}
|
||||
|
||||
getExpectedType() {
|
||||
if (this.sample == String) {
|
||||
return 'string';
|
||||
}
|
||||
|
||||
if (this.sample == Number) {
|
||||
return 'number';
|
||||
}
|
||||
|
||||
if (this.sample == Function) {
|
||||
return 'function';
|
||||
}
|
||||
|
||||
if (this.sample == Object) {
|
||||
return 'object';
|
||||
}
|
||||
|
||||
if (this.sample == Boolean) {
|
||||
return 'boolean';
|
||||
}
|
||||
|
||||
return (0, _jasmineUtils.fnNameFor)(this.sample);
|
||||
}
|
||||
|
||||
toAsymmetricMatcher() {
|
||||
return 'Any<' + (0, _jasmineUtils.fnNameFor)(this.sample) + '>';
|
||||
}
|
||||
}
|
||||
|
||||
class Anything extends AsymmetricMatcher {
|
||||
asymmetricMatch(other) {
|
||||
return !(0, _jasmineUtils.isUndefined)(other) && other !== null;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return 'Anything';
|
||||
} // No getExpectedType method, because it matches either null or undefined.
|
||||
|
||||
toAsymmetricMatcher() {
|
||||
return 'Anything';
|
||||
}
|
||||
}
|
||||
|
||||
class ArrayContaining extends AsymmetricMatcher {
|
||||
constructor(sample, inverse = false) {
|
||||
super(sample);
|
||||
this.inverse = inverse;
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
if (!Array.isArray(this.sample)) {
|
||||
throw new Error(
|
||||
`You must provide an array to ${this.toString()}, not '` +
|
||||
typeof this.sample +
|
||||
"'."
|
||||
);
|
||||
}
|
||||
|
||||
const result =
|
||||
this.sample.length === 0 ||
|
||||
(Array.isArray(other) &&
|
||||
this.sample.every(item =>
|
||||
other.some(another => (0, _jasmineUtils.equals)(item, another))
|
||||
));
|
||||
return this.inverse ? !result : result;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `Array${this.inverse ? 'Not' : ''}Containing`;
|
||||
}
|
||||
|
||||
getExpectedType() {
|
||||
return 'array';
|
||||
}
|
||||
}
|
||||
|
||||
class ObjectContaining extends AsymmetricMatcher {
|
||||
constructor(sample, inverse = false) {
|
||||
super(sample);
|
||||
this.inverse = inverse;
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
if (typeof this.sample !== 'object') {
|
||||
throw new Error(
|
||||
`You must provide an object to ${this.toString()}, not '` +
|
||||
typeof this.sample +
|
||||
"'."
|
||||
);
|
||||
}
|
||||
|
||||
if (this.inverse) {
|
||||
for (const property in this.sample) {
|
||||
if (
|
||||
(0, _jasmineUtils.hasProperty)(other, property) &&
|
||||
(0, _jasmineUtils.equals)(this.sample[property], other[property]) &&
|
||||
!(0, _utils.emptyObject)(this.sample[property]) &&
|
||||
!(0, _utils.emptyObject)(other[property])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
for (const property in this.sample) {
|
||||
if (
|
||||
!(0, _jasmineUtils.hasProperty)(other, property) ||
|
||||
!(0, _jasmineUtils.equals)(this.sample[property], other[property])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `Object${this.inverse ? 'Not' : ''}Containing`;
|
||||
}
|
||||
|
||||
getExpectedType() {
|
||||
return 'object';
|
||||
}
|
||||
}
|
||||
|
||||
class StringContaining extends AsymmetricMatcher {
|
||||
constructor(sample, inverse = false) {
|
||||
if (!(0, _jasmineUtils.isA)('String', sample)) {
|
||||
throw new Error('Expected is not a string');
|
||||
}
|
||||
|
||||
super(sample);
|
||||
this.inverse = inverse;
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
const result =
|
||||
(0, _jasmineUtils.isA)('String', other) && other.includes(this.sample);
|
||||
return this.inverse ? !result : result;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `String${this.inverse ? 'Not' : ''}Containing`;
|
||||
}
|
||||
|
||||
getExpectedType() {
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
|
||||
class StringMatching extends AsymmetricMatcher {
|
||||
constructor(sample, inverse = false) {
|
||||
if (
|
||||
!(0, _jasmineUtils.isA)('String', sample) &&
|
||||
!(0, _jasmineUtils.isA)('RegExp', sample)
|
||||
) {
|
||||
throw new Error('Expected is not a String or a RegExp');
|
||||
}
|
||||
|
||||
super(new RegExp(sample));
|
||||
this.inverse = inverse;
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
const result =
|
||||
(0, _jasmineUtils.isA)('String', other) && this.sample.test(other);
|
||||
return this.inverse ? !result : result;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `String${this.inverse ? 'Not' : ''}Matching`;
|
||||
}
|
||||
|
||||
getExpectedType() {
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
|
||||
const any = expectedObject => new Any(expectedObject);
|
||||
|
||||
exports.any = any;
|
||||
|
||||
const anything = () => new Anything();
|
||||
|
||||
exports.anything = anything;
|
||||
|
||||
const arrayContaining = sample => new ArrayContaining(sample);
|
||||
|
||||
exports.arrayContaining = arrayContaining;
|
||||
|
||||
const arrayNotContaining = sample => new ArrayContaining(sample, true);
|
||||
|
||||
exports.arrayNotContaining = arrayNotContaining;
|
||||
|
||||
const objectContaining = sample => new ObjectContaining(sample);
|
||||
|
||||
exports.objectContaining = objectContaining;
|
||||
|
||||
const objectNotContaining = sample => new ObjectContaining(sample, true);
|
||||
|
||||
exports.objectNotContaining = objectNotContaining;
|
||||
|
||||
const stringContaining = expected => new StringContaining(expected);
|
||||
|
||||
exports.stringContaining = stringContaining;
|
||||
|
||||
const stringNotContaining = expected => new StringContaining(expected, true);
|
||||
|
||||
exports.stringNotContaining = stringNotContaining;
|
||||
|
||||
const stringMatching = expected => new StringMatching(expected);
|
||||
|
||||
exports.stringMatching = stringMatching;
|
||||
|
||||
const stringNotMatching = expected => new StringMatching(expected, true);
|
||||
|
||||
exports.stringNotMatching = stringNotMatching;
|
14
node_modules/expect/build/extractExpectedAssertionsErrors.d.ts
generated
vendored
Normal file
14
node_modules/expect/build/extractExpectedAssertionsErrors.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.
|
||||
*
|
||||
*/
|
||||
declare type AssertionsErrors = Array<{
|
||||
actual: string;
|
||||
error: string;
|
||||
expected: string | number;
|
||||
}>;
|
||||
declare const extractExpectedAssertionsErrors: () => AssertionsErrors;
|
||||
export default extractExpectedAssertionsErrors;
|
91
node_modules/expect/build/extractExpectedAssertionsErrors.js
generated
vendored
Normal file
91
node_modules/expect/build/extractExpectedAssertionsErrors.js
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _jestMatchersObject = require('./jestMatchersObject');
|
||||
|
||||
/**
|
||||
* 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 resetAssertionsLocalState = () => {
|
||||
(0, _jestMatchersObject.setState)({
|
||||
assertionCalls: 0,
|
||||
expectedAssertionsNumber: null,
|
||||
isExpectingAssertions: false
|
||||
});
|
||||
};
|
||||
|
||||
// Create and format all errors related to the mismatched number of `expect`
|
||||
// calls and reset the matcher's state.
|
||||
const extractExpectedAssertionsErrors = () => {
|
||||
const result = [];
|
||||
const {
|
||||
assertionCalls,
|
||||
expectedAssertionsNumber,
|
||||
expectedAssertionsNumberError,
|
||||
isExpectingAssertions,
|
||||
isExpectingAssertionsError
|
||||
} = (0, _jestMatchersObject.getState)();
|
||||
resetAssertionsLocalState();
|
||||
|
||||
if (
|
||||
typeof expectedAssertionsNumber === 'number' &&
|
||||
assertionCalls !== expectedAssertionsNumber
|
||||
) {
|
||||
const numOfAssertionsExpected = (0, _jestMatcherUtils.EXPECTED_COLOR)(
|
||||
(0, _jestMatcherUtils.pluralize)('assertion', expectedAssertionsNumber)
|
||||
);
|
||||
expectedAssertionsNumberError.message =
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
'.assertions',
|
||||
'',
|
||||
String(expectedAssertionsNumber),
|
||||
{
|
||||
isDirectExpectCall: true
|
||||
}
|
||||
) +
|
||||
'\n\n' +
|
||||
`Expected ${numOfAssertionsExpected} to be called but received ` +
|
||||
(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
(0, _jestMatcherUtils.pluralize)('assertion call', assertionCalls || 0)
|
||||
) +
|
||||
'.';
|
||||
result.push({
|
||||
actual: assertionCalls,
|
||||
error: expectedAssertionsNumberError,
|
||||
expected: expectedAssertionsNumber
|
||||
});
|
||||
}
|
||||
|
||||
if (isExpectingAssertions && assertionCalls === 0) {
|
||||
const expected = (0, _jestMatcherUtils.EXPECTED_COLOR)(
|
||||
'at least one assertion'
|
||||
);
|
||||
const received = (0, _jestMatcherUtils.RECEIVED_COLOR)('received none');
|
||||
isExpectingAssertionsError.message =
|
||||
(0, _jestMatcherUtils.matcherHint)('.hasAssertions', '', '', {
|
||||
isDirectExpectCall: true
|
||||
}) +
|
||||
'\n\n' +
|
||||
`Expected ${expected} to be called but ${received}.`;
|
||||
result.push({
|
||||
actual: 'none',
|
||||
error: isExpectingAssertionsError,
|
||||
expected: 'at least one'
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var _default = extractExpectedAssertionsErrors;
|
||||
exports.default = _default;
|
10
node_modules/expect/build/fakeChalk.d.ts
generated
vendored
Normal file
10
node_modules/expect/build/fakeChalk.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 allColorsAsFunc: {
|
||||
[x: string]: (str: string) => string;
|
||||
};
|
||||
export = allColorsAsFunc;
|
28
node_modules/expect/build/fakeChalk.js
generated
vendored
Normal file
28
node_modules/expect/build/fakeChalk.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
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 returnInput = str => str;
|
||||
|
||||
const allColorsAsFunc = Object.keys(_ansiStyles.default)
|
||||
.map(style => ({
|
||||
[style]: returnInput
|
||||
}))
|
||||
.reduce((acc, cur) => Object.assign(acc, cur));
|
||||
Object.keys(allColorsAsFunc)
|
||||
.map(color => allColorsAsFunc[color])
|
||||
.forEach(style => {
|
||||
Object.assign(style, allColorsAsFunc);
|
||||
Object.assign(returnInput, style);
|
||||
});
|
||||
module.exports = allColorsAsFunc;
|
15
node_modules/expect/build/index.d.ts
generated
vendored
Normal file
15
node_modules/expect/build/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* 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 { Expect, MatcherState as JestMatcherState, Matchers as MatcherInterface } from './types';
|
||||
declare const expectExport: Expect;
|
||||
declare namespace expectExport {
|
||||
type MatcherState = JestMatcherState;
|
||||
interface Matchers<R> extends MatcherInterface<R> {
|
||||
}
|
||||
}
|
||||
export = expectExport;
|
436
node_modules/expect/build/index.js
generated
vendored
Normal file
436
node_modules/expect/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,436 @@
|
|||
'use strict';
|
||||
|
||||
var matcherUtils = _interopRequireWildcard(require('jest-matcher-utils'));
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _matchers = _interopRequireDefault(require('./matchers'));
|
||||
|
||||
var _spyMatchers = _interopRequireDefault(require('./spyMatchers'));
|
||||
|
||||
var _toThrowMatchers = _interopRequireWildcard(require('./toThrowMatchers'));
|
||||
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
var _asymmetricMatchers = require('./asymmetricMatchers');
|
||||
|
||||
var _jestMatchersObject = require('./jestMatchersObject');
|
||||
|
||||
var _extractExpectedAssertionsErrors = _interopRequireDefault(
|
||||
require('./extractExpectedAssertionsErrors')
|
||||
);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var 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 JestAssertionError extends Error {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
_defineProperty(this, 'matcherResult', void 0);
|
||||
}
|
||||
}
|
||||
|
||||
const isPromise = obj =>
|
||||
!!obj &&
|
||||
(typeof obj === 'object' || typeof obj === 'function') &&
|
||||
typeof obj.then === 'function';
|
||||
|
||||
const createToThrowErrorMatchingSnapshotMatcher = function (matcher) {
|
||||
return function (received, testNameOrInlineSnapshot) {
|
||||
return matcher.apply(this, [received, testNameOrInlineSnapshot, true]);
|
||||
};
|
||||
};
|
||||
|
||||
const getPromiseMatcher = (name, matcher) => {
|
||||
if (name === 'toThrow' || name === 'toThrowError') {
|
||||
return (0, _toThrowMatchers.createMatcher)(name, true);
|
||||
} else if (
|
||||
name === 'toThrowErrorMatchingSnapshot' ||
|
||||
name === 'toThrowErrorMatchingInlineSnapshot'
|
||||
) {
|
||||
return createToThrowErrorMatchingSnapshotMatcher(matcher);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const expect = (actual, ...rest) => {
|
||||
if (rest.length !== 0) {
|
||||
throw new Error('Expect takes at most one argument.');
|
||||
}
|
||||
|
||||
const allMatchers = (0, _jestMatchersObject.getMatchers)();
|
||||
const expectation = {
|
||||
not: {},
|
||||
rejects: {
|
||||
not: {}
|
||||
},
|
||||
resolves: {
|
||||
not: {}
|
||||
}
|
||||
};
|
||||
const err = new JestAssertionError();
|
||||
Object.keys(allMatchers).forEach(name => {
|
||||
const matcher = allMatchers[name];
|
||||
const promiseMatcher = getPromiseMatcher(name, matcher) || matcher;
|
||||
expectation[name] = makeThrowingMatcher(matcher, false, '', actual);
|
||||
expectation.not[name] = makeThrowingMatcher(matcher, true, '', actual);
|
||||
expectation.resolves[name] = makeResolveMatcher(
|
||||
name,
|
||||
promiseMatcher,
|
||||
false,
|
||||
actual,
|
||||
err
|
||||
);
|
||||
expectation.resolves.not[name] = makeResolveMatcher(
|
||||
name,
|
||||
promiseMatcher,
|
||||
true,
|
||||
actual,
|
||||
err
|
||||
);
|
||||
expectation.rejects[name] = makeRejectMatcher(
|
||||
name,
|
||||
promiseMatcher,
|
||||
false,
|
||||
actual,
|
||||
err
|
||||
);
|
||||
expectation.rejects.not[name] = makeRejectMatcher(
|
||||
name,
|
||||
promiseMatcher,
|
||||
true,
|
||||
actual,
|
||||
err
|
||||
);
|
||||
});
|
||||
return expectation;
|
||||
};
|
||||
|
||||
const getMessage = message =>
|
||||
(message && message()) ||
|
||||
matcherUtils.RECEIVED_COLOR('No message was specified for this matcher.');
|
||||
|
||||
const makeResolveMatcher = (matcherName, matcher, isNot, actual, outerErr) => (
|
||||
...args
|
||||
) => {
|
||||
const options = {
|
||||
isNot,
|
||||
promise: 'resolves'
|
||||
};
|
||||
|
||||
if (!isPromise(actual)) {
|
||||
throw new JestAssertionError(
|
||||
matcherUtils.matcherErrorMessage(
|
||||
matcherUtils.matcherHint(matcherName, undefined, '', options),
|
||||
`${matcherUtils.RECEIVED_COLOR('received')} value must be a promise`,
|
||||
matcherUtils.printWithType(
|
||||
'Received',
|
||||
actual,
|
||||
matcherUtils.printReceived
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const innerErr = new JestAssertionError();
|
||||
return actual.then(
|
||||
result =>
|
||||
makeThrowingMatcher(matcher, isNot, 'resolves', result, innerErr).apply(
|
||||
null,
|
||||
args
|
||||
),
|
||||
reason => {
|
||||
outerErr.message =
|
||||
matcherUtils.matcherHint(matcherName, undefined, '', options) +
|
||||
'\n\n' +
|
||||
`Received promise rejected instead of resolved\n` +
|
||||
`Rejected to value: ${matcherUtils.printReceived(reason)}`;
|
||||
return Promise.reject(outerErr);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const makeRejectMatcher = (matcherName, matcher, isNot, actual, outerErr) => (
|
||||
...args
|
||||
) => {
|
||||
const options = {
|
||||
isNot,
|
||||
promise: 'rejects'
|
||||
};
|
||||
const actualWrapper = typeof actual === 'function' ? actual() : actual;
|
||||
|
||||
if (!isPromise(actualWrapper)) {
|
||||
throw new JestAssertionError(
|
||||
matcherUtils.matcherErrorMessage(
|
||||
matcherUtils.matcherHint(matcherName, undefined, '', options),
|
||||
`${matcherUtils.RECEIVED_COLOR(
|
||||
'received'
|
||||
)} value must be a promise or a function returning a promise`,
|
||||
matcherUtils.printWithType(
|
||||
'Received',
|
||||
actual,
|
||||
matcherUtils.printReceived
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const innerErr = new JestAssertionError();
|
||||
return actualWrapper.then(
|
||||
result => {
|
||||
outerErr.message =
|
||||
matcherUtils.matcherHint(matcherName, undefined, '', options) +
|
||||
'\n\n' +
|
||||
`Received promise resolved instead of rejected\n` +
|
||||
`Resolved to value: ${matcherUtils.printReceived(result)}`;
|
||||
return Promise.reject(outerErr);
|
||||
},
|
||||
reason =>
|
||||
makeThrowingMatcher(matcher, isNot, 'rejects', reason, innerErr).apply(
|
||||
null,
|
||||
args
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
const makeThrowingMatcher = (matcher, isNot, promise, actual, err) =>
|
||||
function throwingMatcher(...args) {
|
||||
let throws = true;
|
||||
const utils = {
|
||||
...matcherUtils,
|
||||
iterableEquality: _utils.iterableEquality,
|
||||
subsetEquality: _utils.subsetEquality
|
||||
};
|
||||
const matcherContext = {
|
||||
// When throws is disabled, the matcher will not throw errors during test
|
||||
// execution but instead add them to the global matcher state. If a
|
||||
// matcher throws, test execution is normally stopped immediately. The
|
||||
// snapshot matcher uses it because we want to log all snapshot
|
||||
// failures in a test.
|
||||
dontThrow: () => (throws = false),
|
||||
...(0, _jestMatchersObject.getState)(),
|
||||
equals: _jasmineUtils.equals,
|
||||
error: err,
|
||||
isNot,
|
||||
promise,
|
||||
utils
|
||||
};
|
||||
|
||||
const processResult = (result, asyncError) => {
|
||||
_validateResult(result);
|
||||
|
||||
(0, _jestMatchersObject.getState)().assertionCalls++;
|
||||
|
||||
if ((result.pass && isNot) || (!result.pass && !isNot)) {
|
||||
// XOR
|
||||
const message = getMessage(result.message);
|
||||
let error;
|
||||
|
||||
if (err) {
|
||||
error = err;
|
||||
error.message = message;
|
||||
} else if (asyncError) {
|
||||
error = asyncError;
|
||||
error.message = message;
|
||||
} else {
|
||||
error = new JestAssertionError(message); // Try to remove this function from the stack trace frame.
|
||||
// Guard for some environments (browsers) that do not support this feature.
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(error, throwingMatcher);
|
||||
}
|
||||
} // Passing the result of the matcher with the error so that a custom
|
||||
// reporter could access the actual and expected objects of the result
|
||||
// for example in order to display a custom visual diff
|
||||
|
||||
error.matcherResult = result;
|
||||
|
||||
if (throws) {
|
||||
throw error;
|
||||
} else {
|
||||
(0, _jestMatchersObject.getState)().suppressedErrors.push(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleError = error => {
|
||||
if (
|
||||
matcher[_jestMatchersObject.INTERNAL_MATCHER_FLAG] === true &&
|
||||
!(error instanceof JestAssertionError) &&
|
||||
error.name !== 'PrettyFormatPluginError' && // Guard for some environments (browsers) that do not support this feature.
|
||||
Error.captureStackTrace
|
||||
) {
|
||||
// Try to remove this and deeper functions from the stack trace frame.
|
||||
Error.captureStackTrace(error, throwingMatcher);
|
||||
}
|
||||
|
||||
throw error;
|
||||
};
|
||||
|
||||
let potentialResult;
|
||||
|
||||
try {
|
||||
potentialResult =
|
||||
matcher[_jestMatchersObject.INTERNAL_MATCHER_FLAG] === true
|
||||
? matcher.call(matcherContext, actual, ...args) // It's a trap specifically for inline snapshot to capture this name
|
||||
: // in the stack trace, so that it can correctly get the custom matcher
|
||||
// function call.
|
||||
(function __EXTERNAL_MATCHER_TRAP__() {
|
||||
return matcher.call(matcherContext, actual, ...args);
|
||||
})();
|
||||
|
||||
if (isPromise(potentialResult)) {
|
||||
const asyncResult = potentialResult;
|
||||
const asyncError = new JestAssertionError();
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(asyncError, throwingMatcher);
|
||||
}
|
||||
|
||||
return asyncResult
|
||||
.then(aResult => processResult(aResult, asyncError))
|
||||
.catch(handleError);
|
||||
} else {
|
||||
const syncResult = potentialResult;
|
||||
return processResult(syncResult);
|
||||
}
|
||||
} catch (error) {
|
||||
return handleError(error);
|
||||
}
|
||||
};
|
||||
|
||||
expect.extend = matchers =>
|
||||
(0, _jestMatchersObject.setMatchers)(matchers, false, expect);
|
||||
|
||||
expect.anything = _asymmetricMatchers.anything;
|
||||
expect.any = _asymmetricMatchers.any;
|
||||
expect.not = {
|
||||
arrayContaining: _asymmetricMatchers.arrayNotContaining,
|
||||
objectContaining: _asymmetricMatchers.objectNotContaining,
|
||||
stringContaining: _asymmetricMatchers.stringNotContaining,
|
||||
stringMatching: _asymmetricMatchers.stringNotMatching
|
||||
};
|
||||
expect.objectContaining = _asymmetricMatchers.objectContaining;
|
||||
expect.arrayContaining = _asymmetricMatchers.arrayContaining;
|
||||
expect.stringContaining = _asymmetricMatchers.stringContaining;
|
||||
expect.stringMatching = _asymmetricMatchers.stringMatching;
|
||||
|
||||
const _validateResult = result => {
|
||||
if (
|
||||
typeof result !== 'object' ||
|
||||
typeof result.pass !== 'boolean' ||
|
||||
(result.message &&
|
||||
typeof result.message !== 'string' &&
|
||||
typeof result.message !== 'function')
|
||||
) {
|
||||
throw new Error(
|
||||
'Unexpected return from a matcher function.\n' +
|
||||
'Matcher functions should ' +
|
||||
'return an object in the following format:\n' +
|
||||
' {message?: string | function, pass: boolean}\n' +
|
||||
`'${matcherUtils.stringify(result)}' was returned`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function assertions(expected) {
|
||||
const error = new Error();
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(error, assertions);
|
||||
}
|
||||
|
||||
(0, _jestMatchersObject.getState)().expectedAssertionsNumber = expected;
|
||||
(0, _jestMatchersObject.getState)().expectedAssertionsNumberError = error;
|
||||
}
|
||||
|
||||
function hasAssertions(...args) {
|
||||
const error = new Error();
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(error, hasAssertions);
|
||||
}
|
||||
|
||||
matcherUtils.ensureNoExpected(args[0], '.hasAssertions');
|
||||
(0, _jestMatchersObject.getState)().isExpectingAssertions = true;
|
||||
(0, _jestMatchersObject.getState)().isExpectingAssertionsError = error;
|
||||
} // add default jest matchers
|
||||
|
||||
(0, _jestMatchersObject.setMatchers)(_matchers.default, true, expect);
|
||||
(0, _jestMatchersObject.setMatchers)(_spyMatchers.default, true, expect);
|
||||
(0, _jestMatchersObject.setMatchers)(_toThrowMatchers.default, true, expect);
|
||||
|
||||
expect.addSnapshotSerializer = () => void 0;
|
||||
|
||||
expect.assertions = assertions;
|
||||
expect.hasAssertions = hasAssertions;
|
||||
expect.getState = _jestMatchersObject.getState;
|
||||
expect.setState = _jestMatchersObject.setState;
|
||||
expect.extractExpectedAssertionsErrors =
|
||||
_extractExpectedAssertionsErrors.default;
|
||||
const expectExport = expect; // eslint-disable-next-line no-redeclare
|
||||
|
||||
module.exports = expectExport;
|
8
node_modules/expect/build/jasmineUtils.d.ts
generated
vendored
Normal file
8
node_modules/expect/build/jasmineUtils.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
import type { Tester } from './types';
|
||||
export declare function equals(a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean): boolean;
|
||||
export declare function isA(typeName: string, value: unknown): boolean;
|
||||
export declare function fnNameFor(func: Function): string;
|
||||
export declare function isUndefined(obj: any): boolean;
|
||||
export declare function hasProperty(obj: object | null, property: string): boolean;
|
||||
export declare function isImmutableUnorderedKeyed(maybeKeyed: any): boolean;
|
||||
export declare function isImmutableUnorderedSet(maybeSet: any): boolean;
|
312
node_modules/expect/build/jasmineUtils.js
generated
vendored
Normal file
312
node_modules/expect/build/jasmineUtils.js
generated
vendored
Normal file
|
@ -0,0 +1,312 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.equals = equals;
|
||||
exports.isA = isA;
|
||||
exports.fnNameFor = fnNameFor;
|
||||
exports.isUndefined = isUndefined;
|
||||
exports.hasProperty = hasProperty;
|
||||
exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
|
||||
exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
|
||||
|
||||
/*
|
||||
Copyright (c) 2008-2016 Pivotal Labs
|
||||
|
||||
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 */
|
||||
// Extracted out of jasmine 2.5.2
|
||||
function equals(a, b, customTesters, strictCheck) {
|
||||
customTesters = customTesters || [];
|
||||
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
||||
}
|
||||
|
||||
const functionToString = Function.prototype.toString;
|
||||
|
||||
function isAsymmetric(obj) {
|
||||
return !!obj && isA('Function', obj.asymmetricMatch);
|
||||
}
|
||||
|
||||
function asymmetricMatch(a, b) {
|
||||
var asymmetricA = isAsymmetric(a),
|
||||
asymmetricB = isAsymmetric(b);
|
||||
|
||||
if (asymmetricA && asymmetricB) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (asymmetricA) {
|
||||
return a.asymmetricMatch(b);
|
||||
}
|
||||
|
||||
if (asymmetricB) {
|
||||
return b.asymmetricMatch(a);
|
||||
}
|
||||
} // Equality function lovingly adapted from isEqual in
|
||||
// [Underscore](http://underscorejs.org)
|
||||
|
||||
function eq(a, b, aStack, bStack, customTesters, hasKey) {
|
||||
var result = true;
|
||||
var asymmetricResult = asymmetricMatch(a, b);
|
||||
|
||||
if (asymmetricResult !== undefined) {
|
||||
return asymmetricResult;
|
||||
}
|
||||
|
||||
for (var i = 0; i < customTesters.length; i++) {
|
||||
var customTesterResult = customTesters[i](a, b);
|
||||
|
||||
if (customTesterResult !== undefined) {
|
||||
return customTesterResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (a instanceof Error && b instanceof Error) {
|
||||
return a.message == b.message;
|
||||
}
|
||||
|
||||
if (Object.is(a, b)) {
|
||||
return true;
|
||||
} // A strict comparison is necessary because `null == undefined`.
|
||||
|
||||
if (a === null || b === null) {
|
||||
return a === b;
|
||||
}
|
||||
|
||||
var className = Object.prototype.toString.call(a);
|
||||
|
||||
if (className != Object.prototype.toString.call(b)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (className) {
|
||||
case '[object Boolean]':
|
||||
case '[object String]':
|
||||
case '[object Number]':
|
||||
if (typeof a !== typeof b) {
|
||||
// One is a primitive, one a `new Primitive()`
|
||||
return false;
|
||||
} else if (typeof a !== 'object' && typeof b !== 'object') {
|
||||
// both are proper primitives
|
||||
return Object.is(a, b);
|
||||
} else {
|
||||
// both are `new Primitive()`s
|
||||
return Object.is(a.valueOf(), b.valueOf());
|
||||
}
|
||||
|
||||
case '[object Date]':
|
||||
// Coerce dates to numeric primitive values. Dates are compared by their
|
||||
// millisecond representations. Note that invalid dates with millisecond representations
|
||||
// of `NaN` are not equivalent.
|
||||
return +a == +b;
|
||||
// RegExps are compared by their source patterns and flags.
|
||||
|
||||
case '[object RegExp]':
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
}
|
||||
|
||||
if (typeof a !== 'object' || typeof b !== 'object') {
|
||||
return false;
|
||||
} // Use DOM3 method isEqualNode (IE>=9)
|
||||
|
||||
if (isDomNode(a) && isDomNode(b)) {
|
||||
return a.isEqualNode(b);
|
||||
} // Used to detect circular references.
|
||||
|
||||
var length = aStack.length;
|
||||
|
||||
while (length--) {
|
||||
// Linear search. Performance is inversely proportional to the number of
|
||||
// unique nested structures.
|
||||
// circular references at same depth are equal
|
||||
// circular reference is not equal to non-circular one
|
||||
if (aStack[length] === a) {
|
||||
return bStack[length] === b;
|
||||
} else if (bStack[length] === b) {
|
||||
return false;
|
||||
}
|
||||
} // Add the first object to the stack of traversed objects.
|
||||
|
||||
aStack.push(a);
|
||||
bStack.push(b);
|
||||
var size = 0; // Recursively compare objects and arrays.
|
||||
// Compare array lengths to determine if a deep comparison is necessary.
|
||||
|
||||
if (className == '[object Array]') {
|
||||
size = a.length;
|
||||
|
||||
if (size !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (size--) {
|
||||
result = eq(a[size], b[size], aStack, bStack, customTesters, hasKey);
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // Deep compare objects.
|
||||
|
||||
var aKeys = keys(a, className == '[object Array]', hasKey),
|
||||
key;
|
||||
size = aKeys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
|
||||
|
||||
if (keys(b, className == '[object Array]', hasKey).length !== size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (size--) {
|
||||
key = aKeys[size]; // Deep compare each member
|
||||
|
||||
result =
|
||||
hasKey(b, key) &&
|
||||
eq(a[key], b[key], aStack, bStack, customTesters, hasKey);
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
} // Remove the first object from the stack of traversed objects.
|
||||
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return result;
|
||||
}
|
||||
|
||||
function keys(obj, isArray, hasKey) {
|
||||
var allKeys = (function (o) {
|
||||
var keys = [];
|
||||
|
||||
for (var key in o) {
|
||||
if (hasKey(o, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
return keys.concat(
|
||||
Object.getOwnPropertySymbols(o).filter(
|
||||
symbol => Object.getOwnPropertyDescriptor(o, symbol).enumerable
|
||||
)
|
||||
);
|
||||
})(obj);
|
||||
|
||||
if (!isArray) {
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
var extraKeys = [];
|
||||
|
||||
if (allKeys.length === 0) {
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
for (var x = 0; x < allKeys.length; x++) {
|
||||
if (typeof allKeys[x] === 'symbol' || !allKeys[x].match(/^[0-9]+$/)) {
|
||||
extraKeys.push(allKeys[x]);
|
||||
}
|
||||
}
|
||||
|
||||
return extraKeys;
|
||||
}
|
||||
|
||||
function hasDefinedKey(obj, key) {
|
||||
return hasKey(obj, key) && obj[key] !== undefined;
|
||||
}
|
||||
|
||||
function hasKey(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
function isA(typeName, value) {
|
||||
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
||||
}
|
||||
|
||||
function isDomNode(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj === 'object' &&
|
||||
typeof obj.nodeType === 'number' &&
|
||||
typeof obj.nodeName === 'string' &&
|
||||
typeof obj.isEqualNode === 'function'
|
||||
);
|
||||
}
|
||||
|
||||
function fnNameFor(func) {
|
||||
if (func.name) {
|
||||
return func.name;
|
||||
}
|
||||
|
||||
const matches = functionToString
|
||||
.call(func)
|
||||
.match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/);
|
||||
return matches ? matches[1] : '<anonymous>';
|
||||
}
|
||||
|
||||
function isUndefined(obj) {
|
||||
return obj === void 0;
|
||||
}
|
||||
|
||||
function getPrototype(obj) {
|
||||
if (Object.getPrototypeOf) {
|
||||
return Object.getPrototypeOf(obj);
|
||||
}
|
||||
|
||||
if (obj.constructor.prototype == obj) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return obj.constructor.prototype;
|
||||
}
|
||||
|
||||
function hasProperty(obj, property) {
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(obj, property)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return hasProperty(getPrototype(obj), property);
|
||||
} // SENTINEL constants are from https://github.com/facebook/immutable-js
|
||||
|
||||
const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
||||
const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
||||
const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
||||
|
||||
function isImmutableUnorderedKeyed(maybeKeyed) {
|
||||
return !!(
|
||||
maybeKeyed &&
|
||||
maybeKeyed[IS_KEYED_SENTINEL] &&
|
||||
!maybeKeyed[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
|
||||
function isImmutableUnorderedSet(maybeSet) {
|
||||
return !!(
|
||||
maybeSet &&
|
||||
maybeSet[IS_SET_SENTINEL] &&
|
||||
!maybeSet[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
13
node_modules/expect/build/jestMatchersObject.d.ts
generated
vendored
Normal file
13
node_modules/expect/build/jestMatchersObject.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 { Expect, MatchersObject } from './types';
|
||||
export declare const INTERNAL_MATCHER_FLAG: unique symbol;
|
||||
export declare const getState: () => any;
|
||||
export declare const setState: (state: object) => void;
|
||||
export declare const getMatchers: () => MatchersObject;
|
||||
export declare const setMatchers: (matchers: MatchersObject, isInternal: boolean, expect: Expect) => void;
|
92
node_modules/expect/build/jestMatchersObject.js
generated
vendored
Normal file
92
node_modules/expect/build/jestMatchersObject.js
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.setMatchers = exports.getMatchers = exports.setState = exports.getState = exports.INTERNAL_MATCHER_FLAG = void 0;
|
||||
|
||||
var _asymmetricMatchers = require('./asymmetricMatchers');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
// Global matchers object holds the list of available matchers and
|
||||
// the state, that can hold matcher specific values that change over time.
|
||||
const JEST_MATCHERS_OBJECT = Symbol.for('$$jest-matchers-object'); // Notes a built-in/internal Jest matcher.
|
||||
// Jest may override the stack trace of Errors thrown by internal matchers.
|
||||
|
||||
const INTERNAL_MATCHER_FLAG = Symbol.for('$$jest-internal-matcher');
|
||||
exports.INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG;
|
||||
|
||||
if (!global.hasOwnProperty(JEST_MATCHERS_OBJECT)) {
|
||||
Object.defineProperty(global, JEST_MATCHERS_OBJECT, {
|
||||
value: {
|
||||
matchers: Object.create(null),
|
||||
state: {
|
||||
assertionCalls: 0,
|
||||
expectedAssertionsNumber: null,
|
||||
isExpectingAssertions: false,
|
||||
suppressedErrors: [] // errors that are not thrown immediately.
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const getState = () => global[JEST_MATCHERS_OBJECT].state;
|
||||
|
||||
exports.getState = getState;
|
||||
|
||||
const setState = state => {
|
||||
Object.assign(global[JEST_MATCHERS_OBJECT].state, state);
|
||||
};
|
||||
|
||||
exports.setState = setState;
|
||||
|
||||
const getMatchers = () => global[JEST_MATCHERS_OBJECT].matchers;
|
||||
|
||||
exports.getMatchers = getMatchers;
|
||||
|
||||
const setMatchers = (matchers, isInternal, expect) => {
|
||||
Object.keys(matchers).forEach(key => {
|
||||
const matcher = matchers[key];
|
||||
Object.defineProperty(matcher, INTERNAL_MATCHER_FLAG, {
|
||||
value: isInternal
|
||||
});
|
||||
|
||||
if (!isInternal) {
|
||||
// expect is defined
|
||||
class CustomMatcher extends _asymmetricMatchers.AsymmetricMatcher {
|
||||
constructor(inverse = false, ...sample) {
|
||||
super(sample);
|
||||
this.inverse = inverse;
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
const {pass} = matcher(other, ...this.sample);
|
||||
return this.inverse ? !pass : pass;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `${this.inverse ? 'not.' : ''}${key}`;
|
||||
}
|
||||
|
||||
getExpectedType() {
|
||||
return 'any';
|
||||
}
|
||||
|
||||
toAsymmetricMatcher() {
|
||||
return `${this.toString()}<${this.sample.map(String).join(', ')}>`;
|
||||
}
|
||||
}
|
||||
|
||||
expect[key] = (...sample) => new CustomMatcher(false, ...sample);
|
||||
|
||||
if (!expect.not) {
|
||||
expect.not = {};
|
||||
}
|
||||
|
||||
expect.not[key] = (...sample) => new CustomMatcher(true, ...sample);
|
||||
}
|
||||
});
|
||||
Object.assign(global[JEST_MATCHERS_OBJECT].matchers, matchers);
|
||||
};
|
||||
|
||||
exports.setMatchers = setMatchers;
|
10
node_modules/expect/build/matchers.d.ts
generated
vendored
Normal file
10
node_modules/expect/build/matchers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
import type { MatchersObject } from './types';
|
||||
declare const matchers: MatchersObject;
|
||||
export default matchers;
|
1340
node_modules/expect/build/matchers.js
generated
vendored
Normal file
1340
node_modules/expect/build/matchers.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
15
node_modules/expect/build/print.d.ts
generated
vendored
Normal file
15
node_modules/expect/build/print.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* 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 const printReceivedStringContainExpectedSubstring: (received: string, start: number, length: number) => string;
|
||||
export declare const printReceivedStringContainExpectedResult: (received: string, result: RegExpExecArray | null) => string;
|
||||
export declare const printReceivedArrayContainExpectedItem: (received: Array<unknown>, index: number) => string;
|
||||
export declare const printCloseTo: (receivedDiff: number, expectedDiff: number, precision: number, isNot: boolean) => string;
|
||||
export declare const printExpectedConstructorName: (label: string, expected: Function) => string;
|
||||
export declare const printExpectedConstructorNameNot: (label: string, expected: Function) => string;
|
||||
export declare const printReceivedConstructorName: (label: string, received: Function) => string;
|
||||
export declare const printReceivedConstructorNameNot: (label: string, received: Function, expected: Function) => string;
|
124
node_modules/expect/build/print.js
generated
vendored
Normal file
124
node_modules/expect/build/print.js
generated
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printCloseTo = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
// Format substring but do not enclose in double quote marks.
|
||||
// The replacement is compatible with pretty-format package.
|
||||
const printSubstring = val => val.replace(/"|\\/g, '\\$&');
|
||||
|
||||
const printReceivedStringContainExpectedSubstring = (received, start, length) =>
|
||||
(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
'"' +
|
||||
printSubstring(received.slice(0, start)) +
|
||||
(0, _jestMatcherUtils.INVERTED_COLOR)(
|
||||
printSubstring(received.slice(start, start + length))
|
||||
) +
|
||||
printSubstring(received.slice(start + length)) +
|
||||
'"'
|
||||
);
|
||||
|
||||
exports.printReceivedStringContainExpectedSubstring = printReceivedStringContainExpectedSubstring;
|
||||
|
||||
const printReceivedStringContainExpectedResult = (received, result) =>
|
||||
result === null
|
||||
? (0, _jestMatcherUtils.printReceived)(received)
|
||||
: printReceivedStringContainExpectedSubstring(
|
||||
received,
|
||||
result.index,
|
||||
result[0].length
|
||||
); // The serialized array is compatible with pretty-format package min option.
|
||||
// However, items have default stringify depth (instead of depth - 1)
|
||||
// so expected item looks consistent by itself and enclosed in the array.
|
||||
|
||||
exports.printReceivedStringContainExpectedResult = printReceivedStringContainExpectedResult;
|
||||
|
||||
const printReceivedArrayContainExpectedItem = (received, index) =>
|
||||
(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
'[' +
|
||||
received
|
||||
.map((item, i) => {
|
||||
const stringified = (0, _jestMatcherUtils.stringify)(item);
|
||||
return i === index
|
||||
? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified)
|
||||
: stringified;
|
||||
})
|
||||
.join(', ') +
|
||||
']'
|
||||
);
|
||||
|
||||
exports.printReceivedArrayContainExpectedItem = printReceivedArrayContainExpectedItem;
|
||||
|
||||
const printCloseTo = (receivedDiff, expectedDiff, precision, isNot) => {
|
||||
const receivedDiffString = (0, _jestMatcherUtils.stringify)(receivedDiff);
|
||||
const expectedDiffString = receivedDiffString.includes('e') // toExponential arg is number of digits after the decimal point.
|
||||
? expectedDiff.toExponential(0)
|
||||
: 0 <= precision && precision < 20 // toFixed arg is number of digits after the decimal point.
|
||||
? // It may be a value between 0 and 20 inclusive.
|
||||
// Implementations may optionally support a larger range of values.
|
||||
expectedDiff.toFixed(precision + 1)
|
||||
: (0, _jestMatcherUtils.stringify)(expectedDiff);
|
||||
return (
|
||||
`Expected precision: ${isNot ? ' ' : ''} ${(0,
|
||||
_jestMatcherUtils.stringify)(precision)}\n` +
|
||||
`Expected difference: ${isNot ? 'not ' : ''}< ${(0,
|
||||
_jestMatcherUtils.EXPECTED_COLOR)(expectedDiffString)}\n` +
|
||||
`Received difference: ${isNot ? ' ' : ''} ${(0,
|
||||
_jestMatcherUtils.RECEIVED_COLOR)(receivedDiffString)}`
|
||||
);
|
||||
};
|
||||
|
||||
exports.printCloseTo = printCloseTo;
|
||||
|
||||
const printExpectedConstructorName = (label, expected) =>
|
||||
printConstructorName(label, expected, false, true) + '\n';
|
||||
|
||||
exports.printExpectedConstructorName = printExpectedConstructorName;
|
||||
|
||||
const printExpectedConstructorNameNot = (label, expected) =>
|
||||
printConstructorName(label, expected, true, true) + '\n';
|
||||
|
||||
exports.printExpectedConstructorNameNot = printExpectedConstructorNameNot;
|
||||
|
||||
const printReceivedConstructorName = (label, received) =>
|
||||
printConstructorName(label, received, false, false) + '\n'; // Do not call function if received is equal to expected.
|
||||
|
||||
exports.printReceivedConstructorName = printReceivedConstructorName;
|
||||
|
||||
const printReceivedConstructorNameNot = (label, received, expected) =>
|
||||
typeof expected.name === 'string' &&
|
||||
expected.name.length !== 0 &&
|
||||
typeof received.name === 'string' &&
|
||||
received.name.length !== 0
|
||||
? printConstructorName(label, received, true, false) +
|
||||
` ${
|
||||
Object.getPrototypeOf(received) === expected
|
||||
? 'extends'
|
||||
: 'extends … extends'
|
||||
} ${(0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)}` +
|
||||
'\n'
|
||||
: printConstructorName(label, received, false, false) + '\n';
|
||||
|
||||
exports.printReceivedConstructorNameNot = printReceivedConstructorNameNot;
|
||||
|
||||
const printConstructorName = (label, constructor, isNot, isExpected) =>
|
||||
typeof constructor.name !== 'string'
|
||||
? `${label} name is not a string`
|
||||
: constructor.name.length === 0
|
||||
? `${label} name is an empty string`
|
||||
: `${label}: ${!isNot ? '' : isExpected ? 'not ' : ' '}${
|
||||
isExpected
|
||||
? (0, _jestMatcherUtils.EXPECTED_COLOR)(constructor.name)
|
||||
: (0, _jestMatcherUtils.RECEIVED_COLOR)(constructor.name)
|
||||
}`;
|
9
node_modules/expect/build/spyMatchers.d.ts
generated
vendored
Normal file
9
node_modules/expect/build/spyMatchers.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 { MatchersObject } from './types';
|
||||
declare const spyMatchers: MatchersObject;
|
||||
export default spyMatchers;
|
1343
node_modules/expect/build/spyMatchers.js
generated
vendored
Normal file
1343
node_modules/expect/build/spyMatchers.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
11
node_modules/expect/build/toThrowMatchers.d.ts
generated
vendored
Normal file
11
node_modules/expect/build/toThrowMatchers.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 { MatchersObject, RawMatcherFn } from './types';
|
||||
export declare const createMatcher: (matcherName: string, fromPromise?: boolean | undefined) => RawMatcherFn;
|
||||
declare const matchers: MatchersObject;
|
||||
export default matchers;
|
465
node_modules/expect/build/toThrowMatchers.js
generated
vendored
Normal file
465
node_modules/expect/build/toThrowMatchers.js
generated
vendored
Normal file
|
@ -0,0 +1,465 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.createMatcher = void 0;
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _print = require('./print');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
const DID_NOT_THROW = 'Received function did not throw';
|
||||
|
||||
const getThrown = e => {
|
||||
const hasMessage =
|
||||
e !== null && e !== undefined && typeof e.message === 'string';
|
||||
|
||||
if (hasMessage && typeof e.name === 'string' && typeof e.stack === 'string') {
|
||||
return {
|
||||
hasMessage,
|
||||
isError: true,
|
||||
message: e.message,
|
||||
value: e
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
hasMessage,
|
||||
isError: false,
|
||||
message: hasMessage ? e.message : String(e),
|
||||
value: e
|
||||
};
|
||||
};
|
||||
|
||||
const createMatcher = (
|
||||
matcherName,
|
||||
fromPromise // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
) =>
|
||||
function (received, expected) {
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
let thrown = null;
|
||||
|
||||
if (fromPromise && (0, _utils.isError)(received)) {
|
||||
thrown = getThrown(received);
|
||||
} else {
|
||||
if (typeof received !== 'function') {
|
||||
if (!fromPromise) {
|
||||
const placeholder = expected === undefined ? '' : 'expected';
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
placeholder,
|
||||
options
|
||||
),
|
||||
`${(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
'received'
|
||||
)} value must be a function`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Received',
|
||||
received,
|
||||
_jestMatcherUtils.printReceived
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
received();
|
||||
} catch (e) {
|
||||
thrown = getThrown(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (expected === undefined) {
|
||||
return toThrow(matcherName, options, thrown);
|
||||
} else if (typeof expected === 'function') {
|
||||
return toThrowExpectedClass(matcherName, options, thrown, expected);
|
||||
} else if (typeof expected === 'string') {
|
||||
return toThrowExpectedString(matcherName, options, thrown, expected);
|
||||
} else if (expected !== null && typeof expected.test === 'function') {
|
||||
return toThrowExpectedRegExp(matcherName, options, thrown, expected);
|
||||
} else if (
|
||||
expected !== null &&
|
||||
typeof expected.asymmetricMatch === 'function'
|
||||
) {
|
||||
return toThrowExpectedAsymmetric(matcherName, options, thrown, expected);
|
||||
} else if (expected !== null && typeof expected === 'object') {
|
||||
return toThrowExpectedObject(matcherName, options, thrown, expected);
|
||||
} else {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
),
|
||||
`${(0, _jestMatcherUtils.EXPECTED_COLOR)(
|
||||
'expected'
|
||||
)} value must be a string or regular expression or class or error`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Expected',
|
||||
expected,
|
||||
_jestMatcherUtils.printExpected
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
exports.createMatcher = createMatcher;
|
||||
const matchers = {
|
||||
toThrow: createMatcher('toThrow'),
|
||||
toThrowError: createMatcher('toThrowError')
|
||||
};
|
||||
|
||||
const toThrowExpectedRegExp = (matcherName, options, thrown, expected) => {
|
||||
const pass = thrown !== null && expected.test(thrown.message);
|
||||
const message = pass
|
||||
? () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected pattern: not ', expected) +
|
||||
(thrown !== null && thrown.hasMessage
|
||||
? formatReceived(
|
||||
'Received message: ',
|
||||
thrown,
|
||||
'message',
|
||||
expected
|
||||
) + formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value'))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected pattern: ', expected) +
|
||||
(thrown === null
|
||||
? '\n' + DID_NOT_THROW
|
||||
: thrown.hasMessage
|
||||
? formatReceived('Received message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value'));
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
};
|
||||
};
|
||||
|
||||
const toThrowExpectedAsymmetric = (matcherName, options, thrown, expected) => {
|
||||
const pass = thrown !== null && expected.asymmetricMatch(thrown.value);
|
||||
const message = pass
|
||||
? () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected asymmetric matcher: not ', expected) +
|
||||
'\n' +
|
||||
(thrown !== null && thrown.hasMessage
|
||||
? formatReceived('Received name: ', thrown, 'name') +
|
||||
formatReceived('Received message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Thrown value: ', thrown, 'value'))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected asymmetric matcher: ', expected) +
|
||||
'\n' +
|
||||
(thrown === null
|
||||
? DID_NOT_THROW
|
||||
: thrown.hasMessage
|
||||
? formatReceived('Received name: ', thrown, 'name') +
|
||||
formatReceived('Received message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Thrown value: ', thrown, 'value'));
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
};
|
||||
};
|
||||
|
||||
const toThrowExpectedObject = (matcherName, options, thrown, expected) => {
|
||||
const pass = thrown !== null && thrown.message === expected.message;
|
||||
const message = pass
|
||||
? () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected message: not ', expected.message) +
|
||||
(thrown !== null && thrown.hasMessage
|
||||
? formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value'))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
(thrown === null
|
||||
? formatExpected('Expected message: ', expected.message) +
|
||||
'\n' +
|
||||
DID_NOT_THROW
|
||||
: thrown.hasMessage
|
||||
? (0, _jestMatcherUtils.printDiffOrStringify)(
|
||||
expected.message,
|
||||
thrown.message,
|
||||
'Expected message',
|
||||
'Received message',
|
||||
true
|
||||
) +
|
||||
'\n' +
|
||||
formatStack(thrown)
|
||||
: formatExpected('Expected message: ', expected.message) +
|
||||
formatReceived('Received value: ', thrown, 'value'));
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
};
|
||||
};
|
||||
|
||||
const toThrowExpectedClass = (matcherName, options, thrown, expected) => {
|
||||
const pass = thrown !== null && thrown.value instanceof expected;
|
||||
const message = pass
|
||||
? () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
(0, _print.printExpectedConstructorNameNot)(
|
||||
'Expected constructor',
|
||||
expected
|
||||
) +
|
||||
(thrown !== null &&
|
||||
thrown.value != null &&
|
||||
typeof thrown.value.constructor === 'function' &&
|
||||
thrown.value.constructor !== expected
|
||||
? (0, _print.printReceivedConstructorNameNot)(
|
||||
'Received constructor',
|
||||
thrown.value.constructor,
|
||||
expected
|
||||
)
|
||||
: '') +
|
||||
'\n' +
|
||||
(thrown !== null && thrown.hasMessage
|
||||
? formatReceived('Received message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value'))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
(0, _print.printExpectedConstructorName)(
|
||||
'Expected constructor',
|
||||
expected
|
||||
) +
|
||||
(thrown === null
|
||||
? '\n' + DID_NOT_THROW
|
||||
: (thrown.value != null &&
|
||||
typeof thrown.value.constructor === 'function'
|
||||
? (0, _print.printReceivedConstructorName)(
|
||||
'Received constructor',
|
||||
thrown.value.constructor
|
||||
)
|
||||
: '') +
|
||||
'\n' +
|
||||
(thrown.hasMessage
|
||||
? formatReceived('Received message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value')));
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
};
|
||||
};
|
||||
|
||||
const toThrowExpectedString = (matcherName, options, thrown, expected) => {
|
||||
const pass = thrown !== null && thrown.message.includes(expected);
|
||||
const message = pass
|
||||
? () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected substring: not ', expected) +
|
||||
(thrown !== null && thrown.hasMessage
|
||||
? formatReceived(
|
||||
'Received message: ',
|
||||
thrown,
|
||||
'message',
|
||||
expected
|
||||
) + formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value'))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
formatExpected('Expected substring: ', expected) +
|
||||
(thrown === null
|
||||
? '\n' + DID_NOT_THROW
|
||||
: thrown.hasMessage
|
||||
? formatReceived('Received message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Received value: ', thrown, 'value'));
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
};
|
||||
};
|
||||
|
||||
const toThrow = (matcherName, options, thrown) => {
|
||||
const pass = thrown !== null;
|
||||
const message = pass
|
||||
? () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
'',
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
(thrown !== null && thrown.hasMessage
|
||||
? formatReceived('Error name: ', thrown, 'name') +
|
||||
formatReceived('Error message: ', thrown, 'message') +
|
||||
formatStack(thrown)
|
||||
: formatReceived('Thrown value: ', thrown, 'value'))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
'',
|
||||
options
|
||||
) +
|
||||
'\n\n' +
|
||||
DID_NOT_THROW;
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
};
|
||||
};
|
||||
|
||||
const formatExpected = (label, expected) =>
|
||||
label + (0, _jestMatcherUtils.printExpected)(expected) + '\n';
|
||||
|
||||
const formatReceived = (label, thrown, key, expected) => {
|
||||
if (thrown === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (key === 'message') {
|
||||
const message = thrown.message;
|
||||
|
||||
if (typeof expected === 'string') {
|
||||
const index = message.indexOf(expected);
|
||||
|
||||
if (index !== -1) {
|
||||
return (
|
||||
label +
|
||||
(0, _print.printReceivedStringContainExpectedSubstring)(
|
||||
message,
|
||||
index,
|
||||
expected.length
|
||||
) +
|
||||
'\n'
|
||||
);
|
||||
}
|
||||
} else if (expected instanceof RegExp) {
|
||||
return (
|
||||
label +
|
||||
(0, _print.printReceivedStringContainExpectedResult)(
|
||||
message,
|
||||
typeof expected.exec === 'function' ? expected.exec(message) : null
|
||||
) +
|
||||
'\n'
|
||||
);
|
||||
}
|
||||
|
||||
return label + (0, _jestMatcherUtils.printReceived)(message) + '\n';
|
||||
}
|
||||
|
||||
if (key === 'name') {
|
||||
return thrown.isError
|
||||
? label + (0, _jestMatcherUtils.printReceived)(thrown.value.name) + '\n'
|
||||
: '';
|
||||
}
|
||||
|
||||
if (key === 'value') {
|
||||
return thrown.isError
|
||||
? ''
|
||||
: label + (0, _jestMatcherUtils.printReceived)(thrown.value) + '\n';
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
const formatStack = thrown =>
|
||||
thrown === null || !thrown.isError
|
||||
? ''
|
||||
: (0, _jestMessageUtil.formatStackTrace)(
|
||||
(0, _jestMessageUtil.separateMessageFromStack)(thrown.value.stack)
|
||||
.stack,
|
||||
{
|
||||
rootDir: process.cwd(),
|
||||
testMatch: []
|
||||
},
|
||||
{
|
||||
noStackTrace: false
|
||||
}
|
||||
);
|
||||
|
||||
var _default = matchers;
|
||||
exports.default = _default;
|
325
node_modules/expect/build/types.d.ts
generated
vendored
Normal file
325
node_modules/expect/build/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,325 @@
|
|||
/**
|
||||
* 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 * as jestMatcherUtils from 'jest-matcher-utils';
|
||||
import { INTERNAL_MATCHER_FLAG } from './jestMatchersObject';
|
||||
export declare type SyncExpectationResult = {
|
||||
pass: boolean;
|
||||
message: () => string;
|
||||
};
|
||||
export declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
||||
export declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
||||
export declare type RawMatcherFn = {
|
||||
(received: any, expected: any, options?: any): ExpectationResult;
|
||||
[INTERNAL_MATCHER_FLAG]?: boolean;
|
||||
};
|
||||
export declare type ThrowingMatcherFn = (actual: any) => void;
|
||||
export declare type PromiseMatcherFn = (actual: any) => Promise<void>;
|
||||
export declare type Tester = (a: any, b: any) => boolean | undefined;
|
||||
export declare type MatcherState = {
|
||||
assertionCalls: number;
|
||||
currentTestName?: string;
|
||||
dontThrow?: () => void;
|
||||
error?: Error;
|
||||
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
||||
expand?: boolean;
|
||||
expectedAssertionsNumber?: number;
|
||||
isExpectingAssertions?: boolean;
|
||||
isNot: boolean;
|
||||
promise: string;
|
||||
suppressedErrors: Array<Error>;
|
||||
testPath?: Config.Path;
|
||||
utils: typeof jestMatcherUtils & {
|
||||
iterableEquality: Tester;
|
||||
subsetEquality: Tester;
|
||||
};
|
||||
};
|
||||
export declare type AsymmetricMatcher = Record<string, any>;
|
||||
export declare type MatchersObject = {
|
||||
[id: string]: RawMatcherFn;
|
||||
};
|
||||
export declare type Expect = {
|
||||
<T = unknown>(actual: T): Matchers<T>;
|
||||
addSnapshotSerializer(arg0: any): void;
|
||||
assertions(arg0: number): void;
|
||||
extend(arg0: any): void;
|
||||
extractExpectedAssertionsErrors: () => Array<{
|
||||
actual: string | number;
|
||||
error: Error;
|
||||
expected: string;
|
||||
}>;
|
||||
getState(): MatcherState;
|
||||
hasAssertions(): void;
|
||||
setState(arg0: any): void;
|
||||
any(expectedObject: any): AsymmetricMatcher;
|
||||
anything(): AsymmetricMatcher;
|
||||
arrayContaining(sample: Array<unknown>): AsymmetricMatcher;
|
||||
objectContaining(sample: Record<string, unknown>): AsymmetricMatcher;
|
||||
stringContaining(expected: string): AsymmetricMatcher;
|
||||
stringMatching(expected: string | RegExp): AsymmetricMatcher;
|
||||
[id: string]: AsymmetricMatcher;
|
||||
not: {
|
||||
[id: string]: AsymmetricMatcher;
|
||||
};
|
||||
};
|
||||
interface Constructable {
|
||||
new (...args: Array<unknown>): unknown;
|
||||
}
|
||||
export interface Matchers<R> {
|
||||
/**
|
||||
* Ensures the last call to a mock function was provided specific args.
|
||||
*/
|
||||
lastCalledWith(...args: Array<unknown>): R;
|
||||
/**
|
||||
* Ensure that the last call to a mock function has returned a specified value.
|
||||
*/
|
||||
lastReturnedWith(value: unknown): R;
|
||||
/**
|
||||
* If you know how to test something, `.not` lets you test its opposite.
|
||||
*/
|
||||
not: Matchers<R>;
|
||||
/**
|
||||
* Ensure that a mock function is called with specific arguments on an Nth call.
|
||||
*/
|
||||
nthCalledWith(nthCall: number, ...args: Array<unknown>): R;
|
||||
/**
|
||||
* Ensure that the nth call to a mock function has returned a specified value.
|
||||
*/
|
||||
nthReturnedWith(n: number, value: unknown): R;
|
||||
/**
|
||||
* Use resolves to unwrap the value of a fulfilled promise so any other
|
||||
* matcher can be chained. If the promise is rejected the assertion fails.
|
||||
*/
|
||||
resolves: Matchers<Promise<R>>;
|
||||
/**
|
||||
* Unwraps the reason of a rejected promise so any other matcher can be chained.
|
||||
* If the promise is fulfilled the assertion fails.
|
||||
*/
|
||||
rejects: Matchers<Promise<R>>;
|
||||
/**
|
||||
* Checks that a value is what you expect. It uses `===` to check strict equality.
|
||||
* Don't use `toBe` with floating-point numbers.
|
||||
*/
|
||||
toBe(expected: unknown): R;
|
||||
/**
|
||||
* Ensures that a mock function is called.
|
||||
*/
|
||||
toBeCalled(): R;
|
||||
/**
|
||||
* Ensures that a mock function is called an exact number of times.
|
||||
*/
|
||||
toBeCalledTimes(expected: number): R;
|
||||
/**
|
||||
* Ensure that a mock function is called with specific arguments.
|
||||
*/
|
||||
toBeCalledWith(...args: Array<unknown>): R;
|
||||
/**
|
||||
* Using exact equality with floating point numbers is a bad idea.
|
||||
* Rounding means that intuitive things fail.
|
||||
* The default for numDigits is 2.
|
||||
*/
|
||||
toBeCloseTo(expected: number, numDigits?: number): R;
|
||||
/**
|
||||
* Ensure that a variable is not undefined.
|
||||
*/
|
||||
toBeDefined(): R;
|
||||
/**
|
||||
* When you don't care what a value is, you just want to
|
||||
* ensure a value is false in a boolean context.
|
||||
*/
|
||||
toBeFalsy(): R;
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeGreaterThan(expected: number | bigint): R;
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeGreaterThanOrEqual(expected: number | bigint): R;
|
||||
/**
|
||||
* Ensure that an object is an instance of a class.
|
||||
* This matcher uses `instanceof` underneath.
|
||||
*/
|
||||
toBeInstanceOf(expected: Function): R;
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeLessThan(expected: number | bigint): R;
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeLessThanOrEqual(expected: number | bigint): R;
|
||||
/**
|
||||
* This is the same as `.toBe(null)` but the error messages are a bit nicer.
|
||||
* So use `.toBeNull()` when you want to check that something is null.
|
||||
*/
|
||||
toBeNull(): R;
|
||||
/**
|
||||
* Use when you don't care what a value is, you just want to ensure a value
|
||||
* is true in a boolean context. In JavaScript, there are six falsy values:
|
||||
* `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
|
||||
*/
|
||||
toBeTruthy(): R;
|
||||
/**
|
||||
* Used to check that a variable is undefined.
|
||||
*/
|
||||
toBeUndefined(): R;
|
||||
/**
|
||||
* Used to check that a variable is NaN.
|
||||
*/
|
||||
toBeNaN(): R;
|
||||
/**
|
||||
* Used when you want to check that an item is in a list.
|
||||
* For testing the items in the list, this uses `===`, a strict equality check.
|
||||
*/
|
||||
toContain(expected: unknown): R;
|
||||
/**
|
||||
* Used when you want to check that an item is in a list.
|
||||
* For testing the items in the list, this matcher recursively checks the
|
||||
* equality of all fields, rather than checking for object identity.
|
||||
*/
|
||||
toContainEqual(expected: unknown): R;
|
||||
/**
|
||||
* Used when you want to check that two objects have the same value.
|
||||
* This matcher recursively checks the equality of all fields, rather than checking for object identity.
|
||||
*/
|
||||
toEqual(expected: unknown): R;
|
||||
/**
|
||||
* Ensures that a mock function is called.
|
||||
*/
|
||||
toHaveBeenCalled(): R;
|
||||
/**
|
||||
* Ensures that a mock function is called an exact number of times.
|
||||
*/
|
||||
toHaveBeenCalledTimes(expected: number): R;
|
||||
/**
|
||||
* Ensure that a mock function is called with specific arguments.
|
||||
*/
|
||||
toHaveBeenCalledWith(...args: Array<unknown>): R;
|
||||
/**
|
||||
* Ensure that a mock function is called with specific arguments on an Nth call.
|
||||
*/
|
||||
toHaveBeenNthCalledWith(nthCall: number, ...args: Array<unknown>): R;
|
||||
/**
|
||||
* If you have a mock function, you can use `.toHaveBeenLastCalledWith`
|
||||
* to test what arguments it was last called with.
|
||||
*/
|
||||
toHaveBeenLastCalledWith(...args: Array<unknown>): R;
|
||||
/**
|
||||
* Use to test the specific value that a mock function last returned.
|
||||
* If the last call to the mock function threw an error, then this matcher will fail
|
||||
* no matter what value you provided as the expected return value.
|
||||
*/
|
||||
toHaveLastReturnedWith(expected: unknown): R;
|
||||
/**
|
||||
* Used to check that an object has a `.length` property
|
||||
* and it is set to a certain numeric value.
|
||||
*/
|
||||
toHaveLength(expected: number): R;
|
||||
/**
|
||||
* Use to test the specific value that a mock function returned for the nth call.
|
||||
* If the nth call to the mock function threw an error, then this matcher will fail
|
||||
* no matter what value you provided as the expected return value.
|
||||
*/
|
||||
toHaveNthReturnedWith(nthCall: number, expected: unknown): R;
|
||||
/**
|
||||
* Use to check if property at provided reference keyPath exists for an object.
|
||||
* For checking deeply nested properties in an object you may use dot notation or an array containing
|
||||
* the keyPath for deep references.
|
||||
*
|
||||
* Optionally, you can provide a value to check if it's equal to the value present at keyPath
|
||||
* on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
|
||||
* the equality of all fields.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* expect(houseForSale).toHaveProperty('kitchen.area', 20);
|
||||
*/
|
||||
toHaveProperty(keyPath: string | Array<string>, value?: unknown): R;
|
||||
/**
|
||||
* Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
|
||||
*/
|
||||
toHaveReturned(): R;
|
||||
/**
|
||||
* Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
|
||||
* Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
|
||||
*/
|
||||
toHaveReturnedTimes(expected: number): R;
|
||||
/**
|
||||
* Use to ensure that a mock function returned a specific value.
|
||||
*/
|
||||
toHaveReturnedWith(expected: unknown): R;
|
||||
/**
|
||||
* Check that a string matches a regular expression.
|
||||
*/
|
||||
toMatch(expected: string | RegExp): R;
|
||||
/**
|
||||
* Used to check that a JavaScript object matches a subset of the properties of an object
|
||||
*/
|
||||
toMatchObject(expected: Record<string, unknown> | Array<unknown>): R;
|
||||
/**
|
||||
* Ensure that a mock function has returned (as opposed to thrown) at least once.
|
||||
*/
|
||||
toReturn(): R;
|
||||
/**
|
||||
* Ensure that a mock function has returned (as opposed to thrown) a specified number of times.
|
||||
*/
|
||||
toReturnTimes(count: number): R;
|
||||
/**
|
||||
* Ensure that a mock function has returned a specified value at least once.
|
||||
*/
|
||||
toReturnWith(value: unknown): R;
|
||||
/**
|
||||
* Use to test that objects have the same types as well as structure.
|
||||
*/
|
||||
toStrictEqual(expected: unknown): R;
|
||||
/**
|
||||
* Used to test that a function throws when it is called.
|
||||
*/
|
||||
toThrow(error?: string | Constructable | RegExp | Error): R;
|
||||
/**
|
||||
* If you want to test that a specific error is thrown inside a function.
|
||||
*/
|
||||
toThrowError(error?: string | Constructable | RegExp | Error): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/en/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchSnapshot<T extends {
|
||||
[P in keyof R]: unknown;
|
||||
}>(propertyMatchers: Partial<T>, snapshotName?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/en/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchSnapshot(snapshotName?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/en/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchInlineSnapshot<T extends {
|
||||
[P in keyof R]: unknown;
|
||||
}>(propertyMatchers: Partial<T>, snapshot?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/en/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchInlineSnapshot(snapshot?: string): R;
|
||||
/**
|
||||
* Used to test that a function throws a error matching the most recent snapshot when it is called.
|
||||
*/
|
||||
toThrowErrorMatchingSnapshot(): R;
|
||||
/**
|
||||
* Used to test that a function throws a error matching the most recent snapshot when it is called.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
*/
|
||||
toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
|
||||
}
|
||||
export {};
|
3
node_modules/expect/build/types.js
generated
vendored
Normal file
3
node_modules/expect/build/types.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
var _jestMatchersObject = require('./jestMatchersObject');
|
24
node_modules/expect/build/utils.d.ts
generated
vendored
Normal file
24
node_modules/expect/build/utils.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* 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 GetPath = {
|
||||
hasEndProp?: boolean;
|
||||
lastTraversedObject: unknown;
|
||||
traversedPath: Array<string>;
|
||||
value?: unknown;
|
||||
};
|
||||
export declare const getPath: (object: Record<string, any>, propertyPath: string | Array<string>) => GetPath;
|
||||
export declare const getObjectSubset: (object: any, subset: any, seenReferences?: WeakMap<object, boolean>) => any;
|
||||
export declare const iterableEquality: (a: any, b: any, aStack?: Array<any>, bStack?: Array<any>) => boolean | undefined;
|
||||
export declare const subsetEquality: (object: any, subset: any) => boolean | undefined;
|
||||
export declare const typeEquality: (a: any, b: any) => boolean | undefined;
|
||||
export declare const sparseArrayEquality: (a: unknown, b: unknown) => boolean | undefined;
|
||||
export declare const partition: <T>(items: T[], predicate: (arg: T) => boolean) => [T[], T[]];
|
||||
export declare const isError: (value: unknown) => value is Error;
|
||||
export declare function emptyObject(obj: any): boolean;
|
||||
export declare const isOneline: (expected: unknown, received: unknown) => boolean;
|
||||
export {};
|
383
node_modules/expect/build/utils.js
generated
vendored
Normal file
383
node_modules/expect/build/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,383 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.emptyObject = emptyObject;
|
||||
exports.isOneline = exports.isError = exports.partition = exports.sparseArrayEquality = exports.typeEquality = exports.subsetEquality = exports.iterableEquality = exports.getObjectSubset = exports.getPath = void 0;
|
||||
|
||||
var _jestGetType = require('jest-get-type');
|
||||
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
|
||||
/**
|
||||
* Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`.
|
||||
*/
|
||||
const hasPropertyInObject = (object, key) => {
|
||||
const shouldTerminate =
|
||||
!object || typeof object !== 'object' || object === Object.prototype;
|
||||
|
||||
if (shouldTerminate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
Object.prototype.hasOwnProperty.call(object, key) ||
|
||||
hasPropertyInObject(Object.getPrototypeOf(object), key)
|
||||
);
|
||||
};
|
||||
|
||||
const getPath = (object, propertyPath) => {
|
||||
if (!Array.isArray(propertyPath)) {
|
||||
propertyPath = propertyPath.split('.');
|
||||
}
|
||||
|
||||
if (propertyPath.length) {
|
||||
const lastProp = propertyPath.length === 1;
|
||||
const prop = propertyPath[0];
|
||||
const newObject = object[prop];
|
||||
|
||||
if (!lastProp && (newObject === null || newObject === undefined)) {
|
||||
// This is not the last prop in the chain. If we keep recursing it will
|
||||
// hit a `can't access property X of undefined | null`. At this point we
|
||||
// know that the chain has broken and we can return right away.
|
||||
return {
|
||||
hasEndProp: false,
|
||||
lastTraversedObject: object,
|
||||
traversedPath: []
|
||||
};
|
||||
}
|
||||
|
||||
const result = getPath(newObject, propertyPath.slice(1));
|
||||
|
||||
if (result.lastTraversedObject === null) {
|
||||
result.lastTraversedObject = object;
|
||||
}
|
||||
|
||||
result.traversedPath.unshift(prop);
|
||||
|
||||
if (lastProp) {
|
||||
// Does object have the property with an undefined value?
|
||||
// Although primitive values support bracket notation (above)
|
||||
// they would throw TypeError for in operator (below).
|
||||
result.hasEndProp =
|
||||
newObject !== undefined ||
|
||||
(!(0, _jestGetType.isPrimitive)(object) && prop in object);
|
||||
|
||||
if (!result.hasEndProp) {
|
||||
result.traversedPath.shift();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return {
|
||||
lastTraversedObject: null,
|
||||
traversedPath: [],
|
||||
value: object
|
||||
};
|
||||
}; // Strip properties from object that are not present in the subset. Useful for
|
||||
// printing the diff for toMatchObject() without adding unrelated noise.
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
exports.getPath = getPath;
|
||||
|
||||
const getObjectSubset = (object, subset, seenReferences = new WeakMap()) => {
|
||||
if (Array.isArray(object)) {
|
||||
if (Array.isArray(subset) && subset.length === object.length) {
|
||||
// The map method returns correct subclass of subset.
|
||||
return subset.map((sub, i) => getObjectSubset(object[i], sub));
|
||||
}
|
||||
} else if (object instanceof Date) {
|
||||
return object;
|
||||
} else if (isObject(object) && isObject(subset)) {
|
||||
if (
|
||||
(0, _jasmineUtils.equals)(object, subset, [
|
||||
iterableEquality,
|
||||
subsetEquality
|
||||
])
|
||||
) {
|
||||
// Avoid unnecessary copy which might return Object instead of subclass.
|
||||
return subset;
|
||||
}
|
||||
|
||||
const trimmed = {};
|
||||
seenReferences.set(object, trimmed);
|
||||
Object.keys(object)
|
||||
.filter(key => hasPropertyInObject(subset, key))
|
||||
.forEach(key => {
|
||||
trimmed[key] = seenReferences.has(object[key])
|
||||
? seenReferences.get(object[key])
|
||||
: getObjectSubset(object[key], subset[key], seenReferences);
|
||||
});
|
||||
|
||||
if (Object.keys(trimmed).length > 0) {
|
||||
return trimmed;
|
||||
}
|
||||
}
|
||||
|
||||
return object;
|
||||
};
|
||||
|
||||
exports.getObjectSubset = getObjectSubset;
|
||||
const IteratorSymbol = Symbol.iterator;
|
||||
|
||||
const hasIterator = object => !!(object != null && object[IteratorSymbol]); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
const iterableEquality = (a, b, aStack = [], bStack = []) => {
|
||||
if (
|
||||
typeof a !== 'object' ||
|
||||
typeof b !== 'object' ||
|
||||
Array.isArray(a) ||
|
||||
Array.isArray(b) ||
|
||||
!hasIterator(a) ||
|
||||
!hasIterator(b)
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (a.constructor !== b.constructor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let length = aStack.length;
|
||||
|
||||
while (length--) {
|
||||
// Linear search. Performance is inversely proportional to the number of
|
||||
// unique nested structures.
|
||||
// circular references at same depth are equal
|
||||
// circular reference is not equal to non-circular one
|
||||
if (aStack[length] === a) {
|
||||
return bStack[length] === b;
|
||||
}
|
||||
}
|
||||
|
||||
aStack.push(a);
|
||||
bStack.push(b);
|
||||
|
||||
const iterableEqualityWithStack = (a, b) =>
|
||||
iterableEquality(a, b, [...aStack], [...bStack]);
|
||||
|
||||
if (a.size !== undefined) {
|
||||
if (a.size !== b.size) {
|
||||
return false;
|
||||
} else if (
|
||||
(0, _jasmineUtils.isA)('Set', a) ||
|
||||
(0, _jasmineUtils.isImmutableUnorderedSet)(a)
|
||||
) {
|
||||
let allFound = true;
|
||||
|
||||
for (const aValue of a) {
|
||||
if (!b.has(aValue)) {
|
||||
let has = false;
|
||||
|
||||
for (const bValue of b) {
|
||||
const isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [
|
||||
iterableEqualityWithStack
|
||||
]);
|
||||
|
||||
if (isEqual === true) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // Remove the first value from the stack of traversed values.
|
||||
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return allFound;
|
||||
} else if (
|
||||
(0, _jasmineUtils.isA)('Map', a) ||
|
||||
(0, _jasmineUtils.isImmutableUnorderedKeyed)(a)
|
||||
) {
|
||||
let allFound = true;
|
||||
|
||||
for (const aEntry of a) {
|
||||
if (
|
||||
!b.has(aEntry[0]) ||
|
||||
!(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [
|
||||
iterableEqualityWithStack
|
||||
])
|
||||
) {
|
||||
let has = false;
|
||||
|
||||
for (const bEntry of b) {
|
||||
const matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], [
|
||||
iterableEqualityWithStack
|
||||
]);
|
||||
let matchedValue = false;
|
||||
|
||||
if (matchedKey === true) {
|
||||
matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], [
|
||||
iterableEqualityWithStack
|
||||
]);
|
||||
}
|
||||
|
||||
if (matchedValue === true) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // Remove the first value from the stack of traversed values.
|
||||
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return allFound;
|
||||
}
|
||||
}
|
||||
|
||||
const bIterator = b[IteratorSymbol]();
|
||||
|
||||
for (const aValue of a) {
|
||||
const nextB = bIterator.next();
|
||||
|
||||
if (
|
||||
nextB.done ||
|
||||
!(0, _jasmineUtils.equals)(aValue, nextB.value, [
|
||||
iterableEqualityWithStack
|
||||
])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bIterator.next().done) {
|
||||
return false;
|
||||
} // Remove the first value from the stack of traversed values.
|
||||
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return true;
|
||||
};
|
||||
|
||||
exports.iterableEquality = iterableEquality;
|
||||
|
||||
const isObject = a => a !== null && typeof a === 'object';
|
||||
|
||||
const isObjectWithKeys = a =>
|
||||
isObject(a) &&
|
||||
!(a instanceof Error) &&
|
||||
!(a instanceof Array) &&
|
||||
!(a instanceof Date); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
const subsetEquality = (object, subset) => {
|
||||
// subsetEquality needs to keep track of the references
|
||||
// it has already visited to avoid infinite loops in case
|
||||
// there are circular references in the subset passed to it.
|
||||
const subsetEqualityWithContext = (seenReferences = new WeakMap()) => (
|
||||
object,
|
||||
subset
|
||||
) => {
|
||||
if (!isObjectWithKeys(subset)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return Object.keys(subset).every(key => {
|
||||
if (isObjectWithKeys(subset[key])) {
|
||||
if (seenReferences.has(subset[key])) {
|
||||
return (0, _jasmineUtils.equals)(object[key], subset[key], [
|
||||
iterableEquality
|
||||
]);
|
||||
}
|
||||
|
||||
seenReferences.set(subset[key], true);
|
||||
}
|
||||
|
||||
const result =
|
||||
object != null &&
|
||||
hasPropertyInObject(object, key) &&
|
||||
(0, _jasmineUtils.equals)(object[key], subset[key], [
|
||||
iterableEquality,
|
||||
subsetEqualityWithContext(seenReferences)
|
||||
]); // The main goal of using seenReference is to avoid circular node on tree.
|
||||
// It will only happen within a parent and its child, not a node and nodes next to it (same level)
|
||||
// We should keep the reference for a parent and its child only
|
||||
// Thus we should delete the reference immediately so that it doesn't interfere
|
||||
// other nodes within the same level on tree.
|
||||
|
||||
seenReferences.delete(subset[key]);
|
||||
return result;
|
||||
});
|
||||
};
|
||||
|
||||
return subsetEqualityWithContext()(object, subset);
|
||||
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
exports.subsetEquality = subsetEquality;
|
||||
|
||||
const typeEquality = (a, b) => {
|
||||
if (a == null || b == null || a.constructor === b.constructor) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.typeEquality = typeEquality;
|
||||
|
||||
const sparseArrayEquality = (a, b) => {
|
||||
if (!Array.isArray(a) || !Array.isArray(b)) {
|
||||
return undefined;
|
||||
} // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"]
|
||||
|
||||
const aKeys = Object.keys(a);
|
||||
const bKeys = Object.keys(b);
|
||||
return (
|
||||
(0, _jasmineUtils.equals)(a, b, [iterableEquality, typeEquality], true) &&
|
||||
(0, _jasmineUtils.equals)(aKeys, bKeys)
|
||||
);
|
||||
};
|
||||
|
||||
exports.sparseArrayEquality = sparseArrayEquality;
|
||||
|
||||
const partition = (items, predicate) => {
|
||||
const result = [[], []];
|
||||
items.forEach(item => result[predicate(item) ? 0 : 1].push(item));
|
||||
return result;
|
||||
}; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
|
||||
|
||||
exports.partition = partition;
|
||||
|
||||
const isError = value => {
|
||||
switch (Object.prototype.toString.call(value)) {
|
||||
case '[object Error]':
|
||||
return true;
|
||||
|
||||
case '[object Exception]':
|
||||
return true;
|
||||
|
||||
case '[object DOMException]':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return value instanceof Error;
|
||||
}
|
||||
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
exports.isError = isError;
|
||||
|
||||
function emptyObject(obj) {
|
||||
return obj && typeof obj === 'object' ? !Object.keys(obj).length : false;
|
||||
}
|
||||
|
||||
const MULTILINE_REGEXP = /[\r\n]/;
|
||||
|
||||
const isOneline = (expected, received) =>
|
||||
typeof expected === 'string' &&
|
||||
typeof received === 'string' &&
|
||||
(!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
|
||||
|
||||
exports.isOneline = isOneline;
|
21
node_modules/expect/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
21
node_modules/expect/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/expect/node_modules/@jest/types/build/Circus.d.ts
generated
vendored
Normal file
187
node_modules/expect/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/expect/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
1
node_modules/expect/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
421
node_modules/expect/node_modules/@jest/types/build/Config.d.ts
generated
vendored
Normal file
421
node_modules/expect/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/expect/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
1
node_modules/expect/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
85
node_modules/expect/node_modules/@jest/types/build/Global.d.ts
generated
vendored
Normal file
85
node_modules/expect/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/expect/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
1
node_modules/expect/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
31
node_modules/expect/node_modules/@jest/types/build/TestResult.d.ts
generated
vendored
Normal file
31
node_modules/expect/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/expect/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
1
node_modules/expect/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
12
node_modules/expect/node_modules/@jest/types/build/Transform.d.ts
generated
vendored
Normal file
12
node_modules/expect/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/expect/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
1
node_modules/expect/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
12
node_modules/expect/node_modules/@jest/types/build/index.d.ts
generated
vendored
Normal file
12
node_modules/expect/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/expect/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
1
node_modules/expect/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
26
node_modules/expect/node_modules/@jest/types/package.json
generated
vendored
Normal file
26
node_modules/expect/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/expect/node_modules/@types/istanbul-reports/LICENSE
generated
vendored
Normal file
21
node_modules/expect/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/expect/node_modules/@types/istanbul-reports/README.md
generated
vendored
Normal file
16
node_modules/expect/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/expect/node_modules/@types/istanbul-reports/index.d.ts
generated
vendored
Normal file
74
node_modules/expect/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/expect/node_modules/@types/istanbul-reports/package.json
generated
vendored
Normal file
31
node_modules/expect/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/expect/node_modules/chalk/index.d.ts
generated
vendored
Normal file
415
node_modules/expect/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/expect/node_modules/chalk/license
generated
vendored
Normal file
9
node_modules/expect/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/expect/node_modules/chalk/package.json
generated
vendored
Normal file
68
node_modules/expect/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/expect/node_modules/chalk/readme.md
generated
vendored
Normal file
293
node_modules/expect/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/expect/node_modules/chalk/source/index.js
generated
vendored
Normal file
229
node_modules/expect/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/expect/node_modules/chalk/source/templates.js
generated
vendored
Normal file
134
node_modules/expect/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/expect/node_modules/chalk/source/util.js
generated
vendored
Normal file
39
node_modules/expect/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/expect/node_modules/jest-get-type/LICENSE
generated
vendored
Normal file
21
node_modules/expect/node_modules/jest-get-type/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.
|
12
node_modules/expect/node_modules/jest-get-type/build/index.d.ts
generated
vendored
Normal file
12
node_modules/expect/node_modules/jest-get-type/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.
|
||||
*/
|
||||
declare type ValueType = 'array' | 'bigint' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined';
|
||||
declare function getType(value: unknown): ValueType;
|
||||
declare namespace getType {
|
||||
var isPrimitive: (value: unknown) => boolean;
|
||||
}
|
||||
export = getType;
|
51
node_modules/expect/node_modules/jest-get-type/build/index.js
generated
vendored
Normal file
51
node_modules/expect/node_modules/jest-get-type/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* 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 the type of a value with handling the edge cases like `typeof []`
|
||||
// and `typeof null`
|
||||
function getType(value) {
|
||||
if (value === undefined) {
|
||||
return 'undefined';
|
||||
} else if (value === null) {
|
||||
return 'null';
|
||||
} else if (Array.isArray(value)) {
|
||||
return 'array';
|
||||
} else if (typeof value === 'boolean') {
|
||||
return 'boolean';
|
||||
} else if (typeof value === 'function') {
|
||||
return 'function';
|
||||
} else if (typeof value === 'number') {
|
||||
return 'number';
|
||||
} else if (typeof value === 'string') {
|
||||
return 'string';
|
||||
} else if (typeof value === 'bigint') {
|
||||
return 'bigint';
|
||||
} else if (typeof value === 'object') {
|
||||
if (value != null) {
|
||||
if (value.constructor === RegExp) {
|
||||
return 'regexp';
|
||||
} else if (value.constructor === Map) {
|
||||
return 'map';
|
||||
} else if (value.constructor === Set) {
|
||||
return 'set';
|
||||
} else if (value.constructor === Date) {
|
||||
return 'date';
|
||||
}
|
||||
}
|
||||
|
||||
return 'object';
|
||||
} else if (typeof value === 'symbol') {
|
||||
return 'symbol';
|
||||
}
|
||||
|
||||
throw new Error(`value of unknown type: ${value}`);
|
||||
}
|
||||
|
||||
getType.isPrimitive = value => Object(value) !== value;
|
||||
|
||||
module.exports = getType;
|
20
node_modules/expect/node_modules/jest-get-type/package.json
generated
vendored
Normal file
20
node_modules/expect/node_modules/jest-get-type/package.json
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "jest-get-type",
|
||||
"description": "A utility function to get the type of a value",
|
||||
"version": "26.3.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/jest-get-type"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "3a7e06fe855515a848241bb06a6f6e117847443d"
|
||||
}
|
33
node_modules/expect/package.json
generated
vendored
Normal file
33
node_modules/expect/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "expect",
|
||||
"version": "26.4.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/expect"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"dependencies": {
|
||||
"@jest/types": "^26.3.0",
|
||||
"ansi-styles": "^4.0.0",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"jest-matcher-utils": "^26.4.2",
|
||||
"jest-message-util": "^26.3.0",
|
||||
"jest-regex-util": "^26.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "^26.3.0",
|
||||
"chalk": "^4.0.0",
|
||||
"fast-check": "^2.0.0",
|
||||
"immutable": "^4.0.0-rc.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "2586a798260886c28b6d28256cdfe354e039d5d1"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue