This commit is contained in:
eric sciple 2020-01-24 12:20:19 -05:00
parent beb1329f9f
commit 2b95e76931
7736 changed files with 1874747 additions and 51184 deletions

23
node_modules/expect/LICENSE generated vendored Normal file
View file

@ -0,0 +1,23 @@
MIT License
For Jest software
Copyright (c) 2014-present, Facebook, Inc.
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
View 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).

33523
node_modules/expect/build-es5/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/expect/build-es5/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

61
node_modules/expect/build/asymmetricMatchers.d.ts generated vendored Normal file
View file

@ -0,0 +1,61 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
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: any) => Any;
export declare const anything: () => Anything;
export declare const arrayContaining: (sample: unknown[]) => ArrayContaining;
export declare const arrayNotContaining: (sample: 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 {};
//# sourceMappingURL=asymmetricMatchers.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"asymmetricMatchers.d.ts","sourceRoot":"","sources":["../src/asymmetricMatchers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,qBAAa,iBAAiB,CAAC,CAAC;IAC9B,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEN,MAAM,EAAE,CAAC;CAItB;AAED,cAAM,GAAI,SAAQ,iBAAiB,CAAC,GAAG,CAAC;gBAC1B,MAAM,EAAE,OAAO;IAU3B,eAAe,CAAC,KAAK,EAAE,OAAO;IAwB9B,QAAQ;IAIR,eAAe;IAwBf,mBAAmB;CAGpB;AAED,cAAM,QAAS,SAAQ,iBAAiB,CAAC,IAAI,CAAC;IAC5C,eAAe,CAAC,KAAK,EAAE,OAAO;IAI9B,QAAQ;IAMR,mBAAmB;CAGpB;AAED,cAAM,eAAgB,SAAQ,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACjD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,GAAE,OAAe;IAK5D,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAmBrC,QAAQ;IAIR,eAAe;CAGhB;AAED,cAAM,gBAAiB,SAAQ,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAE,OAAe;IAKjE,eAAe,CAAC,KAAK,EAAE,GAAG;IAoC1B,QAAQ;IAIR,eAAe;CAGhB;AAED,cAAM,gBAAiB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;gBAC1C,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe;IAQpD,eAAe,CAAC,KAAK,EAAE,MAAM;IAM7B,QAAQ;IAIR,eAAe;CAGhB;AAED,cAAM,cAAe,SAAQ,iBAAiB,CAAC,MAAM,CAAC;gBACxC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,GAAE,OAAe;IAS7D,eAAe,CAAC,KAAK,EAAE,MAAM;IAM7B,QAAQ;IAIR,eAAe;CAGhB;AAED,eAAO,MAAM,GAAG,8BAAmD,CAAC;AACpE,eAAO,MAAM,QAAQ,gBAAuB,CAAC;AAC7C,eAAO,MAAM,eAAe,wCACC,CAAC;AAC9B,eAAO,MAAM,kBAAkB,wCACI,CAAC;AACpC,eAAO,MAAM,gBAAgB,mDACC,CAAC;AAC/B,eAAO,MAAM,mBAAmB,mDACI,CAAC;AACrC,eAAO,MAAM,gBAAgB,wCACG,CAAC;AACjC,eAAO,MAAM,mBAAmB,wCACM,CAAC;AACvC,eAAO,MAAM,cAAc,+CACG,CAAC;AAC/B,eAAO,MAAM,iBAAiB,+CACM,CAAC"}

301
node_modules/expect/build/asymmetricMatchers.js generated vendored Normal file
View file

@ -0,0 +1,301 @@
'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';
}
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;

View file

@ -0,0 +1,18 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
declare const extractExpectedAssertionsErrors: () => ({
actual: any;
error: any;
expected: number;
} | {
actual: string;
error: any;
expected: string;
})[];
export default extractExpectedAssertionsErrors;
//# sourceMappingURL=extractExpectedAssertionsErrors.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"extractExpectedAssertionsErrors.d.ts","sourceRoot":"","sources":["../src/extractExpectedAssertionsErrors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,QAAA,MAAM,+BAA+B;;;;;;;;IAsDpC,CAAC;AAEF,eAAe,+BAA+B,CAAC"}

View 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 _getState = (0, _jestMatchersObject.getState)(),
assertionCalls = _getState.assertionCalls,
expectedAssertionsNumber = _getState.expectedAssertionsNumber,
expectedAssertionsNumberError = _getState.expectedAssertionsNumberError,
isExpectingAssertions = _getState.isExpectingAssertions,
isExpectingAssertionsError = _getState.isExpectingAssertionsError;
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;

11
node_modules/expect/build/fakeChalk.d.ts generated vendored Normal file
View 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.
*/
declare const allColorsAsFunc: {
[x: string]: (str: string) => string;
};
export = allColorsAsFunc;
//# sourceMappingURL=fakeChalk.d.ts.map

1
node_modules/expect/build/fakeChalk.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"fakeChalk.d.ts","sourceRoot":"","sources":["../src/fakeChalk.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,eAAe;;CAE2B,CAAC;AASjD,SAAS,eAAe,CAAC"}

28
node_modules/expect/build/fakeChalk.js generated vendored Normal file
View 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;

