@vitest/expect 1.3.1 → 1.4.0
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 +17 -4
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -885,10 +885,14 @@ const JestChaiExpect = (chai, utils) => {
|
|
885
885
|
);
|
886
886
|
});
|
887
887
|
def("toMatch", function(expected) {
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
888
|
+
const actual = this._obj;
|
889
|
+
return this.assert(
|
890
|
+
typeof expected === "string" ? actual.includes(expected) : actual.match(expected),
|
891
|
+
`expected #{this} to match #{exp}`,
|
892
|
+
`expected #{this} not to match #{exp}`,
|
893
|
+
expected,
|
894
|
+
actual
|
895
|
+
);
|
892
896
|
});
|
893
897
|
def("toContain", function(item) {
|
894
898
|
const actual = this._obj;
|
@@ -915,6 +919,15 @@ const JestChaiExpect = (chai, utils) => {
|
|
915
919
|
actual.value
|
916
920
|
);
|
917
921
|
}
|
922
|
+
if (typeof actual === "string" && typeof item === "string") {
|
923
|
+
return this.assert(
|
924
|
+
actual.includes(item),
|
925
|
+
`expected #{this} to contain #{exp}`,
|
926
|
+
`expected #{this} not to contain #{exp}`,
|
927
|
+
item,
|
928
|
+
actual
|
929
|
+
);
|
930
|
+
}
|
918
931
|
if (actual != null && typeof actual !== "string")
|
919
932
|
utils.flag(this, "object", Array.from(actual));
|
920
933
|
return this.contain(item);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/expect",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.4.0",
|
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/spy": "1.
|
35
|
-
"@vitest/utils": "1.
|
34
|
+
"@vitest/spy": "1.4.0",
|
35
|
+
"@vitest/utils": "1.4.0"
|
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.
|
41
|
+
"@vitest/runner": "1.4.0"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
44
|
"build": "rimraf dist && rollup -c",
|