@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,506 @@
|
|
|
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
|
+
*/
|
|
8
|
+
const pkg = 'diff-sequences'; // for error messages
|
|
9
|
+
const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8
|
|
10
|
+
// Return the number of common items that follow in forward direction.
|
|
11
|
+
// The length of what Myers paper calls a “snake” in a forward path.
|
|
12
|
+
const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => {
|
|
13
|
+
let nCommon = 0;
|
|
14
|
+
while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
|
|
15
|
+
aIndex += 1;
|
|
16
|
+
bIndex += 1;
|
|
17
|
+
nCommon += 1;
|
|
18
|
+
}
|
|
19
|
+
return nCommon;
|
|
20
|
+
};
|
|
21
|
+
// Return the number of common items that precede in reverse direction.
|
|
22
|
+
// The length of what Myers paper calls a “snake” in a reverse path.
|
|
23
|
+
const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => {
|
|
24
|
+
let nCommon = 0;
|
|
25
|
+
while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
|
|
26
|
+
aIndex -= 1;
|
|
27
|
+
bIndex -= 1;
|
|
28
|
+
nCommon += 1;
|
|
29
|
+
}
|
|
30
|
+
return nCommon;
|
|
31
|
+
};
|
|
32
|
+
// A simple function to extend forward paths from (d - 1) to d changes
|
|
33
|
+
// when forward and reverse paths cannot yet overlap.
|
|
34
|
+
const extendPathsF = (d, aEnd, bEnd, bF, // bIndex = bF + aIndex - kF
|
|
35
|
+
isCommon, aIndexesF, // update indexes in sequence a of paths in diagonals kF
|
|
36
|
+
iMaxF // return the value because optimization might decrease it
|
|
37
|
+
) => {
|
|
38
|
+
// Unroll the first iteration.
|
|
39
|
+
let iF = 0;
|
|
40
|
+
let kF = -d; // kF = 2 * iF - d
|
|
41
|
+
let aFirst = aIndexesF[iF]; // in first iteration always insert
|
|
42
|
+
let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration
|
|
43
|
+
aIndexesF[iF] += countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
|
|
44
|
+
// Optimization: skip diagonals in which paths cannot ever overlap.
|
|
45
|
+
const nF = d < iMaxF ? d : iMaxF;
|
|
46
|
+
// The diagonals kF are odd when d is odd and even when d is even.
|
|
47
|
+
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
|
|
48
|
+
// To get first point of path segment, move one change in forward direction
|
|
49
|
+
// from last point of previous path segment in an adjacent diagonal.
|
|
50
|
+
// In last possible iteration when iF === d and kF === d always delete.
|
|
51
|
+
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
|
|
52
|
+
aFirst = aIndexesF[iF]; // vertical to insert from b
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
aFirst = aIndexPrev1 + 1; // horizontal to delete from a
|
|
56
|
+
if (aEnd <= aFirst) {
|
|
57
|
+
// Optimization: delete moved past right of graph.
|
|
58
|
+
return iF - 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// To get last point of path segment, move along diagonal of common items.
|
|
62
|
+
aIndexPrev1 = aIndexesF[iF];
|
|
63
|
+
aIndexesF[iF] =
|
|
64
|
+
aFirst +
|
|
65
|
+
countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
|
|
66
|
+
}
|
|
67
|
+
return iMaxF;
|
|
68
|
+
};
|
|
69
|
+
// A simple function to extend reverse paths from (d - 1) to d changes
|
|
70
|
+
// when reverse and forward paths cannot yet overlap.
|
|
71
|
+
const extendPathsR = (d, aStart, bStart, bR, // bIndex = bR + aIndex - kR
|
|
72
|
+
isCommon, aIndexesR, // update indexes in sequence a of paths in diagonals kR
|
|
73
|
+
iMaxR // return the value because optimization might decrease it
|
|
74
|
+
) => {
|
|
75
|
+
// Unroll the first iteration.
|
|
76
|
+
let iR = 0;
|
|
77
|
+
let kR = d; // kR = d - 2 * iR
|
|
78
|
+
let aFirst = aIndexesR[iR]; // in first iteration always insert
|
|
79
|
+
let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration
|
|
80
|
+
aIndexesR[iR] -= countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
|
|
81
|
+
// Optimization: skip diagonals in which paths cannot ever overlap.
|
|
82
|
+
const nR = d < iMaxR ? d : iMaxR;
|
|
83
|
+
// The diagonals kR are odd when d is odd and even when d is even.
|
|
84
|
+
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
|
|
85
|
+
// To get first point of path segment, move one change in reverse direction
|
|
86
|
+
// from last point of previous path segment in an adjacent diagonal.
|
|
87
|
+
// In last possible iteration when iR === d and kR === -d always delete.
|
|
88
|
+
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
|
|
89
|
+
aFirst = aIndexesR[iR]; // vertical to insert from b
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
aFirst = aIndexPrev1 - 1; // horizontal to delete from a
|
|
93
|
+
if (aFirst < aStart) {
|
|
94
|
+
// Optimization: delete moved past left of graph.
|
|
95
|
+
return iR - 1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// To get last point of path segment, move along diagonal of common items.
|
|
99
|
+
aIndexPrev1 = aIndexesR[iR];
|
|
100
|
+
aIndexesR[iR] =
|
|
101
|
+
aFirst -
|
|
102
|
+
countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
|
|
103
|
+
}
|
|
104
|
+
return iMaxR;
|
|
105
|
+
};
|
|
106
|
+
// A complete function to extend forward paths from (d - 1) to d changes.
|
|
107
|
+
// Return true if a path overlaps reverse path of (d - 1) changes in its diagonal.
|
|
108
|
+
const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, // update indexes in sequence a of paths in diagonals kF
|
|
109
|
+
iMaxF, aIndexesR, iMaxR, division // update prop values if return true
|
|
110
|
+
) => {
|
|
111
|
+
const bF = bStart - aStart; // bIndex = bF + aIndex - kF
|
|
112
|
+
const aLength = aEnd - aStart;
|
|
113
|
+
const bLength = bEnd - bStart;
|
|
114
|
+
const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength
|
|
115
|
+
// Range of diagonals in which forward and reverse paths might overlap.
|
|
116
|
+
const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR
|
|
117
|
+
const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1)
|
|
118
|
+
let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration
|
|
119
|
+
// Optimization: skip diagonals in which paths cannot ever overlap.
|
|
120
|
+
const nF = d < iMaxF ? d : iMaxF;
|
|
121
|
+
// The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even.
|
|
122
|
+
for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
|
|
123
|
+
// To get first point of path segment, move one change in forward direction
|
|
124
|
+
// from last point of previous path segment in an adjacent diagonal.
|
|
125
|
+
// In first iteration when iF === 0 and kF === -d always insert.
|
|
126
|
+
// In last possible iteration when iF === d and kF === d always delete.
|
|
127
|
+
const insert = iF === 0 || (iF !== d && aIndexPrev1 < aIndexesF[iF]);
|
|
128
|
+
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
|
|
129
|
+
const aFirst = insert
|
|
130
|
+
? aLastPrev // vertical to insert from b
|
|
131
|
+
: aLastPrev + 1; // horizontal to delete from a
|
|
132
|
+
// To get last point of path segment, move along diagonal of common items.
|
|
133
|
+
const bFirst = bF + aFirst - kF;
|
|
134
|
+
const nCommonF = countCommonItemsF(aFirst + 1, aEnd, bFirst + 1, bEnd, isCommon);
|
|
135
|
+
const aLast = aFirst + nCommonF;
|
|
136
|
+
aIndexPrev1 = aIndexesF[iF];
|
|
137
|
+
aIndexesF[iF] = aLast;
|
|
138
|
+
if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
|
|
139
|
+
// Solve for iR of reverse path with (d - 1) changes in diagonal kF:
|
|
140
|
+
// kR = kF + baDeltaLength
|
|
141
|
+
// kR = (d - 1) - 2 * iR
|
|
142
|
+
const iR = (d - 1 - (kF + baDeltaLength)) / 2;
|
|
143
|
+
// If this forward path overlaps the reverse path in this diagonal,
|
|
144
|
+
// then this is the middle change of the index intervals.
|
|
145
|
+
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
|
|
146
|
+
// Unlike the Myers algorithm which finds only the middle “snake”
|
|
147
|
+
// this package can find two common subsequences per division.
|
|
148
|
+
// Last point of previous path segment is on an adjacent diagonal.
|
|
149
|
+
const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
|
|
150
|
+
// Because of invariant that intervals preceding the middle change
|
|
151
|
+
// cannot have common items at the end,
|
|
152
|
+
// move in reverse direction along a diagonal of common items.
|
|
153
|
+
const nCommonR = countCommonItemsR(aStart, aLastPrev, bStart, bLastPrev, isCommon);
|
|
154
|
+
const aIndexPrevFirst = aLastPrev - nCommonR;
|
|
155
|
+
const bIndexPrevFirst = bLastPrev - nCommonR;
|
|
156
|
+
const aEndPreceding = aIndexPrevFirst + 1;
|
|
157
|
+
const bEndPreceding = bIndexPrevFirst + 1;
|
|
158
|
+
division.nChangePreceding = d - 1;
|
|
159
|
+
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
|
|
160
|
+
// Optimization: number of preceding changes in forward direction
|
|
161
|
+
// is equal to number of items in preceding interval,
|
|
162
|
+
// therefore it cannot contain any common items.
|
|
163
|
+
division.aEndPreceding = aStart;
|
|
164
|
+
division.bEndPreceding = bStart;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
division.aEndPreceding = aEndPreceding;
|
|
168
|
+
division.bEndPreceding = bEndPreceding;
|
|
169
|
+
}
|
|
170
|
+
division.nCommonPreceding = nCommonR;
|
|
171
|
+
if (nCommonR !== 0) {
|
|
172
|
+
division.aCommonPreceding = aEndPreceding;
|
|
173
|
+
division.bCommonPreceding = bEndPreceding;
|
|
174
|
+
}
|
|
175
|
+
division.nCommonFollowing = nCommonF;
|
|
176
|
+
if (nCommonF !== 0) {
|
|
177
|
+
division.aCommonFollowing = aFirst + 1;
|
|
178
|
+
division.bCommonFollowing = bFirst + 1;
|
|
179
|
+
}
|
|
180
|
+
const aStartFollowing = aLast + 1;
|
|
181
|
+
const bStartFollowing = bFirst + nCommonF + 1;
|
|
182
|
+
division.nChangeFollowing = d - 1;
|
|
183
|
+
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
184
|
+
// Optimization: number of changes in reverse direction
|
|
185
|
+
// is equal to number of items in following interval,
|
|
186
|
+
// therefore it cannot contain any common items.
|
|
187
|
+
division.aStartFollowing = aEnd;
|
|
188
|
+
division.bStartFollowing = bEnd;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
division.aStartFollowing = aStartFollowing;
|
|
192
|
+
division.bStartFollowing = bStartFollowing;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
};
|
|
200
|
+
// A complete function to extend reverse paths from (d - 1) to d changes.
|
|
201
|
+
// Return true if a path overlaps forward path of d changes in its diagonal.
|
|
202
|
+
const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, // update indexes in sequence a of paths in diagonals kR
|
|
203
|
+
iMaxR, division // update prop values if return true
|
|
204
|
+
) => {
|
|
205
|
+
const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
|
|
206
|
+
const aLength = aEnd - aStart;
|
|
207
|
+
const bLength = bEnd - bStart;
|
|
208
|
+
const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength
|
|
209
|
+
// Range of diagonals in which forward and reverse paths might overlap.
|
|
210
|
+
const kMinOverlapR = baDeltaLength - d; // -d <= kF
|
|
211
|
+
const kMaxOverlapR = baDeltaLength + d; // kF <= d
|
|
212
|
+
let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration
|
|
213
|
+
// Optimization: skip diagonals in which paths cannot ever overlap.
|
|
214
|
+
const nR = d < iMaxR ? d : iMaxR;
|
|
215
|
+
// The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even.
|
|
216
|
+
for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
|
|
217
|
+
// To get first point of path segment, move one change in reverse direction
|
|
218
|
+
// from last point of previous path segment in an adjacent diagonal.
|
|
219
|
+
// In first iteration when iR === 0 and kR === d always insert.
|
|
220
|
+
// In last possible iteration when iR === d and kR === -d always delete.
|
|
221
|
+
const insert = iR === 0 || (iR !== d && aIndexesR[iR] < aIndexPrev1);
|
|
222
|
+
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
|
|
223
|
+
const aFirst = insert
|
|
224
|
+
? aLastPrev // vertical to insert from b
|
|
225
|
+
: aLastPrev - 1; // horizontal to delete from a
|
|
226
|
+
// To get last point of path segment, move along diagonal of common items.
|
|
227
|
+
const bFirst = bR + aFirst - kR;
|
|
228
|
+
const nCommonR = countCommonItemsR(aStart, aFirst - 1, bStart, bFirst - 1, isCommon);
|
|
229
|
+
const aLast = aFirst - nCommonR;
|
|
230
|
+
aIndexPrev1 = aIndexesR[iR];
|
|
231
|
+
aIndexesR[iR] = aLast;
|
|
232
|
+
if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
|
|
233
|
+
// Solve for iF of forward path with d changes in diagonal kR:
|
|
234
|
+
// kF = kR - baDeltaLength
|
|
235
|
+
// kF = 2 * iF - d
|
|
236
|
+
const iF = (d + (kR - baDeltaLength)) / 2;
|
|
237
|
+
// If this reverse path overlaps the forward path in this diagonal,
|
|
238
|
+
// then this is a middle change of the index intervals.
|
|
239
|
+
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
|
|
240
|
+
const bLast = bFirst - nCommonR;
|
|
241
|
+
division.nChangePreceding = d;
|
|
242
|
+
if (d === aLast + bLast - aStart - bStart) {
|
|
243
|
+
// Optimization: number of changes in reverse direction
|
|
244
|
+
// is equal to number of items in preceding interval,
|
|
245
|
+
// therefore it cannot contain any common items.
|
|
246
|
+
division.aEndPreceding = aStart;
|
|
247
|
+
division.bEndPreceding = bStart;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
division.aEndPreceding = aLast;
|
|
251
|
+
division.bEndPreceding = bLast;
|
|
252
|
+
}
|
|
253
|
+
division.nCommonPreceding = nCommonR;
|
|
254
|
+
if (nCommonR !== 0) {
|
|
255
|
+
// The last point of reverse path segment is start of common subsequence.
|
|
256
|
+
division.aCommonPreceding = aLast;
|
|
257
|
+
division.bCommonPreceding = bLast;
|
|
258
|
+
}
|
|
259
|
+
division.nChangeFollowing = d - 1;
|
|
260
|
+
if (d === 1) {
|
|
261
|
+
// There is no previous path segment.
|
|
262
|
+
division.nCommonFollowing = 0;
|
|
263
|
+
division.aStartFollowing = aEnd;
|
|
264
|
+
division.bStartFollowing = bEnd;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
// Unlike the Myers algorithm which finds only the middle “snake”
|
|
268
|
+
// this package can find two common subsequences per division.
|
|
269
|
+
// Last point of previous path segment is on an adjacent diagonal.
|
|
270
|
+
const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
|
|
271
|
+
// Because of invariant that intervals following the middle change
|
|
272
|
+
// cannot have common items at the start,
|
|
273
|
+
// move in forward direction along a diagonal of common items.
|
|
274
|
+
const nCommonF = countCommonItemsF(aLastPrev, aEnd, bLastPrev, bEnd, isCommon);
|
|
275
|
+
division.nCommonFollowing = nCommonF;
|
|
276
|
+
if (nCommonF !== 0) {
|
|
277
|
+
// The last point of reverse path segment is start of common subsequence.
|
|
278
|
+
division.aCommonFollowing = aLastPrev;
|
|
279
|
+
division.bCommonFollowing = bLastPrev;
|
|
280
|
+
}
|
|
281
|
+
const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev
|
|
282
|
+
const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev
|
|
283
|
+
if (d - 1 ===
|
|
284
|
+
aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
285
|
+
// Optimization: number of changes in forward direction
|
|
286
|
+
// is equal to number of items in following interval,
|
|
287
|
+
// therefore it cannot contain any common items.
|
|
288
|
+
division.aStartFollowing = aEnd;
|
|
289
|
+
division.bStartFollowing = bEnd;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
division.aStartFollowing = aStartFollowing;
|
|
293
|
+
division.bStartFollowing = bStartFollowing;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return false;
|
|
301
|
+
};
|
|
302
|
+
// Given index intervals and input function to compare items at indexes,
|
|
303
|
+
// divide at the middle change.
|
|
304
|
+
//
|
|
305
|
+
// DO NOT CALL if start === end, because interval cannot contain common items
|
|
306
|
+
// and because this function will throw the “no overlap” error.
|
|
307
|
+
const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, // temporary memory, not input nor output
|
|
308
|
+
aIndexesR, // temporary memory, not input nor output
|
|
309
|
+
division // output
|
|
310
|
+
) => {
|
|
311
|
+
const bF = bStart - aStart; // bIndex = bF + aIndex - kF
|
|
312
|
+
const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
|
|
313
|
+
const aLength = aEnd - aStart;
|
|
314
|
+
const bLength = bEnd - bStart;
|
|
315
|
+
// Because graph has square or portrait orientation,
|
|
316
|
+
// length difference is minimum number of items to insert from b.
|
|
317
|
+
// Corresponding forward and reverse diagonals in graph
|
|
318
|
+
// depend on length difference of the sequences:
|
|
319
|
+
// kF = kR - baDeltaLength
|
|
320
|
+
// kR = kF + baDeltaLength
|
|
321
|
+
const baDeltaLength = bLength - aLength;
|
|
322
|
+
// Optimization: max diagonal in graph intersects corner of shorter side.
|
|
323
|
+
let iMaxF = aLength;
|
|
324
|
+
let iMaxR = aLength;
|
|
325
|
+
// Initialize no changes yet in forward or reverse direction:
|
|
326
|
+
aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start
|
|
327
|
+
aIndexesR[0] = aEnd; // at open end of interval
|
|
328
|
+
if (baDeltaLength % 2 === 0) {
|
|
329
|
+
// The number of changes in paths is 2 * d if length difference is even.
|
|
330
|
+
const dMin = (nChange || baDeltaLength) / 2;
|
|
331
|
+
const dMax = (aLength + bLength) / 2;
|
|
332
|
+
for (let d = 1; d <= dMax; d += 1) {
|
|
333
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
334
|
+
if (d < dMin) {
|
|
335
|
+
iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
|
|
336
|
+
}
|
|
337
|
+
else if (
|
|
338
|
+
// If a reverse path overlaps a forward path in the same diagonal,
|
|
339
|
+
// return a division of the index intervals at the middle change.
|
|
340
|
+
extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
// The number of changes in paths is 2 * d - 1 if length difference is odd.
|
|
347
|
+
const dMin = ((nChange || baDeltaLength) + 1) / 2;
|
|
348
|
+
const dMax = (aLength + bLength + 1) / 2;
|
|
349
|
+
// Unroll first half iteration so loop extends the relevant pairs of paths.
|
|
350
|
+
// Because of invariant that intervals have no common items at start or end,
|
|
351
|
+
// and limitation not to call divide with empty intervals,
|
|
352
|
+
// therefore it cannot be called if a forward path with one change
|
|
353
|
+
// would overlap a reverse path with no changes, even if dMin === 1.
|
|
354
|
+
let d = 1;
|
|
355
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
356
|
+
for (d += 1; d <= dMax; d += 1) {
|
|
357
|
+
iMaxR = extendPathsR(d - 1, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
|
|
358
|
+
if (d < dMin) {
|
|
359
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
360
|
+
}
|
|
361
|
+
else if (
|
|
362
|
+
// If a forward path overlaps a reverse path in the same diagonal,
|
|
363
|
+
// return a division of the index intervals at the middle change.
|
|
364
|
+
extendOverlappablePathsF(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
/* istanbul ignore next */
|
|
370
|
+
throw new Error(`${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`);
|
|
371
|
+
};
|
|
372
|
+
// Given index intervals and input function to compare items at indexes,
|
|
373
|
+
// return by output function the number of adjacent items and starting indexes
|
|
374
|
+
// of each common subsequence. Divide and conquer with only linear space.
|
|
375
|
+
//
|
|
376
|
+
// The index intervals are half open [start, end) like array slice method.
|
|
377
|
+
// DO NOT CALL if start === end, because interval cannot contain common items
|
|
378
|
+
// and because divide function will throw the “no overlap” error.
|
|
379
|
+
const findSubsequences = (nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, // temporary memory, not input nor output
|
|
380
|
+
aIndexesR, // temporary memory, not input nor output
|
|
381
|
+
division // temporary memory, not input nor output
|
|
382
|
+
) => {
|
|
383
|
+
if (bEnd - bStart < aEnd - aStart) {
|
|
384
|
+
// Transpose graph so it has portrait instead of landscape orientation.
|
|
385
|
+
// Always compare shorter to longer sequence for consistency and optimization.
|
|
386
|
+
transposed = !transposed;
|
|
387
|
+
if (transposed && callbacks.length === 1) {
|
|
388
|
+
// Lazily wrap callback functions to swap args if graph is transposed.
|
|
389
|
+
const { foundSubsequence, isCommon } = callbacks[0];
|
|
390
|
+
callbacks[1] = {
|
|
391
|
+
foundSubsequence: (nCommon, bCommon, aCommon) => {
|
|
392
|
+
foundSubsequence(nCommon, aCommon, bCommon);
|
|
393
|
+
},
|
|
394
|
+
isCommon: (bIndex, aIndex) => isCommon(aIndex, bIndex),
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
const tStart = aStart;
|
|
398
|
+
const tEnd = aEnd;
|
|
399
|
+
aStart = bStart;
|
|
400
|
+
aEnd = bEnd;
|
|
401
|
+
bStart = tStart;
|
|
402
|
+
bEnd = tEnd;
|
|
403
|
+
}
|
|
404
|
+
const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
|
|
405
|
+
// Divide the index intervals at the middle change.
|
|
406
|
+
divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division);
|
|
407
|
+
const { nChangePreceding, aEndPreceding, bEndPreceding, nCommonPreceding, aCommonPreceding, bCommonPreceding, nCommonFollowing, aCommonFollowing, bCommonFollowing, nChangeFollowing, aStartFollowing, bStartFollowing, } = division;
|
|
408
|
+
// Unless either index interval is empty, they might contain common items.
|
|
409
|
+
if (aStart < aEndPreceding && bStart < bEndPreceding) {
|
|
410
|
+
// Recursely find and return common subsequences preceding the division.
|
|
411
|
+
findSubsequences(nChangePreceding, aStart, aEndPreceding, bStart, bEndPreceding, transposed, callbacks, aIndexesF, aIndexesR, division);
|
|
412
|
+
}
|
|
413
|
+
// Return common subsequences that are adjacent to the middle change.
|
|
414
|
+
if (nCommonPreceding !== 0) {
|
|
415
|
+
foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
|
|
416
|
+
}
|
|
417
|
+
if (nCommonFollowing !== 0) {
|
|
418
|
+
foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
|
|
419
|
+
}
|
|
420
|
+
// Unless either index interval is empty, they might contain common items.
|
|
421
|
+
if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
|
|
422
|
+
// Recursely find and return common subsequences following the division.
|
|
423
|
+
findSubsequences(nChangeFollowing, aStartFollowing, aEnd, bStartFollowing, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
const validateLength = (name, arg) => {
|
|
427
|
+
if (typeof arg !== 'number') {
|
|
428
|
+
throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
|
|
429
|
+
}
|
|
430
|
+
if (!Number.isSafeInteger(arg)) {
|
|
431
|
+
throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
|
|
432
|
+
}
|
|
433
|
+
if (arg < 0) {
|
|
434
|
+
throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const validateCallback = (name, arg) => {
|
|
438
|
+
const type = typeof arg;
|
|
439
|
+
if (type !== 'function') {
|
|
440
|
+
throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
// Compare items in two sequences to find a longest common subsequence.
|
|
444
|
+
// Given lengths of sequences and input function to compare items at indexes,
|
|
445
|
+
// return by output function the number of adjacent items and starting indexes
|
|
446
|
+
// of each common subsequence.
|
|
447
|
+
export default (aLength, bLength, isCommon, foundSubsequence) => {
|
|
448
|
+
validateLength('aLength', aLength);
|
|
449
|
+
validateLength('bLength', bLength);
|
|
450
|
+
validateCallback('isCommon', isCommon);
|
|
451
|
+
validateCallback('foundSubsequence', foundSubsequence);
|
|
452
|
+
// Count common items from the start in the forward direction.
|
|
453
|
+
const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
|
|
454
|
+
if (nCommonF !== 0) {
|
|
455
|
+
foundSubsequence(nCommonF, 0, 0);
|
|
456
|
+
}
|
|
457
|
+
// Unless both sequences consist of common items only,
|
|
458
|
+
// find common items in the half-trimmed index intervals.
|
|
459
|
+
if (aLength !== nCommonF || bLength !== nCommonF) {
|
|
460
|
+
// Invariant: intervals do not have common items at the start.
|
|
461
|
+
// The start of an index interval is closed like array slice method.
|
|
462
|
+
const aStart = nCommonF;
|
|
463
|
+
const bStart = nCommonF;
|
|
464
|
+
// Count common items from the end in the reverse direction.
|
|
465
|
+
const nCommonR = countCommonItemsR(aStart, aLength - 1, bStart, bLength - 1, isCommon);
|
|
466
|
+
// Invariant: intervals do not have common items at the end.
|
|
467
|
+
// The end of an index interval is open like array slice method.
|
|
468
|
+
const aEnd = aLength - nCommonR;
|
|
469
|
+
const bEnd = bLength - nCommonR;
|
|
470
|
+
// Unless one sequence consists of common items only,
|
|
471
|
+
// therefore the other trimmed index interval consists of changes only,
|
|
472
|
+
// find common items in the trimmed index intervals.
|
|
473
|
+
const nCommonFR = nCommonF + nCommonR;
|
|
474
|
+
if (aLength !== nCommonFR && bLength !== nCommonFR) {
|
|
475
|
+
const nChange = 0; // number of change items is not yet known
|
|
476
|
+
const transposed = false; // call the original unwrapped functions
|
|
477
|
+
const callbacks = [{ foundSubsequence, isCommon }];
|
|
478
|
+
// Indexes in sequence a of last points in furthest reaching paths
|
|
479
|
+
// from outside the start at top left in the forward direction:
|
|
480
|
+
const aIndexesF = [NOT_YET_SET];
|
|
481
|
+
// from the end at bottom right in the reverse direction:
|
|
482
|
+
const aIndexesR = [NOT_YET_SET];
|
|
483
|
+
// Initialize one object as output of all calls to divide function.
|
|
484
|
+
const division = {
|
|
485
|
+
aCommonFollowing: NOT_YET_SET,
|
|
486
|
+
aCommonPreceding: NOT_YET_SET,
|
|
487
|
+
aEndPreceding: NOT_YET_SET,
|
|
488
|
+
aStartFollowing: NOT_YET_SET,
|
|
489
|
+
bCommonFollowing: NOT_YET_SET,
|
|
490
|
+
bCommonPreceding: NOT_YET_SET,
|
|
491
|
+
bEndPreceding: NOT_YET_SET,
|
|
492
|
+
bStartFollowing: NOT_YET_SET,
|
|
493
|
+
nChangeFollowing: NOT_YET_SET,
|
|
494
|
+
nChangePreceding: NOT_YET_SET,
|
|
495
|
+
nCommonFollowing: NOT_YET_SET,
|
|
496
|
+
nCommonPreceding: NOT_YET_SET,
|
|
497
|
+
};
|
|
498
|
+
// Find and return common subsequences in the trimmed index intervals.
|
|
499
|
+
findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
|
|
500
|
+
}
|
|
501
|
+
if (nCommonR !== 0) {
|
|
502
|
+
foundSubsequence(nCommonR, aEnd, bEnd);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgGH,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,qBAAqB;AACnD,MAAM,WAAW,GAAG,CAAC,CAAC,CAAC,sDAAsD;AAE7E,sEAAsE;AACtE,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,CACtB,MAAc,EACd,IAAY,EACZ,MAAc,EACd,IAAY,EACZ,QAAkB,EACpB,EAAE;IACA,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,OAAO,MAAM,GAAG,IAAI,IAAI,MAAM,GAAG,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QAC/D,MAAM,IAAI,CAAC,CAAC;QACZ,MAAM,IAAI,CAAC,CAAC;QACZ,OAAO,IAAI,CA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MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,wCAAwC;YAClE,MAAM,SAAS,GAAG,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC;YAEnD,kEAAkE;YAClE,+DAA+D;YAC/D,MAAM,SAAS,GAAG,CAAC,WAAW,CAAC,CAAC;YAChC,yDAAyD;YACzD,MAAM,SAAS,GAAG,CAAC,WAAW,CAAC,CAAC;YAEhC,mEAAmE;YACnE,MAAM,QAAQ,GAAG;gBACb,gBAAgB,EAAE,WAAW;gBAC7B,gBAAgB,EAAE,WAAW;gBAC7B,aAAa,EAAE,WAAW;gBAC1B,eAAe,EAAE,WAAW;gBAC5B,gBAAgB,EAAE,WAAW;gBAC7B,gBAAgB,EAAE,WAAW;gBAC7B,aAAa,EAAE,WAAW;gBAC1B,eAAe,EAAE,WAAW;gBAC5B,gBAAgB,EAAE,WAAW;gBAC7B,gBAAgB,EAAE,WAAW;gBAC7B,gBAAgB,EAAE,WAAW;gBAC7B,gBAAgB,EAAE,WAAW;aAChC,CAAC;YAEF,sEAAsE;YACtE,gBAAgB,CACZ,OAAO,EACP,MAAM,EACN,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,CACX,CAAC;SACL;QAED,IAAI,QAAQ,KAAK,CAAC,EAAE;YAChB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;SAC1C;KACJ;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
*/
|
|
8
|
+
import type { Expect } from './types';
|
|
9
|
+
declare const extractExpectedAssertionsErrors: Expect['extractExpectedAssertionsErrors'];
|
|
10
|
+
export default extractExpectedAssertionsErrors;
|
|
11
|
+
//# sourceMappingURL=extractExpectedAssertionsErrors.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
*/
|
|
8
|
+
import { EXPECTED_COLOR, RECEIVED_COLOR, matcherHint, pluralize, } from './matcher-utils';
|
|
9
|
+
import { getState, setState } from './jestMatchersObject';
|
|
10
|
+
const resetAssertionsLocalState = () => {
|
|
11
|
+
setState({
|
|
12
|
+
assertionCalls: 0,
|
|
13
|
+
expectedAssertionsNumber: null,
|
|
14
|
+
isExpectingAssertions: false,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
// Create and format all errors related to the mismatched number of `expect`
|
|
18
|
+
// calls and reset the matcher's state.
|
|
19
|
+
const extractExpectedAssertionsErrors = () => {
|
|
20
|
+
const result = [];
|
|
21
|
+
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberError, isExpectingAssertions, isExpectingAssertionsError, } = getState();
|
|
22
|
+
resetAssertionsLocalState();
|
|
23
|
+
if (typeof expectedAssertionsNumber === 'number' &&
|
|
24
|
+
assertionCalls !== expectedAssertionsNumber) {
|
|
25
|
+
const numOfAssertionsExpected = EXPECTED_COLOR(pluralize('assertion', expectedAssertionsNumber));
|
|
26
|
+
expectedAssertionsNumberError.message =
|
|
27
|
+
matcherHint('.assertions', '', String(expectedAssertionsNumber), {
|
|
28
|
+
isDirectExpectCall: true,
|
|
29
|
+
}) +
|
|
30
|
+
'\n\n' +
|
|
31
|
+
`Expected ${numOfAssertionsExpected} to be called but received ` +
|
|
32
|
+
RECEIVED_COLOR(pluralize('assertion call', assertionCalls || 0)) +
|
|
33
|
+
'.';
|
|
34
|
+
result.push({
|
|
35
|
+
actual: assertionCalls.toString(),
|
|
36
|
+
error: expectedAssertionsNumberError,
|
|
37
|
+
expected: expectedAssertionsNumber.toString(),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (isExpectingAssertions && assertionCalls === 0) {
|
|
41
|
+
const expected = EXPECTED_COLOR('at least one assertion');
|
|
42
|
+
const received = RECEIVED_COLOR('received none');
|
|
43
|
+
isExpectingAssertionsError.message =
|
|
44
|
+
matcherHint('.hasAssertions', '', '', {
|
|
45
|
+
isDirectExpectCall: true,
|
|
46
|
+
}) +
|
|
47
|
+
'\n\n' +
|
|
48
|
+
`Expected ${expected} to be called but ${received}.`;
|
|
49
|
+
result.push({
|
|
50
|
+
actual: 'none',
|
|
51
|
+
error: isExpectingAssertionsError,
|
|
52
|
+
expected: 'at least one',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
export default extractExpectedAssertionsErrors;
|
|
58
|
+
//# sourceMappingURL=extractExpectedAssertionsErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractExpectedAssertionsErrors.js","sourceRoot":"","sources":["extractExpectedAssertionsErrors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACnC,QAAQ,CAAC;QACL,cAAc,EAAE,CAAC;QACjB,wBAAwB,EAAE,IAAI;QAC9B,qBAAqB,EAAE,KAAK;KAC/B,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,4EAA4E;AAC5E,uCAAuC;AACvC,MAAM,+BAA+B,GACjC,GAAG,EAAE;IACD,MAAM,MAAM,GAA6B,EAAE,CAAC;IAC5C,MAAM,EACF,cAAc,EACd,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;AAEN,eAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
declare type ValueType = 'array' | 'bigint' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined';
|
|
8
|
+
export declare function getType(value: unknown): ValueType;
|
|
9
|
+
export declare const isPrimitive: (value: unknown) => boolean;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|