16
node_modules/expect/build/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,16 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { Matchers as MatcherInterface, MatcherState as JestMatcherState, Expect } from './types';
declare const expectExport: Expect;
declare namespace expectExport {
type MatcherState = JestMatcherState;
interface Matchers<R> extends MatcherInterface<R> {
}
}
export = expectExport;
//# sourceMappingURL=index.d.ts.map

1
node_modules/expect/build/index.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAIL,QAAQ,IAAI,gBAAgB,EAC5B,YAAY,IAAI,gBAAgB,EAKhC,MAAM,EACP,MAAM,SAAS,CAAC;AAqYjB,QAAA,MAAM,YAAY,QAAmB,CAAC;AAGtC,kBAAU,YAAY,CAAC;IACrB,KAAY,YAAY,GAAG,gBAAgB,CAAC;IAC5C,UAAiB,QAAQ,CAAC,CAAC,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAC;KAAG;CAC5D;AAED,SAAS,YAAY,CAAC"}

435
node_modules/expect/build/index.js generated vendored Normal file
View file

@ -0,0 +1,435 @@
'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 _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc =
Object.defineProperty && Object.getOwnPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
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 createToThrowErrorMatchingSnapshotMatcher(
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'
};
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 => {
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 = _objectSpread({}, matcherUtils, {
iterableEquality: _utils.iterableEquality,
subsetEquality: _utils.subsetEquality
});
const matcherContext = _objectSpread(
{
// 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 handlError = 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.apply(matcherContext, [actual].concat(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(error => handlError(error));
} else {
const syncResult = potentialResult;
return processResult(syncResult);
}
} catch (error) {
return handlError(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;

9
node_modules/expect/build/jasmineUtils.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
import { 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;
//# sourceMappingURL=jasmineUtils.d.ts.map

1
node_modules/expect/build/jasmineUtils.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"jasmineUtils.d.ts","sourceRoot":"","sources":["../src/jasmineUtils.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAG/B,wBAAgB,MAAM,CACpB,CAAC,EAAE,OAAO,EACV,CAAC,EAAE,OAAO,EACV,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAC7B,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAGT;AA4MD,wBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,WAEnD;AAYD,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,UASvC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,WAEnC;AAcD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAUzE;AAOD,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,GAAG,WAMxD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,GAAG,WAMpD"}

313
node_modules/expect/build/jasmineUtils.js generated vendored Normal file
View file

@ -0,0 +1,313 @@
'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) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
return Object.is(Number(a), Number(b));
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans 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.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase
);
}
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]
);
}

