@jest/expect-utils 29.4.0 → 29.4.1
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/utils.js +13 -2
- package/package.json +3 -3
package/build/utils.js
CHANGED
@@ -34,6 +34,17 @@ const hasPropertyInObject = (object, key) => {
|
|
34
34
|
hasPropertyInObject(Object.getPrototypeOf(object), key)
|
35
35
|
);
|
36
36
|
};
|
37
|
+
|
38
|
+
// Retrieves an object's keys for evaluation by getObjectSubset. This evaluates
|
39
|
+
// the prototype chain for string keys but not for symbols. (Otherwise, it
|
40
|
+
// could find values such as a Set or Map's Symbol.toStringTag, with unexpected
|
41
|
+
// results.)
|
42
|
+
//
|
43
|
+
// Compare with subsetEquality's use of Reflect.ownKeys.
|
44
|
+
const getObjectKeys = object => [
|
45
|
+
...Object.keys(object),
|
46
|
+
...Object.getOwnPropertySymbols(object)
|
47
|
+
];
|
37
48
|
const getPath = (object, propertyPath) => {
|
38
49
|
if (!Array.isArray(propertyPath)) {
|
39
50
|
propertyPath = pathAsArray(propertyPath);
|
@@ -110,7 +121,7 @@ const getObjectSubset = (
|
|
110
121
|
}
|
111
122
|
const trimmed = {};
|
112
123
|
seenReferences.set(object, trimmed);
|
113
|
-
|
124
|
+
getObjectKeys(object)
|
114
125
|
.filter(key => hasPropertyInObject(subset, key))
|
115
126
|
.forEach(key => {
|
116
127
|
trimmed[key] = seenReferences.has(object[key])
|
@@ -122,7 +133,7 @@ const getObjectSubset = (
|
|
122
133
|
seenReferences
|
123
134
|
);
|
124
135
|
});
|
125
|
-
if (
|
136
|
+
if (getObjectKeys(trimmed).length > 0) {
|
126
137
|
return trimmed;
|
127
138
|
}
|
128
139
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jest/expect-utils",
|
3
|
-
"version": "29.4.
|
3
|
+
"version": "29.4.1",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/facebook/jest.git",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"devDependencies": {
|
23
23
|
"@tsd/typescript": "^4.9.0",
|
24
24
|
"immutable": "^4.0.0",
|
25
|
-
"jest-matcher-utils": "^29.4.
|
25
|
+
"jest-matcher-utils": "^29.4.1",
|
26
26
|
"tsd-lite": "^0.6.0"
|
27
27
|
},
|
28
28
|
"engines": {
|
@@ -31,5 +31,5 @@
|
|
31
31
|
"publishConfig": {
|
32
32
|
"access": "public"
|
33
33
|
},
|
34
|
-
"gitHead": "
|
34
|
+
"gitHead": "bc84c8a15649aaaefdd624dc83824518c17467ed"
|
35
35
|
}
|