@casual-simulation/expect 2.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/index.d.ts +6 -0
- package/index.js +5 -0
- package/index.js.map +1 -0
- package/package.json +35 -0
- package/src/asymmetricMatchers.d.ts +67 -0
- package/src/asymmetricMatchers.js +188 -0
- package/src/asymmetricMatchers.js.map +1 -0
- package/src/diff/cleanupSemantic.d.ts +58 -0
- package/src/diff/cleanupSemantic.js +526 -0
- package/src/diff/cleanupSemantic.js.map +1 -0
- package/src/diff/constants.d.ts +9 -0
- package/src/diff/constants.js +10 -0
- package/src/diff/constants.js.map +1 -0
- package/src/diff/diffLines.d.ts +13 -0
- package/src/diff/diffLines.js +138 -0
- package/src/diff/diffLines.js.map +1 -0
- package/src/diff/diffStrings.d.ts +10 -0
- package/src/diff/diffStrings.js +36 -0
- package/src/diff/diffStrings.js.map +1 -0
- package/src/diff/getAlignedDiffs.d.ts +11 -0
- package/src/diff/getAlignedDiffs.js +187 -0
- package/src/diff/getAlignedDiffs.js.map +1 -0
- package/src/diff/index.d.ts +16 -0
- package/src/diff/index.js +139 -0
- package/src/diff/index.js.map +1 -0
- package/src/diff/joinAlignedDiffs.d.ts +11 -0
- package/src/diff/joinAlignedDiffs.js +191 -0
- package/src/diff/joinAlignedDiffs.js.map +1 -0
- package/src/diff/normalizeDiffOptions.d.ts +10 -0
- package/src/diff/normalizeDiffOptions.js +40 -0
- package/src/diff/normalizeDiffOptions.js.map +1 -0
- package/src/diff/printDiffs.d.ts +11 -0
- package/src/diff/printDiffs.js +46 -0
- package/src/diff/printDiffs.js.map +1 -0
- package/src/diff/types.d.ts +49 -0
- package/src/diff/types.js +2 -0
- package/src/diff/types.js.map +1 -0
- package/src/diff-sequences/index.d.ts +19 -0
- package/src/diff-sequences/index.js +506 -0
- package/src/diff-sequences/index.js.map +1 -0
- package/src/extractExpectedAssertionsErrors.d.ts +11 -0
- package/src/extractExpectedAssertionsErrors.js +58 -0
- package/src/extractExpectedAssertionsErrors.js.map +1 -0
- package/src/get-type/index.d.ts +11 -0
- package/src/get-type/index.js +57 -0
- package/src/get-type/index.js.map +1 -0
- package/src/index.d.ts +16 -0
- package/src/index.js +247 -0
- package/src/index.js.map +1 -0
- package/src/jasmineUtils.d.ts +9 -0
- package/src/jasmineUtils.js +218 -0
- package/src/jasmineUtils.js.map +1 -0
- package/src/jestMatchersObject.d.ts +14 -0
- package/src/jestMatchersObject.js +78 -0
- package/src/jestMatchersObject.js.map +1 -0
- package/src/matcher-utils/Replaceable.d.ts +18 -0
- package/src/matcher-utils/Replaceable.js +57 -0
- package/src/matcher-utils/Replaceable.js.map +1 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.d.ts +8 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.js +96 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.js.map +1 -0
- package/src/matcher-utils/index.d.ts +53 -0
- package/src/matcher-utils/index.js +341 -0
- package/src/matcher-utils/index.js.map +1 -0
- package/src/matchers.d.ts +11 -0
- package/src/matchers.js +575 -0
- package/src/matchers.js.map +1 -0
- package/src/message-util/index.d.ts +11 -0
- package/src/message-util/index.js +34 -0
- package/src/message-util/index.js.map +1 -0
- package/src/pretty-format/collections.d.ts +33 -0
- package/src/pretty-format/collections.js +130 -0
- package/src/pretty-format/collections.js.map +1 -0
- package/src/pretty-format/index.d.ts +25 -0
- package/src/pretty-format/index.js +390 -0
- package/src/pretty-format/index.js.map +1 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.d.ts +12 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.js +53 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.js.map +1 -0
- package/src/pretty-format/plugins/ConvertAnsi.d.ts +12 -0
- package/src/pretty-format/plugins/ConvertAnsi.js +58 -0
- package/src/pretty-format/plugins/ConvertAnsi.js.map +1 -0
- package/src/pretty-format/plugins/DOMCollection.d.ts +12 -0
- package/src/pretty-format/plugins/DOMCollection.js +39 -0
- package/src/pretty-format/plugins/DOMCollection.js.map +1 -0
- package/src/pretty-format/plugins/DOMElement.d.ts +12 -0
- package/src/pretty-format/plugins/DOMElement.js +68 -0
- package/src/pretty-format/plugins/DOMElement.js.map +1 -0
- package/src/pretty-format/plugins/Immutable.d.ts +12 -0
- package/src/pretty-format/plugins/Immutable.js +113 -0
- package/src/pretty-format/plugins/Immutable.js.map +1 -0
- package/src/pretty-format/plugins/ReactTestComponent.d.ts +19 -0
- package/src/pretty-format/plugins/ReactTestComponent.js +29 -0
- package/src/pretty-format/plugins/ReactTestComponent.js.map +1 -0
- package/src/pretty-format/plugins/lib/escapeHTML.d.ts +8 -0
- package/src/pretty-format/plugins/lib/escapeHTML.js +10 -0
- package/src/pretty-format/plugins/lib/escapeHTML.js.map +1 -0
- package/src/pretty-format/plugins/lib/markup.d.ts +14 -0
- package/src/pretty-format/plugins/lib/markup.js +98 -0
- package/src/pretty-format/plugins/lib/markup.js.map +1 -0
- package/src/pretty-format/types.d.ts +109 -0
- package/src/pretty-format/types.js +8 -0
- package/src/pretty-format/types.js.map +1 -0
- package/src/print.d.ts +16 -0
- package/src/print.js +71 -0
- package/src/print.js.map +1 -0
- package/src/spyMatchers.d.ts +10 -0
- package/src/spyMatchers.js +766 -0
- package/src/spyMatchers.js.map +1 -0
- package/src/test-utils/ConditionalTest.d.ts +10 -0
- package/src/test-utils/ConditionalTest.js +25 -0
- package/src/test-utils/ConditionalTest.js.map +1 -0
- package/src/test-utils/alignedAnsiStyleSerializer.d.ts +9 -0
- package/src/test-utils/alignedAnsiStyleSerializer.js +46 -0
- package/src/test-utils/alignedAnsiStyleSerializer.js.map +1 -0
- package/src/test-utils/config.d.ts +10 -0
- package/src/test-utils/config.js +143 -0
- package/src/test-utils/config.js.map +1 -0
- package/src/test-utils/index.d.ts +10 -0
- package/src/test-utils/index.js +10 -0
- package/src/test-utils/index.js.map +1 -0
- package/src/toThrowMatchers.d.ts +12 -0
- package/src/toThrowMatchers.js +258 -0
- package/src/toThrowMatchers.js.map +1 -0
- package/src/types.d.ts +327 -0
- package/src/types.js +9 -0
- package/src/types.js.map +1 -0
- package/src/utils.d.ts +26 -0
- package/src/utils.js +303 -0
- package/src/utils.js.map +1 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable local/ban-types-eventually */
|
|
8
|
+
import chalk from '@casual-simulation/chalk';
|
|
9
|
+
import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, diff as diffDefault, diffStringsRaw, diffStringsUnified, } from '../diff';
|
|
10
|
+
import { getType, isPrimitive } from '../get-type';
|
|
11
|
+
import { format as prettyFormat, plugins as prettyFormatPlugins, } from '../pretty-format';
|
|
12
|
+
import Replaceable from './Replaceable';
|
|
13
|
+
import deepCyclicCopyReplaceable from './deepCyclicCopyReplaceable';
|
|
14
|
+
const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactTestComponent, } = prettyFormatPlugins;
|
|
15
|
+
const PLUGINS = [
|
|
16
|
+
ReactTestComponent,
|
|
17
|
+
DOMElement,
|
|
18
|
+
DOMCollection,
|
|
19
|
+
Immutable,
|
|
20
|
+
AsymmetricMatcher,
|
|
21
|
+
];
|
|
22
|
+
export const EXPECTED_COLOR = chalk.green;
|
|
23
|
+
export const RECEIVED_COLOR = chalk.red;
|
|
24
|
+
export const INVERTED_COLOR = chalk.inverse;
|
|
25
|
+
export const BOLD_WEIGHT = chalk.bold;
|
|
26
|
+
export const DIM_COLOR = chalk.dim;
|
|
27
|
+
const MULTILINE_REGEXP = /\n/;
|
|
28
|
+
const SPACE_SYMBOL = '\u{00B7}'; // middle dot
|
|
29
|
+
const NUMBERS = [
|
|
30
|
+
'zero',
|
|
31
|
+
'one',
|
|
32
|
+
'two',
|
|
33
|
+
'three',
|
|
34
|
+
'four',
|
|
35
|
+
'five',
|
|
36
|
+
'six',
|
|
37
|
+
'seven',
|
|
38
|
+
'eight',
|
|
39
|
+
'nine',
|
|
40
|
+
'ten',
|
|
41
|
+
'eleven',
|
|
42
|
+
'twelve',
|
|
43
|
+
'thirteen',
|
|
44
|
+
];
|
|
45
|
+
export const SUGGEST_TO_CONTAIN_EQUAL = chalk.dim('Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.');
|
|
46
|
+
export const stringify = (object, maxDepth = 10) => {
|
|
47
|
+
const MAX_LENGTH = 10000;
|
|
48
|
+
let result;
|
|
49
|
+
try {
|
|
50
|
+
result = prettyFormat(object, {
|
|
51
|
+
maxDepth,
|
|
52
|
+
min: true,
|
|
53
|
+
plugins: PLUGINS,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (_a) {
|
|
57
|
+
result = prettyFormat(object, {
|
|
58
|
+
callToJSON: false,
|
|
59
|
+
maxDepth,
|
|
60
|
+
min: true,
|
|
61
|
+
plugins: PLUGINS,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return result.length >= MAX_LENGTH && maxDepth > 1
|
|
65
|
+
? stringify(object, Math.floor(maxDepth / 2))
|
|
66
|
+
: result;
|
|
67
|
+
};
|
|
68
|
+
export const highlightTrailingWhitespace = (text) => text.replace(/\s+$/gm, chalk.inverse('$&'));
|
|
69
|
+
// Instead of inverse highlight which now implies a change,
|
|
70
|
+
// replace common spaces with middle dot at the end of any line.
|
|
71
|
+
const replaceTrailingSpaces = (text) => text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
|
|
72
|
+
export const printReceived = (object) => RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
|
|
73
|
+
export const printExpected = (value) => EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
|
|
74
|
+
export const printWithType = (name, // 'Expected' or 'Received'
|
|
75
|
+
value, print // printExpected or printReceived
|
|
76
|
+
) => {
|
|
77
|
+
const type = getType(value);
|
|
78
|
+
const hasType = type !== 'null' && type !== 'undefined'
|
|
79
|
+
? `${name} has type: ${type}\n`
|
|
80
|
+
: '';
|
|
81
|
+
const hasValue = `${name} has value: ${print(value)}`;
|
|
82
|
+
return hasType + hasValue;
|
|
83
|
+
};
|
|
84
|
+
export const ensureNoExpected = (expected, matcherName, options) => {
|
|
85
|
+
if (typeof expected !== 'undefined') {
|
|
86
|
+
// Prepend maybe not only for backward compatibility.
|
|
87
|
+
const matcherString = (options ? '' : '[.not]') + matcherName;
|
|
88
|
+
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, '', options),
|
|
89
|
+
// Because expected is omitted in hint above,
|
|
90
|
+
// expected is black instead of green in message below.
|
|
91
|
+
'this matcher must not have an expected argument', printWithType('Expected', expected, printExpected)));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Ensures that `actual` is of type `number | bigint`
|
|
96
|
+
*/
|
|
97
|
+
export const ensureActualIsNumber = (actual, matcherName, options) => {
|
|
98
|
+
if (typeof actual !== 'number' && typeof actual !== 'bigint') {
|
|
99
|
+
// Prepend maybe not only for backward compatibility.
|
|
100
|
+
const matcherString = (options ? '' : '[.not]') + matcherName;
|
|
101
|
+
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), `${RECEIVED_COLOR('received')} value must be a number or bigint`, printWithType('Received', actual, printReceived)));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Ensures that `expected` is of type `number | bigint`
|
|
106
|
+
*/
|
|
107
|
+
export const ensureExpectedIsNumber = (expected, matcherName, options) => {
|
|
108
|
+
if (typeof expected !== 'number' && typeof expected !== 'bigint') {
|
|
109
|
+
// Prepend maybe not only for backward compatibility.
|
|
110
|
+
const matcherString = (options ? '' : '[.not]') + matcherName;
|
|
111
|
+
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), `${EXPECTED_COLOR('expected')} value must be a number or bigint`, printWithType('Expected', expected, printExpected)));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Ensures that `actual` & `expected` are of type `number | bigint`
|
|
116
|
+
*/
|
|
117
|
+
export const ensureNumbers = (actual, expected, matcherName, options) => {
|
|
118
|
+
ensureActualIsNumber(actual, matcherName, options);
|
|
119
|
+
ensureExpectedIsNumber(expected, matcherName, options);
|
|
120
|
+
};
|
|
121
|
+
export const ensureExpectedIsNonNegativeInteger = (expected, matcherName, options) => {
|
|
122
|
+
if (typeof expected !== 'number' ||
|
|
123
|
+
!Number.isSafeInteger(expected) ||
|
|
124
|
+
expected < 0) {
|
|
125
|
+
// Prepend maybe not only for backward compatibility.
|
|
126
|
+
const matcherString = (options ? '' : '[.not]') + matcherName;
|
|
127
|
+
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), `${EXPECTED_COLOR('expected')} value must be a non-negative integer`, printWithType('Expected', expected, printExpected)));
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
// Given array of diffs, return concatenated string:
|
|
131
|
+
// * include common substrings
|
|
132
|
+
// * exclude change substrings which have opposite op
|
|
133
|
+
// * include change substrings which have argument op
|
|
134
|
+
// with inverse highlight only if there is a common substring
|
|
135
|
+
const getCommonAndChangedSubstrings = (diffs, op, hasCommonDiff) => diffs.reduce((reduced, diff) => reduced +
|
|
136
|
+
(diff[0] === DIFF_EQUAL
|
|
137
|
+
? diff[1]
|
|
138
|
+
: diff[0] !== op
|
|
139
|
+
? ''
|
|
140
|
+
: hasCommonDiff
|
|
141
|
+
? INVERTED_COLOR(diff[1])
|
|
142
|
+
: diff[1]), '');
|
|
143
|
+
const isLineDiffable = (expected, received) => {
|
|
144
|
+
const expectedType = getType(expected);
|
|
145
|
+
const receivedType = getType(received);
|
|
146
|
+
if (expectedType !== receivedType) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
if (isPrimitive(expected)) {
|
|
150
|
+
// Print generic line diff for strings only:
|
|
151
|
+
// * if neither string is empty
|
|
152
|
+
// * if either string has more than one line
|
|
153
|
+
return (typeof expected === 'string' &&
|
|
154
|
+
typeof received === 'string' &&
|
|
155
|
+
expected.length !== 0 &&
|
|
156
|
+
received.length !== 0 &&
|
|
157
|
+
(MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received)));
|
|
158
|
+
}
|
|
159
|
+
if (expectedType === 'date' ||
|
|
160
|
+
expectedType === 'function' ||
|
|
161
|
+
expectedType === 'regexp') {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
if (expected instanceof Error && received instanceof Error) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (expectedType === 'object' &&
|
|
168
|
+
typeof expected.asymmetricMatch === 'function') {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
if (receivedType === 'object' &&
|
|
172
|
+
typeof received.asymmetricMatch === 'function') {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
176
|
+
};
|
|
177
|
+
const MAX_DIFF_STRING_LENGTH = 20000;
|
|
178
|
+
export const printDiffOrStringify = (expected, received, expectedLabel, receivedLabel, expand // CLI options: true if `--expand` or false if `--no-expand`
|
|
179
|
+
) => {
|
|
180
|
+
if (typeof expected === 'string' &&
|
|
181
|
+
typeof received === 'string' &&
|
|
182
|
+
expected.length !== 0 &&
|
|
183
|
+
received.length !== 0 &&
|
|
184
|
+
expected.length <= MAX_DIFF_STRING_LENGTH &&
|
|
185
|
+
received.length <= MAX_DIFF_STRING_LENGTH &&
|
|
186
|
+
expected !== received) {
|
|
187
|
+
if (expected.includes('\n') || received.includes('\n')) {
|
|
188
|
+
return diffStringsUnified(expected, received, {
|
|
189
|
+
aAnnotation: expectedLabel,
|
|
190
|
+
bAnnotation: receivedLabel,
|
|
191
|
+
changeLineTrailingSpaceColor: chalk.bgYellow,
|
|
192
|
+
commonLineTrailingSpaceColor: chalk.bgYellow,
|
|
193
|
+
emptyFirstOrLastLinePlaceholder: '↵',
|
|
194
|
+
expand,
|
|
195
|
+
includeChangeCounts: true,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const diffs = diffStringsRaw(expected, received, true);
|
|
199
|
+
const hasCommonDiff = diffs.some((diff) => diff[0] === DIFF_EQUAL);
|
|
200
|
+
const printLabel = getLabelPrinter(expectedLabel, receivedLabel);
|
|
201
|
+
const expectedLine = printLabel(expectedLabel) +
|
|
202
|
+
printExpected(getCommonAndChangedSubstrings(diffs, DIFF_DELETE, hasCommonDiff));
|
|
203
|
+
const receivedLine = printLabel(receivedLabel) +
|
|
204
|
+
printReceived(getCommonAndChangedSubstrings(diffs, DIFF_INSERT, hasCommonDiff));
|
|
205
|
+
return expectedLine + '\n' + receivedLine;
|
|
206
|
+
}
|
|
207
|
+
if (isLineDiffable(expected, received)) {
|
|
208
|
+
const { replacedExpected, replacedReceived } = replaceMatchedToAsymmetricMatcher(deepCyclicCopyReplaceable(expected), deepCyclicCopyReplaceable(received), [], []);
|
|
209
|
+
const difference = diffDefault(replacedExpected, replacedReceived, {
|
|
210
|
+
aAnnotation: expectedLabel,
|
|
211
|
+
bAnnotation: receivedLabel,
|
|
212
|
+
expand,
|
|
213
|
+
includeChangeCounts: true,
|
|
214
|
+
});
|
|
215
|
+
if (typeof difference === 'string' &&
|
|
216
|
+
difference.includes('- ' + expectedLabel) &&
|
|
217
|
+
difference.includes('+ ' + receivedLabel)) {
|
|
218
|
+
return difference;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const printLabel = getLabelPrinter(expectedLabel, receivedLabel);
|
|
222
|
+
const expectedLine = printLabel(expectedLabel) + printExpected(expected);
|
|
223
|
+
const receivedLine = printLabel(receivedLabel) +
|
|
224
|
+
(stringify(expected) === stringify(received)
|
|
225
|
+
? 'serializes to the same string'
|
|
226
|
+
: printReceived(received));
|
|
227
|
+
return expectedLine + '\n' + receivedLine;
|
|
228
|
+
};
|
|
229
|
+
// Sometimes, e.g. when comparing two numbers, the output from jest-diff
|
|
230
|
+
// does not contain more information than the `Expected:` / `Received:` already gives.
|
|
231
|
+
// In those cases, we do not print a diff to make the output shorter and not redundant.
|
|
232
|
+
const shouldPrintDiff = (actual, expected) => {
|
|
233
|
+
if (typeof actual === 'number' && typeof expected === 'number') {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
if (typeof actual === 'bigint' && typeof expected === 'bigint') {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
if (typeof actual === 'boolean' && typeof expected === 'boolean') {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
};
|
|
244
|
+
function replaceMatchedToAsymmetricMatcher(replacedExpected, replacedReceived, expectedCycles, receivedCycles) {
|
|
245
|
+
if (!Replaceable.isReplaceable(replacedExpected, replacedReceived)) {
|
|
246
|
+
return { replacedExpected, replacedReceived };
|
|
247
|
+
}
|
|
248
|
+
if (expectedCycles.includes(replacedExpected) ||
|
|
249
|
+
receivedCycles.includes(replacedReceived)) {
|
|
250
|
+
return { replacedExpected, replacedReceived };
|
|
251
|
+
}
|
|
252
|
+
expectedCycles.push(replacedExpected);
|
|
253
|
+
receivedCycles.push(replacedReceived);
|
|
254
|
+
const expectedReplaceable = new Replaceable(replacedExpected);
|
|
255
|
+
const receivedReplaceable = new Replaceable(replacedReceived);
|
|
256
|
+
expectedReplaceable.forEach((expectedValue, key) => {
|
|
257
|
+
const receivedValue = receivedReplaceable.get(key);
|
|
258
|
+
if (isAsymmetricMatcher(expectedValue)) {
|
|
259
|
+
if (expectedValue.asymmetricMatch(receivedValue)) {
|
|
260
|
+
receivedReplaceable.set(key, expectedValue);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (isAsymmetricMatcher(receivedValue)) {
|
|
264
|
+
if (receivedValue.asymmetricMatch(expectedValue)) {
|
|
265
|
+
expectedReplaceable.set(key, receivedValue);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
else if (Replaceable.isReplaceable(expectedValue, receivedValue)) {
|
|
269
|
+
const replaced = replaceMatchedToAsymmetricMatcher(expectedValue, receivedValue, expectedCycles, receivedCycles);
|
|
270
|
+
expectedReplaceable.set(key, replaced.replacedExpected);
|
|
271
|
+
receivedReplaceable.set(key, replaced.replacedReceived);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return {
|
|
275
|
+
replacedExpected: expectedReplaceable.object,
|
|
276
|
+
replacedReceived: receivedReplaceable.object,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function isAsymmetricMatcher(data) {
|
|
280
|
+
const type = getType(data);
|
|
281
|
+
return type === 'object' && typeof data.asymmetricMatch === 'function';
|
|
282
|
+
}
|
|
283
|
+
export const diff = (a, b, options) => (shouldPrintDiff(a, b) ? diffDefault(a, b, options) : null);
|
|
284
|
+
export const pluralize = (word, count) => (NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
|
|
285
|
+
export const getLabelPrinter = (...strings) => {
|
|
286
|
+
const maxLength = strings.reduce((max, string) => (string.length > max ? string.length : max), 0);
|
|
287
|
+
return (string) => `${string}: ${' '.repeat(maxLength - string.length)}`;
|
|
288
|
+
};
|
|
289
|
+
export const matcherErrorMessage = (hint, // assertion returned from call to matcherHint
|
|
290
|
+
generic, // condition which correct value must fulfill
|
|
291
|
+
specific // incorrect value returned from call to printWithType
|
|
292
|
+
) => `${hint}\n\n${chalk.bold('Matcher error')}: ${generic}${typeof specific === 'string' ? '\n\n' + specific : ''}`;
|
|
293
|
+
// Display assertion for the report when a test fails.
|
|
294
|
+
// New format: rejects/resolves, not, and matcher name have black color
|
|
295
|
+
// Old format: matcher name has dim color
|
|
296
|
+
export const matcherHint = (matcherName, received = 'received', expected = 'expected', options = {}) => {
|
|
297
|
+
const { comment = '', expectedColor = EXPECTED_COLOR, isDirectExpectCall = false, // seems redundant with received === ''
|
|
298
|
+
isNot = false, promise = '', receivedColor = RECEIVED_COLOR, secondArgument = '', secondArgumentColor = EXPECTED_COLOR, } = options;
|
|
299
|
+
let hint = '';
|
|
300
|
+
let dimString = 'expect'; // concatenate adjacent dim substrings
|
|
301
|
+
if (!isDirectExpectCall && received !== '') {
|
|
302
|
+
hint += DIM_COLOR(dimString + '(') + receivedColor(received);
|
|
303
|
+
dimString = ')';
|
|
304
|
+
}
|
|
305
|
+
if (promise !== '') {
|
|
306
|
+
hint += DIM_COLOR(dimString + '.') + promise;
|
|
307
|
+
dimString = '';
|
|
308
|
+
}
|
|
309
|
+
if (isNot) {
|
|
310
|
+
hint += DIM_COLOR(dimString + '.') + 'not';
|
|
311
|
+
dimString = '';
|
|
312
|
+
}
|
|
313
|
+
if (matcherName.includes('.')) {
|
|
314
|
+
// Old format: for backward compatibility,
|
|
315
|
+
// especially without promise or isNot options
|
|
316
|
+
dimString += matcherName;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
// New format: omit period from matcherName arg
|
|
320
|
+
hint += DIM_COLOR(dimString + '.') + matcherName;
|
|
321
|
+
dimString = '';
|
|
322
|
+
}
|
|
323
|
+
if (expected === '') {
|
|
324
|
+
dimString += '()';
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
hint += DIM_COLOR(dimString + '(') + expectedColor(expected);
|
|
328
|
+
if (secondArgument) {
|
|
329
|
+
hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument);
|
|
330
|
+
}
|
|
331
|
+
dimString = ')';
|
|
332
|
+
}
|
|
333
|
+
if (comment !== '') {
|
|
334
|
+
dimString += ' // ' + comment;
|
|
335
|
+
}
|
|
336
|
+
if (dimString !== '') {
|
|
337
|
+
hint += DIM_COLOR(dimString);
|
|
338
|
+
}
|
|
339
|
+
return hint;
|
|
340
|
+
};
|
|
341
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0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|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { MatchersObject } from './types';
|
|
9
|
+
declare const matchers: MatchersObject;
|
|
10
|
+
export default matchers;
|
|
11
|
+
//# sourceMappingURL=matchers.d.ts.map
|