14
node_modules/expect/build/jestMatchersObject.d.ts generated vendored Normal file
View 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.
*
*/
import { 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: () => any;
export declare const setMatchers: (matchers: MatchersObject, isInternal: boolean, expect: Expect) => void;
//# sourceMappingURL=jestMatchersObject.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"jestMatchersObject.d.ts","sourceRoot":"","sources":["../src/jestMatchersObject.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAC,MAAM,EAAE,cAAc,EAAwB,MAAM,SAAS,CAAC;AAQtE,eAAO,MAAM,qBAAqB,eAAwC,CAAC;AAgB3E,eAAO,MAAM,QAAQ,WAAoD,CAAC;AAE1E,eAAO,MAAM,QAAQ,yBAEpB,CAAC;AAEF,eAAO,MAAM,WAAW,WAAuD,CAAC;AAEhF,eAAO,MAAM,WAAW,yEAqDvB,CAAC"}

94
node_modules/expect/build/jestMatchersObject.js generated vendored Normal file
View file

@ -0,0 +1,94 @@
'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[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 _ref = matcher(other, ...this.sample),
pass = _ref.pass;
return this.inverse ? !pass : pass;
}
toString() {
return `${this.inverse ? 'not.' : ''}${key}`;
}
getExpectedType() {
return 'any';
}
toAsymmetricMatcher() {
return `${this.toString()}<${this.sample.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;

11
node_modules/expect/build/matchers.d.ts generated vendored Normal file
View 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 { MatchersObject } from './types';
declare const matchers: MatchersObject;
export default matchers;
//# sourceMappingURL=matchers.d.ts.map

1
node_modules/expect/build/matchers.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"matchers.d.ts","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,OAAO,EAAC,cAAc,EAAe,MAAM,SAAS,CAAC;AAwCrD,QAAA,MAAM,QAAQ,EAAE,cA81Bf,CAAC;AAEF,eAAe,QAAQ,CAAC"}

1322
node_modules/expect/build/matchers.js generated vendored Normal file

File diff suppressed because it is too large Load diff

16
node_modules/expect/build/print.d.ts generated vendored Normal file
View file

@ -0,0 +1,16 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
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: unknown[], index: number) => string;
export declare const printDiffOrStringify: (expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand?: boolean | undefined) => 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;
//# sourceMappingURL=print.d.ts.map

1
node_modules/expect/build/print.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../src/print.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,eAAO,MAAM,2CAA2C,6DAWrD,CAAC;AAEJ,eAAO,MAAM,wCAAwC,8DAU9C,CAAC;AAKR,eAAO,MAAM,qCAAqC,gDAa/C,CAAC;AA8BJ,eAAO,MAAM,oBAAoB,8HAsChC,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAGqB,CAAC;AAE/D,eAAO,MAAM,+BAA+B,+CAGiB,CAAC;AAE9D,eAAO,MAAM,4BAA4B,+CAGsB,CAAC;AAGhE,eAAO,MAAM,+BAA+B,mEAgBoB,CAAC"}

209
node_modules/expect/build/print.js generated vendored Normal file
View file

@ -0,0 +1,209 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printDiffOrStringify = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
var _jestGetType = _interopRequireWildcard(require('jest-get-type'));
var _jestMatcherUtils = require('jest-matcher-utils');
var _utils = require('./utils');
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc =
Object.defineProperty && Object.getOwnPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// 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 shouldPrintDiff = (expected, received) => {
const expectedType = (0, _jestGetType.default)(expected);
const receivedType = (0, _jestGetType.default)(received);
if (expectedType !== receivedType) {
return false;
}
if ((0, _jestGetType.isPrimitive)(expected)) {
// Print diff only if both strings have more than one line.
return (
expectedType === 'string' && !(0, _utils.isOneline)(expected, received)
);
}
if (
expectedType === 'date' ||
expectedType === 'function' ||
expectedType === 'regexp'
) {
return false;
}
if (expected instanceof Error && received instanceof Error) {
return false;
}
return true;
};
const printDiffOrStringify = (
expected,
received,
expectedLabel,
receivedLabel,
expand
) => {
// Cannot use same serialization as shortcut to avoid diff,
// because stringify (that is, pretty-format with min option)
// omits constructor name for array or object, too bad so sad :(
const difference = shouldPrintDiff(expected, received)
? (0, _jestMatcherUtils.diff)(expected, received, {
aAnnotation: expectedLabel,
bAnnotation: receivedLabel,
expand
}) // string | null
: null; // Cannot reuse value of stringify(received) in report string,
// because printReceived does inverse highlight space at end of line,
// but RECEIVED_COLOR does not (it refers to a plain chalk method).
if (
typeof difference === 'string' &&
difference.includes('- ' + expectedLabel) &&
difference.includes('+ ' + receivedLabel)
) {
return difference;
}
const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
expectedLabel,
receivedLabel
);
return (
`${printLabel(expectedLabel)}${(0, _jestMatcherUtils.printExpected)(
expected
)}\n` +
`${printLabel(receivedLabel)}${
(0, _jestMatcherUtils.stringify)(expected) ===
(0, _jestMatcherUtils.stringify)(received)
? 'serializes to the same string'
: (0, _jestMatcherUtils.printReceived)(received)
}`
);
};
exports.printDiffOrStringify = printDiffOrStringify;
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)
}`;

11
node_modules/expect/build/spyMatchers.d.ts generated vendored Normal file
View 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 { MatchersObject } from './types';
declare const spyMatchers: MatchersObject;
export default spyMatchers;
//# sourceMappingURL=spyMatchers.d.ts.map

1
node_modules/expect/build/spyMatchers.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"spyMatchers.d.ts","sourceRoot":"","sources":["../src/spyMatchers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,OAAO,EAAC,cAAc,EAAwB,MAAM,SAAS,CAAC;AAua9D,QAAA,MAAM,WAAW,EAAE,cAyBlB,CAAC;AAoJF,eAAe,WAAW,CAAC"}

708
node_modules/expect/build/spyMatchers.js generated vendored Normal file
View file

@ -0,0 +1,708 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
var _jestMatcherUtils = require('jest-matcher-utils');
var _jasmineUtils = require('./jasmineUtils');
var _utils = require('./utils');
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
function _slicedToArray(arr, i) {
return (
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
);
}
function _nonIterableRest() {
throw new TypeError('Invalid attempt to destructure non-iterable instance');
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (
var _i = arr[Symbol.iterator](), _s;
!(_n = (_s = _i.next()).done);
_n = true
) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i['return'] != null) _i['return']();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
const CALL_PRINT_LIMIT = 3;
const RETURN_PRINT_LIMIT = 5;
const LAST_CALL_PRINT_LIMIT = 1;
const createToBeCalledMatcher = matcherName => (received, expected) => {
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName);
ensureMock(received, matcherName);
const receivedIsSpy = isSpy(received);
const type = receivedIsSpy ? 'spy' : 'mock function';
const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
const identifier =
receivedIsSpy || receivedName === 'jest.fn()'
? type
: `${type} "${receivedName}"`;
const count = receivedIsSpy
? received.calls.count()
: received.mock.calls.length;
const calls = receivedIsSpy
? received.calls.all().map(x => x.args)
: received.mock.calls;
const pass = count > 0;
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)(
'.not' + matcherName,
receivedName,
''
) +
'\n\n' +
`Expected ${identifier} not to be called ` +
formatReceivedCalls(calls, CALL_PRINT_LIMIT, {
sameSentence: true
})
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, '') +
'\n\n' +
`Expected ${identifier} to have been called, but it was not called.`;
return {
message,
pass
};
};
const createToReturnMatcher = matcherName => (received, expected) => {
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName);
ensureMock(received, matcherName);
const receivedName = received.getMockName();
const identifier =
receivedName === 'jest.fn()'
? 'mock function'
: `mock function "${receivedName}"`; // List of return values that correspond only to calls that returned
const returnValues = received.mock.results
.filter(result => result.type === 'return')
.map(result => result.value);
const count = returnValues.length;
const pass = count > 0;
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)(
'.not' + matcherName,
receivedName,
''
) +
'\n\n' +
`Expected ${identifier} not to have returned, but it returned:\n` +
` ${getPrintedReturnValues(returnValues, RETURN_PRINT_LIMIT)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, '') +
'\n\n' +
`Expected ${identifier} to have returned.`;
return {
message,
pass
};
};
const createToBeCalledTimesMatcher = matcherName => (received, expected) => {
(0, _jestMatcherUtils.ensureExpectedIsNumber)(expected, matcherName);
ensureMock(received, matcherName);
const receivedIsSpy = isSpy(received);
const type = receivedIsSpy ? 'spy' : 'mock function';
const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
const identifier =
receivedIsSpy || receivedName === 'jest.fn()'
? type
: `${type} "${receivedName}"`;
const count = receivedIsSpy
? received.calls.count()
: received.mock.calls.length;
const pass = count === expected;
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)(
'.not' + matcherName,
receivedName,
String(expected)
) +
`\n\n` +
`Expected ${identifier} not to be called ` +
`${(0, _jestMatcherUtils.EXPECTED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', expected)
)}, but it was` +
` called exactly ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', count)
)}.`
: () =>
(0, _jestMatcherUtils.matcherHint)(
matcherName,
receivedName,
String(expected)
) +
'\n\n' +
`Expected ${identifier} to have been called ` +
`${(0, _jestMatcherUtils.EXPECTED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', expected)
)},` +
` but it was called ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', count)
)}.`;
return {
message,
pass
};
};
const createToReturnTimesMatcher = matcherName => (received, expected) => {
(0, _jestMatcherUtils.ensureExpectedIsNumber)(expected, matcherName);
ensureMock(received, matcherName);
const receivedName = received.getMockName();
const identifier =
receivedName === 'jest.fn()'
? 'mock function'
: `mock function "${receivedName}"`; // List of return results that correspond only to calls that returned
const returnResults = received.mock.results.filter(
result => result.type === 'return'
);
const count = returnResults.length;
const pass = count === expected;
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)(
'.not' + matcherName,
receivedName,
String(expected)
) +
`\n\n` +
`Expected ${identifier} not to have returned ` +
`${(0, _jestMatcherUtils.EXPECTED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', expected)
)}, but it` +
` returned exactly ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', count)
)}.`
: () =>
(0, _jestMatcherUtils.matcherHint)(
matcherName,
receivedName,
String(expected)
) +
'\n\n' +
`Expected ${identifier} to have returned ` +
`${(0, _jestMatcherUtils.EXPECTED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', expected)
)},` +
` but it returned ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
(0, _jestMatcherUtils.pluralize)('time', count)
)}.`;
return {
message,
pass
};
};
const createToBeCalledWithMatcher = matcherName => (received, ...expected) => {
ensureMock(received, matcherName);
const receivedIsSpy = isSpy(received);
const type = receivedIsSpy ? 'spy' : 'mock function';
const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
const identifier =
receivedIsSpy || receivedName === 'jest.fn()'
? type
: `${type} "${receivedName}"`;
const calls = receivedIsSpy
? received.calls.all().map(x => x.args)
: received.mock.calls;
const _partition = (0, _utils.partition)(calls, call =>
(0, _jasmineUtils.equals)(call, expected, [_utils.iterableEquality])
),
_partition2 = _slicedToArray(_partition, 2),
match = _partition2[0],
fail = _partition2[1];
const pass = match.length > 0;
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)('.not' + matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} not to have been called with:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} to have been called with:\n` +
formatMismatchedCalls(fail, expected, CALL_PRINT_LIMIT);
return {
message,
pass
};
};
const createToReturnWithMatcher = matcherName => (received, expected) => {
ensureMock(received, matcherName);
const receivedName = received.getMockName();
const identifier =
receivedName === 'jest.fn()'
? 'mock function'
: `mock function "${receivedName}"`; // List of return values that correspond only to calls that returned
const returnValues = received.mock.results
.filter(result => result.type === 'return')
.map(result => result.value);
const _partition3 = (0, _utils.partition)(returnValues, value =>
(0, _jasmineUtils.equals)(expected, value, [_utils.iterableEquality])
),
_partition4 = _slicedToArray(_partition3, 1),
match = _partition4[0];
const pass = match.length > 0;
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)('.not' + matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} not to have returned:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`But it returned exactly:\n` +
` ${(0, _jestMatcherUtils.printReceived)(expected)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} to have returned:\n` +
formatMismatchedReturnValues(
returnValues,
expected,
RETURN_PRINT_LIMIT
);
return {
message,
pass
};
};
const createLastCalledWithMatcher = matcherName => (received, ...expected) => {
ensureMock(received, matcherName);
const receivedIsSpy = isSpy(received);
const type = receivedIsSpy ? 'spy' : 'mock function';
const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
const identifier =
receivedIsSpy || receivedName === 'jest.fn()'
? type
: `${type} "${receivedName}"`;
const calls = receivedIsSpy
? received.calls.all().map(x => x.args)
: received.mock.calls;
const pass = (0, _jasmineUtils.equals)(calls[calls.length - 1], expected, [
_utils.iterableEquality
]);
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)('.not' + matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} to not have been last called with:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} to have been last called with:\n` +
formatMismatchedCalls(calls, expected, LAST_CALL_PRINT_LIMIT);
return {
message,
pass
};
};
const createLastReturnedMatcher = matcherName => (received, expected) => {
ensureMock(received, matcherName);
const receivedName = received.getMockName();
const identifier =
receivedName === 'jest.fn()'
? 'mock function'
: `mock function "${receivedName}"`;
const results = received.mock.results;
const lastResult = results[results.length - 1];
const pass =
!!lastResult &&
lastResult.type === 'return' &&
(0, _jasmineUtils.equals)(lastResult.value, expected, [
_utils.iterableEquality
]);
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)('.not' + matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} to not have last returned:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`But it last returned exactly:\n` +
` ${(0, _jestMatcherUtils.printReceived)(lastResult.value)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} to have last returned:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
(!lastResult
? `But it was ${(0, _jestMatcherUtils.RECEIVED_COLOR)('not called')}`
: lastResult.type === 'incomplete'
? `But the last call ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
'has not returned yet'
)}`
: lastResult.type === 'throw'
? `But the last call ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
'threw an error'
)}`
: `But the last call returned:\n ${(0,
_jestMatcherUtils.printReceived)(lastResult.value)}`);
return {
message,
pass
};
};
const createNthCalledWithMatcher = matcherName => (
received,
nth,
...expected
) => {
ensureMock(received, matcherName);
const receivedIsSpy = isSpy(received);
const type = receivedIsSpy ? 'spy' : 'mock function'; // @ts-ignore
if (typeof nth !== 'number' || parseInt(nth, 10) !== nth || nth < 1) {
const message = () =>
`nth value ${(0, _jestMatcherUtils.printReceived)(
nth
)} must be a positive integer greater than ${(0,
_jestMatcherUtils.printExpected)(0)}`;
const pass = false;
return {
message,
pass
};
}
const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
const identifier =
receivedIsSpy || receivedName === 'jest.fn()'
? type
: `${type} "${receivedName}"`;
const calls = receivedIsSpy
? received.calls.all().map(x => x.args)
: received.mock.calls;
const pass = (0, _jasmineUtils.equals)(calls[nth - 1], expected, [
_utils.iterableEquality
]);
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)('.not' + matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} ${nthToString(
nth
)} call to not have been called with:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} ${nthToString(
nth
)} call to have been called with:\n` +
formatMismatchedCalls(
calls[nth - 1] ? [calls[nth - 1]] : [],
expected,
LAST_CALL_PRINT_LIMIT
);
return {
message,
pass
};
};
const createNthReturnedWithMatcher = matcherName => (
received,
nth,
expected
) => {
ensureMock(received, matcherName); //@ts-ignore
if (typeof nth !== 'number' || parseInt(nth, 10) !== nth || nth < 1) {
const message = () =>
`nth value ${(0, _jestMatcherUtils.printReceived)(
nth
)} must be a positive integer greater than ${(0,
_jestMatcherUtils.printExpected)(0)}`;
const pass = false;
return {
message,
pass
};
}
const receivedName = received.getMockName();
const identifier =
receivedName === 'jest.fn()'
? 'mock function'
: `mock function "${receivedName}"`;
const results = received.mock.results;
const nthResult = results[nth - 1];
const pass =
!!nthResult &&
nthResult.type === 'return' &&
(0, _jasmineUtils.equals)(nthResult.value, expected, [
_utils.iterableEquality
]);
const nthString = nthToString(nth);
const message = pass
? () =>
(0, _jestMatcherUtils.matcherHint)('.not' + matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} ${nthString} call to not have returned with:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`But the ${nthString} call returned exactly:\n` +
` ${(0, _jestMatcherUtils.printReceived)(nthResult.value)}`
: () =>
(0, _jestMatcherUtils.matcherHint)(matcherName, receivedName) +
'\n\n' +
`Expected ${identifier} ${nthString} call to have returned with:\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
(results.length === 0
? `But it was ${(0, _jestMatcherUtils.RECEIVED_COLOR)('not called')}`
: nth > results.length
? `But it was only called ${(0, _jestMatcherUtils.printReceived)(
results.length
)} times`
: nthResult.type === 'incomplete'
? `But the ${nthString} call ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
'has not returned yet'
)}`
: nthResult.type === 'throw'
? `But the ${nthString} call ${(0, _jestMatcherUtils.RECEIVED_COLOR)(
'threw an error'
)}`
: `But the ${nthString} call returned with:\n ${(0,
_jestMatcherUtils.printReceived)(nthResult.value)}`);
return {
message,
pass
};
};
const spyMatchers = {
lastCalledWith: createLastCalledWithMatcher('.lastCalledWith'),
lastReturnedWith: createLastReturnedMatcher('.lastReturnedWith'),
nthCalledWith: createNthCalledWithMatcher('.nthCalledWith'),
nthReturnedWith: createNthReturnedWithMatcher('.nthReturnedWith'),
toBeCalled: createToBeCalledMatcher('.toBeCalled'),
toBeCalledTimes: createToBeCalledTimesMatcher('.toBeCalledTimes'),
toBeCalledWith: createToBeCalledWithMatcher('.toBeCalledWith'),
toHaveBeenCalled: createToBeCalledMatcher('.toHaveBeenCalled'),
toHaveBeenCalledTimes: createToBeCalledTimesMatcher('.toHaveBeenCalledTimes'),
toHaveBeenCalledWith: createToBeCalledWithMatcher('.toHaveBeenCalledWith'),
toHaveBeenLastCalledWith: createLastCalledWithMatcher(
'.toHaveBeenLastCalledWith'
),
toHaveBeenNthCalledWith: createNthCalledWithMatcher(
'.toHaveBeenNthCalledWith'
),
toHaveLastReturnedWith: createLastReturnedMatcher('.toHaveLastReturnedWith'),
toHaveNthReturnedWith: createNthReturnedWithMatcher('.toHaveNthReturnedWith'),
toHaveReturned: createToReturnMatcher('.toHaveReturned'),
toHaveReturnedTimes: createToReturnTimesMatcher('.toHaveReturnedTimes'),
toHaveReturnedWith: createToReturnWithMatcher('.toHaveReturnedWith'),
toReturn: createToReturnMatcher('.toReturn'),
toReturnTimes: createToReturnTimesMatcher('.toReturnTimes'),
toReturnWith: createToReturnWithMatcher('.toReturnWith')
};
const isSpy = spy => spy.calls && typeof spy.calls.count === 'function';
const ensureMock = (mockOrSpy, matcherName) => {
if (
!mockOrSpy ||
((mockOrSpy.calls === undefined || mockOrSpy.calls.all === undefined) &&
mockOrSpy._isMockFunction !== true)
) {
throw new Error(
(0, _jestMatcherUtils.matcherErrorMessage)(
(0, _jestMatcherUtils.matcherHint)(
'[.not]' + matcherName,
'jest.fn()',
''
),
`${(0, _jestMatcherUtils.RECEIVED_COLOR)(
'received'
)} value must be a mock or spy function`,
(0, _jestMatcherUtils.printWithType)(
'Received',
mockOrSpy,
_jestMatcherUtils.printReceived
)
)
);
}
};
const getPrintedCalls = (calls, limit, sep, fn) => {
const result = [];
let i = calls.length;
while (--i >= 0 && --limit >= 0) {
result.push(fn(calls[i]));
}
return result.join(sep);
};
const getPrintedReturnValues = (calls, limit) => {
const result = [];
for (let i = 0; i < calls.length && i < limit; i += 1) {
result.push((0, _jestMatcherUtils.printReceived)(calls[i]));
}
if (calls.length > limit) {
result.push(
`...and ${(0, _jestMatcherUtils.printReceived)(
calls.length - limit
)} more`
);
}
return result.join('\n\n ');
};
const formatReceivedCalls = (calls, limit, options) => {
if (calls.length) {
const but = options && options.sameSentence ? 'but' : 'But';
const count = calls.length - limit;
const printedCalls = getPrintedCalls(
calls,
limit,
', ',
_jestMatcherUtils.printReceived
);
return (
`${but} it was called ` +
`with:\n ` +
printedCalls +
(count > 0
? '\nand ' +
(0, _jestMatcherUtils.RECEIVED_COLOR)(
(0, _jestMatcherUtils.pluralize)('more call', count)
) +
'.'
: '')
);
} else {
return `But it was ${(0, _jestMatcherUtils.RECEIVED_COLOR)('not called')}.`;
}
};
const formatMismatchedCalls = (calls, expected, limit) => {
if (calls.length) {
return getPrintedCalls(
calls,
limit,
'\n\n',
formatMismatchedArgs.bind(null, expected)
);
} else {
return (
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`But it was ${(0, _jestMatcherUtils.RECEIVED_COLOR)('not called')}.`
);
}
};
const formatMismatchedReturnValues = (returnValues, expected, limit) => {
if (returnValues.length) {
return (
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`But it returned:\n` +
` ${getPrintedReturnValues(returnValues, limit)}`
);
} else {
return (
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`But it did ${(0, _jestMatcherUtils.RECEIVED_COLOR)('not return')}.`
);
}
};
const formatMismatchedArgs = (expected, received) => {
const length = Math.max(expected.length, received.length);
const printedArgs = [];
for (let i = 0; i < length; i++) {
if (
!(0, _jasmineUtils.equals)(expected[i], received[i], [
_utils.iterableEquality
])
) {
const oneline = (0, _utils.isOneline)(expected[i], received[i]);
const diffString = (0, _jestMatcherUtils.diff)(expected[i], received[i]);
printedArgs.push(
` ${(0, _jestMatcherUtils.printExpected)(expected[i])}\n` +
`as argument ${i + 1}, but it was called with\n` +
` ${(0, _jestMatcherUtils.printReceived)(received[i])}.` +
(diffString && !oneline ? `\n\nDifference:\n\n${diffString}` : '')
);
} else if (i >= expected.length) {
printedArgs.push(
` Did not expect argument ${i + 1} ` +
`but it was called with ${(0, _jestMatcherUtils.printReceived)(
received[i]
)}.`
);
}
}
return printedArgs.join('\n');
};
const nthToString = nth => {
switch (nth) {
case 1:
return 'first';
case 2:
return 'second';
case 3:
return 'third';
}
return `${nth}th`;
};
var _default = spyMatchers;
exports.default = _default;

