@jest/expect-utils 30.0.0-alpha.5 → 30.0.0-alpha.7
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/build/index.js +12 -6
- package/package.json +5 -5
package/build/index.js
CHANGED
@@ -177,7 +177,7 @@ function eq(a, b, aStack, bStack, customTesters, strictCheck) {
|
|
177
177
|
}
|
178
178
|
}
|
179
179
|
if (a instanceof Error && b instanceof Error) {
|
180
|
-
return a.message
|
180
|
+
return a.message === b.message;
|
181
181
|
}
|
182
182
|
if (Object.is(a, b)) {
|
183
183
|
return true;
|
@@ -187,7 +187,7 @@ function eq(a, b, aStack, bStack, customTesters, strictCheck) {
|
|
187
187
|
return false;
|
188
188
|
}
|
189
189
|
const className = Object.prototype.toString.call(a);
|
190
|
-
if (className
|
190
|
+
if (className !== Object.prototype.toString.call(b)) {
|
191
191
|
return false;
|
192
192
|
}
|
193
193
|
switch (className) {
|
@@ -208,7 +208,7 @@ function eq(a, b, aStack, bStack, customTesters, strictCheck) {
|
|
208
208
|
// Coerce dates to numeric primitive values. Dates are compared by their
|
209
209
|
// millisecond representations. Note that invalid dates with millisecond representations
|
210
210
|
// of `NaN` are not equivalent.
|
211
|
-
return +a
|
211
|
+
return +a === +b;
|
212
212
|
// RegExps are compared by their source patterns and flags.
|
213
213
|
case '[object RegExp]':
|
214
214
|
return a.source === b.source && a.flags === b.flags;
|
@@ -243,7 +243,7 @@ function eq(a, b, aStack, bStack, customTesters, strictCheck) {
|
|
243
243
|
bStack.push(b);
|
244
244
|
// Recursively compare objects and arrays.
|
245
245
|
// Compare array lengths to determine if a deep comparison is necessary.
|
246
|
-
if (strictCheck && className
|
246
|
+
if (strictCheck && className === '[object Array]' && a.length !== b.length) {
|
247
247
|
return false;
|
248
248
|
}
|
249
249
|
|
@@ -426,7 +426,7 @@ const hasIterator = object => !!(object != null && object[IteratorSymbol]);
|
|
426
426
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
427
427
|
const iterableEquality = (a, b, customTesters = [], /* eslint-enable @typescript-eslint/explicit-module-boundary-types */
|
428
428
|
aStack = [], bStack = []) => {
|
429
|
-
if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
|
429
|
+
if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b) || ArrayBuffer.isView(a) || ArrayBuffer.isView(b) || !hasIterator(a) || !hasIterator(b)) {
|
430
430
|
return undefined;
|
431
431
|
}
|
432
432
|
if (a.constructor !== b.constructor) {
|
@@ -581,9 +581,12 @@ exports.typeEquality = typeEquality;
|
|
581
581
|
const arrayBufferEquality = (a, b) => {
|
582
582
|
let dataViewA = a;
|
583
583
|
let dataViewB = b;
|
584
|
-
if (a
|
584
|
+
if (isArrayBuffer(a) && isArrayBuffer(b)) {
|
585
585
|
dataViewA = new DataView(a);
|
586
586
|
dataViewB = new DataView(b);
|
587
|
+
} else if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
588
|
+
dataViewA = new DataView(a.buffer, a.byteOffset, a.byteLength);
|
589
|
+
dataViewB = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
587
590
|
}
|
588
591
|
if (!(dataViewA instanceof DataView && dataViewB instanceof DataView)) {
|
589
592
|
return undefined;
|
@@ -603,6 +606,9 @@ const arrayBufferEquality = (a, b) => {
|
|
603
606
|
return true;
|
604
607
|
};
|
605
608
|
exports.arrayBufferEquality = arrayBufferEquality;
|
609
|
+
function isArrayBuffer(obj) {
|
610
|
+
return Object.prototype.toString.call(obj) === '[object ArrayBuffer]';
|
611
|
+
}
|
606
612
|
const sparseArrayEquality = (a, b, customTesters = []) => {
|
607
613
|
if (!Array.isArray(a) || !Array.isArray(b)) {
|
608
614
|
return undefined;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jest/expect-utils",
|
3
|
-
"version": "30.0.0-alpha.
|
3
|
+
"version": "30.0.0-alpha.7",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/jestjs/jest.git",
|
@@ -19,11 +19,11 @@
|
|
19
19
|
"./package.json": "./package.json"
|
20
20
|
},
|
21
21
|
"dependencies": {
|
22
|
-
"jest-get-type": "30.0.0-alpha.
|
22
|
+
"jest-get-type": "30.0.0-alpha.7"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
|
-
"immutable": "^
|
26
|
-
"jest-matcher-utils": "30.0.0-alpha.
|
25
|
+
"immutable": "^5.0.0",
|
26
|
+
"jest-matcher-utils": "30.0.0-alpha.7"
|
27
27
|
},
|
28
28
|
"engines": {
|
29
29
|
"node": "^16.10.0 || ^18.12.0 || >=20.0.0"
|
@@ -31,5 +31,5 @@
|
|
31
31
|
"publishConfig": {
|
32
32
|
"access": "public"
|
33
33
|
},
|
34
|
-
"gitHead": "
|
34
|
+
"gitHead": "bacb7de30d053cd87181294b0c8a8576632a8b02"
|
35
35
|
}
|