This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

View File

@@ -51,7 +51,10 @@ function _interopRequireWildcard(obj) {
const EXPECTED_LABEL = 'Expected';
const RECEIVED_LABEL = 'Received';
const EXPECTED_VALUE_LABEL = 'Expected value';
const RECEIVED_VALUE_LABEL = 'Received value';
const RECEIVED_VALUE_LABEL = 'Received value'; // The optional property of matcher context is true if undefined.
const isExpand = expand => expand !== false;
const toStrictEqualTesters = [
_utils.iterableEquality,
_utils.typeEquality,
@@ -114,12 +117,12 @@ const matchers = {
`If it should pass with deep equality, replace "${matcherName}" with "${deepEqualityName}"`
) + '\n\n'
: '') +
(0, _print.printDiffOrStringify)(
(0, _jestMatcherUtils.printDiffOrStringify)(
expected,
received,
EXPECTED_LABEL,
RECEIVED_LABEL,
this.expand
isExpand(this.expand)
)
);
}; // Passing the actual and expected objects so that a custom reporter
@@ -141,7 +144,8 @@ const matchers = {
const options = {
isNot: this.isNot,
promise: this.promise,
secondArgument
secondArgument,
secondArgumentColor: arg => arg
};
(0, _jestMatcherUtils.ensureNumbers)(
received,
@@ -179,8 +183,9 @@ const matchers = {
received
)}\n` +
'\n' +
`Expected precision: ${(0,
_jestMatcherUtils.printExpected)(precision)}\n` +
`Expected precision: ${(0, _jestMatcherUtils.stringify)(
precision
)}\n` +
`Expected difference: not < ${(0,
_jestMatcherUtils.printExpected)(expectedDiff)}\n` +
`Received difference: ${(0,
@@ -196,7 +201,7 @@ const matchers = {
`Expected: ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
`Received: ${(0, _jestMatcherUtils.printReceived)(received)}\n` +
'\n' +
`Expected precision: ${(0, _jestMatcherUtils.printExpected)(
`Expected precision: ${(0, _jestMatcherUtils.stringify)(
precision
)}\n` +
`Expected difference: < ${(0, _jestMatcherUtils.printExpected)(
@@ -761,12 +766,12 @@ const matchers = {
options
) +
'\n\n' +
(0, _print.printDiffOrStringify)(
(0, _jestMatcherUtils.printDiffOrStringify)(
expected,
received,
EXPECTED_LABEL,
RECEIVED_LABEL,
this.expand
isExpand(this.expand)
); // Passing the actual and expected objects so that a custom reporter
// could access them, for example in order to display a custom visual diff,
// or create a different error message
@@ -1025,12 +1030,12 @@ const matchers = {
)}\n` +
(hasCompletePath
? '\n' +
(0, _print.printDiffOrStringify)(
(0, _jestMatcherUtils.printDiffOrStringify)(
expectedValue,
receivedValue,
EXPECTED_VALUE_LABEL,
RECEIVED_VALUE_LABEL,
this.expand
isExpand(this.expand)
)
: `Received path: ${(0, _jestMatcherUtils.printReceived)(
expectedPathType === 'array' || receivedPath.length === 0
@@ -1251,12 +1256,12 @@ const matchers = {
options
) +
'\n\n' +
(0, _print.printDiffOrStringify)(
(0, _jestMatcherUtils.printDiffOrStringify)(
expected,
(0, _utils.getObjectSubset)(received, expected),
EXPECTED_LABEL,
RECEIVED_LABEL,
this.expand
isExpand(this.expand)
);
return {
message,
@@ -1299,12 +1304,12 @@ const matchers = {
options
) +
'\n\n' +
(0, _print.printDiffOrStringify)(
(0, _jestMatcherUtils.printDiffOrStringify)(
expected,
received,
EXPECTED_LABEL,
RECEIVED_LABEL,
this.expand
isExpand(this.expand)
); // Passing the actual and expected objects so that a custom reporter
// could access them, for example in order to display a custom visual diff,
// or create a different error message