12
node_modules/expect/build/toThrowMatchers.d.ts generated vendored Normal file
View 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 { MatchersObject, RawMatcherFn } from './types';
export declare const createMatcher: (matcherName: string, fromPromise?: boolean | undefined) => RawMatcherFn;
declare const matchers: MatchersObject;
export default matchers;
//# sourceMappingURL=toThrowMatchers.d.ts.map

1
node_modules/expect/build/toThrowMatchers.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"toThrowMatchers.d.ts","sourceRoot":"","sources":["../src/toThrowMatchers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,OAAO,EACL,cAAc,EAEd,YAAY,EAEb,MAAM,SAAS,CAAC;AAwCjB,eAAO,MAAM,aAAa,0EA6DvB,CAAC;AAEJ,QAAA,MAAM,QAAQ,EAAE,cAGf,CAAC;AA6RF,eAAe,QAAQ,CAAC"}

453
node_modules/expect/build/toThrowMatchers.js generated vendored Normal file
View file

@ -0,0 +1,453 @@
'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) =>
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' +
formatExpected('Expected message: ', expected.message) +
(thrown === null
? '\n' + DID_NOT_THROW
: thrown.hasMessage
? formatReceived('Received message: ', thrown, 'message') +
formatStack(thrown)
: 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;

322
node_modules/expect/build/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,322 @@
/**
* 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 { Config } from '@jest/types';
import * as jestMatcherUtils from 'jest-matcher-utils';
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;
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): R;
/**
* For comparing floating point numbers.
*/
toBeGreaterThanOrEqual(expected: number): 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): R;
/**
* For comparing floating point numbers.
*/
toBeLessThanOrEqual(expected: number): 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 {};
//# sourceMappingURL=types.d.ts.map

