Updating NPM dependencies
This commit is contained in:
15
node_modules/expect/build/asymmetricMatchers.d.ts
generated
vendored
15
node_modules/expect/build/asymmetricMatchers.d.ts
generated
vendored
@@ -29,8 +29,8 @@ declare class ArrayContaining extends AsymmetricMatcher<Array<unknown>> {
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
}
|
||||
declare class ObjectContaining extends AsymmetricMatcher<Record<string, any>> {
|
||||
constructor(sample: Record<string, any>, inverse?: boolean);
|
||||
declare class ObjectContaining extends AsymmetricMatcher<Record<string, unknown>> {
|
||||
constructor(sample: Record<string, unknown>, inverse?: boolean);
|
||||
asymmetricMatch(other: any): boolean;
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
@@ -47,15 +47,14 @@ declare class StringMatching extends AsymmetricMatcher<RegExp> {
|
||||
toString(): string;
|
||||
getExpectedType(): string;
|
||||
}
|
||||
export declare const any: (expectedObject: any) => Any;
|
||||
export declare const any: (expectedObject: unknown) => 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 arrayContaining: (sample: Array<unknown>) => ArrayContaining;
|
||||
export declare const arrayNotContaining: (sample: Array<unknown>) => ArrayContaining;
|
||||
export declare const objectContaining: (sample: Record<string, unknown>) => ObjectContaining;
|
||||
export declare const objectNotContaining: (sample: Record<string, unknown>) => 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
|
||||
1
node_modules/expect/build/asymmetricMatchers.d.ts.map
generated
vendored
1
node_modules/expect/build/asymmetricMatchers.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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"}
|
||||
9
node_modules/expect/build/asymmetricMatchers.js
generated
vendored
9
node_modules/expect/build/asymmetricMatchers.js
generated
vendored
@@ -72,6 +72,15 @@ class Any extends AsymmetricMatcher {
|
||||
if (this.sample == Boolean) {
|
||||
return typeof other == 'boolean';
|
||||
}
|
||||
/* global BigInt */
|
||||
|
||||
if (this.sample == BigInt) {
|
||||
return typeof other == 'bigint';
|
||||
}
|
||||
|
||||
if (this.sample == Symbol) {
|
||||
return typeof other == 'symbol';
|
||||
}
|
||||
|
||||
return other instanceof this.sample;
|
||||
}
|
||||
|
||||
12
node_modules/expect/build/extractExpectedAssertionsErrors.d.ts
generated
vendored
12
node_modules/expect/build/extractExpectedAssertionsErrors.d.ts
generated
vendored
@@ -5,14 +5,6 @@
|
||||
* 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;
|
||||
})[];
|
||||
import type { Expect } from './types';
|
||||
declare const extractExpectedAssertionsErrors: Expect['extractExpectedAssertionsErrors'];
|
||||
export default extractExpectedAssertionsErrors;
|
||||
//# sourceMappingURL=extractExpectedAssertionsErrors.d.ts.map
|
||||
1
node_modules/expect/build/extractExpectedAssertionsErrors.d.ts.map
generated
vendored
1
node_modules/expect/build/extractExpectedAssertionsErrors.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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"}
|
||||
19
node_modules/expect/build/extractExpectedAssertionsErrors.js
generated
vendored
19
node_modules/expect/build/extractExpectedAssertionsErrors.js
generated
vendored
@@ -27,14 +27,13 @@ const resetAssertionsLocalState = () => {
|
||||
|
||||
const extractExpectedAssertionsErrors = () => {
|
||||
const result = [];
|
||||
|
||||
const _getState = (0, _jestMatchersObject.getState)(),
|
||||
assertionCalls = _getState.assertionCalls,
|
||||
expectedAssertionsNumber = _getState.expectedAssertionsNumber,
|
||||
expectedAssertionsNumberError = _getState.expectedAssertionsNumberError,
|
||||
isExpectingAssertions = _getState.isExpectingAssertions,
|
||||
isExpectingAssertionsError = _getState.isExpectingAssertionsError;
|
||||
|
||||
const {
|
||||
assertionCalls,
|
||||
expectedAssertionsNumber,
|
||||
expectedAssertionsNumberError,
|
||||
isExpectingAssertions,
|
||||
isExpectingAssertionsError
|
||||
} = (0, _jestMatchersObject.getState)();
|
||||
resetAssertionsLocalState();
|
||||
|
||||
if (
|
||||
@@ -60,9 +59,9 @@ const extractExpectedAssertionsErrors = () => {
|
||||
) +
|
||||
'.';
|
||||
result.push({
|
||||
actual: assertionCalls,
|
||||
actual: assertionCalls.toString(),
|
||||
error: expectedAssertionsNumberError,
|
||||
expected: expectedAssertionsNumber
|
||||
expected: expectedAssertionsNumber.toString()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
11
node_modules/expect/build/fakeChalk.d.ts
generated
vendored
11
node_modules/expect/build/fakeChalk.d.ts
generated
vendored
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
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
1
node_modules/expect/build/fakeChalk.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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
28
node_modules/expect/build/fakeChalk.js
generated
vendored
@@ -1,28 +0,0 @@
|
||||
'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;
|
||||
3
node_modules/expect/build/index.d.ts
generated
vendored
3
node_modules/expect/build/index.d.ts
generated
vendored
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
import { Matchers as MatcherInterface, MatcherState as JestMatcherState, Expect } from './types';
|
||||
import type { Expect, MatcherState as JestMatcherState, Matchers as MatcherInterface } from './types';
|
||||
declare const expectExport: Expect;
|
||||
declare namespace expectExport {
|
||||
type MatcherState = JestMatcherState;
|
||||
@@ -13,4 +13,3 @@ declare namespace expectExport {
|
||||
}
|
||||
}
|
||||
export = expectExport;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/expect/build/index.d.ts.map
generated
vendored
1
node_modules/expect/build/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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;AAkYjB,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"}
|
||||
162
node_modules/expect/build/index.js
generated
vendored
162
node_modules/expect/build/index.js
generated
vendored
@@ -2,7 +2,15 @@
|
||||
|
||||
var matcherUtils = _interopRequireWildcard(require('jest-matcher-utils'));
|
||||
|
||||
var _utils = require('./utils');
|
||||
var _asymmetricMatchers = require('./asymmetricMatchers');
|
||||
|
||||
var _extractExpectedAssertionsErrors = _interopRequireDefault(
|
||||
require('./extractExpectedAssertionsErrors')
|
||||
);
|
||||
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
var _jestMatchersObject = require('./jestMatchersObject');
|
||||
|
||||
var _matchers = _interopRequireDefault(require('./matchers'));
|
||||
|
||||
@@ -10,65 +18,55 @@ 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')
|
||||
);
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -99,10 +97,8 @@ const isPromise = obj =>
|
||||
(typeof obj === 'object' || typeof obj === 'function') &&
|
||||
typeof obj.then === 'function';
|
||||
|
||||
const createToThrowErrorMatchingSnapshotMatcher = function createToThrowErrorMatchingSnapshotMatcher(
|
||||
matcher
|
||||
) {
|
||||
return function(received, testNameOrInlineSnapshot) {
|
||||
const createToThrowErrorMatchingSnapshotMatcher = function (matcher) {
|
||||
return function (received, testNameOrInlineSnapshot) {
|
||||
return matcher.apply(this, [received, testNameOrInlineSnapshot, true]);
|
||||
};
|
||||
};
|
||||
@@ -224,12 +220,15 @@ const makeRejectMatcher = (matcherName, matcher, isNot, actual, outerErr) => (
|
||||
isNot,
|
||||
promise: 'rejects'
|
||||
};
|
||||
const actualWrapper = typeof actual === 'function' ? actual() : actual;
|
||||
|
||||
if (!isPromise(actual)) {
|
||||
if (!isPromise(actualWrapper)) {
|
||||
throw new JestAssertionError(
|
||||
matcherUtils.matcherErrorMessage(
|
||||
matcherUtils.matcherHint(matcherName, undefined, '', options),
|
||||
`${matcherUtils.RECEIVED_COLOR('received')} value must be a promise`,
|
||||
`${matcherUtils.RECEIVED_COLOR(
|
||||
'received'
|
||||
)} value must be a promise or a function returning a promise`,
|
||||
matcherUtils.printWithType(
|
||||
'Received',
|
||||
actual,
|
||||
@@ -240,7 +239,7 @@ const makeRejectMatcher = (matcherName, matcher, isNot, actual, outerErr) => (
|
||||
}
|
||||
|
||||
const innerErr = new JestAssertionError();
|
||||
return actual.then(
|
||||
return actualWrapper.then(
|
||||
result => {
|
||||
outerErr.message =
|
||||
matcherUtils.matcherHint(matcherName, undefined, '', options) +
|
||||
@@ -260,30 +259,25 @@ const makeRejectMatcher = (matcherName, matcher, isNot, actual, outerErr) => (
|
||||
const makeThrowingMatcher = (matcher, isNot, promise, actual, err) =>
|
||||
function throwingMatcher(...args) {
|
||||
let throws = true;
|
||||
|
||||
const utils = _objectSpread({}, matcherUtils, {
|
||||
const utils = {
|
||||
...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 matcherContext = {
|
||||
// When throws is disabled, the matcher will not throw errors during test
|
||||
// execution but instead add them to the global matcher state. If a
|
||||
// matcher throws, test execution is normally stopped immediately. The
|
||||
// snapshot matcher uses it because we want to log all snapshot
|
||||
// failures in a test.
|
||||
dontThrow: () => (throws = false),
|
||||
...(0, _jestMatchersObject.getState)(),
|
||||
equals: _jasmineUtils.equals,
|
||||
error: err,
|
||||
isNot,
|
||||
promise,
|
||||
utils
|
||||
};
|
||||
|
||||
const processResult = (result, asyncError) => {
|
||||
_validateResult(result);
|
||||
@@ -322,7 +316,7 @@ const makeThrowingMatcher = (matcher, isNot, promise, actual, err) =>
|
||||
}
|
||||
};
|
||||
|
||||
const handlError = error => {
|
||||
const handleError = error => {
|
||||
if (
|
||||
matcher[_jestMatchersObject.INTERNAL_MATCHER_FLAG] === true &&
|
||||
!(error instanceof JestAssertionError) &&
|
||||
@@ -339,7 +333,14 @@ const makeThrowingMatcher = (matcher, isNot, promise, actual, err) =>
|
||||
let potentialResult;
|
||||
|
||||
try {
|
||||
potentialResult = matcher.call(matcherContext, actual, ...args);
|
||||
potentialResult =
|
||||
matcher[_jestMatchersObject.INTERNAL_MATCHER_FLAG] === true
|
||||
? matcher.call(matcherContext, actual, ...args) // It's a trap specifically for inline snapshot to capture this name
|
||||
: // in the stack trace, so that it can correctly get the custom matcher
|
||||
// function call.
|
||||
(function __EXTERNAL_MATCHER_TRAP__() {
|
||||
return matcher.call(matcherContext, actual, ...args);
|
||||
})();
|
||||
|
||||
if (isPromise(potentialResult)) {
|
||||
const asyncResult = potentialResult;
|
||||
@@ -351,13 +352,13 @@ const makeThrowingMatcher = (matcher, isNot, promise, actual, err) =>
|
||||
|
||||
return asyncResult
|
||||
.then(aResult => processResult(aResult, asyncError))
|
||||
.catch(error => handlError(error));
|
||||
.catch(handleError);
|
||||
} else {
|
||||
const syncResult = potentialResult;
|
||||
return processResult(syncResult);
|
||||
}
|
||||
} catch (error) {
|
||||
return handlError(error);
|
||||
return handleError(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -430,6 +431,5 @@ expect.getState = _jestMatchersObject.getState;
|
||||
expect.setState = _jestMatchersObject.setState;
|
||||
expect.extractExpectedAssertionsErrors =
|
||||
_extractExpectedAssertionsErrors.default;
|
||||
const expectExport = expect; // eslint-disable-next-line no-redeclare
|
||||
|
||||
const expectExport = expect;
|
||||
module.exports = expectExport;
|
||||
|
||||
3
node_modules/expect/build/jasmineUtils.d.ts
generated
vendored
3
node_modules/expect/build/jasmineUtils.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import { Tester } from './types';
|
||||
import type { Tester } from './types';
|
||||
export declare function equals(a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean): boolean;
|
||||
export declare function isA(typeName: string, value: unknown): boolean;
|
||||
export declare function fnNameFor(func: Function): string;
|
||||
@@ -6,4 +6,3 @@ 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
1
node_modules/expect/build/jasmineUtils.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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;AA6MD,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"}
|
||||
31
node_modules/expect/build/jasmineUtils.js
generated
vendored
31
node_modules/expect/build/jasmineUtils.js
generated
vendored
@@ -101,33 +101,32 @@ function eq(a, b, aStack, bStack, customTesters, hasKey) {
|
||||
}
|
||||
|
||||
switch (className) {
|
||||
// Strings, numbers, dates, and booleans are compared by value.
|
||||
case '[object Boolean]':
|
||||
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));
|
||||
if (typeof a !== typeof b) {
|
||||
// One is a primitive, one a `new Primitive()`
|
||||
return false;
|
||||
} else if (typeof a !== 'object' && typeof b !== 'object') {
|
||||
// both are proper primitives
|
||||
return Object.is(a, b);
|
||||
} else {
|
||||
// both are `new Primitive()`s
|
||||
return Object.is(a.valueOf(), b.valueOf());
|
||||
}
|
||||
|
||||
case '[object Date]':
|
||||
case '[object Boolean]':
|
||||
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
|
||||
// Coerce dates to numeric primitive values. Dates are compared by their
|
||||
// millisecond representations. Note that invalid dates with millisecond representations
|
||||
// of `NaN` are not equivalent.
|
||||
return +a == +b;
|
||||
// RegExps are compared by their source patterns and flags.
|
||||
|
||||
case '[object RegExp]':
|
||||
return (
|
||||
a.source == b.source &&
|
||||
a.global == b.global &&
|
||||
a.multiline == b.multiline &&
|
||||
a.ignoreCase == b.ignoreCase
|
||||
);
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
}
|
||||
|
||||
if (typeof a != 'object' || typeof b != 'object') {
|
||||
if (typeof a !== 'object' || typeof b !== 'object') {
|
||||
return false;
|
||||
} // Use DOM3 method isEqualNode (IE>=9)
|
||||
|
||||
@@ -196,7 +195,7 @@ function eq(a, b, aStack, bStack, customTesters, hasKey) {
|
||||
}
|
||||
|
||||
function keys(obj, isArray, hasKey) {
|
||||
var allKeys = (function(o) {
|
||||
var allKeys = (function (o) {
|
||||
var keys = [];
|
||||
|
||||
for (var key in o) {
|
||||
|
||||
9
node_modules/expect/build/jestMatchersObject.d.ts
generated
vendored
9
node_modules/expect/build/jestMatchersObject.d.ts
generated
vendored
@@ -5,10 +5,9 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
import { Expect, MatchersObject } from './types';
|
||||
import type { Expect, MatcherState, 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 getState: () => MatcherState;
|
||||
export declare const setState: (state: Partial<MatcherState>) => void;
|
||||
export declare const getMatchers: () => MatchersObject;
|
||||
export declare const setMatchers: (matchers: MatchersObject, isInternal: boolean, expect: Expect) => void;
|
||||
//# sourceMappingURL=jestMatchersObject.d.ts.map
|
||||
1
node_modules/expect/build/jestMatchersObject.d.ts.map
generated
vendored
1
node_modules/expect/build/jestMatchersObject.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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"}
|
||||
19
node_modules/expect/build/jestMatchersObject.js
generated
vendored
19
node_modules/expect/build/jestMatchersObject.js
generated
vendored
@@ -17,15 +17,16 @@ const INTERNAL_MATCHER_FLAG = Symbol.for('$$jest-internal-matcher');
|
||||
exports.INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG;
|
||||
|
||||
if (!global.hasOwnProperty(JEST_MATCHERS_OBJECT)) {
|
||||
const defaultState = {
|
||||
assertionCalls: 0,
|
||||
expectedAssertionsNumber: null,
|
||||
isExpectingAssertions: false,
|
||||
suppressedErrors: [] // errors that are not thrown immediately.
|
||||
};
|
||||
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.
|
||||
}
|
||||
state: defaultState
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -60,9 +61,7 @@ const setMatchers = (matchers, isInternal, expect) => {
|
||||
}
|
||||
|
||||
asymmetricMatch(other) {
|
||||
const _ref = matcher(other, ...this.sample),
|
||||
pass = _ref.pass;
|
||||
|
||||
const {pass} = matcher(other, ...this.sample);
|
||||
return this.inverse ? !pass : pass;
|
||||
}
|
||||
|
||||
@@ -75,7 +74,7 @@ const setMatchers = (matchers, isInternal, expect) => {
|
||||
}
|
||||
|
||||
toAsymmetricMatcher() {
|
||||
return `${this.toString()}<${this.sample.join(', ')}>`;
|
||||
return `${this.toString()}<${this.sample.map(String).join(', ')}>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
node_modules/expect/build/matchers.d.ts
generated
vendored
3
node_modules/expect/build/matchers.d.ts
generated
vendored
@@ -5,7 +5,6 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
import { MatchersObject } from './types';
|
||||
import type { 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
1
node_modules/expect/build/matchers.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"matchers.d.ts","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,OAAO,EAAC,cAAc,EAAe,MAAM,SAAS,CAAC;AA0CrD,QAAA,MAAM,QAAQ,EAAE,cA+1Bf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
||||
125
node_modules/expect/build/matchers.js
generated
vendored
125
node_modules/expect/build/matchers.js
generated
vendored
@@ -5,39 +5,18 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _jestGetType = _interopRequireWildcard(require('jest-get-type'));
|
||||
var _jestGetType = _interopRequireDefault(require('jest-get-type'));
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
var _print = require('./print');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
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;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,6 +26,8 @@ function _interopRequireWildcard(obj) {
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
// Omit colon and one or more spaces, so can call getLabelPrinter.
|
||||
const EXPECTED_LABEL = 'Expected';
|
||||
const RECEIVED_LABEL = 'Received';
|
||||
@@ -141,18 +122,56 @@ const matchers = {
|
||||
toBeCloseTo(received, expected, precision = 2) {
|
||||
const matcherName = 'toBeCloseTo';
|
||||
const secondArgument = arguments.length === 3 ? 'precision' : undefined;
|
||||
const isNot = this.isNot;
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
isNot,
|
||||
promise: this.promise,
|
||||
secondArgument,
|
||||
secondArgumentColor: arg => arg
|
||||
};
|
||||
(0, _jestMatcherUtils.ensureNumbers)(
|
||||
received,
|
||||
expected,
|
||||
matcherName,
|
||||
options
|
||||
);
|
||||
|
||||
if (typeof expected !== 'number') {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
),
|
||||
`${(0, _jestMatcherUtils.EXPECTED_COLOR)(
|
||||
'expected'
|
||||
)} value must be a number`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Expected',
|
||||
expected,
|
||||
_jestMatcherUtils.printExpected
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof received !== 'number') {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
undefined,
|
||||
options
|
||||
),
|
||||
`${(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
'received'
|
||||
)} value must be a number`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Received',
|
||||
received,
|
||||
_jestMatcherUtils.printReceived
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
let pass = false;
|
||||
let expectedDiff = 0;
|
||||
let receivedDiff = 0;
|
||||
@@ -183,13 +202,12 @@ const matchers = {
|
||||
received
|
||||
)}\n` +
|
||||
'\n' +
|
||||
`Expected precision: ${(0, _jestMatcherUtils.stringify)(
|
||||
precision
|
||||
)}\n` +
|
||||
`Expected difference: not < ${(0,
|
||||
_jestMatcherUtils.printExpected)(expectedDiff)}\n` +
|
||||
`Received difference: ${(0,
|
||||
_jestMatcherUtils.printReceived)(receivedDiff)}`)
|
||||
(0, _print.printCloseTo)(
|
||||
receivedDiff,
|
||||
expectedDiff,
|
||||
precision,
|
||||
isNot
|
||||
))
|
||||
: () =>
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
@@ -201,15 +219,12 @@ const matchers = {
|
||||
`Expected: ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
|
||||
`Received: ${(0, _jestMatcherUtils.printReceived)(received)}\n` +
|
||||
'\n' +
|
||||
`Expected precision: ${(0, _jestMatcherUtils.stringify)(
|
||||
precision
|
||||
)}\n` +
|
||||
`Expected difference: < ${(0, _jestMatcherUtils.printExpected)(
|
||||
expectedDiff
|
||||
)}\n` +
|
||||
`Received difference: ${(0, _jestMatcherUtils.printReceived)(
|
||||
receivedDiff
|
||||
)}`;
|
||||
(0, _print.printCloseTo)(
|
||||
receivedDiff,
|
||||
expectedDiff,
|
||||
precision,
|
||||
isNot
|
||||
);
|
||||
return {
|
||||
message,
|
||||
pass
|
||||
@@ -388,7 +403,7 @@ const matchers = {
|
||||
'Expected constructor',
|
||||
expected
|
||||
) +
|
||||
((0, _jestGetType.isPrimitive)(received) ||
|
||||
(_jestGetType.default.isPrimitive(received) ||
|
||||
Object.getPrototypeOf(received) === null
|
||||
? `\nReceived value has no prototype\nReceived value: ${(0,
|
||||
_jestMatcherUtils.printReceived)(received)}`
|
||||
@@ -794,8 +809,9 @@ const matchers = {
|
||||
};
|
||||
|
||||
if (
|
||||
typeof received !== 'string' &&
|
||||
(!received || typeof received.length !== 'number')
|
||||
typeof (received === null || received === void 0
|
||||
? void 0
|
||||
: received.length) !== 'number'
|
||||
) {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
@@ -941,8 +957,7 @@ const matchers = {
|
||||
}
|
||||
|
||||
const result = (0, _utils.getPath)(received, expectedPath);
|
||||
const lastTraversedObject = result.lastTraversedObject,
|
||||
hasEndProp = result.hasEndProp;
|
||||
const {lastTraversedObject, hasEndProp} = result;
|
||||
const receivedPath = result.traversedPath;
|
||||
const hasCompletePath = receivedPath.length === expectedPathLength;
|
||||
const receivedValue = hasCompletePath ? result.value : lastTraversedObject;
|
||||
@@ -1111,7 +1126,7 @@ const matchers = {
|
||||
const pass =
|
||||
typeof expected === 'string'
|
||||
? received.includes(expected)
|
||||
: expected.test(received);
|
||||
: new RegExp(expected).test(received);
|
||||
const message = pass
|
||||
? () =>
|
||||
typeof expected === 'string'
|
||||
|
||||
4
node_modules/expect/build/print.d.ts
generated
vendored
4
node_modules/expect/build/print.d.ts
generated
vendored
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
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 printReceivedArrayContainExpectedItem: (received: Array<unknown>, index: number) => string;
|
||||
export declare const printCloseTo: (receivedDiff: number, expectedDiff: number, precision: number, isNot: boolean) => string;
|
||||
export declare const printExpectedConstructorName: (label: string, expected: Function) => string;
|
||||
export declare const printExpectedConstructorNameNot: (label: string, expected: Function) => string;
|
||||
export declare const printReceivedConstructorName: (label: string, received: Function) => string;
|
||||
export declare const printReceivedConstructorNameNot: (label: string, received: Function, expected: Function) => string;
|
||||
//# sourceMappingURL=print.d.ts.map
|
||||
1
node_modules/expect/build/print.d.ts.map
generated
vendored
1
node_modules/expect/build/print.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../src/print.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH,eAAO,MAAM,2CAA2C,6DAWrD,CAAC;AAEJ,eAAO,MAAM,wCAAwC,8DAU9C,CAAC;AAKR,eAAO,MAAM,qCAAqC,gDAa/C,CAAC;AAEJ,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"}
|
||||
25
node_modules/expect/build/print.js
generated
vendored
25
node_modules/expect/build/print.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printCloseTo = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
@@ -14,6 +14,8 @@ var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
// Format substring but do not enclose in double quote marks.
|
||||
// The replacement is compatible with pretty-format package.
|
||||
const printSubstring = val => val.replace(/"|\\/g, '\\$&');
|
||||
@@ -60,6 +62,27 @@ const printReceivedArrayContainExpectedItem = (received, index) =>
|
||||
|
||||
exports.printReceivedArrayContainExpectedItem = printReceivedArrayContainExpectedItem;
|
||||
|
||||
const printCloseTo = (receivedDiff, expectedDiff, precision, isNot) => {
|
||||
const receivedDiffString = (0, _jestMatcherUtils.stringify)(receivedDiff);
|
||||
const expectedDiffString = receivedDiffString.includes('e') // toExponential arg is number of digits after the decimal point.
|
||||
? expectedDiff.toExponential(0)
|
||||
: 0 <= precision && precision < 20 // toFixed arg is number of digits after the decimal point.
|
||||
? // It may be a value between 0 and 20 inclusive.
|
||||
// Implementations may optionally support a larger range of values.
|
||||
expectedDiff.toFixed(precision + 1)
|
||||
: (0, _jestMatcherUtils.stringify)(expectedDiff);
|
||||
return (
|
||||
`Expected precision: ${isNot ? ' ' : ''} ${(0,
|
||||
_jestMatcherUtils.stringify)(precision)}\n` +
|
||||
`Expected difference: ${isNot ? 'not ' : ''}< ${(0,
|
||||
_jestMatcherUtils.EXPECTED_COLOR)(expectedDiffString)}\n` +
|
||||
`Received difference: ${isNot ? ' ' : ''} ${(0,
|
||||
_jestMatcherUtils.RECEIVED_COLOR)(receivedDiffString)}`
|
||||
);
|
||||
};
|
||||
|
||||
exports.printCloseTo = printCloseTo;
|
||||
|
||||
const printExpectedConstructorName = (label, expected) =>
|
||||
printConstructorName(label, expected, false, true) + '\n';
|
||||
|
||||
|
||||
3
node_modules/expect/build/spyMatchers.d.ts
generated
vendored
3
node_modules/expect/build/spyMatchers.d.ts
generated
vendored
@@ -4,7 +4,6 @@
|
||||
* 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';
|
||||
import type { 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
1
node_modules/expect/build/spyMatchers.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"spyMatchers.d.ts","sourceRoot":"","sources":["../src/spyMatchers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,OAAO,EAAC,cAAc,EAAsC,MAAM,SAAS,CAAC;AAykC5E,QAAA,MAAM,WAAW,EAAE,cAyBlB,CAAC;AA6CF,eAAe,WAAW,CAAC"}
|
||||
77
node_modules/expect/build/spyMatchers.js
generated
vendored
77
node_modules/expect/build/spyMatchers.js
generated
vendored
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _jestGetType = _interopRequireWildcard(require('jest-get-type'));
|
||||
var _jestGetType = _interopRequireDefault(require('jest-get-type'));
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
@@ -13,29 +13,8 @@ var _jasmineUtils = require('./jasmineUtils');
|
||||
|
||||
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;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,12 +160,7 @@ const printExpectedReceivedCallsPositive = (
|
||||
difference.includes('+ Received')
|
||||
) {
|
||||
// Omit annotation in case multiple args have diff.
|
||||
lines.push(
|
||||
difference
|
||||
.split('\n')
|
||||
.slice(3)
|
||||
.join('\n') + ','
|
||||
);
|
||||
lines.push(difference.split('\n').slice(3).join('\n') + ',');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -255,6 +229,7 @@ const printDiffCall = (expected, received, expand) =>
|
||||
difference.includes('+ Received')
|
||||
) {
|
||||
// Display diff with indentation.
|
||||
// Omit annotation in case multiple args have diff.
|
||||
return (
|
||||
difference
|
||||
.split('\n')
|
||||
@@ -292,7 +267,7 @@ const isLineDiffableArg = (expected, received) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((0, _jestGetType.isPrimitive)(expected)) {
|
||||
if (_jestGetType.default.isPrimitive(expected)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -367,7 +342,7 @@ const printReceivedResults = (
|
||||
};
|
||||
|
||||
const createToBeCalledMatcher = matcherName =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const expectedArgument = '';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
@@ -429,7 +404,7 @@ const createToBeCalledMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createToReturnMatcher = matcherName =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const expectedArgument = '';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
@@ -499,13 +474,13 @@ const createToReturnMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createToBeCalledTimesMatcher = matcherName =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const expectedArgument = 'expected';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
(0, _jestMatcherUtils.ensureExpectedIsNumber)(
|
||||
(0, _jestMatcherUtils.ensureExpectedIsNonNegativeInteger)(
|
||||
expected,
|
||||
matcherName,
|
||||
options
|
||||
@@ -550,13 +525,13 @@ const createToBeCalledTimesMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createToReturnTimesMatcher = matcherName =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const expectedArgument = 'expected';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
(0, _jestMatcherUtils.ensureExpectedIsNumber)(
|
||||
(0, _jestMatcherUtils.ensureExpectedIsNonNegativeInteger)(
|
||||
expected,
|
||||
matcherName,
|
||||
options
|
||||
@@ -609,7 +584,7 @@ const createToReturnTimesMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createToBeCalledWithMatcher = matcherName =>
|
||||
function(received, ...expected) {
|
||||
function (received, ...expected) {
|
||||
const expectedArgument = '...expected';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
@@ -695,7 +670,7 @@ const createToBeCalledWithMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createToReturnWithMatcher = matcherName =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const expectedArgument = 'expected';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
@@ -703,9 +678,7 @@ const createToReturnWithMatcher = matcherName =>
|
||||
};
|
||||
ensureMock(received, matcherName, expectedArgument, options);
|
||||
const receivedName = received.getMockName();
|
||||
const _received$mock = received.mock,
|
||||
calls = _received$mock.calls,
|
||||
results = _received$mock.results;
|
||||
const {calls, results} = received.mock;
|
||||
const pass = results.some(result => isEqualReturn(expected, result));
|
||||
const message = pass
|
||||
? () => {
|
||||
@@ -781,7 +754,7 @@ const createToReturnWithMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createLastCalledWithMatcher = matcherName =>
|
||||
function(received, ...expected) {
|
||||
function (received, ...expected) {
|
||||
const expectedArgument = '...expected';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
@@ -877,7 +850,7 @@ const createLastCalledWithMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createLastReturnedMatcher = matcherName =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const expectedArgument = 'expected';
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
@@ -885,9 +858,7 @@ const createLastReturnedMatcher = matcherName =>
|
||||
};
|
||||
ensureMock(received, matcherName, expectedArgument, options);
|
||||
const receivedName = received.getMockName();
|
||||
const _received$mock2 = received.mock,
|
||||
calls = _received$mock2.calls,
|
||||
results = _received$mock2.results;
|
||||
const {calls, results} = received.mock;
|
||||
const iLast = results.length - 1;
|
||||
const pass = iLast >= 0 && isEqualReturn(expected, results[iLast]);
|
||||
const message = pass
|
||||
@@ -973,7 +944,7 @@ const createLastReturnedMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createNthCalledWithMatcher = matcherName =>
|
||||
function(received, nth, ...expected) {
|
||||
function (received, nth, ...expected) {
|
||||
const expectedArgument = 'n';
|
||||
const options = {
|
||||
expectedColor: arg => arg,
|
||||
@@ -1013,6 +984,7 @@ const createNthCalledWithMatcher = matcherName =>
|
||||
const message = pass
|
||||
? () => {
|
||||
// Display preceding and following calls,
|
||||
// in case assertions fails because index is off by one.
|
||||
const indexedCalls = [];
|
||||
|
||||
if (iNth - 1 >= 0) {
|
||||
@@ -1054,6 +1026,7 @@ const createNthCalledWithMatcher = matcherName =>
|
||||
// Display preceding and following calls:
|
||||
// * nearest call that is equal to expected args
|
||||
// * otherwise, adjacent call
|
||||
// in case assertions fails because of index, especially off by one.
|
||||
const indexedCalls = [];
|
||||
|
||||
if (iNth < length) {
|
||||
@@ -1129,7 +1102,7 @@ const createNthCalledWithMatcher = matcherName =>
|
||||
};
|
||||
|
||||
const createNthReturnedWithMatcher = matcherName =>
|
||||
function(received, nth, expected) {
|
||||
function (received, nth, expected) {
|
||||
const expectedArgument = 'n';
|
||||
const options = {
|
||||
expectedColor: arg => arg,
|
||||
@@ -1159,15 +1132,14 @@ const createNthReturnedWithMatcher = matcherName =>
|
||||
}
|
||||
|
||||
const receivedName = received.getMockName();
|
||||
const _received$mock3 = received.mock,
|
||||
calls = _received$mock3.calls,
|
||||
results = _received$mock3.results;
|
||||
const {calls, results} = received.mock;
|
||||
const length = results.length;
|
||||
const iNth = nth - 1;
|
||||
const pass = iNth < length && isEqualReturn(expected, results[iNth]);
|
||||
const message = pass
|
||||
? () => {
|
||||
// Display preceding and following results,
|
||||
// in case assertions fails because index is off by one.
|
||||
const indexedResults = [];
|
||||
|
||||
if (iNth - 1 >= 0) {
|
||||
@@ -1211,6 +1183,7 @@ const createNthReturnedWithMatcher = matcherName =>
|
||||
// Display preceding and following results:
|
||||
// * nearest result that is equal to expected value
|
||||
// * otherwise, adjacent result
|
||||
// in case assertions fails because of index, especially off by one.
|
||||
const indexedResults = [];
|
||||
|
||||
if (iNth < length) {
|
||||
|
||||
3
node_modules/expect/build/toThrowMatchers.d.ts
generated
vendored
3
node_modules/expect/build/toThrowMatchers.d.ts
generated
vendored
@@ -5,8 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
import { MatchersObject, RawMatcherFn } from './types';
|
||||
import type { 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
1
node_modules/expect/build/toThrowMatchers.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"toThrowMatchers.d.ts","sourceRoot":"","sources":["../src/toThrowMatchers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsBH,OAAO,EACL,cAAc,EAEd,YAAY,EAEb,MAAM,SAAS,CAAC;AAwCjB,eAAO,MAAM,aAAa,0EA6DvB,CAAC;AAEJ,QAAA,MAAM,QAAQ,EAAE,cAGf,CAAC;AAsSF,eAAe,QAAQ,CAAC"}
|
||||
8
node_modules/expect/build/toThrowMatchers.js
generated
vendored
8
node_modules/expect/build/toThrowMatchers.js
generated
vendored
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = exports.createMatcher = void 0;
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _print = require('./print');
|
||||
|
||||
var _utils = require('./utils');
|
||||
@@ -20,6 +20,8 @@ var _utils = require('./utils');
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
const DID_NOT_THROW = 'Received function did not throw';
|
||||
|
||||
const getThrown = e => {
|
||||
@@ -44,7 +46,7 @@ const getThrown = e => {
|
||||
};
|
||||
|
||||
const createMatcher = (matcherName, fromPromise) =>
|
||||
function(received, expected) {
|
||||
function (received, expected) {
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
|
||||
30
node_modules/expect/build/types.d.ts
generated
vendored
30
node_modules/expect/build/types.d.ts
generated
vendored
@@ -5,8 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import * as jestMatcherUtils from 'jest-matcher-utils';
|
||||
import type { Config } from '@jest/types';
|
||||
import type * as jestMatcherUtils from 'jest-matcher-utils';
|
||||
import { INTERNAL_MATCHER_FLAG } from './jestMatchersObject';
|
||||
export declare type SyncExpectationResult = {
|
||||
pass: boolean;
|
||||
@@ -28,8 +28,10 @@ export declare type MatcherState = {
|
||||
error?: Error;
|
||||
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
||||
expand?: boolean;
|
||||
expectedAssertionsNumber?: number;
|
||||
expectedAssertionsNumber?: number | null;
|
||||
expectedAssertionsNumberError?: Error;
|
||||
isExpectingAssertions?: boolean;
|
||||
isExpectingAssertionsError?: Error;
|
||||
isNot: boolean;
|
||||
promise: string;
|
||||
suppressedErrors: Array<Error>;
|
||||
@@ -43,19 +45,20 @@ export declare type AsymmetricMatcher = Record<string, any>;
|
||||
export declare type MatchersObject = {
|
||||
[id: string]: RawMatcherFn;
|
||||
};
|
||||
export declare type ExpectedAssertionsErrors = Array<{
|
||||
actual: string | number;
|
||||
error: Error;
|
||||
expected: string;
|
||||
}>;
|
||||
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;
|
||||
}>;
|
||||
extractExpectedAssertionsErrors: () => ExpectedAssertionsErrors;
|
||||
getState(): MatcherState;
|
||||
hasAssertions(): void;
|
||||
setState(arg0: any): void;
|
||||
setState(state: Partial<MatcherState>): void;
|
||||
any(expectedObject: any): AsymmetricMatcher;
|
||||
anything(): AsymmetricMatcher;
|
||||
arrayContaining(sample: Array<unknown>): AsymmetricMatcher;
|
||||
@@ -136,11 +139,11 @@ export interface Matchers<R> {
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeGreaterThan(expected: number): R;
|
||||
toBeGreaterThan(expected: number | bigint): R;
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeGreaterThanOrEqual(expected: number): R;
|
||||
toBeGreaterThanOrEqual(expected: number | bigint): R;
|
||||
/**
|
||||
* Ensure that an object is an instance of a class.
|
||||
* This matcher uses `instanceof` underneath.
|
||||
@@ -149,11 +152,11 @@ export interface Matchers<R> {
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeLessThan(expected: number): R;
|
||||
toBeLessThan(expected: number | bigint): R;
|
||||
/**
|
||||
* For comparing floating point numbers.
|
||||
*/
|
||||
toBeLessThanOrEqual(expected: number): R;
|
||||
toBeLessThanOrEqual(expected: number | bigint): R;
|
||||
/**
|
||||
* This is the same as `.toBe(null)` but the error messages are a bit nicer.
|
||||
* So use `.toBeNull()` when you want to check that something is null.
|
||||
@@ -323,4 +326,3 @@ export interface Matchers<R> {
|
||||
toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/expect/build/types.d.ts.map
generated
vendored
1
node_modules/expect/build/types.d.ts.map
generated
vendored
File diff suppressed because one or more lines are too long
16
node_modules/expect/build/utils.d.ts
generated
vendored
16
node_modules/expect/build/utils.d.ts
generated
vendored
@@ -11,16 +11,14 @@ declare type GetPath = {
|
||||
traversedPath: Array<string>;
|
||||
value?: unknown;
|
||||
};
|
||||
export declare const hasOwnProperty: (object: object, key: string) => boolean;
|
||||
export declare const getPath: (object: Record<string, any>, propertyPath: string | string[]) => GetPath;
|
||||
export declare const getPath: (object: Record<string, any>, propertyPath: string | Array<string>) => GetPath;
|
||||
export declare const getObjectSubset: (object: any, subset: any, seenReferences?: WeakMap<object, boolean>) => any;
|
||||
export declare const iterableEquality: (a: any, b: any, aStack?: 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 iterableEquality: (a: any, b: any, aStack?: Array<any>, bStack?: Array<any>) => boolean | undefined;
|
||||
export declare const subsetEquality: (object: unknown, subset: unknown) => boolean | undefined;
|
||||
export declare const typeEquality: (a: any, b: any) => boolean | undefined;
|
||||
export declare const sparseArrayEquality: (a: unknown, b: unknown) => boolean | undefined;
|
||||
export declare const partition: <T>(items: T[], predicate: (arg: T) => boolean) => [T[], T[]];
|
||||
export declare const isError: (value: unknown) => boolean;
|
||||
export declare function emptyObject(obj: any): boolean;
|
||||
export declare const isOneline: (expected: any, received: any) => boolean;
|
||||
export declare const isError: (value: unknown) => value is Error;
|
||||
export declare function emptyObject(obj: unknown): boolean;
|
||||
export declare const isOneline: (expected: unknown, received: unknown) => boolean;
|
||||
export {};
|
||||
//# sourceMappingURL=utils.d.ts.map
|
||||
1
node_modules/expect/build/utils.d.ts.map
generated
vendored
1
node_modules/expect/build/utils.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"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,2EAoDnB,CAAC;AAIF,eAAO,MAAM,eAAe,8EA8B3B,CAAC;AAOF,eAAO,MAAM,gBAAgB,yEAqH5B,CAAC;AAUF,eAAO,MAAM,cAAc,mDAkC1B,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"}
|
||||
292
node_modules/expect/build/utils.js
generated
vendored
292
node_modules/expect/build/utils.js
generated
vendored
@@ -4,7 +4,7 @@ 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;
|
||||
exports.isOneline = exports.isError = exports.partition = exports.sparseArrayEquality = exports.typeEquality = exports.subsetEquality = exports.iterableEquality = exports.getObjectSubset = exports.getPath = void 0;
|
||||
|
||||
var _jestGetType = require('jest-get-type');
|
||||
|
||||
@@ -12,37 +12,23 @@ 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;
|
||||
/**
|
||||
* Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`.
|
||||
*/
|
||||
const hasPropertyInObject = (object, key) => {
|
||||
const shouldTerminate =
|
||||
!object || typeof object !== 'object' || object === Object.prototype;
|
||||
|
||||
if (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 don’t have any getters.
|
||||
if (shouldTerminate) {
|
||||
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 (
|
||||
Object.prototype.hasOwnProperty.call(object, key) ||
|
||||
hasPropertyInObject(Object.getPrototypeOf(object), 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('.');
|
||||
@@ -96,20 +82,34 @@ const getPath = (object, propertyPath) => {
|
||||
}; // Strip properties from object that are not present in the subset. Useful for
|
||||
// printing the diff for toMatchObject() without adding unrelated noise.
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
exports.getPath = getPath;
|
||||
|
||||
const getObjectSubset = (object, subset, seenReferences = new WeakMap()) => {
|
||||
/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
|
||||
if (Array.isArray(object)) {
|
||||
if (Array.isArray(subset) && subset.length === object.length) {
|
||||
// The map method returns correct subclass of subset.
|
||||
return subset.map((sub, i) => getObjectSubset(object[i], sub));
|
||||
}
|
||||
} else if (object instanceof Date) {
|
||||
return object;
|
||||
} else if (isObject(object) && isObject(subset)) {
|
||||
if (
|
||||
(0, _jasmineUtils.equals)(object, subset, [
|
||||
iterableEquality,
|
||||
subsetEquality
|
||||
])
|
||||
) {
|
||||
// Avoid unnecessary copy which might return Object instead of subclass.
|
||||
return subset;
|
||||
}
|
||||
|
||||
const trimmed = {};
|
||||
seenReferences.set(object, trimmed);
|
||||
Object.keys(object)
|
||||
.filter(key => hasOwnProperty(subset, key))
|
||||
.filter(key => hasPropertyInObject(subset, key))
|
||||
.forEach(key => {
|
||||
trimmed[key] = seenReferences.has(object[key])
|
||||
? seenReferences.get(object[key])
|
||||
@@ -128,8 +128,15 @@ exports.getObjectSubset = getObjectSubset;
|
||||
const IteratorSymbol = Symbol.iterator;
|
||||
|
||||
const hasIterator = object => !!(object != null && object[IteratorSymbol]);
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
const iterableEquality = (a, b, aStack = [], bStack = []) => {
|
||||
const iterableEquality = (
|
||||
a,
|
||||
b,
|
||||
/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
|
||||
aStack = [],
|
||||
bStack = []
|
||||
) => {
|
||||
if (
|
||||
typeof a !== 'object' ||
|
||||
typeof b !== 'object' ||
|
||||
@@ -171,75 +178,27 @@ const iterableEquality = (a, b, aStack = [], bStack = []) => {
|
||||
(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;
|
||||
for (const aValue of a) {
|
||||
if (!b.has(aValue)) {
|
||||
let has = false;
|
||||
|
||||
if (!b.has(aValue)) {
|
||||
let has = false;
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
for (const bValue of b) {
|
||||
const isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [
|
||||
iterableEqualityWithStack
|
||||
]);
|
||||
|
||||
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;
|
||||
if (isEqual === true) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
} // 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;
|
||||
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Remove the first value from the stack of traversed values.
|
||||
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
@@ -249,91 +208,39 @@ const iterableEquality = (a, b, aStack = [], bStack = []) => {
|
||||
(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
|
||||
for (const aEntry of a) {
|
||||
if (
|
||||
!b.has(aEntry[0]) ||
|
||||
!(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [
|
||||
iterableEqualityWithStack
|
||||
])
|
||||
) {
|
||||
const aEntry = _step3.value;
|
||||
let has = false;
|
||||
|
||||
if (
|
||||
!b.has(aEntry[0]) ||
|
||||
!(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [
|
||||
for (const bEntry of b) {
|
||||
const matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], [
|
||||
iterableEqualityWithStack
|
||||
])
|
||||
) {
|
||||
let has = false;
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
]);
|
||||
let matchedValue = false;
|
||||
|
||||
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 (matchedKey === true) {
|
||||
matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], [
|
||||
iterableEqualityWithStack
|
||||
]);
|
||||
}
|
||||
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
if (matchedValue === true) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
} // 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;
|
||||
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Remove the first value from the stack of traversed values.
|
||||
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
@@ -342,40 +249,17 @@ const iterableEquality = (a, b, aStack = [], bStack = []) => {
|
||||
}
|
||||
|
||||
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
|
||||
for (const aValue of a) {
|
||||
const nextB = bIterator.next();
|
||||
|
||||
if (
|
||||
nextB.done ||
|
||||
!(0, _jasmineUtils.equals)(aValue, nextB.value, [
|
||||
iterableEqualityWithStack
|
||||
])
|
||||
) {
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +296,7 @@ const subsetEquality = (object, subset) => {
|
||||
|
||||
return Object.keys(subset).every(key => {
|
||||
if (isObjectWithKeys(subset[key])) {
|
||||
if (seenReferences.get(subset[key])) {
|
||||
if (seenReferences.has(subset[key])) {
|
||||
return (0, _jasmineUtils.equals)(object[key], subset[key], [
|
||||
iterableEquality
|
||||
]);
|
||||
@@ -421,19 +305,25 @@ const subsetEquality = (object, subset) => {
|
||||
seenReferences.set(subset[key], true);
|
||||
}
|
||||
|
||||
return (
|
||||
const result =
|
||||
object != null &&
|
||||
hasOwnProperty(object, key) &&
|
||||
hasPropertyInObject(object, key) &&
|
||||
(0, _jasmineUtils.equals)(object[key], subset[key], [
|
||||
iterableEquality,
|
||||
subsetEqualityWithContext(seenReferences)
|
||||
])
|
||||
);
|
||||
]); // The main goal of using seenReference is to avoid circular node on tree.
|
||||
// It will only happen within a parent and its child, not a node and nodes next to it (same level)
|
||||
// We should keep the reference for a parent and its child only
|
||||
// Thus we should delete the reference immediately so that it doesn't interfere
|
||||
// other nodes within the same level on tree.
|
||||
|
||||
seenReferences.delete(subset[key]);
|
||||
return result;
|
||||
});
|
||||
};
|
||||
|
||||
return subsetEqualityWithContext()(object, subset);
|
||||
};
|
||||
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
exports.subsetEquality = subsetEquality;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user