@vitest/expect 3.0.0-beta.4 → 3.0.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 +20 -20
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -186,7 +186,7 @@ function asymmetricMatch(a, b) {
|
|
186
186
|
const asymmetricA = isAsymmetric(a);
|
187
187
|
const asymmetricB = isAsymmetric(b);
|
188
188
|
if (asymmetricA && asymmetricB) {
|
189
|
-
return
|
189
|
+
return undefined;
|
190
190
|
}
|
191
191
|
if (asymmetricA) {
|
192
192
|
return a.asymmetricMatch(b);
|
@@ -198,7 +198,7 @@ function asymmetricMatch(a, b) {
|
|
198
198
|
function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
199
199
|
let result = true;
|
200
200
|
const asymmetricResult = asymmetricMatch(a, b);
|
201
|
-
if (asymmetricResult !==
|
201
|
+
if (asymmetricResult !== undefined) {
|
202
202
|
return asymmetricResult;
|
203
203
|
}
|
204
204
|
const testerContext = { equals };
|
@@ -209,7 +209,7 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
209
209
|
b,
|
210
210
|
customTesters
|
211
211
|
);
|
212
|
-
if (customTesterResult !==
|
212
|
+
if (customTesterResult !== undefined) {
|
213
213
|
return customTesterResult;
|
214
214
|
}
|
215
215
|
}
|
@@ -315,7 +315,7 @@ function keys(obj, hasKey2) {
|
|
315
315
|
);
|
316
316
|
}
|
317
317
|
function hasDefinedKey(obj, key) {
|
318
|
-
return hasKey(obj, key) && obj[key] !==
|
318
|
+
return hasKey(obj, key) && obj[key] !== undefined;
|
319
319
|
}
|
320
320
|
function hasKey(obj, key) {
|
321
321
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
@@ -387,7 +387,7 @@ function hasIterator(object) {
|
|
387
387
|
}
|
388
388
|
function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
|
389
389
|
if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
|
390
|
-
return
|
390
|
+
return undefined;
|
391
391
|
}
|
392
392
|
if (a.constructor !== b.constructor) {
|
393
393
|
return false;
|
@@ -407,7 +407,7 @@ function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
|
|
407
407
|
function iterableEqualityWithStack(a2, b2) {
|
408
408
|
return iterableEquality(a2, b2, [...customTesters], [...aStack], [...bStack]);
|
409
409
|
}
|
410
|
-
if (a.size !==
|
410
|
+
if (a.size !== undefined) {
|
411
411
|
if (a.size !== b.size) {
|
412
412
|
return false;
|
413
413
|
} else if (isA("Set", a) || isImmutableUnorderedSet(a)) {
|
@@ -501,7 +501,7 @@ function subsetEquality(object, subset, customTesters = []) {
|
|
501
501
|
);
|
502
502
|
const subsetEqualityWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {
|
503
503
|
if (!isObjectWithKeys(subset2)) {
|
504
|
-
return
|
504
|
+
return undefined;
|
505
505
|
}
|
506
506
|
return Object.keys(subset2).every((key) => {
|
507
507
|
if (subset2[key] != null && typeof subset2[key] === "object") {
|
@@ -522,7 +522,7 @@ function subsetEquality(object, subset, customTesters = []) {
|
|
522
522
|
}
|
523
523
|
function typeEquality(a, b) {
|
524
524
|
if (a == null || b == null || a.constructor === b.constructor) {
|
525
|
-
return
|
525
|
+
return undefined;
|
526
526
|
}
|
527
527
|
return false;
|
528
528
|
}
|
@@ -531,13 +531,13 @@ function arrayBufferEquality(a, b) {
|
|
531
531
|
let dataViewB = b;
|
532
532
|
if (!(a instanceof DataView && b instanceof DataView)) {
|
533
533
|
if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) {
|
534
|
-
return
|
534
|
+
return undefined;
|
535
535
|
}
|
536
536
|
try {
|
537
537
|
dataViewA = new DataView(a);
|
538
538
|
dataViewB = new DataView(b);
|
539
539
|
} catch {
|
540
|
-
return
|
540
|
+
return undefined;
|
541
541
|
}
|
542
542
|
}
|
543
543
|
if (dataViewA.byteLength !== dataViewB.byteLength) {
|
@@ -552,7 +552,7 @@ function arrayBufferEquality(a, b) {
|
|
552
552
|
}
|
553
553
|
function sparseArrayEquality(a, b, customTesters = []) {
|
554
554
|
if (!Array.isArray(a) || !Array.isArray(b)) {
|
555
|
-
return
|
555
|
+
return undefined;
|
556
556
|
}
|
557
557
|
const aKeys = Object.keys(a);
|
558
558
|
const bKeys = Object.keys(b);
|
@@ -583,7 +583,7 @@ function getObjectKeys(object) {
|
|
583
583
|
...Object.getOwnPropertySymbols(object).filter(
|
584
584
|
(s) => {
|
585
585
|
var _a;
|
586
|
-
return (_a = Object.getOwnPropertyDescriptor(object, s)) == null ?
|
586
|
+
return (_a = Object.getOwnPropertyDescriptor(object, s)) == null ? undefined : _a.enumerable;
|
587
587
|
}
|
588
588
|
)
|
589
589
|
];
|
@@ -1001,7 +1001,7 @@ function recordAsyncExpect(_test, promise, assertion, error) {
|
|
1001
1001
|
test.onFinished.push(() => {
|
1002
1002
|
var _a;
|
1003
1003
|
if (!resolved) {
|
1004
|
-
const processor = ((_a = globalThis.__vitest_worker__) == null ?
|
1004
|
+
const processor = ((_a = globalThis.__vitest_worker__) == null ? undefined : _a.onFilterStackTrace) || ((s) => s || "");
|
1005
1005
|
const stack = processor(error.stack);
|
1006
1006
|
console.warn([
|
1007
1007
|
`Promise returned by \`${assertion}\` was not awaited. `,
|
@@ -1357,10 +1357,10 @@ const JestChaiExpect = (chai, utils) => {
|
|
1357
1357
|
def("toBeUndefined", function() {
|
1358
1358
|
const obj = utils.flag(this, "object");
|
1359
1359
|
this.assert(
|
1360
|
-
|
1360
|
+
undefined === obj,
|
1361
1361
|
"expected #{this} to be undefined",
|
1362
1362
|
"expected #{this} not to be undefined",
|
1363
|
-
|
1363
|
+
undefined,
|
1364
1364
|
obj
|
1365
1365
|
);
|
1366
1366
|
});
|
@@ -1429,7 +1429,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1429
1429
|
`expected #{this} to have property "${propertyName}"${valueString}`,
|
1430
1430
|
`expected #{this} to not have property "${propertyName}"${valueString}`,
|
1431
1431
|
expected,
|
1432
|
-
exists ? value :
|
1432
|
+
exists ? value : undefined
|
1433
1433
|
);
|
1434
1434
|
}
|
1435
1435
|
);
|
@@ -1836,7 +1836,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1836
1836
|
`expected last "${spyName}" call to ${action} #{exp}`,
|
1837
1837
|
`expected last "${spyName}" call to not ${action} #{exp}`,
|
1838
1838
|
value,
|
1839
|
-
result == null ?
|
1839
|
+
result == null ? undefined : result.value
|
1840
1840
|
);
|
1841
1841
|
});
|
1842
1842
|
});
|
@@ -1869,7 +1869,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1869
1869
|
`expected ${ordinalCall} "${spyName}" call to ${action} #{exp}`,
|
1870
1870
|
`expected ${ordinalCall} "${spyName}" call to not ${action} #{exp}`,
|
1871
1871
|
value,
|
1872
|
-
result == null ?
|
1872
|
+
result == null ? undefined : result.value
|
1873
1873
|
);
|
1874
1874
|
});
|
1875
1875
|
});
|
@@ -1893,7 +1893,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1893
1893
|
`expect.poll() is not supported in combination with .resolves`
|
1894
1894
|
);
|
1895
1895
|
}
|
1896
|
-
if (typeof (obj == null ?
|
1896
|
+
if (typeof (obj == null ? undefined : obj.then) !== "function") {
|
1897
1897
|
throw new TypeError(
|
1898
1898
|
`You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`
|
1899
1899
|
);
|
@@ -1953,7 +1953,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1953
1953
|
`expect.poll() is not supported in combination with .rejects`
|
1954
1954
|
);
|
1955
1955
|
}
|
1956
|
-
if (typeof (wrapper == null ?
|
1956
|
+
if (typeof (wrapper == null ? undefined : wrapper.then) !== "function") {
|
1957
1957
|
throw new TypeError(
|
1958
1958
|
`You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`
|
1959
1959
|
);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/expect",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.
|
4
|
+
"version": "3.0.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": "^5.1.2",
|
34
|
-
"tinyrainbow": "^
|
35
|
-
"@vitest/
|
36
|
-
"@vitest/
|
34
|
+
"tinyrainbow": "^2.0.0",
|
35
|
+
"@vitest/utils": "3.0.1",
|
36
|
+
"@vitest/spy": "3.0.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"@types/chai": "4.3.6",
|
40
40
|
"rollup-plugin-copy": "^3.5.0",
|
41
|
-
"@vitest/runner": "3.0.
|
41
|
+
"@vitest/runner": "3.0.1"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
44
|
"build": "rimraf dist && rollup -c",
|