1
node_modules/expect/build/types.d.ts.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/expect/build/types.js generated vendored Normal file
View file

@ -0,0 +1 @@
'use strict';

26
node_modules/expect/build/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,26 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
declare type GetPath = {
hasEndProp?: boolean;
lastTraversedObject: unknown;
traversedPath: Array<string>;
value?: unknown;
};
export declare const hasOwnProperty: (object: object, key: string) => boolean;
export declare const getPath: (object: object, propertyPath: string | string[]) => GetPath;
export declare const getObjectSubset: (object: any, subset: any) => any;
export declare const iterableEquality: (a: any, b: any, aStack?: any[], bStack?: any[]) => boolean | undefined;
export declare const subsetEquality: (object: any, subset: any) => boolean | undefined;
export declare const typeEquality: (a: any, b: any) => false | 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) => boolean;
export declare function emptyObject(obj: any): boolean;
export declare const isOneline: (expected: any, received: any) => boolean;
export {};
//# sourceMappingURL=utils.d.ts.map

1
node_modules/expect/build/utils.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,aAAK,OAAO,GAAG;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAyBF,eAAO,MAAM,cAAc,0CAEY,CAAC;AAExC,eAAO,MAAM,OAAO,8DAoDnB,CAAC;AAIF,eAAO,MAAM,eAAe,mCA2B3B,CAAC;AAOF,eAAO,MAAM,gBAAgB,yEAqH5B,CAAC;AASF,eAAO,MAAM,cAAc,mDAc1B,CAAC;AAEF,eAAO,MAAM,YAAY,uCAMxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,iDAW/B,CAAC;AAEF,eAAO,MAAM,SAAS,+DASrB,CAAC;AAGF,eAAO,MAAM,OAAO,6BAWnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,WAEnC;AAID,eAAO,MAAM,SAAS,2CAGkD,CAAC"}

