@jest/expect-utils 30.0.0-alpha.1 → 30.0.0-alpha.2
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.d.ts +3 -2
- package/build/index.js +15 -6
- package/package.json +4 -4
package/build/index.d.ts
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
+
|
7
8
|
export declare const arrayBufferEquality: (
|
8
9
|
a: unknown,
|
9
10
|
b: unknown,
|
@@ -60,9 +61,9 @@ export declare const iterableEquality: (
|
|
60
61
|
) => boolean | undefined;
|
61
62
|
|
62
63
|
export declare const partition: <T>(
|
63
|
-
items: T
|
64
|
+
items: Array<T>,
|
64
65
|
predicate: (arg: T) => boolean,
|
65
|
-
) => [T
|
66
|
+
) => [Array<T>, Array<T>];
|
66
67
|
|
67
68
|
export declare const pathAsArray: (propertyPath: string) => Array<any>;
|
68
69
|
|
package/build/index.js
CHANGED
@@ -212,6 +212,9 @@ function eq(a, b, aStack, bStack, customTesters, strictCheck) {
|
|
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;
|
215
|
+
// URLs are compared by their href property which contains the entire url string.
|
216
|
+
case '[object URL]':
|
217
|
+
return a.href === b.href;
|
215
218
|
}
|
216
219
|
if (typeof a !== 'object' || typeof b !== 'object') {
|
217
220
|
return false;
|
@@ -338,10 +341,12 @@ const hasPropertyInObject = (object, key) => {
|
|
338
341
|
};
|
339
342
|
|
340
343
|
// Retrieves an object's keys for evaluation by getObjectSubset. This evaluates
|
341
|
-
// the prototype chain for string keys but not for symbols.
|
342
|
-
// could find values such as a Set or Map's Symbol.toStringTag,
|
343
|
-
// results.)
|
344
|
-
const getObjectKeys = object =>
|
344
|
+
// the prototype chain for string keys but not for non-enumerable symbols.
|
345
|
+
// (Otherwise, it could find values such as a Set or Map's Symbol.toStringTag,
|
346
|
+
// with unexpected results.)
|
347
|
+
const getObjectKeys = object => {
|
348
|
+
return [...Object.keys(object), ...Object.getOwnPropertySymbols(object).filter(s => Object.getOwnPropertyDescriptor(object, s)?.enumerable)];
|
349
|
+
};
|
345
350
|
exports.getObjectKeys = getObjectKeys;
|
346
351
|
const getPath = (object, propertyPath) => {
|
347
352
|
if (!Array.isArray(propertyPath)) {
|
@@ -506,8 +511,8 @@ aStack = [], bStack = []) => {
|
|
506
511
|
return false;
|
507
512
|
}
|
508
513
|
if (!(0, _immutableUtils.isImmutableList)(a) && !(0, _immutableUtils.isImmutableOrderedKeyed)(a) && !(0, _immutableUtils.isImmutableOrderedSet)(a) && !(0, _immutableUtils.isImmutableRecord)(a)) {
|
509
|
-
const aEntries =
|
510
|
-
const bEntries =
|
514
|
+
const aEntries = entries(a);
|
515
|
+
const bEntries = entries(b);
|
511
516
|
if (!(0, _jasmineUtils.equals)(aEntries, bEntries)) {
|
512
517
|
return false;
|
513
518
|
}
|
@@ -519,6 +524,10 @@ aStack = [], bStack = []) => {
|
|
519
524
|
return true;
|
520
525
|
};
|
521
526
|
exports.iterableEquality = iterableEquality;
|
527
|
+
const entries = obj => {
|
528
|
+
if (!isObject(obj)) return [];
|
529
|
+
return Object.getOwnPropertySymbols(obj).filter(key => key !== Symbol.iterator).map(key => [key, obj[key]]).concat(Object.entries(obj));
|
530
|
+
};
|
522
531
|
const isObject = a => a !== null && typeof a === 'object';
|
523
532
|
const isObjectWithKeys = a => isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
|
524
533
|
const subsetEquality = (object, subset, customTesters = []) => {
|
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.2",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/jestjs/jest.git",
|
@@ -19,12 +19,12 @@
|
|
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.2"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
25
|
"@tsd/typescript": "^5.0.4",
|
26
26
|
"immutable": "^4.0.0",
|
27
|
-
"jest-matcher-utils": "30.0.0-alpha.
|
27
|
+
"jest-matcher-utils": "30.0.0-alpha.2",
|
28
28
|
"tsd-lite": "^0.8.0"
|
29
29
|
},
|
30
30
|
"engines": {
|
@@ -33,5 +33,5 @@
|
|
33
33
|
"publishConfig": {
|
34
34
|
"access": "public"
|
35
35
|
},
|
36
|
-
"gitHead": "
|
36
|
+
"gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4"
|
37
37
|
}
|