@vitest/expect 1.5.0 → 1.5.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/dist/index.js +13 -12
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -304,7 +304,7 @@ function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
|
|
304
304
|
return iterableEquality(
|
305
305
|
a2,
|
306
306
|
b2,
|
307
|
-
[...
|
307
|
+
[...customTesters],
|
308
308
|
[...aStack],
|
309
309
|
[...bStack]
|
310
310
|
);
|
@@ -382,7 +382,7 @@ function subsetEquality(object, subset, customTesters = []) {
|
|
382
382
|
if (!isObjectWithKeys(subset2))
|
383
383
|
return void 0;
|
384
384
|
return Object.keys(subset2).every((key) => {
|
385
|
-
if (
|
385
|
+
if (typeof subset2[key] === "object") {
|
386
386
|
if (seenReferences.has(subset2[key]))
|
387
387
|
return equals(object2[key], subset2[key], filteredCustomTesters);
|
388
388
|
seenReferences.set(subset2[key], true);
|
@@ -930,17 +930,18 @@ const JestChaiExpect = (chai, utils) => {
|
|
930
930
|
const pass = equals(actual, expected, [...customTesters, iterableEquality, subsetEquality]);
|
931
931
|
const isNot = utils.flag(this, "negate");
|
932
932
|
const { subset: actualSubset, stripped } = getObjectSubset(actual, expected);
|
933
|
-
const msg = utils.getMessage(
|
934
|
-
this,
|
935
|
-
[
|
936
|
-
pass,
|
937
|
-
"expected #{this} to match object #{exp}",
|
938
|
-
"expected #{this} to not match object #{exp}",
|
939
|
-
expected,
|
940
|
-
actualSubset
|
941
|
-
]
|
942
|
-
);
|
943
933
|
if (pass && isNot || !pass && !isNot) {
|
934
|
+
const msg = utils.getMessage(
|
935
|
+
this,
|
936
|
+
[
|
937
|
+
pass,
|
938
|
+
"expected #{this} to match object #{exp}",
|
939
|
+
"expected #{this} to not match object #{exp}",
|
940
|
+
expected,
|
941
|
+
actualSubset,
|
942
|
+
false
|
943
|
+
]
|
944
|
+
);
|
944
945
|
const message = stripped === 0 ? msg : `${msg}
|
945
946
|
(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
|
946
947
|
throw new AssertionError(message, { showDiff: true, expected, actual: actualSubset });
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/expect",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.5.
|
4
|
+
"version": "1.5.1",
|
5
5
|
"description": "Jest's expect matchers as a Chai plugin",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -31,14 +31,14 @@
|
|
31
31
|
],
|
32
32
|
"dependencies": {
|
33
33
|
"chai": "^4.3.10",
|
34
|
-
"@vitest/
|
35
|
-
"@vitest/
|
34
|
+
"@vitest/spy": "1.5.1",
|
35
|
+
"@vitest/utils": "1.5.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
38
|
"@types/chai": "4.3.6",
|
39
39
|
"picocolors": "^1.0.0",
|
40
40
|
"rollup-plugin-copy": "^3.5.0",
|
41
|
-
"@vitest/runner": "1.5.
|
41
|
+
"@vitest/runner": "1.5.1"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
44
|
"build": "rimraf dist && rollup -c",
|