482
node_modules/expect/build/utils.js generated vendored Normal file
View file

@ -0,0 +1,482 @@
'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 = exports.hasOwnProperty = void 0;
var _jestGetType = require('jest-get-type');
var _jasmineUtils = require('./jasmineUtils');
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
// Return whether object instance inherits getter from its class.
const hasGetterFromConstructor = (object, key) => {
const constructor = object.constructor;
if (constructor === Object) {
// A literal object has Object as constructor.
// Therefore, it cannot inherit application-specific getters.
// Furthermore, Object has __proto__ getter which is not relevant.
// Array, Boolean, Number, String constructors dont have any getters.
return false;
}
if (typeof constructor !== 'function') {
// Object.create(null) constructs object with no constructor nor prototype.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects
return false;
}
const descriptor = Object.getOwnPropertyDescriptor(
constructor.prototype,
key
);
return descriptor !== undefined && typeof descriptor.get === 'function';
};
const hasOwnProperty = (object, key) =>
Object.prototype.hasOwnProperty.call(object, key) ||
hasGetterFromConstructor(object, key);
exports.hasOwnProperty = hasOwnProperty;
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.
exports.getPath = getPath;
const getObjectSubset = (object, subset) => {
if (Array.isArray(object)) {
if (Array.isArray(subset) && subset.length === object.length) {
return subset.map((sub, i) => getObjectSubset(object[i], sub));
}
} else if (object instanceof Date) {
return object;
} else if (
typeof object === 'object' &&
object !== null &&
typeof subset === 'object' &&
subset !== null
) {
const trimmed = {};
Object.keys(subset)
.filter(key => hasOwnProperty(object, key))
.forEach(
key => (trimmed[key] = getObjectSubset(object[key], subset[key]))
);
if (Object.keys(trimmed).length > 0) {
return trimmed;
}
}
return object;
};
exports.getObjectSubset = getObjectSubset;
const IteratorSymbol = Symbol.iterator;
const hasIterator = object => !!(object != null && object[IteratorSymbol]);
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;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (
var _iterator = a[Symbol.iterator](), _step;
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
_iteratorNormalCompletion = true
) {
const aValue = _step.value;
if (!b.has(aValue)) {
let has = false;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (
var _iterator2 = b[Symbol.iterator](), _step2;
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next())
.done);
_iteratorNormalCompletion2 = true
) {
const bValue = _step2.value;
const isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [
iterableEqualityWithStack
]);
if (isEqual === true) {
has = true;
}
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
if (has === false) {
allFound = false;
break;
}
}
} // Remove the first value from the stack of traversed values.
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
aStack.pop();
bStack.pop();
return allFound;
} else if (
(0, _jasmineUtils.isA)('Map', a) ||
(0, _jasmineUtils.isImmutableUnorderedKeyed)(a)
) {
let allFound = true;
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (
var _iterator3 = a[Symbol.iterator](), _step3;
!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done);
_iteratorNormalCompletion3 = true
) {
const aEntry = _step3.value;
if (
!b.has(aEntry[0]) ||
!(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [
iterableEqualityWithStack
])
) {
let has = false;
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (
var _iterator4 = b[Symbol.iterator](), _step4;
!(_iteratorNormalCompletion4 = (_step4 = _iterator4.next())
.done);
_iteratorNormalCompletion4 = true
) {
const bEntry = _step4.value;
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;
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
if (has === false) {
allFound = false;
break;
}
}
} // Remove the first value from the stack of traversed values.
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
aStack.pop();
bStack.pop();
return allFound;
}
}
const bIterator = b[IteratorSymbol]();
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (
var _iterator5 = a[Symbol.iterator](), _step5;
!(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done);
_iteratorNormalCompletion5 = true
) {
const aValue = _step5.value;
const nextB = bIterator.next();
if (
nextB.done ||
!(0, _jasmineUtils.equals)(aValue, nextB.value, [
iterableEqualityWithStack
])
) {
return false;
}
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
_iterator5.return();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
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 isObjectWithKeys = a =>
a !== null &&
typeof a === 'object' &&
!(a instanceof Error) &&
!(a instanceof Array) &&
!(a instanceof Date);
const subsetEquality = (object, subset) => {
if (!isObjectWithKeys(subset)) {
return undefined;
}
return Object.keys(subset).every(
key =>
object != null &&
hasOwnProperty(object, key) &&
(0, _jasmineUtils.equals)(object[key], subset[key], [
iterableEquality,
subsetEquality
])
);
};
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;
}
};
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;

