@vitest/expect 3.2.1 → 3.2.3
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.d.ts +7 -6
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
@@ -165,8 +165,8 @@ type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawM
|
|
165
165
|
interface ExpectStatic extends Chai.ExpectStatic, Matchers, AsymmetricMatchersContaining {
|
166
166
|
<T>(actual: T, message?: string): Assertion<T>;
|
167
167
|
extend: (expects: MatchersObject) => void;
|
168
|
-
anything: () =>
|
169
|
-
any: (constructor: unknown) =>
|
168
|
+
anything: () => any;
|
169
|
+
any: (constructor: unknown) => any;
|
170
170
|
getState: () => MatcherState;
|
171
171
|
setState: (state: Partial<MatcherState>) => void;
|
172
172
|
not: AsymmetricMatchersContaining;
|
@@ -235,7 +235,8 @@ interface AsymmetricMatchersContaining extends CustomMatcher {
|
|
235
235
|
*/
|
236
236
|
closeTo: (expected: number, precision?: number) => any;
|
237
237
|
}
|
238
|
-
type
|
238
|
+
type WithAsymmetricMatcher<T> = T | AsymmetricMatcher<unknown>;
|
239
|
+
type DeeplyAllowMatchers<T> = T extends Array<infer Element> ? WithAsymmetricMatcher<T> | DeeplyAllowMatchers<Element>[] : T extends object ? WithAsymmetricMatcher<T> | { [K in keyof T] : DeeplyAllowMatchers<T[K]> } : WithAsymmetricMatcher<T>;
|
239
240
|
interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher {
|
240
241
|
/**
|
241
242
|
* Used when you want to check that two objects have the same value.
|
@@ -244,14 +245,14 @@ interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher {
|
|
244
245
|
* @example
|
245
246
|
* expect(user).toEqual({ name: 'Alice', age: 30 });
|
246
247
|
*/
|
247
|
-
toEqual: <E>(expected:
|
248
|
+
toEqual: <E>(expected: E) => void;
|
248
249
|
/**
|
249
250
|
* Use to test that objects have the same types as well as structure.
|
250
251
|
*
|
251
252
|
* @example
|
252
253
|
* expect(user).toStrictEqual({ name: 'Alice', age: 30 });
|
253
254
|
*/
|
254
|
-
toStrictEqual: <E>(expected:
|
255
|
+
toStrictEqual: <E>(expected: E) => void;
|
255
256
|
/**
|
256
257
|
* Checks that a value is what you expect. It calls `Object.is` to compare values.
|
257
258
|
* Don't use `toBe` with floating-point numbers.
|
@@ -278,7 +279,7 @@ interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher {
|
|
278
279
|
* address: { city: 'Wonderland' }
|
279
280
|
* });
|
280
281
|
*/
|
281
|
-
toMatchObject: <E extends object | any[]>(expected:
|
282
|
+
toMatchObject: <E extends object | any[]>(expected: E) => void;
|
282
283
|
/**
|
283
284
|
* Used when you want to check that an item is in a list.
|
284
285
|
* For testing the items in the list, this uses `===`, a strict equality check.
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/expect",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.2.
|
4
|
+
"version": "3.2.3",
|
5
5
|
"description": "Jest's expect matchers as a Chai plugin",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -32,12 +32,12 @@
|
|
32
32
|
"@types/chai": "^5.2.2",
|
33
33
|
"chai": "^5.2.0",
|
34
34
|
"tinyrainbow": "^2.0.0",
|
35
|
-
"@vitest/spy": "3.2.
|
36
|
-
"@vitest/utils": "3.2.
|
35
|
+
"@vitest/spy": "3.2.3",
|
36
|
+
"@vitest/utils": "3.2.3"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"rollup-plugin-copy": "^3.5.0",
|
40
|
-
"@vitest/runner": "3.2.
|
40
|
+
"@vitest/runner": "3.2.3"
|
41
41
|
},
|
42
42
|
"scripts": {
|
43
43
|
"build": "rimraf dist && rollup -c",
|