@vitest/expect
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -888,6 +888,10 @@ import { getType, getColors, stringify, isObject, assertTypes } from '@vitest/utils'; | ||
def("toMatch", function(expected) { | ||
if (typeof expected === "string") | ||
return this.include(expected); | ||
else | ||
return this.match(expected); | ||
const actual = this._obj; | ||
return this.assert( | ||
typeof expected === "string" ? actual.includes(expected) : actual.match(expected), | ||
`expected #{this} to match #{exp}`, | ||
`expected #{this} not to match #{exp}`, | ||
expected, | ||
actual | ||
); | ||
}); | ||
@@ -919,2 +923,11 @@ def("toContain", function(item) { | ||
} | ||
if (typeof actual === "string" && typeof item === "string") { | ||
return this.assert( | ||
actual.includes(item), | ||
`expected #{this} to contain #{exp}`, | ||
`expected #{this} not to contain #{exp}`, | ||
item, | ||
actual | ||
); | ||
} | ||
if (actual != null && typeof actual !== "string") | ||
@@ -921,0 +934,0 @@ utils.flag(this, "object", Array.from(actual)); |
{ | ||
"name": "@vitest/expect", | ||
"type": "module", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Jest's expect matchers as a Chai plugin", | ||
@@ -34,4 +34,4 @@ "license": "MIT", | ||
"chai": "^4.3.10", | ||
"@vitest/spy": "1.3.1", | ||
"@vitest/utils": "1.3.1" | ||
"@vitest/spy": "1.4.0", | ||
"@vitest/utils": "1.4.0" | ||
}, | ||
@@ -42,3 +42,3 @@ "devDependencies": { | ||
"rollup-plugin-copy": "^3.5.0", | ||
"@vitest/runner": "1.3.1" | ||
"@vitest/runner": "1.4.0" | ||
}, | ||
@@ -45,0 +45,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139502
1795
+ Added@vitest/spy@1.4.0(transitive)
+ Added@vitest/utils@1.4.0(transitive)
- Removed@vitest/spy@1.3.1(transitive)
- Removed@vitest/utils@1.3.1(transitive)
Updated@vitest/spy@1.4.0
Updated@vitest/utils@1.4.0