vitest 2.0.0-beta.3 → 2.0.0-beta.6

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.
Files changed (44) hide show
  1. package/dist/browser.d.ts +5 -1
  2. package/dist/browser.js +18 -2
  3. package/dist/chunks/{integrations-globals.D0I8wu4f.js → integrations-globals.BK0Cn4q1.js} +3 -4
  4. package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.DiVMr5d4.js} +54 -24
  5. package/dist/chunks/{runtime-runBaseTests.CsxVA4nP.js → runtime-runBaseTests.C-Bkopka.js} +5 -6
  6. package/dist/cli.js +2 -2
  7. package/dist/config.d.ts +1 -1
  8. package/dist/coverage.d.ts +1 -1
  9. package/dist/environments.d.ts +1 -1
  10. package/dist/execute.d.ts +2 -2
  11. package/dist/execute.js +1 -1
  12. package/dist/index-Bp1kcIfF.d.ts +1571 -0
  13. package/dist/index.d.ts +6 -1448
  14. package/dist/index.js +3 -4
  15. package/dist/node.d.ts +2 -6
  16. package/dist/node.js +6 -6
  17. package/dist/{reporters-C-3dxOaA.d.ts → reporters-qky6mwBH.d.ts} +237 -91
  18. package/dist/reporters.d.ts +1 -1
  19. package/dist/reporters.js +4 -4
  20. package/dist/runners.d.ts +2 -1
  21. package/dist/runners.js +6 -1
  22. package/dist/{suite-V5kCKZme.d.ts → suite-B5_jYIf8.d.ts} +1 -1
  23. package/dist/suite.d.ts +2 -2
  24. package/dist/vendor/{base.CfOCwoIE.js → base.D4XK-wRp.js} +2 -2
  25. package/dist/vendor/{cac.f5m2SesE.js → cac.DDQuPgBf.js} +47 -16
  26. package/dist/vendor/{cli-api.pZNNj7LX.js → cli-api.C0OPqjkb.js} +372 -200
  27. package/dist/vendor/{constants.XmjJgDXx.js → constants.TCjCaw2D.js} +2 -1
  28. package/dist/vendor/{execute.Bwzklsfj.js → execute.BHj6OMh4.js} +2 -2
  29. package/dist/vendor/{index.DOAUPIJU.js → index.CyGfDRbW.js} +34 -14
  30. package/dist/vendor/{index.BHPXakMe.js → index.DHRpy7zp.js} +1 -1
  31. package/dist/vendor/{index.BkeKAX-R.js → index.DwR86H5i.js} +26 -3
  32. package/dist/vendor/{setup-common.6St9QHh1.js → setup-common.BhJvzjns.js} +2 -2
  33. package/dist/vendor/{utils.D5gGkwyH.js → utils.YuQ3LT2a.js} +1 -1
  34. package/dist/vendor/{vi.B31D70yH.js → vi.C6AfDXK6.js} +23 -11
  35. package/dist/vendor/{vm.rKHnSoLJ.js → vm.Ow-X2mkS.js} +2 -2
  36. package/dist/workers/forks.js +2 -2
  37. package/dist/workers/runVmTests.js +4 -5
  38. package/dist/workers/threads.js +2 -2
  39. package/dist/workers/vmForks.js +3 -3
  40. package/dist/workers/vmThreads.js +3 -3
  41. package/dist/workers.d.ts +1 -1
  42. package/dist/workers.js +4 -4
  43. package/package.json +9 -9
  44. package/dist/vendor/run-once.DLomgGUH.js +0 -27