68
node_modules/expect/package.json generated vendored Normal file
View file

@ -0,0 +1,68 @@
{
"_args": [
[
"expect@24.8.0",
"/Users/eric/repos/actions/setup-node"
]
],
"_development": true,
"_from": "expect@24.8.0",
"_id": "expect@24.8.0",
"_inBundle": false,
"_integrity": "sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA==",
"_location": "/expect",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "expect@24.8.0",
"name": "expect",
"escapedName": "expect",
"rawSpec": "24.8.0",
"saveSpec": null,
"fetchSpec": "24.8.0"
},
"_requiredBy": [
"/jest-circus",
"/jest-jasmine2",
"/jest-snapshot"
],
"_resolved": "https://registry.npmjs.org/expect/-/expect-24.8.0.tgz",
"_spec": "24.8.0",
"_where": "/Users/eric/repos/actions/setup-node",
"browser": "build-es5/index.js",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"dependencies": {
"@jest/types": "^24.8.0",
"ansi-styles": "^3.2.0",
"jest-get-type": "^24.8.0",
"jest-matcher-utils": "^24.8.0",
"jest-message-util": "^24.8.0",
"jest-regex-util": "^24.3.0"
},
"description": "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).",
"devDependencies": {
"@types/ansi-styles": "^3.2.1",
"immutable": "^4.0.0-rc.12"
},
"engines": {
"node": ">= 6"
},
"gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4",
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
"name": "expect",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git",
"directory": "packages/expect"
},
"types": "build/index.d.ts",
"version": "24.8.0"
}

14
node_modules/expect/tsconfig.json generated vendored Normal file
View file

@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
},
"references": [
{"path": "../jest-get-type"},
{"path": "../jest-matcher-utils"},
{"path": "../jest-message-util"},
{"path": "../jest-regex-util"},
{"path": "../jest-types"}
]
}