@vitest/expect 0.28.3 → 0.28.5
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 +9 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -107,13 +107,6 @@ function diff(a, b, options) {
|
|
107
107
|
});
|
108
108
|
}
|
109
109
|
|
110
|
-
var matcherUtils = /*#__PURE__*/Object.freeze({
|
111
|
-
__proto__: null,
|
112
|
-
stringify: stringify,
|
113
|
-
getMatcherUtils: getMatcherUtils,
|
114
|
-
diff: diff
|
115
|
-
});
|
116
|
-
|
117
110
|
function equals(a, b, customTesters, strictCheck) {
|
118
111
|
customTesters = customTesters || [];
|
119
112
|
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
@@ -418,7 +411,13 @@ class AsymmetricMatcher {
|
|
418
411
|
...getState(expect || globalThis[GLOBAL_EXPECT]),
|
419
412
|
equals,
|
420
413
|
isNot: this.inverse,
|
421
|
-
utils:
|
414
|
+
utils: {
|
415
|
+
...getMatcherUtils(),
|
416
|
+
diff,
|
417
|
+
stringify,
|
418
|
+
iterableEquality,
|
419
|
+
subsetEquality
|
420
|
+
}
|
422
421
|
};
|
423
422
|
}
|
424
423
|
}
|
@@ -866,7 +865,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
866
865
|
});
|
867
866
|
def("toHaveProperty", function(...args) {
|
868
867
|
if (Array.isArray(args[0]))
|
869
|
-
args[0] = args[0].map((key) => key.replace(/([.[\]])/g, "\\$1")).join(".");
|
868
|
+
args[0] = args[0].map((key) => String(key).replace(/([.[\]])/g, "\\$1")).join(".");
|
870
869
|
const actual = this._obj;
|
871
870
|
const [propertyName, expected] = args;
|
872
871
|
const getValue = () => {
|
@@ -1120,7 +1119,7 @@ Number of calls: ${c().bold(spy.mock.calls.length)}
|
|
1120
1119
|
def(["toHaveReturned", "toReturn"], function() {
|
1121
1120
|
const spy = getSpy(this);
|
1122
1121
|
const spyName = spy.getMockName();
|
1123
|
-
const calledAndNotThrew = spy.mock.calls.length > 0 &&
|
1122
|
+
const calledAndNotThrew = spy.mock.calls.length > 0 && spy.mock.results.some(({ type }) => type !== "throw");
|
1124
1123
|
this.assert(
|
1125
1124
|
calledAndNotThrew,
|
1126
1125
|
`expected "${spyName}" to be successfully called at least once`,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/expect",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.28.
|
4
|
+
"version": "0.28.5",
|
5
5
|
"description": "Jest's expect matchers as a Chai plugin",
|
6
6
|
"license": "MIT",
|
7
7
|
"repository": {
|
@@ -25,8 +25,8 @@
|
|
25
25
|
],
|
26
26
|
"dependencies": {
|
27
27
|
"chai": "^4.3.7",
|
28
|
-
"@vitest/
|
29
|
-
"@vitest/
|
28
|
+
"@vitest/utils": "0.28.5",
|
29
|
+
"@vitest/spy": "0.28.5"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
32
|
"picocolors": "^1.0.0"
|