@@ -0,0 +1,1571 @@
1
+ import { TaskPopulated, Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task as Task$1, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult as TaskResult$1, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
+ import { b as bench } from './suite-B5_jYIf8.js';
3
+ import { ExpectStatic, Assertion, AsymmetricMatchersContaining, JestAssertion } from '@vitest/expect';
4
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, u as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, v as ApiConfig, w as ArgumentsType, x as Arrayable, y as Awaitable, B as BaseCoverageOptions, z as BenchFunction, D as Benchmark, G as BenchmarkAPI, I as BenchmarkResult, K as BenchmarkUserOptions, L as BrowserConfigOptions, r as BrowserScript, N as BuiltinEnvironment, O as CSSModuleScopeStrategy, Q as CollectLineNumbers, S as CollectLines, X as Constructable, Y as Context, f as ContextRPC, Z as ContextTestEnvironment, _ as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, $ as CoverageReporter, a0 as CoverageV8Options, a1 as CustomProviderOptions, a2 as DepsOptimizationOptions, E as Environment, a3 as EnvironmentOptions, a4 as EnvironmentReturn, a5 as HappyDOMOptions, a6 as InlineConfig, a7 as JSDOMOptions, a8 as ModuleCache, a9 as ModuleGraphData, aa as MutableArray, ab as Nullable, ac as OnServerRestartHandler, ad as Pool, ae as PoolOptions, af as ProjectConfig, ag as RawErrsMap, ah as ReportContext, ai as Reporter, aj as ResolveIdFunction, R as ResolvedConfig, a as ResolvedCoverageOptions, ak as ResolvedTestEnvironment, al as RootAndTarget, am as RunnerRPC, e as RuntimeRPC, an as SerializableSpec, ao as TransformModePatterns, ap as TransformResultWithSource, aq as TscErrorInfo, ar as TypecheckConfig, U as UserConfig, as as UserConsoleLog, at as UserWorkspaceConfig, i as Vitest, au as VitestEnvironment, V as VitestRunMode, av as VmEnvironmentReturn, aw as WebSocketBrowserEvents, ax as WebSocketBrowserHandlers, ay as WebSocketBrowserRPC, az as WebSocketEvents, aA as WebSocketHandlers, aB as WebSocketRPC, g as WorkerContext, W as WorkerGlobalState, aC as WorkerRPC } from './reporters-qky6mwBH.js';
5
+ import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance, Mock, MockContext, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
6
+ import { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
7
+ import { DiffOptions } from '@vitest/utils/diff';
8
+ import * as chai from 'chai';
9
+ import { assert, should } from 'chai';
10
+ import { ErrorWithDiff, ParsedStack } from '@vitest/utils';
11
+ import { Bench, Options, Task, TaskResult } from 'tinybench';
12
+
13
+ /**
14
+ * Negates a boolean type.
15
+ */
16
+ declare type Not<T extends boolean> = T extends true ? false : true;
17
+ /**
18
+ * Checks if all the boolean types in the {@linkcode Types} array are `true`.
19
+ */
20
+ declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
21
+ /**
22
+ * Represents an equality type that returns {@linkcode Right} if
23
+ * {@linkcode Left} is `true`,
24
+ * otherwise returns the negation of {@linkcode Right}.
25
+ */
26
+ declare type Eq<Left extends boolean, Right extends boolean> = Left extends true ? Right : Not<Right>;
27
+ declare const secret: unique symbol;
28
+ declare type Secret = typeof secret;
29
+ /**
30
+ * Checks if the given type is `never`.
31
+ */
32
+ declare type IsNever<T> = [T] extends [never] ? true : false;
33
+ /**
34
+ * Checks if the given type is `any`.
35
+ */
36
+ declare type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false;
37
+ /**
38
+ * Determines if the given type is `unknown`.
39
+ */
40
+ declare type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;
41
+ /**
42
+ * Determines the printable type representation for a given type.
43
+ */
44
+ declare type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends (...args: any[]) => any ? 'function' : '...';
45
+ /**
46
+ * Subjective "useful" keys from a type. For objects it's just `keyof` but for
47
+ * tuples/arrays it's the number keys.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * UsefulKeys<{a: 1; b: 2}> // 'a' | 'b'
52
+ *
53
+ * UsefulKeys<['a', 'b']> // '0' | '1'
54
+ *
55
+ * UsefulKeys<string[]> // number
56
+ * ```
57
+ */
58
+ declare type UsefulKeys<T> = T extends any[] ? {
59
+ [K in keyof T]: K;
60
+ }[number] : keyof T;
61
+ declare type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : {
62
+ [K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
63
+ } : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
64
+ /**
65
+ * Represents a deeply branded type.
66
+ *
67
+ * Recursively walk a type and replace it with a branded type related to the
68
+ * original. This is useful for equality-checking stricter than
69
+ * `A extends B ? B extends A ? true : false : false`, because it detects the
70
+ * difference between a few edge-case types that vanilla typescript
71
+ * doesn't by default:
72
+ * - `any` vs `unknown`
73
+ * - `{ readonly a: string }` vs `{ a: string }`
74
+ * - `{ a?: string }` vs `{ a: string | undefined }`
75
+ *
76
+ * __Note__: not very performant for complex types - this should only be used
77
+ * when you know you need it. If doing an equality check, it's almost always
78
+ * better to use {@linkcode StrictEqualUsingTSInternalIdenticalToOperator}.
79
+ */
80
+ declare type DeepBrand<T> = IsNever<T> extends true ? {
81
+ type: 'never';
82
+ } : IsAny<T> extends true ? {
83
+ type: 'any';
84
+ } : IsUnknown<T> extends true ? {
85
+ type: 'unknown';
86
+ } : T extends string | number | boolean | symbol | bigint | null | undefined | void ? {
87
+ type: 'primitive';
88
+ value: T;
89
+ } : T extends new (...args: any[]) => any ? {
90
+ type: 'constructor';
91
+ params: ConstructorParams<T>;
92
+ instance: DeepBrand<InstanceType<Extract<T, new (...args: any) => any>>>;
93
+ } : T extends (...args: infer P) => infer R ? {
94
+ type: 'function';
95
+ params: DeepBrand<P>;
96
+ return: DeepBrand<R>;
97
+ this: DeepBrand<ThisParameterType<T>>;
98
+ props: DeepBrand<Omit<T, keyof Function>>;
99
+ } : T extends any[] ? {
100
+ type: 'array';
101
+ items: {
102
+ [K in keyof T]: T[K];
103
+ };
104
+ } : {
105
+ type: 'object';
106
+ properties: {
107
+ [K in keyof T]: DeepBrand<T[K]>;
108
+ };
109
+ readonly: ReadonlyKeys<T>;
110
+ required: RequiredKeys<T>;
111
+ optional: OptionalKeys<T>;
112
+ constructorParams: DeepBrand<ConstructorParams<T>>;
113
+ };
114
+ /**
115
+ * Extracts the keys from a type that are required (not optional).
116
+ */
117
+ declare type RequiredKeys<T> = Extract<{
118
+ [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
119
+ }[keyof T], keyof T>;
120
+ /**
121
+ * Gets the keys of an object type that are optional.
122
+ */
123
+ declare type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
124
+ /**
125
+ * Extracts the keys from a type that are not readonly.
126
+ */
127
+ declare type ReadonlyKeys<T> = Extract<{
128
+ [K in keyof T]-?: ReadonlyEquivalent<{
129
+ [_K in K]: T[K];
130
+ }, {
131
+ -readonly [_K in K]: T[K];
132
+ }> extends true ? never : K;
133
+ }[keyof T], keyof T>;
134
+ /**
135
+ * Determines if two types, are equivalent in a `readonly` manner.
136
+ */
137
+ declare type ReadonlyEquivalent<X, Y> = Extends<(<T>() => T extends X ? true : false), (<T>() => T extends Y ? true : false)>;
138
+ /**
139
+ * Checks if one type extends another.
140
+ */
141
+ declare type Extends<L, R> = IsNever<L> extends true ? IsNever<R> : [L] extends [R] ? true : false;
142
+ declare type ExtendsUsingBranding<L, R> = Extends<DeepBrand<L>, DeepBrand<R>>;
143
+ declare type ExtendsExcludingAnyOrNever<L, R> = IsAny<L> extends true ? IsAny<R> : Extends<L, R>;
144
+ /**
145
+ * Checks if two types are strictly equal using
146
+ * the TypeScript internal identical-to operator.
147
+ *
148
+ * @see {@link https://github.com/microsoft/TypeScript/issues/55188#issuecomment-1656328122 much history}
149
+ */
150
+ declare type StrictEqualUsingTSInternalIdenticalToOperator<L, R> = (<T>() => T extends (L & T) | T ? true : false) extends <T>() => T extends (R & T) | T ? true : false ? IsNever<L> extends IsNever<R> ? true : false : false;
151
+ /**
152
+ * Checks if two types are strictly equal using branding.
153
+ */
154
+ declare type StrictEqualUsingBranding<Left, Right> = And<[
155
+ ExtendsUsingBranding<Left, Right>,
156
+ ExtendsUsingBranding<Right, Left>
157
+ ]>;
158
+ /**
159
+ * Extracts the parameter types from a function type.
160
+ */
161
+ declare type Params<Actual> = Actual extends (...args: infer ParameterTypes) => any ? ParameterTypes : never;
162
+ /**
163
+ * Represents the constructor parameters of a class or constructor function.
164
+ * If the constructor takes no arguments, an empty array is returned.
165
+ */
166
+ declare type ConstructorParams<Actual> = Actual extends new (...args: infer P) => any ? Actual extends new () => any ? P | [] : P : never;
167
+ declare const mismatch: unique symbol;
168
+ declare type Mismatch = {
169
+ [mismatch]: 'mismatch';
170
+ };
171
+ /**
172
+ * A type which should match anything passed as a value but *doesn't*
173
+ * match {@linkcode Mismatch}. It helps TypeScript select the right overload
174
+ * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf `.toEqualTypeOf()`} and
175
+ * {@linkcode PositiveExpectTypeOf.toMatchTypeOf `.toMatchTypeOf()`}.
176
+ */
177
+ declare const avalue: unique symbol;
178
+ /**
179
+ * Represents a value that can be of various types.
180
+ */
181
+ declare type AValue = {
182
+ [avalue]?: undefined;
183
+ } | string | number | boolean | symbol | bigint | null | undefined | void;
184
+ /**
185
+ * Represents the type of mismatched arguments between
186
+ * the actual result and the expected result.
187
+ *
188
+ * If {@linkcode ActualResult} and {@linkcode ExpectedResult} are equivalent,
189
+ * the type resolves to an empty tuple `[]`, indicating no mismatch.
190
+ * If they are not equivalent, it resolves to a tuple containing the element
191
+ * {@linkcode Mismatch}, signifying a discrepancy between
192
+ * the expected and actual results.
193
+ */
194
+ declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [Mismatch];
195
+ declare const inverted: unique symbol;
196
+ declare type Inverted<T> = {
197
+ [inverted]: T;
198
+ };
199
+ declare const expectNull: unique symbol;
200
+ declare type ExpectNull<T> = {
201
+ [expectNull]: T;
202
+ result: ExtendsExcludingAnyOrNever<T, null>;
203
+ };
204
+ declare const expectUndefined: unique symbol;
205
+ declare type ExpectUndefined<T> = {
206
+ [expectUndefined]: T;
207
+ result: ExtendsExcludingAnyOrNever<T, undefined>;
208
+ };
209
+ declare const expectNumber: unique symbol;
210
+ declare type ExpectNumber<T> = {
211
+ [expectNumber]: T;
212
+ result: ExtendsExcludingAnyOrNever<T, number>;
213
+ };
214
+ declare const expectString: unique symbol;
215
+ declare type ExpectString<T> = {
216
+ [expectString]: T;
217
+ result: ExtendsExcludingAnyOrNever<T, string>;
218
+ };
219
+ declare const expectBoolean: unique symbol;
220
+ declare type ExpectBoolean<T> = {
221
+ [expectBoolean]: T;
222
+ result: ExtendsExcludingAnyOrNever<T, boolean>;
223
+ };
224
+ declare const expectVoid: unique symbol;
225
+ declare type ExpectVoid<T> = {
226
+ [expectVoid]: T;
227
+ result: ExtendsExcludingAnyOrNever<T, void>;
228
+ };
229
+ declare const expectFunction: unique symbol;
230
+ declare type ExpectFunction<T> = {
231
+ [expectFunction]: T;
232
+ result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>;
233
+ };
234
+ declare const expectObject: unique symbol;
235
+ declare type ExpectObject<T> = {
236
+ [expectObject]: T;
237
+ result: ExtendsExcludingAnyOrNever<T, object>;
238
+ };
239
+ declare const expectArray: unique symbol;
240
+ declare type ExpectArray<T> = {
241
+ [expectArray]: T;
242
+ result: ExtendsExcludingAnyOrNever<T, any[]>;
243
+ };
244
+ declare const expectSymbol: unique symbol;
245
+ declare type ExpectSymbol<T> = {
246
+ [expectSymbol]: T;
247
+ result: ExtendsExcludingAnyOrNever<T, symbol>;
248
+ };
249
+ declare const expectAny: unique symbol;
250
+ declare type ExpectAny<T> = {
251
+ [expectAny]: T;
252
+ result: IsAny<T>;
253
+ };
254
+ declare const expectUnknown: unique symbol;
255
+ declare type ExpectUnknown<T> = {
256
+ [expectUnknown]: T;
257
+ result: IsUnknown<T>;
258
+ };
259
+ declare const expectNever: unique symbol;
260
+ declare type ExpectNever<T> = {
261
+ [expectNever]: T;
262
+ result: IsNever<T>;
263
+ };
264
+ declare const expectNullable: unique symbol;
265
+ declare type ExpectNullable<T> = {
266
+ [expectNullable]: T;
267
+ result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>;
268
+ };
269
+ /**
270
+ * Represents a scolder function that checks if the result of an expecter
271
+ * matches the specified options.
272
+ */
273
+ declare type Scolder<Expecter extends {
274
+ result: boolean;
275
+ }, Options extends {
276
+ positive: boolean;
277
+ }> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>;
278
+ /**
279
+ * Represents the positive assertion methods available for type checking in the
280
+ * {@linkcode expectTypeOf()} utility.
281
+ */
282
+ interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
283
+ positive: true;
284
+ branded: false;
285
+ }> {
286
+ toEqualTypeOf: {
287
+ /**
288
+ * Uses TypeScript's internal technique to check for type "identicalness".
289
+ *
290
+ * It will check if the types are fully equal to each other.
291
+ * It will not fail if two objects have different values, but the same type.
292
+ * It will fail however if an object is missing a property.
293
+ *
294
+ * **_Unexpected failure_**? For a more permissive but less performant
295
+ * check that accommodates for equivalent intersection types,
296
+ * use {@linkcode branded `.branded.toEqualTypeOf()`}.
297
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing The documentation for details}.
298
+ *
299
+ * @example
300
+ * <caption>Using generic type argument syntax</caption>
301
+ * ```ts
302
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
303
+ *
304
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
305
+ * ```
306
+ *
307
+ * @example
308
+ * <caption>Using inferred type syntax by passing a value</caption>
309
+ * ```ts
310
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
311
+ *
312
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
313
+ * ```
314
+ *
315
+ * @param value - The value to compare against the expected type.
316
+ * @param MISMATCH - The mismatch arguments.
317
+ * @returns `true`.
318
+ */
319
+ <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
320
+ ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
321
+ /**
322
+ * Uses TypeScript's internal technique to check for type "identicalness".
323
+ *
324
+ * It will check if the types are fully equal to each other.
325
+ * It will not fail if two objects have different values, but the same type.
326
+ * It will fail however if an object is missing a property.
327
+ *
328
+ * **_Unexpected failure_**? For a more permissive but less performant
329
+ * check that accommodates for equivalent intersection types,
330
+ * use {@linkcode branded `.branded.toEqualTypeOf()`}.
331
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing The documentation for details}.
332
+ *
333
+ * @example
334
+ * <caption>Using generic type argument syntax</caption>
335
+ * ```ts
336
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
337
+ *
338
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
339
+ * ```
340
+ *
341
+ * @example
342
+ * <caption>Using inferred type syntax by passing a value</caption>
343
+ * ```ts
344
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
345
+ *
346
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
347
+ * ```
348
+ *
349
+ * @param MISMATCH - The mismatch arguments.
350
+ * @returns `true`.
351
+ */
352
+ <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
353
+ };
354
+ toMatchTypeOf: {
355
+ /**
356
+ * A less strict version of {@linkcode toEqualTypeOf `.toEqualTypeOf()`}
357
+ * that allows for extra properties.
358
+ * This is roughly equivalent to an `extends` constraint
359
+ * in a function type argument.
360
+ *
361
+ * @example
362
+ * <caption>Using generic type argument syntax</caption>
363
+ * ```ts
364
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
365
+ * ```
366
+ *
367
+ * @example
368
+ * <caption>Using inferred type syntax by passing a value</caption>
369
+ * ```ts
370
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
371
+ * ```
372
+ *
373
+ * @param value - The value to compare against the expected type.
374
+ * @param MISMATCH - The mismatch arguments.
375
+ * @returns `true`.
376
+ */
377
+ <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
378
+ ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
379
+ /**
380
+ * A less strict version of {@linkcode toEqualTypeOf `.toEqualTypeOf()`}
381
+ * that allows for extra properties.
382
+ * This is roughly equivalent to an `extends` constraint
383
+ * in a function type argument.
384
+ *
385
+ * @example
386
+ * <caption>Using generic type argument syntax</caption>
387
+ * ```ts
388
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
389
+ * ```
390
+ *
391
+ * @example
392
+ * <caption>Using inferred type syntax by passing a value</caption>
393
+ * ```ts
394
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
395
+ * ```
396
+ *
397
+ * @param MISMATCH - The mismatch arguments.
398
+ * @returns `true`.
399
+ */
400
+ <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
401
+ };
402
+ /**
403
+ * Checks whether an object has a given property.
404
+ *
405
+ * @example
406
+ * <caption>check that properties exist</caption>
407
+ * ```ts
408
+ * const obj = {a: 1, b: ''}
409
+ *
410
+ * expectTypeOf(obj).toHaveProperty('a')
411
+ *
412
+ * expectTypeOf(obj).not.toHaveProperty('c')
413
+ * ```
414
+ *
415
+ * @param key - The property key to check for.
416
+ * @param MISMATCH - The mismatch arguments.
417
+ * @returns `true`.
418
+ */
419
+ toHaveProperty: <KeyType extends keyof Actual>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, true>) => KeyType extends keyof Actual ? PositiveExpectTypeOf<Actual[KeyType]> : true;
420
+ /**
421
+ * Inverts the result of the following assertions.
422
+ *
423
+ * @example
424
+ * ```ts
425
+ * expectTypeOf({ a: 1 }).not.toMatchTypeOf({ b: 1 })
426
+ * ```
427
+ */
428
+ not: NegativeExpectTypeOf<Actual>;
429
+ /**
430
+ * Intersection types can cause issues with
431
+ * {@linkcode toEqualTypeOf `.toEqualTypeOf()`}:
432
+ * ```ts
433
+ * // ❌ The following line doesn't compile, even though the types are arguably the same.
434
+ * expectTypeOf<{ a: 1 } & { b: 2 }>().toEqualTypeOf<{ a: 1; b: 2 }>()
435
+ * ```
436
+ * This helper works around this problem by using
437
+ * a more permissive but less performant check.
438
+ *
439
+ * __Note__: This comes at a performance cost, and can cause the compiler
440
+ * to 'give up' if used with excessively deep types, so use sparingly.
441
+ *
442
+ * @see {@link https://github.com/mmkal/expect-type/pull/21 Reference}
443
+ */
444
+ branded: {
445
+ /**
446
+ * Uses TypeScript's internal technique to check for type "identicalness".
447
+ *
448
+ * It will check if the types are fully equal to each other.
449
+ * It will not fail if two objects have different values, but the same type.
450
+ * It will fail however if an object is missing a property.
451
+ *
452
+ * **_Unexpected failure_**? For a more permissive but less performant
453
+ * check that accommodates for equivalent intersection types,
454
+ * use {@linkcode PositiveExpectTypeOf.branded `.branded.toEqualTypeOf()`}.
455
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing The documentation for details}.
456
+ *
457
+ * @example
458
+ * <caption>Using generic type argument syntax</caption>
459
+ * ```ts
460
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
461
+ *
462
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
463
+ * ```
464
+ *
465
+ * @example
466
+ * <caption>Using inferred type syntax by passing a value</caption>
467
+ * ```ts
468
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
469
+ *
470
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
471
+ * ```
472
+ *
473
+ * @param MISMATCH - The mismatch arguments.
474
+ * @returns `true`.
475
+ */
476
+ toEqualTypeOf: <Expected extends StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true;
477
+ };
478
+ }
479
+ /**
480
+ * Represents the negative expectation type for the {@linkcode Actual} type.
481
+ */
482
+ interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
483
+ positive: false;
484
+ }> {
485
+ toEqualTypeOf: {
486
+ /**
487
+ * Uses TypeScript's internal technique to check for type "identicalness".
488
+ *
489
+ * It will check if the types are fully equal to each other.
490
+ * It will not fail if two objects have different values, but the same type.
491
+ * It will fail however if an object is missing a property.
492
+ *
493
+ * **_Unexpected failure_**? For a more permissive but less performant
494
+ * check that accommodates for equivalent intersection types,
495
+ * use {@linkcode PositiveExpectTypeOf.branded `.branded.toEqualTypeOf()`}.
496
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing The documentation for details}.
497
+ *
498
+ * @example
499
+ * <caption>Using generic type argument syntax</caption>
500
+ * ```ts
501
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
502
+ *
503
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
504
+ * ```
505
+ *
506
+ * @example
507
+ * <caption>Using inferred type syntax by passing a value</caption>
508
+ * ```ts
509
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
510
+ *
511
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
512
+ * ```
513
+ *
514
+ * @param value - The value to compare against the expected type.
515
+ * @param MISMATCH - The mismatch arguments.
516
+ * @returns `true`.
517
+ */
518
+ <Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
519
+ /**
520
+ * Uses TypeScript's internal technique to check for type "identicalness".
521
+ *
522
+ * It will check if the types are fully equal to each other.
523
+ * It will not fail if two objects have different values, but the same type.
524
+ * It will fail however if an object is missing a property.
525
+ *
526
+ * **_Unexpected failure_**? For a more permissive but less performant
527
+ * check that accommodates for equivalent intersection types,
528
+ * use {@linkcode PositiveExpectTypeOf.branded `.branded.toEqualTypeOf()`}.
529
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing The documentation for details}.
530
+ *
531
+ * @example
532
+ * <caption>Using generic type argument syntax</caption>
533
+ * ```ts
534
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
535
+ *
536
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
537
+ * ```
538
+ *
539
+ * @example
540
+ * <caption>Using inferred type syntax by passing a value</caption>
541
+ * ```ts
542
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
543
+ *
544
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
545
+ * ```
546
+ *
547
+ * @param MISMATCH - The mismatch arguments.
548
+ * @returns `true`.
549
+ */
550
+ <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
551
+ };
552
+ toMatchTypeOf: {
553
+ /**
554
+ * A less strict version of
555
+ * {@linkcode PositiveExpectTypeOf.toEqualTypeOf `.toEqualTypeOf()`}
556
+ * that allows for extra properties.
557
+ * This is roughly equivalent to an `extends` constraint
558
+ * in a function type argument.
559
+ *
560
+ * @example
561
+ * <caption>Using generic type argument syntax</caption>
562
+ * ```ts
563
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
564
+ * ```
565
+ *
566
+ * @example
567
+ * <caption>Using inferred type syntax by passing a value</caption>
568
+ * ```ts
569
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
570
+ * ```
571
+ *
572
+ * @param value - The value to compare against the expected type.
573
+ * @param MISMATCH - The mismatch arguments.
574
+ * @returns `true`.
575
+ */
576
+ <Expected>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
577
+ ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
578
+ /**
579
+ * A less strict version of
580
+ * {@linkcode PositiveExpectTypeOf.toEqualTypeOf `.toEqualTypeOf()`}
581
+ * that allows for extra properties.
582
+ * This is roughly equivalent to an `extends` constraint
583
+ * in a function type argument.
584
+ *
585
+ * @example
586
+ * <caption>Using generic type argument syntax</caption>
587
+ * ```ts
588
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
589
+ * ```
590
+ *
591
+ * @example
592
+ * <caption>Using inferred type syntax by passing a value</caption>
593
+ * ```ts
594
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
595
+ * ```
596
+ *
597
+ * @param MISMATCH - The mismatch arguments.
598
+ * @returns `true`.
599
+ */
600
+ <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
601
+ };
602
+ /**
603
+ * Checks whether an object has a given property.
604
+ *
605
+ * @example
606
+ * <caption>check that properties exist</caption>
607
+ * ```ts
608
+ * const obj = {a: 1, b: ''}
609
+ *
610
+ * expectTypeOf(obj).toHaveProperty('a')
611
+ *
612
+ * expectTypeOf(obj).not.toHaveProperty('c')
613
+ * ```
614
+ *
615
+ * @param key - The property key to check for.
616
+ * @param MISMATCH - The mismatch arguments.
617
+ * @returns `true`.
618
+ */
619
+ toHaveProperty: <KeyType extends string | number | symbol>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, false>) => true;
620
+ }
621
+ /**
622
+ * Represents a conditional type that selects either
623
+ * {@linkcode PositiveExpectTypeOf} or {@linkcode NegativeExpectTypeOf} based
624
+ * on the value of the `positive` property in the {@linkcode Options} type.
625
+ */
626
+ declare type ExpectTypeOf<Actual, Options extends {
627
+ positive: boolean;
628
+ }> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>;
629
+ /**
630
+ * Represents the base interface for the
631
+ * {@linkcode expectTypeOf()} function.
632
+ * Provides a set of assertion methods to perform type checks on a value.
633
+ */
634
+ interface BaseExpectTypeOf<Actual, Options extends {
635
+ positive: boolean;
636
+ }> {
637
+ /**
638
+ * Checks whether the type of the value is `any`.
639
+ */
640
+ toBeAny: Scolder<ExpectAny<Actual>, Options>;
641
+ /**
642
+ * Checks whether the type of the value is `unknown`.
643
+ */
644
+ toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>;
645
+ /**
646
+ * Checks whether the type of the value is `never`.
647
+ */
648
+ toBeNever: Scolder<ExpectNever<Actual>, Options>;
649
+ /**
650
+ * Checks whether the type of the value is `function`.
651
+ */
652
+ toBeFunction: Scolder<ExpectFunction<Actual>, Options>;
653
+ /**
654
+ * Checks whether the type of the value is `object`.
655
+ */
656
+ toBeObject: Scolder<ExpectObject<Actual>, Options>;
657
+ /**
658
+ * Checks whether the type of the value is an {@linkcode Array}.
659
+ */
660
+ toBeArray: Scolder<ExpectArray<Actual>, Options>;
661
+ /**
662
+ * Checks whether the type of the value is `number`.
663
+ */
664
+ toBeNumber: Scolder<ExpectNumber<Actual>, Options>;
665
+ /**
666
+ * Checks whether the type of the value is `string`.
667
+ */
668
+ toBeString: Scolder<ExpectString<Actual>, Options>;
669
+ /**
670
+ * Checks whether the type of the value is `boolean`.
671
+ */
672
+ toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>;
673
+ /**
674
+ * Checks whether the type of the value is `void`.
675
+ */
676
+ toBeVoid: Scolder<ExpectVoid<Actual>, Options>;
677
+ /**
678
+ * Checks whether the type of the value is `symbol`.
679
+ */
680
+ toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>;
681
+ /**
682
+ * Checks whether the type of the value is `null`.
683
+ */
684
+ toBeNull: Scolder<ExpectNull<Actual>, Options>;
685
+ /**
686
+ * Checks whether the type of the value is `undefined`.
687
+ */
688
+ toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>;
689
+ /**
690
+ * Checks whether the type of the value is `null` or `undefined`.
691
+ */
692
+ toBeNullable: Scolder<ExpectNullable<Actual>, Options>;
693
+ /**
694
+ * Checks whether a function is callable with the given parameters.
695
+ *
696
+ * __Note__: You cannot negate this assertion with
697
+ * {@linkcode PositiveExpectTypeOf.not `.not`} you need to use
698
+ * `ts-expect-error` instead.
699
+ *
700
+ * @example
701
+ * ```ts
702
+ * const f = (a: number) => [a, a]
703
+ *
704
+ * expectTypeOf(f).toBeCallableWith(1)
705
+ * ```
706
+ *
707
+ * __Known Limitation__: This assertion will likely fail if you try to use it
708
+ * with a generic function or an overload.
709
+ * @see {@link https://github.com/mmkal/expect-type/issues/50 This issue} for an example and a workaround.
710
+ *
711
+ * @param args - The arguments to check for callability.
712
+ * @returns `true`.
713
+ */
714
+ toBeCallableWith: Options['positive'] extends true ? (...args: Params<Actual>) => true : never;
715
+ /**
716
+ * Checks whether a class is constructible with the given parameters.
717
+ *
718
+ * @example
719
+ * ```ts
720
+ * expectTypeOf(Date).toBeConstructibleWith('1970')
721
+ *
722
+ * expectTypeOf(Date).toBeConstructibleWith(0)
723
+ *
724
+ * expectTypeOf(Date).toBeConstructibleWith(new Date())
725
+ *
726
+ * expectTypeOf(Date).toBeConstructibleWith()
727
+ * ```
728
+ *
729
+ * @param args - The arguments to check for constructibility.
730
+ * @returns `true`.
731
+ */
732
+ toBeConstructibleWith: Options['positive'] extends true ? (...args: ConstructorParams<Actual>) => true : never;
733
+ /**
734
+ * Equivalent to the {@linkcode Extract} utility type.
735
+ * Helps narrow down complex union types.
736
+ *
737
+ * @example
738
+ * ```ts
739
+ * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
740
+ *
741
+ * interface CSSProperties {
742
+ * margin?: string
743
+ * padding?: string
744
+ * }
745
+ *
746
+ * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
747
+ * return {}
748
+ * }
749
+ *
750
+ * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
751
+ *
752
+ * expectTypeOf(getResponsiveProp(cssProperties))
753
+ * .extract<{ xs?: any }>() // extracts the last type from a union
754
+ * .toEqualTypeOf<{
755
+ * xs?: CSSProperties
756
+ * sm?: CSSProperties
757
+ * md?: CSSProperties
758
+ * }>()
759
+ *
760
+ * expectTypeOf(getResponsiveProp(cssProperties))
761
+ * .extract<unknown[]>() // extracts an array from a union
762
+ * .toEqualTypeOf<CSSProperties[]>()
763
+ * ```
764
+ *
765
+ * __Note__: If no type is found in the union, it will return `never`.
766
+ *
767
+ * @param v - The type to extract from the union.
768
+ * @returns The type after extracting the type from the union.
769
+ */
770
+ extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
771
+ /**
772
+ * Equivalent to the {@linkcode Exclude} utility type.
773
+ * Removes types from a union.
774
+ *
775
+ * @example
776
+ * ```ts
777
+ * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
778
+ *
779
+ * interface CSSProperties {
780
+ * margin?: string
781
+ * padding?: string
782
+ * }
783
+ *
784
+ * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
785
+ * return {}
786
+ * }
787
+ *
788
+ * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
789
+ *
790
+ * expectTypeOf(getResponsiveProp(cssProperties))
791
+ * .exclude<unknown[]>()
792
+ * .exclude<{ xs?: unknown }>() // or just `.exclude<unknown[] | { xs?: unknown }>()`
793
+ * .toEqualTypeOf<CSSProperties>()
794
+ * ```
795
+ */
796
+ exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
797
+ /**
798
+ * Equivalent to the {@linkcode Pick} utility type.
799
+ * Helps select a subset of properties from an object type.
800
+ *
801
+ * @example
802
+ * ```ts
803
+ * interface Person {
804
+ * name: string
805
+ * age: number
806
+ * }
807
+ *
808
+ * expectTypeOf<Person>()
809
+ * .pick<'name'>()
810
+ * .toEqualTypeOf<{ name: string }>()
811
+ * ```
812
+ *
813
+ * @param keyToPick - The property key to pick.
814
+ * @returns The type after picking the property.
815
+ */
816
+ pick: <KeyToPick extends keyof Actual>(keyToPick?: KeyToPick) => ExpectTypeOf<Pick<Actual, KeyToPick>, Options>;
817
+ /**
818
+ * Equivalent to the {@linkcode Omit} utility type.
819
+ * Helps remove a subset of properties from an object type.
820
+ *
821
+ * @example
822
+ * ```ts
823
+ * interface Person {
824
+ * name: string
825
+ * age: number
826
+ * }
827
+ *
828
+ * expectTypeOf<Person>().omit<'name'>().toEqualTypeOf<{ age: number }>()
829
+ * ```
830
+ *
831
+ * @param keyToOmit - The property key to omit.
832
+ * @returns The type after omitting the property.
833
+ */
834
+ omit: <KeyToOmit extends keyof Actual | (PropertyKey & Record<never, never>)>(keyToOmit?: KeyToOmit) => ExpectTypeOf<Omit<Actual, KeyToOmit>, Options>;
835
+ /**
836
+ * Extracts a certain function argument with `.parameter(number)` call to
837
+ * perform other assertions on it.
838
+ *
839
+ * @example
840
+ * ```ts
841
+ * function foo(a: number, b: string) {
842
+ * return [a, b]
843
+ * }
844
+ *
845
+ * expectTypeOf(foo).parameter(0).toBeNumber()
846
+ *
847
+ * expectTypeOf(foo).parameter(1).toBeString()
848
+ * ```
849
+ *
850
+ * @param index - The index of the parameter to extract.
851
+ * @returns The extracted parameter type.
852
+ */
853
+ parameter: <Index extends keyof Params<Actual>>(index: Index) => ExpectTypeOf<Params<Actual>[Index], Options>;
854
+ /**
855
+ * Equivalent to the {@linkcode Parameters} utility type.
856
+ * Extracts function parameters to perform assertions on its value.
857
+ * Parameters are returned as an array.
858
+ *
859
+ * @example
860
+ * ```ts
861
+ * function noParam() {}
862
+ *
863
+ * function hasParam(s: string) {}
864
+ *
865
+ * expectTypeOf(noParam).parameters.toEqualTypeOf<[]>()
866
+ *
867
+ * expectTypeOf(hasParam).parameters.toEqualTypeOf<[string]>()
868
+ * ```
869
+ */
870
+ parameters: ExpectTypeOf<Params<Actual>, Options>;
871
+ /**
872
+ * Equivalent to the {@linkcode ConstructorParameters} utility type.
873
+ * Extracts constructor parameters as an array of values and
874
+ * perform assertions on them with this method.
875
+ *
876
+ * @example
877
+ * ```ts
878
+ * expectTypeOf(Date).constructorParameters.toEqualTypeOf<
879
+ * [] | [string | number | Date]
880
+ * >()
881
+ * ```
882
+ */
883
+ constructorParameters: ExpectTypeOf<ConstructorParams<Actual>, Options>;
884
+ /**
885
+ * Equivalent to the {@linkcode ThisParameterType} utility type.
886
+ * Extracts the `this` parameter of a function to
887
+ * perform assertions on its value.
888
+ *
889
+ * @example
890
+ * ```ts
891
+ * function greet(this: { name: string }, message: string) {
892
+ * return `Hello ${this.name}, here's your message: ${message}`
893
+ * }
894
+ *
895
+ * expectTypeOf(greet).thisParameter.toEqualTypeOf<{ name: string }>()
896
+ * ```
897
+ */
898
+ thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>;
899
+ /**
900
+ * Equivalent to the {@linkcode InstanceType} utility type.
901
+ * Extracts the instance type of a class to perform assertions on.
902
+ *
903
+ * @example
904
+ * ```ts
905
+ * expectTypeOf(Date).instance.toHaveProperty('toISOString')
906
+ * ```
907
+ */
908
+ instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, Options> : never;
909
+ /**
910
+ * Equivalent to the {@linkcode ReturnType} utility type.
911
+ * Extracts the return type of a function.
912
+ *
913
+ * @example
914
+ * ```ts
915
+ * expectTypeOf(() => {}).returns.toBeVoid()
916
+ *
917
+ * expectTypeOf((a: number) => [a, a]).returns.toEqualTypeOf([1, 2])
918
+ * ```
919
+ */
920
+ returns: Actual extends (...args: any[]) => infer R ? ExpectTypeOf<R, Options> : never;
921
+ /**
922
+ * Extracts resolved value of a Promise,
923
+ * so you can perform other assertions on it.
924
+ *
925
+ * @example
926
+ * ```ts
927
+ * async function asyncFunc() {
928
+ * return 123
929
+ * }
930
+ *
931
+ * expectTypeOf(asyncFunc).returns.resolves.toBeNumber()
932
+ *
933
+ * expectTypeOf(Promise.resolve('string')).resolves.toBeString()
934
+ * ```
935
+ *
936
+ * Type Equivalent:
937
+ * ```ts
938
+ * type Resolves<PromiseType> = PromiseType extends PromiseLike<infer ResolvedType>
939
+ * ? ResolvedType
940
+ * : never
941
+ * ```
942
+ */
943
+ resolves: Actual extends PromiseLike<infer ResolvedType> ? ExpectTypeOf<ResolvedType, Options> : never;
944
+ /**
945
+ * Extracts array item type to perform assertions on.
946
+ *
947
+ * @example
948
+ * ```ts
949
+ * expectTypeOf([1, 2, 3]).items.toEqualTypeOf<number>()
950
+ *
951
+ * expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf<string>()
952
+ * ```
953
+ *
954
+ * __Type Equivalent__:
955
+ * ```ts
956
+ * type Items<ArrayType> = ArrayType extends ArrayLike<infer ItemType>
957
+ * ? ItemType
958
+ * : never
959
+ * ```
960
+ */
961
+ items: Actual extends ArrayLike<infer ItemType> ? ExpectTypeOf<ItemType, Options> : never;
962
+ /**
963
+ * Extracts the type guarded by a function to perform assertions on.
964
+ *
965
+ * @example
966
+ * ```ts
967
+ * function isString(v: any): v is string {
968
+ * return typeof v === 'string'
969
+ * }
970
+ *
971
+ * expectTypeOf(isString).guards.toBeString()
972
+ * ```
973
+ */
974
+ guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
975
+ /**
976
+ * Extracts the type asserted by a function to perform assertions on.
977
+ *
978
+ * @example
979
+ * ```ts
980
+ * function assertNumber(v: any): asserts v is number {
981
+ * if (typeof v !== 'number')
982
+ * throw new TypeError('Nope !')
983
+ * }
984
+ *
985
+ * expectTypeOf(assertNumber).asserts.toBeNumber()
986
+ * ```
987
+ */
988
+ asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
989
+ }
990
+ /**
991
+ * Represents a function that allows asserting the expected type of a value.
992
+ */
993
+ declare type _ExpectTypeOf = {
994
+ /**
995
+ * Asserts the expected type of a value.
996
+ *
997
+ * @param actual - The actual value being asserted.
998
+ * @returns An object representing the expected type assertion.
999
+ */
1000
+ <Actual>(actual: Actual): ExpectTypeOf<Actual, {
1001
+ positive: true;
1002
+ branded: false;
1003
+ }>;
1004
+ /**
1005
+ * Asserts the expected type of a value without providing an actual value.
1006
+ *
1007
+ * @returns An object representing the expected type assertion.
1008
+ */
1009
+ <Actual>(): ExpectTypeOf<Actual, {
1010
+ positive: true;
1011
+ branded: false;
1012
+ }>;
1013
+ };
1014
+ /**
1015
+ * Similar to Jest's `expect`, but with type-awareness.
1016
+ * Gives you access to a number of type-matchers that let you make assertions about the
1017
+ * form of a reference or generic type parameter.
1018
+ *
1019
+ * @example
1020
+ * import {foo, bar} from '../foo'
1021
+ * import {expectTypeOf} from 'expect-type'
1022
+ *
1023
+ * test('foo types', () => {
1024
+ * // make sure `foo` has type {a: number}
1025
+ * expectTypeOf(foo).toMatchTypeOf({a: 1})
1026
+ * expectTypeOf(foo).toHaveProperty('a').toBeNumber()
1027
+ *
1028
+ * // make sure `bar` is a function taking a string:
1029
+ * expectTypeOf(bar).parameter(0).toBeString()
1030
+ * expectTypeOf(bar).returns.not.toBeAny()
1031
+ * })
1032
+ *
1033
+ * @description
1034
+ * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
1035
+ */
1036
+ declare const expectTypeOf: _ExpectTypeOf;
1037
+
1038
+ interface AssertType {
1039
+ <T>(value: T): void;
1040
+ }
1041
+ declare const assertType: AssertType;
1042
+
1043
+ interface BrowserUI {
1044
+ setCurrentFileId: (fileId: string) => void;
1045
+ setIframeViewport: (width: number, height: number) => Promise<void>;
1046
+ }
1047
+
1048
+ /**
1049
+ * This utils allows computational intensive tasks to only be ran once
1050
+ * across test reruns to improve the watch mode performance.
1051
+ *
1052
+ * Currently only works with `poolOptions.<pool>.isolate: false`
1053
+ *
1054
+ * @experimental
1055
+ */
1056
+ declare function runOnce<T>(fn: (() => T), key?: string): T;
1057
+ /**
1058
+ * Get a boolean indicates whether the task is running in the first time.
1059
+ * Could only be `false` in watch mode.
1060
+ *
1061
+ * Currently only works with `isolate: false`
1062
+ *
1063
+ * @experimental
1064
+ */
1065
+ declare function isFirstRun(): boolean;
1066
+
1067
+ declare function createExpect(test?: TaskPopulated): ExpectStatic;
1068
+ declare const globalExpect: ExpectStatic;
1069
+
1070
+ type WaitForCallback<T> = () => T | Promise<T>;
1071
+ interface WaitForOptions {
1072
+ /**
1073
+ * @description Time in ms between each check callback
1074
+ * @default 50ms
1075
+ */
1076
+ interval?: number;
1077
+ /**
1078
+ * @description Time in ms after which the throw a timeout error
1079
+ * @default 1000ms
1080
+ */
1081
+ timeout?: number;
1082
+ }
1083
+ declare function waitFor<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions): Promise<T>;
1084
+ type WaitUntilCallback<T> = () => T | Promise<T>;
1085
+ interface WaitUntilOptions extends Pick<WaitForOptions, 'interval' | 'timeout'> {
1086
+ }
1087
+ type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
1088
+ declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<Truthy<T>>;
1089
+
1090
+ type ESModuleExports = Record<string, unknown>;
1091
+ interface VitestUtils {
1092
+ /**
1093
+ * Checks if fake timers are enabled.
1094
+ */
1095
+ isFakeTimers: () => boolean;
1096
+ /**
1097
+ * This method wraps all further calls to timers until [`vi.useRealTimers()`](https://vitest.dev/api/vi#vi-userealtimers) is called.
1098
+ */
1099
+ useFakeTimers: (config?: FakeTimerInstallOpts) => VitestUtils;
1100
+ /**
1101
+ * Restores mocked timers to their original implementations. All timers that were scheduled before will be discarded.
1102
+ */
1103
+ useRealTimers: () => VitestUtils;
1104
+ /**
1105
+ * This method will call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call.
1106
+ * It will not fire any timer that was initiated during its call.
1107
+ */
1108
+ runOnlyPendingTimers: () => VitestUtils;
1109
+ /**
1110
+ * This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call, even asynchronous ones.
1111
+ * It will not fire any timer that was initiated during its call.
1112
+ */
1113
+ runOnlyPendingTimersAsync: () => Promise<VitestUtils>;
1114
+ /**
1115
+ * This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired.
1116
+ * If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
1117
+ */
1118
+ runAllTimers: () => VitestUtils;
1119
+ /**
1120
+ * This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers.
1121
+ * If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
1122
+ */
1123
+ runAllTimersAsync: () => Promise<VitestUtils>;
1124
+ /**
1125
+ * Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves.
1126
+ */
1127
+ runAllTicks: () => VitestUtils;
1128
+ /**
1129
+ * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first.
1130
+ */
1131
+ advanceTimersByTime: (ms: number) => VitestUtils;
1132
+ /**
1133
+ * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. This will include and await asynchronously set timers.
1134
+ */
1135
+ advanceTimersByTimeAsync: (ms: number) => Promise<VitestUtils>;
1136
+ /**
1137
+ * Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself.
1138
+ */
1139
+ advanceTimersToNextTimer: () => VitestUtils;
1140
+ /**
1141
+ * Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call.
1142
+ */
1143
+ advanceTimersToNextTimerAsync: () => Promise<VitestUtils>;
1144
+ /**
1145
+ * Get the number of waiting timers.
1146
+ */
1147
+ getTimerCount: () => number;
1148
+ /**
1149
+ * If fake timers are enabled, this method simulates a user changing the system clock (will affect date related API like `hrtime`, `performance.now` or `new Date()`) - however, it will not fire any timers.
1150
+ * If fake timers are not enabled, this method will only mock `Date.*` and `new Date()` calls.
1151
+ */
1152
+ setSystemTime: (time: number | string | Date) => VitestUtils;
1153
+ /**
1154
+ * Returns mocked current date that was set using `setSystemTime`. If date is not mocked the method will return `null`.
1155
+ */
1156
+ getMockedSystemTime: () => Date | null;
1157
+ /**
1158
+ * When using `vi.useFakeTimers`, `Date.now` calls are mocked. If you need to get real time in milliseconds, you can call this function.
1159
+ */
1160
+ getRealSystemTime: () => number;
1161
+ /**
1162
+ * Removes all timers that are scheduled to run. These timers will never run in the future.
1163
+ */
1164
+ clearAllTimers: () => VitestUtils;
1165
+ /**
1166
+ * Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock).
1167
+ *
1168
+ * @example
1169
+ * const cart = {
1170
+ * getApples: () => 42
1171
+ * }
1172
+ *
1173
+ * const spy = vi.spyOn(cart, 'getApples').mockReturnValue(10)
1174
+ *
1175
+ * expect(cart.getApples()).toBe(10)
1176
+ * expect(spy).toHaveBeenCalled()
1177
+ * expect(spy).toHaveReturnedWith(10)
1178
+ */
1179
+ spyOn: typeof spyOn;
1180
+ /**
1181
+ * Creates a spy on a function, though can be initiated without one. Every time a function is invoked, it stores its call arguments, returns, and instances. Also, you can manipulate its behavior with [methods](https://vitest.dev/api/mock).
1182
+ *
1183
+ * If no function is given, mock will return `undefined`, when invoked.
1184
+ *
1185
+ * @example
1186
+ * const getApples = vi.fn(() => 0)
1187
+ *
1188
+ * getApples()
1189
+ *
1190
+ * expect(getApples).toHaveBeenCalled()
1191
+ * expect(getApples).toHaveReturnedWith(0)
1192
+ *
1193
+ * getApples.mockReturnValueOnce(5)
1194
+ *
1195
+ * expect(getApples()).toBe(5)
1196
+ * expect(getApples).toHaveNthReturnedWith(2, 5)
1197
+ */
1198
+ fn: typeof fn;
1199
+ /**
1200
+ * Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out.
1201
+ *
1202
+ * This is very useful when you need to wait for some asynchronous action to complete, for example, when you start a server and need to wait for it to start.
1203
+ *
1204
+ * @example
1205
+ * const server = createServer()
1206
+ *
1207
+ * await vi.waitFor(
1208
+ * () => {
1209
+ * if (!server.isReady)
1210
+ * throw new Error('Server not started')
1211
+ *
1212
+ * console.log('Server started')
1213
+ * }, {
1214
+ * timeout: 500, // default is 1000
1215
+ * interval: 20, // default is 50
1216
+ * }
1217
+ * )
1218
+ */
1219
+ waitFor: typeof waitFor;
1220
+ /**
1221
+ * This is similar to [`vi.waitFor`](https://vitest.dev/api/vi#vi-waitfor), but if the callback throws any errors, execution is immediately interrupted and an error message is received.
1222
+ *
1223
+ * If the callback returns a falsy value, the next check will continue until a truthy value is returned. This is useful when you need to wait for something to exist before taking the next step.
1224
+ *
1225
+ * @example
1226
+ * const element = await vi.waitUntil(
1227
+ * () => document.querySelector('.element'),
1228
+ * {
1229
+ * timeout: 500, // default is 1000
1230
+ * interval: 20, // default is 50
1231
+ * }
1232
+ * )
1233
+ *
1234
+ * // do something with the element
1235
+ * expect(element.querySelector('.element-child')).toBeTruthy()
1236
+ */
1237
+ waitUntil: typeof waitUntil;
1238
+ /**
1239
+ * Run the factory before imports are evaluated. You can return a value from the factory
1240
+ * to reuse it inside your [`vi.mock`](https://vitest.dev/api/vi#vi-mock) factory and tests.
1241
+ *
1242
+ * If used with [`vi.mock`](https://vitest.dev/api/vi#vi-mock), both will be hoisted in the order they are defined in.
1243
+ */
1244
+ hoisted: <T>(factory: () => T) => T;
1245
+ /**
1246
+ * Mocks every import call to the module even if it was already statically imported.
1247
+ *
1248
+ * The call to `vi.mock` is hoisted to the top of the file, so you don't have access to variables declared in the global file scope
1249
+ * unless they are defined with [`vi.hoisted`](https://vitest.dev/api/vi#vi-hoisted) before this call.
1250
+ *
1251
+ * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
1252
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
1253
+ * @param factory Mocked module factory. The result of this function will be an exports object
1254
+ */
1255
+ mock(path: string, factory?: MockFactoryWithHelper): void;
1256
+ mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T>): void;
1257
+ /**
1258
+ * Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
1259
+ *
1260
+ * This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
1261
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
1262
+ */
1263
+ unmock(path: string): void;
1264
+ unmock(module: Promise<unknown>): void;
1265
+ /**
1266
+ * Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
1267
+ *
1268
+ * Unlike [`vi.mock`](https://vitest.dev/api/vi#vi-mock), this method will not mock statically imported modules because it is not hoisted to the top of the file.
1269
+ *
1270
+ * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
1271
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
1272
+ * @param factory Mocked module factory. The result of this function will be an exports object
1273
+ */
1274
+ doMock(path: string, factory?: MockFactoryWithHelper): void;
1275
+ doMock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T>): void;
1276
+ /**
1277
+ * Removes module from mocked registry. All subsequent calls to import will return original module.
1278
+ *
1279
+ * Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
1280
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
1281
+ */
1282
+ doUnmock(path: string): void;
1283
+ doUnmock(module: Promise<unknown>): void;
1284
+ /**
1285
+ * Imports module, bypassing all checks if it should be mocked.
1286
+ * Can be useful if you want to mock module partially.
1287
+ * @example
1288
+ * vi.mock('./example.js', async () => {
1289
+ * const axios = await vi.importActual<typeof import('./example.js')>('./example.js')
1290
+ *
1291
+ * return { ...axios, get: vi.fn() }
1292
+ * })
1293
+ * @param path Path to the module. Can be aliased, if your config supports it
1294
+ */
1295
+ importActual: <T = ESModuleExports>(path: string) => Promise<T>;
1296
+ /**
1297
+ * Imports a module with all of its properties and nested properties mocked.
1298
+ *
1299
+ * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
1300
+ * @example
1301
+ * const example = await vi.importMock<typeof import('./example.js')>('./example.js')
1302
+ * example.calc.mockReturnValue(10)
1303
+ * expect(example.calc()).toBe(10)
1304
+ * @param path Path to the module. Can be aliased, if your config supports it
1305
+ * @returns Fully mocked module
1306
+ */
1307
+ importMock: <T = ESModuleExports>(path: string) => Promise<MaybeMockedDeep<T>>;
1308
+ /**
1309
+ * Type helper for TypeScript. Just returns the object that was passed.
1310
+ *
1311
+ * When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
1312
+ * the first level values are mocked. You can pass down `{ deep: true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually is.
1313
+ * @example
1314
+ * import example from './example.js'
1315
+ * vi.mock('./example.js')
1316
+ *
1317
+ * test('1 + 1 equals 10' async () => {
1318
+ * vi.mocked(example.calc).mockReturnValue(10)
1319
+ * expect(example.calc(1, '+', 1)).toBe(10)
1320
+ * })
1321
+ * @param item Anything that can be mocked
1322
+ * @param deep If the object is deeply mocked
1323
+ * @param options If the object is partially or deeply mocked
1324
+ */
1325
+ mocked: (<T>(item: T, deep?: false) => MaybeMocked<T>) & (<T>(item: T, deep: true) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
1326
+ partial?: false;
1327
+ deep?: false;
1328
+ }) => MaybeMocked<T>) & (<T>(item: T, options: {
1329
+ partial?: false;
1330
+ deep: true;
1331
+ }) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
1332
+ partial: true;
1333
+ deep?: false;
1334
+ }) => MaybePartiallyMocked<T>) & (<T>(item: T, options: {
1335
+ partial: true;
1336
+ deep: true;
1337
+ }) => MaybePartiallyMockedDeep<T>) & (<T>(item: T) => MaybeMocked<T>);
1338
+ /**
1339
+ * Checks that a given parameter is a mock function. If you are using TypeScript, it will also narrow down its type.
1340
+ */
1341
+ isMockFunction: (fn: any) => fn is MockInstance;
1342
+ /**
1343
+ * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation.
1344
+ *
1345
+ * It is useful if you need to clean up mock between different assertions.
1346
+ */
1347
+ clearAllMocks: () => VitestUtils;
1348
+ /**
1349
+ * Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will empty `.mock` state, reset "once" implementations and force the base implementation to return `undefined` when invoked.
1350
+ *
1351
+ * This is useful when you want to completely reset a mock to the default state.
1352
+ */
1353
+ resetAllMocks: () => VitestUtils;
1354
+ /**
1355
+ * Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This will restore all original implementations.
1356
+ */
1357
+ restoreAllMocks: () => VitestUtils;
1358
+ /**
1359
+ * Makes value available on global namespace.
1360
+ * Useful, if you want to have global variables available, like `IntersectionObserver`.
1361
+ * You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option.
1362
+ */
1363
+ stubGlobal: (name: string | symbol | number, value: unknown) => VitestUtils;
1364
+ /**
1365
+ * Changes the value of `import.meta.env` and `process.env`.
1366
+ * You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
1367
+ */
1368
+ stubEnv: <T extends string>(name: T, value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string) => VitestUtils;
1369
+ /**
1370
+ * Reset the value to original value that was available before first `vi.stubGlobal` was called.
1371
+ */
1372
+ unstubAllGlobals: () => VitestUtils;
1373
+ /**
1374
+ * Reset environmental variables to the ones that were available before first `vi.stubEnv` was called.
1375
+ */
1376
+ unstubAllEnvs: () => VitestUtils;
1377
+ /**
1378
+ * Resets modules registry by clearing the cache of all modules. This allows modules to be reevaluated when reimported.
1379
+ * Top-level imports cannot be re-evaluated. Might be useful to isolate modules where local state conflicts between tests.
1380
+ *
1381
+ * This method does not reset mocks registry. To clear mocks registry, use [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock) or [`vi.doUnmock`](https://vitest.dev/api/vi#vi-dounmock).
1382
+ */
1383
+ resetModules: () => VitestUtils;
1384
+ /**
1385
+ * Wait for all imports to load. Useful, if you have a synchronous call that starts
1386
+ * importing a module that you cannot await otherwise.
1387
+ * Will also wait for new imports, started during the wait.
1388
+ */
1389
+ dynamicImportSettled: () => Promise<void>;
1390
+ /**
1391
+ * Updates runtime config. You can only change values that are used when executing tests.
1392
+ */
1393
+ setConfig: (config: RuntimeConfig) => void;
1394
+ /**
1395
+ * If config was changed with `vi.setConfig`, this will reset it to the original state.
1396
+ */
1397
+ resetConfig: () => void;
1398
+ }
1399
+ declare const vitest: VitestUtils;
1400
+ declare const vi: VitestUtils;
1401
+
1402
+ declare function getRunningMode(): "run" | "watch";
1403
+ declare function isWatchMode(): boolean;
1404
+
1405
+ /**
1406
+ * Gives access to injected context provided from the main thread.
1407
+ * This usually returns a value provided by `globalSetup` or an external library.
1408
+ */
1409
+ declare function inject<T extends keyof ProvidedContext>(key: T): ProvidedContext[T];
1410
+
1411
+ declare const index_AfterSuiteRunMeta: typeof AfterSuiteRunMeta;
1412
+ declare const index_ApiConfig: typeof ApiConfig;
1413
+ declare const index_ArgumentsType: typeof ArgumentsType;
1414
+ declare const index_Arrayable: typeof Arrayable;
1415
+ type index_AssertType = AssertType;
1416
+ declare const index_Assertion: typeof Assertion;
1417
+ declare const index_AsymmetricMatchersContaining: typeof AsymmetricMatchersContaining;
1418
+ declare const index_Awaitable: typeof Awaitable;
1419
+ declare const index_BaseCoverageOptions: typeof BaseCoverageOptions;
1420
+ declare const index_BenchFunction: typeof BenchFunction;
1421
+ declare const index_Benchmark: typeof Benchmark;
1422
+ declare const index_BenchmarkAPI: typeof BenchmarkAPI;
1423
+ declare const index_BenchmarkResult: typeof BenchmarkResult;
1424
+ declare const index_BenchmarkUserOptions: typeof BenchmarkUserOptions;
1425
+ declare const index_BrowserConfigOptions: typeof BrowserConfigOptions;
1426
+ declare const index_BrowserScript: typeof BrowserScript;
1427
+ type index_BrowserUI = BrowserUI;
1428
+ declare const index_BuiltinEnvironment: typeof BuiltinEnvironment;
1429
+ declare const index_CSSModuleScopeStrategy: typeof CSSModuleScopeStrategy;
1430
+ declare const index_CollectLineNumbers: typeof CollectLineNumbers;
1431
+ declare const index_CollectLines: typeof CollectLines;
1432
+ declare const index_Constructable: typeof Constructable;
1433
+ declare const index_Context: typeof Context;
1434
+ declare const index_ContextRPC: typeof ContextRPC;
1435
+ declare const index_ContextTestEnvironment: typeof ContextTestEnvironment;
1436
+ declare const index_CoverageIstanbulOptions: typeof CoverageIstanbulOptions;
1437
+ declare const index_CoverageOptions: typeof CoverageOptions;
1438
+ declare const index_CoverageProvider: typeof CoverageProvider;
1439
+ declare const index_CoverageProviderModule: typeof CoverageProviderModule;
1440
+ declare const index_CoverageReporter: typeof CoverageReporter;
1441
+ declare const index_CoverageV8Options: typeof CoverageV8Options;
1442
+ declare const index_Custom: typeof Custom;
1443
+ declare const index_CustomProviderOptions: typeof CustomProviderOptions;
1444
+ declare const index_DepsOptimizationOptions: typeof DepsOptimizationOptions;
1445
+ declare const index_DiffOptions: typeof DiffOptions;
1446
+ declare const index_DoneCallback: typeof DoneCallback;
1447
+ declare const index_Environment: typeof Environment;
1448
+ declare const index_EnvironmentOptions: typeof EnvironmentOptions;
1449
+ declare const index_EnvironmentReturn: typeof EnvironmentReturn;
1450
+ declare const index_ErrorWithDiff: typeof ErrorWithDiff;
1451
+ declare const index_ExpectStatic: typeof ExpectStatic;
1452
+ type index_ExpectTypeOf<Actual, Options extends {
1453
+ positive: boolean;
1454
+ }> = ExpectTypeOf<Actual, Options>;
1455
+ declare const index_ExtendedContext: typeof ExtendedContext;
1456
+ declare const index_File: typeof File;
1457
+ declare const index_HappyDOMOptions: typeof HappyDOMOptions;
1458
+ declare const index_HookCleanupCallback: typeof HookCleanupCallback;
1459
+ declare const index_HookListener: typeof HookListener;
1460
+ declare const index_InlineConfig: typeof InlineConfig;
1461
+ declare const index_JSDOMOptions: typeof JSDOMOptions;
1462
+ declare const index_JestAssertion: typeof JestAssertion;
1463
+ declare const index_Mock: typeof Mock;
1464
+ declare const index_MockContext: typeof MockContext;
1465
+ declare const index_MockInstance: typeof MockInstance;
1466
+ declare const index_Mocked: typeof Mocked;
1467
+ declare const index_MockedClass: typeof MockedClass;
1468
+ declare const index_MockedFunction: typeof MockedFunction;
1469
+ declare const index_MockedObject: typeof MockedObject;
1470
+ declare const index_ModuleCache: typeof ModuleCache;
1471
+ declare const index_ModuleGraphData: typeof ModuleGraphData;
1472
+ declare const index_MutableArray: typeof MutableArray;
1473
+ declare const index_Nullable: typeof Nullable;
1474
+ declare const index_OnServerRestartHandler: typeof OnServerRestartHandler;
1475
+ declare const index_OnTestFailedHandler: typeof OnTestFailedHandler;
1476
+ declare const index_ParsedStack: typeof ParsedStack;
1477
+ declare const index_Pool: typeof Pool;
1478
+ declare const index_PoolOptions: typeof PoolOptions;
1479
+ declare const index_ProjectConfig: typeof ProjectConfig;
1480
+ declare const index_ProvidedContext: typeof ProvidedContext;
1481
+ declare const index_RawErrsMap: typeof RawErrsMap;
1482
+ declare const index_ReportContext: typeof ReportContext;
1483
+ declare const index_Reporter: typeof Reporter;
1484
+ declare const index_ResolveIdFunction: typeof ResolveIdFunction;
1485
+ declare const index_ResolvedConfig: typeof ResolvedConfig;
1486
+ declare const index_ResolvedCoverageOptions: typeof ResolvedCoverageOptions;
1487
+ declare const index_ResolvedTestEnvironment: typeof ResolvedTestEnvironment;
1488
+ declare const index_RootAndTarget: typeof RootAndTarget;
1489
+ declare const index_RunMode: typeof RunMode;
1490
+ declare const index_RunnerRPC: typeof RunnerRPC;
1491
+ declare const index_RuntimeConfig: typeof RuntimeConfig;
1492
+ declare const index_RuntimeContext: typeof RuntimeContext;
1493
+ declare const index_RuntimeRPC: typeof RuntimeRPC;
1494
+ declare const index_SequenceHooks: typeof SequenceHooks;
1495
+ declare const index_SequenceSetupFiles: typeof SequenceSetupFiles;
1496
+ declare const index_SerializableSpec: typeof SerializableSpec;
1497
+ declare const index_SnapshotData: typeof SnapshotData;
1498
+ declare const index_SnapshotMatchOptions: typeof SnapshotMatchOptions;
1499
+ declare const index_SnapshotResult: typeof SnapshotResult;
1500
+ declare const index_SnapshotSerializer: typeof SnapshotSerializer;
1501
+ declare const index_SnapshotStateOptions: typeof SnapshotStateOptions;
1502
+ declare const index_SnapshotSummary: typeof SnapshotSummary;
1503
+ declare const index_SnapshotUpdateState: typeof SnapshotUpdateState;
1504
+ declare const index_SpyInstance: typeof SpyInstance;
1505
+ declare const index_Suite: typeof Suite;
1506
+ declare const index_SuiteAPI: typeof SuiteAPI;
1507
+ declare const index_SuiteCollector: typeof SuiteCollector;
1508
+ declare const index_SuiteFactory: typeof SuiteFactory;
1509
+ declare const index_SuiteHooks: typeof SuiteHooks;
1510
+ declare const index_TaskBase: typeof TaskBase;
1511
+ declare const index_TaskContext: typeof TaskContext;
1512
+ declare const index_TaskCustomOptions: typeof TaskCustomOptions;
1513
+ declare const index_TaskMeta: typeof TaskMeta;
1514
+ declare const index_TaskResultPack: typeof TaskResultPack;
1515
+ declare const index_TaskState: typeof TaskState;
1516
+ declare const index_Test: typeof Test;
1517
+ declare const index_TestAPI: typeof TestAPI;
1518
+ declare const index_TestContext: typeof TestContext;
1519
+ declare const index_TestFunction: typeof TestFunction;
1520
+ declare const index_TestOptions: typeof TestOptions;
1521
+ declare const index_TransformModePatterns: typeof TransformModePatterns;
1522
+ declare const index_TransformResultWithSource: typeof TransformResultWithSource;
1523
+ declare const index_TscErrorInfo: typeof TscErrorInfo;
1524
+ declare const index_TypecheckConfig: typeof TypecheckConfig;
1525
+ declare const index_UncheckedSnapshot: typeof UncheckedSnapshot;
1526
+ declare const index_UserConfig: typeof UserConfig;
1527
+ declare const index_UserConsoleLog: typeof UserConsoleLog;
1528
+ declare const index_UserWorkspaceConfig: typeof UserWorkspaceConfig;
1529
+ declare const index_Vitest: typeof Vitest;
1530
+ declare const index_VitestEnvironment: typeof VitestEnvironment;
1531
+ declare const index_VitestRunMode: typeof VitestRunMode;
1532
+ type index_VitestUtils = VitestUtils;
1533
+ declare const index_VmEnvironmentReturn: typeof VmEnvironmentReturn;
1534
+ declare const index_WebSocketBrowserEvents: typeof WebSocketBrowserEvents;
1535
+ declare const index_WebSocketBrowserHandlers: typeof WebSocketBrowserHandlers;
1536
+ declare const index_WebSocketBrowserRPC: typeof WebSocketBrowserRPC;
1537
+ declare const index_WebSocketEvents: typeof WebSocketEvents;
1538
+ declare const index_WebSocketHandlers: typeof WebSocketHandlers;
1539
+ declare const index_WebSocketRPC: typeof WebSocketRPC;
1540
+ declare const index_WorkerContext: typeof WorkerContext;
1541
+ declare const index_WorkerGlobalState: typeof WorkerGlobalState;
1542
+ declare const index_WorkerRPC: typeof WorkerRPC;
1543
+ declare const index_afterAll: typeof afterAll;
1544
+ declare const index_afterEach: typeof afterEach;
1545
+ declare const index_assert: typeof assert;
1546
+ declare const index_assertType: typeof assertType;
1547
+ declare const index_beforeAll: typeof beforeAll;
1548
+ declare const index_beforeEach: typeof beforeEach;
1549
+ declare const index_bench: typeof bench;
1550
+ declare const index_chai: typeof chai;
1551
+ declare const index_createExpect: typeof createExpect;
1552
+ declare const index_describe: typeof describe;
1553
+ declare const index_expectTypeOf: typeof expectTypeOf;
1554
+ declare const index_getRunningMode: typeof getRunningMode;
1555
+ declare const index_inject: typeof inject;
1556
+ declare const index_isFirstRun: typeof isFirstRun;
1557
+ declare const index_isWatchMode: typeof isWatchMode;
1558
+ declare const index_it: typeof it;
1559
+ declare const index_onTestFailed: typeof onTestFailed;
1560
+ declare const index_onTestFinished: typeof onTestFinished;
1561
+ declare const index_runOnce: typeof runOnce;
1562
+ declare const index_should: typeof should;
1563
+ declare const index_suite: typeof suite;
1564
+ declare const index_test: typeof test;
1565
+ declare const index_vi: typeof vi;
1566
+ declare const index_vitest: typeof vitest;
1567
+ declare namespace index {
1568
+ export { index_AfterSuiteRunMeta as AfterSuiteRunMeta, index_ApiConfig as ApiConfig, index_ArgumentsType as ArgumentsType, index_Arrayable as Arrayable, type index_AssertType as AssertType, index_Assertion as Assertion, index_AsymmetricMatchersContaining as AsymmetricMatchersContaining, index_Awaitable as Awaitable, index_BaseCoverageOptions as BaseCoverageOptions, Bench as BenchFactory, index_BenchFunction as BenchFunction, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult, index_Benchmark as Benchmark, index_BenchmarkAPI as BenchmarkAPI, index_BenchmarkResult as BenchmarkResult, index_BenchmarkUserOptions as BenchmarkUserOptions, index_BrowserConfigOptions as BrowserConfigOptions, index_BrowserScript as BrowserScript, type index_BrowserUI as BrowserUI, index_BuiltinEnvironment as BuiltinEnvironment, index_CSSModuleScopeStrategy as CSSModuleScopeStrategy, index_CollectLineNumbers as CollectLineNumbers, index_CollectLines as CollectLines, index_Constructable as Constructable, index_Context as Context, index_ContextRPC as ContextRPC, index_ContextTestEnvironment as ContextTestEnvironment, index_CoverageIstanbulOptions as CoverageIstanbulOptions, index_CoverageOptions as CoverageOptions, index_CoverageProvider as CoverageProvider, index_CoverageProviderModule as CoverageProviderModule, index_CoverageReporter as CoverageReporter, index_CoverageV8Options as CoverageV8Options, index_Custom as Custom, index_CustomProviderOptions as CustomProviderOptions, index_DepsOptimizationOptions as DepsOptimizationOptions, index_DiffOptions as DiffOptions, index_DoneCallback as DoneCallback, index_Environment as Environment, index_EnvironmentOptions as EnvironmentOptions, index_EnvironmentReturn as EnvironmentReturn, index_ErrorWithDiff as ErrorWithDiff, index_ExpectStatic as ExpectStatic, type index_ExpectTypeOf as ExpectTypeOf, index_ExtendedContext as ExtendedContext, index_File as File, index_HappyDOMOptions as HappyDOMOptions, index_HookCleanupCallback as HookCleanupCallback, index_HookListener as HookListener, index_InlineConfig as InlineConfig, index_JSDOMOptions as JSDOMOptions, index_JestAssertion as JestAssertion, index_Mock as Mock, index_MockContext as MockContext, index_MockInstance as MockInstance, index_Mocked as Mocked, index_MockedClass as MockedClass, index_MockedFunction as MockedFunction, index_MockedObject as MockedObject, index_ModuleCache as ModuleCache, index_ModuleGraphData as ModuleGraphData, index_MutableArray as MutableArray, index_Nullable as Nullable, index_OnServerRestartHandler as OnServerRestartHandler, index_OnTestFailedHandler as OnTestFailedHandler, index_ParsedStack as ParsedStack, index_Pool as Pool, index_PoolOptions as PoolOptions, index_ProjectConfig as ProjectConfig, index_ProvidedContext as ProvidedContext, index_RawErrsMap as RawErrsMap, index_ReportContext as ReportContext, index_Reporter as Reporter, index_ResolveIdFunction as ResolveIdFunction, index_ResolvedConfig as ResolvedConfig, index_ResolvedCoverageOptions as ResolvedCoverageOptions, index_ResolvedTestEnvironment as ResolvedTestEnvironment, index_RootAndTarget as RootAndTarget, index_RunMode as RunMode, index_RunnerRPC as RunnerRPC, index_RuntimeConfig as RuntimeConfig, index_RuntimeContext as RuntimeContext, index_RuntimeRPC as RuntimeRPC, index_SequenceHooks as SequenceHooks, index_SequenceSetupFiles as SequenceSetupFiles, index_SerializableSpec as SerializableSpec, index_SnapshotData as SnapshotData, index_SnapshotMatchOptions as SnapshotMatchOptions, index_SnapshotResult as SnapshotResult, index_SnapshotSerializer as SnapshotSerializer, index_SnapshotStateOptions as SnapshotStateOptions, index_SnapshotSummary as SnapshotSummary, index_SnapshotUpdateState as SnapshotUpdateState, index_SpyInstance as SpyInstance, index_Suite as Suite, index_SuiteAPI as SuiteAPI, index_SuiteCollector as SuiteCollector, index_SuiteFactory as SuiteFactory, index_SuiteHooks as SuiteHooks, Task$1 as Task, index_TaskBase as TaskBase, index_TaskContext as TaskContext, index_TaskCustomOptions as TaskCustomOptions, index_TaskMeta as TaskMeta, TaskResult$1 as TaskResult, index_TaskResultPack as TaskResultPack, index_TaskState as TaskState, index_Test as Test, index_TestAPI as TestAPI, index_TestContext as TestContext, index_TestFunction as TestFunction, index_TestOptions as TestOptions, index_TransformModePatterns as TransformModePatterns, index_TransformResultWithSource as TransformResultWithSource, index_TscErrorInfo as TscErrorInfo, index_TypecheckConfig as TypecheckConfig, index_UncheckedSnapshot as UncheckedSnapshot, index_UserConfig as UserConfig, index_UserConsoleLog as UserConsoleLog, index_UserWorkspaceConfig as UserWorkspaceConfig, index_Vitest as Vitest, index_VitestEnvironment as VitestEnvironment, index_VitestRunMode as VitestRunMode, type index_VitestUtils as VitestUtils, index_VmEnvironmentReturn as VmEnvironmentReturn, index_WebSocketBrowserEvents as WebSocketBrowserEvents, index_WebSocketBrowserHandlers as WebSocketBrowserHandlers, index_WebSocketBrowserRPC as WebSocketBrowserRPC, index_WebSocketEvents as WebSocketEvents, index_WebSocketHandlers as WebSocketHandlers, index_WebSocketRPC as WebSocketRPC, index_WorkerContext as WorkerContext, index_WorkerGlobalState as WorkerGlobalState, index_WorkerRPC as WorkerRPC, index_afterAll as afterAll, index_afterEach as afterEach, index_assert as assert, index_assertType as assertType, index_beforeAll as beforeAll, index_beforeEach as beforeEach, index_bench as bench, index_chai as chai, index_createExpect as createExpect, index_describe as describe, globalExpect as expect, index_expectTypeOf as expectTypeOf, index_getRunningMode as getRunningMode, index_inject as inject, index_isFirstRun as isFirstRun, index_isWatchMode as isWatchMode, index_it as it, index_onTestFailed as onTestFailed, index_onTestFinished as onTestFinished, index_runOnce as runOnce, index_should as should, index_suite as suite, index_test as test, index_vi as vi, index_vitest as vitest };
1569
+ }
1570
+
1571
+ export { type AssertType as A, type BrowserUI as B, type ExpectTypeOf as E, type VitestUtils as V, isFirstRun as a, inject as b, createExpect as c, vi as d, getRunningMode as e, isWatchMode as f, globalExpect as g, expectTypeOf as h, index as i, assertType as j, runOnce as r, vitest as v };