@vitest/expect 3.0.7 → 3.0.9
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/chai.d.cts +2119 -1962
- package/dist/index.d.ts +665 -661
- package/dist/index.js +10 -9
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -834,7 +834,7 @@ class Any extends AsymmetricMatcher {
|
|
834
834
|
return typeof other == "number" || other instanceof Number;
|
835
835
|
}
|
836
836
|
if (this.sample === Function) {
|
837
|
-
return typeof other == "function" || other
|
837
|
+
return typeof other == "function" || typeof other === "function";
|
838
838
|
}
|
839
839
|
if (this.sample === Boolean) {
|
840
840
|
return typeof other == "boolean" || other instanceof Boolean;
|
@@ -1511,12 +1511,15 @@ const JestChaiExpect = (chai, utils) => {
|
|
1511
1511
|
throw new AssertionError(msg);
|
1512
1512
|
}
|
1513
1513
|
});
|
1514
|
+
function equalsArgumentArray(a, b) {
|
1515
|
+
return a.length === b.length && a.every(
|
1516
|
+
(aItem, i) => equals(aItem, b[i], [...customTesters, iterableEquality])
|
1517
|
+
);
|
1518
|
+
}
|
1514
1519
|
def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
|
1515
1520
|
const spy = getSpy(this);
|
1516
1521
|
const spyName = spy.getMockName();
|
1517
|
-
const pass = spy.mock.calls.some(
|
1518
|
-
(callArg) => equals(callArg, args, [...customTesters, iterableEquality])
|
1519
|
-
);
|
1522
|
+
const pass = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
|
1520
1523
|
const isNot = utils.flag(this, "negate");
|
1521
1524
|
const msg = utils.getMessage(this, [
|
1522
1525
|
pass,
|
@@ -1532,9 +1535,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1532
1535
|
const spy = getSpy(this);
|
1533
1536
|
const spyName = spy.getMockName();
|
1534
1537
|
const callCount = spy.mock.calls.length;
|
1535
|
-
const hasCallWithArgs = spy.mock.calls.some(
|
1536
|
-
(callArg) => equals(callArg, args, [...customTesters, iterableEquality])
|
1537
|
-
);
|
1538
|
+
const hasCallWithArgs = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
|
1538
1539
|
const pass = hasCallWithArgs && callCount === 1;
|
1539
1540
|
const isNot = utils.flag(this, "negate");
|
1540
1541
|
const msg = utils.getMessage(this, [
|
@@ -1556,7 +1557,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1556
1557
|
const callCount = spy.mock.calls.length;
|
1557
1558
|
const isCalled = times <= callCount;
|
1558
1559
|
this.assert(
|
1559
|
-
|
1560
|
+
nthCall && equalsArgumentArray(nthCall, args),
|
1560
1561
|
`expected ${ordinalOf(
|
1561
1562
|
times
|
1562
1563
|
)} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`,
|
@@ -1576,7 +1577,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
1576
1577
|
const spyName = spy.getMockName();
|
1577
1578
|
const lastCall = spy.mock.calls[spy.mock.calls.length - 1];
|
1578
1579
|
this.assert(
|
1579
|
-
|
1580
|
+
lastCall && equalsArgumentArray(lastCall, args),
|
1580
1581
|
`expected last "${spyName}" call to have been called with #{exp}`,
|
1581
1582
|
`expected last "${spyName}" call to not have been called with #{exp}`,
|
1582
1583
|
args,
|
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.9",
|
5
5
|
"description": "Jest's expect matchers as a Chai plugin",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -32,13 +32,13 @@
|
|
32
32
|
"dependencies": {
|
33
33
|
"chai": "^5.2.0",
|
34
34
|
"tinyrainbow": "^2.0.0",
|
35
|
-
"@vitest/
|
36
|
-
"@vitest/
|
35
|
+
"@vitest/utils": "3.0.9",
|
36
|
+
"@vitest/spy": "3.0.9"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@types/chai": "
|
39
|
+
"@types/chai": "5.0.1",
|
40
40
|
"rollup-plugin-copy": "^3.5.0",
|
41
|
-
"@vitest/runner": "3.0.
|
41
|
+
"@vitest/runner": "3.0.9"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
44
|
"build": "rimraf dist && rollup -c",
|