vitest 1.0.0-beta.3 → 1.0.0-beta.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.
Files changed (66) hide show
  1. package/LICENSE.md +3 -498
  2. package/dist/browser.d.ts +1 -2
  3. package/dist/browser.js +4 -4
  4. package/dist/child.js +15 -18
  5. package/dist/{chunk-api-setup.37a43981.js → chunks/api-setup.jHV5vgr2.js} +101 -39
  6. package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
  7. package/dist/chunks/integrations-globals.-pds_Gug.js +29 -0
  8. package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
  9. package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.iCAG0Yz3.js} +1 -1
  10. package/dist/cli-wrapper.js +2 -18
  11. package/dist/cli.js +21 -23
  12. package/dist/config.cjs +2 -1
  13. package/dist/config.d.ts +4 -7
  14. package/dist/config.js +2 -1
  15. package/dist/coverage.d.ts +25 -16
  16. package/dist/coverage.js +118 -49
  17. package/dist/entry-vm.js +13 -13
  18. package/dist/entry.js +14 -14
  19. package/dist/environments.d.ts +1 -2
  20. package/dist/environments.js +1 -1
  21. package/dist/execute.d.ts +2 -3
  22. package/dist/execute.js +3 -4
  23. package/dist/index.d.ts +396 -95
  24. package/dist/index.js +10 -10
  25. package/dist/node.d.ts +10 -6
  26. package/dist/node.js +17 -22
  27. package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
  28. package/dist/{reporters-1678fe04.d.ts → reporters-ANEBTnOh.d.ts} +336 -340
  29. package/dist/reporters.d.ts +1 -2
  30. package/dist/reporters.js +7 -8
  31. package/dist/runners.d.ts +1 -2
  32. package/dist/runners.js +8 -9
  33. package/dist/{suite-0579b50d.d.ts → suite-C1OmA61l.d.ts} +1 -1
  34. package/dist/suite.d.ts +2 -3
  35. package/dist/suite.js +3 -3
  36. package/dist/{vendor-benchmark.44931cfa.js → vendor/benchmark.WVm6DARl.js} +1 -1
  37. package/dist/{vendor-execute.e6e4e89b.js → vendor/execute.aMjV5C9u.js} +4 -7
  38. package/dist/vendor/global.L7JRz1qU.js +14 -0
  39. package/dist/{vendor-index.68ecee35.js → vendor/index.Npc-eff0.js} +11 -4
  40. package/dist/{vendor-index.29282562.js → vendor/index.XU72Rmy8.js} +1 -1
  41. package/dist/{vendor-index.3d079eea.js → vendor/index.h0j9y5vy.js} +5 -5
  42. package/dist/vendor/index.xL8XjTLv.js +3962 -0
  43. package/dist/vendor/loader.CU0NY2Is.js +39 -0
  44. package/dist/{vendor-node.327f8f1f.js → vendor/node.c-kzGvOB.js} +2192 -5614
  45. package/dist/{vendor-reporters.b9600369.js → vendor/reporters.1xKxm8im.js} +424 -374
  46. package/dist/{vendor-rpc.cbd8e972.js → vendor/rpc.Bl-ysZIr.js} +1 -1
  47. package/dist/{vendor-run-once.3e5ef7d7.js → vendor/run-once.X3E7xx3F.js} +1 -1
  48. package/dist/{vendor-vi.d30b47ae.js → vendor/vi.voNYQWB_.js} +35 -38
  49. package/dist/vm.js +16 -20
  50. package/dist/worker.js +16 -20
  51. package/index.cjs +5 -0
  52. package/package.json +50 -54
  53. package/dist/chunk-install-pkg.6349b322.js +0 -1740
  54. package/dist/chunk-integrations-globals.9df12d91.js +0 -29
  55. package/dist/vendor-global.97e4527c.js +0 -9
  56. package/dist/vendor-index.8efe7746.js +0 -2236
  57. package/dist/vendor-loader.9c966f23.js +0 -2089
  58. /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
  59. /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
  60. /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
  61. /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
  62. /package/dist/{vendor-date.6e993429.js → vendor/date.W90-E5kF.js} +0 -0
  63. /package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.hpEVJZPC.js} +0 -0
  64. /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
  65. /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
  66. /package/dist/{vendor-tasks.f9d75aed.js → vendor/tasks.IknbGB2n.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
2
  export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- export { b as bench } from './suite-0579b50d.js';
3
+ export { b as bench } from './suite-C1OmA61l.js';
4
4
  import { ExpectStatic } from '@vitest/expect';
5
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
- import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, k as RuntimeConfig, A as AfterSuiteRunMeta, l as UserConsoleLog, R as ResolvedConfig, m as ModuleGraphData, n as Reporter } from './reporters-1678fe04.js';
7
- export { D as ApiConfig, a4 as ArgumentsType, a3 as Arrayable, a1 as Awaitable, B as BaseCoverageOptions, ai as BenchFunction, ag as Benchmark, aj as BenchmarkAPI, ah as BenchmarkResult, af as BenchmarkUserOptions, x as BuiltinEnvironment, z as CSSModuleScopeStrategy, q as CollectLineNumbers, r as CollectLines, a6 as Constructable, u as Context, Y as ContextRPC, S as ContextTestEnvironment, ad as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ac as CoverageReporter, C as CoverageV8Options, ae as CustomProviderOptions, I as DepsOptimizationOptions, E as Environment, G as EnvironmentOptions, a8 as EnvironmentReturn, H as HappyDOMOptions, L as InlineConfig, J as JSDOMOptions, a7 as ModuleCache, a5 as MutableArray, a2 as Nullable, aa as OnServerRestartHandler, v as Pool, w as PoolOptions, P as ProjectConfig, o as RawErrsMap, ab as ReportContext, _ as ResolveIdFunction, a as ResolvedCoverageOptions, X as ResolvedTestEnvironment, t as RootAndTarget, Q as RunnerRPC, O as RuntimeRPC, K as TransformModePatterns, p as TscErrorInfo, N as TypecheckConfig, U as UserConfig, e as Vitest, y as VitestEnvironment, V as VitestRunMode, a9 as VmEnvironmentReturn, Z as WorkerContext, a0 as WorkerGlobalState, $ as WorkerRPC } from './reporters-1678fe04.js';
8
- import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
9
- export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-ANEBTnOh.js';
7
+ export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-ANEBTnOh.js';
8
+ import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
9
+ export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
11
11
  import { SnapshotResult } from '@vitest/snapshot';
12
12
  export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
@@ -24,7 +24,6 @@ import 'vite-node/client';
24
24
  import '@vitest/snapshot/manager';
25
25
  import 'vite-node/server';
26
26
  import 'node:worker_threads';
27
- import 'rollup';
28
27
  import 'node:fs';
29
28
 
30
29
  declare type Not<T extends boolean> = T extends true ? false : true;
@@ -35,6 +34,19 @@ declare type Secret = typeof secret;
35
34
  declare type IsNever<T> = [T] extends [never] ? true : false;
36
35
  declare type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false;
37
36
  declare type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;
37
+ 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' : '...';
38
+ /** Subjective "useful" keys from a type. For objects it's just `keyof` but for tuples/arrays it's the number keys
39
+ * @example
40
+ * UsefulKeys<{a: 1; b: 2}> // 'a' | 'b'
41
+ * UsefulKeys<['a', 'b']> // '0' | '1'
42
+ * UsefulKeys<string[]> // number
43
+ */
44
+ declare type UsefulKeys<T> = T extends any[] ? {
45
+ [K in keyof T]: K;
46
+ }[number] : keyof T;
47
+ 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]>> : {
48
+ [K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
49
+ } : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
38
50
  /**
39
51
  * Recursively walk a type and replace it with a branded type related to the original. This is useful for
40
52
  * equality-checking stricter than `A extends B ? B extends A ? true : false : false`, because it detects
@@ -42,6 +54,9 @@ declare type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;
42
54
  * - `any` vs `unknown`
43
55
  * - `{ readonly a: string }` vs `{ a: string }`
44
56
  * - `{ a?: string }` vs `{ a: string | undefined }`
57
+ *
58
+ * Note: not very performant for complex types - this should only be used when you know you need it. If doing
59
+ * an equality check, it's almost always better to use `StrictEqualUsingTSInternalIdenticalToOperator`.
45
60
  */
46
61
  declare type DeepBrand<T> = IsNever<T> extends true ? {
47
62
  type: 'never';
@@ -61,6 +76,7 @@ declare type DeepBrand<T> = IsNever<T> extends true ? {
61
76
  params: DeepBrand<P>;
62
77
  return: DeepBrand<R>;
63
78
  this: DeepBrand<ThisParameterType<T>>;
79
+ props: DeepBrand<Omit<T, keyof Function>>;
64
80
  } : T extends any[] ? {
65
81
  type: 'array';
66
82
  items: {
@@ -88,43 +104,162 @@ declare type ReadonlyKeys<T> = Extract<{
88
104
  }> extends true ? never : K;
89
105
  }[keyof T], keyof T>;
90
106
  declare type ReadonlyEquivalent<X, Y> = Extends<(<T>() => T extends X ? true : false), (<T>() => T extends Y ? true : false)>;
107
+ /** Returns true if `L extends R`. Explicitly checks for `never` since that can give unexpected results. */
91
108
  declare type Extends<L, R> = IsNever<L> extends true ? IsNever<R> : [L] extends [R] ? true : false;
92
- declare type StrictExtends<L, R> = Extends<DeepBrand<L>, DeepBrand<R>>;
93
- declare type StrictEqual<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;
94
- declare type Equal<Left, Right, Branded = true> = Branded extends true ? And<[StrictExtends<Left, Right>, StrictExtends<Right, Left>]> : StrictEqual<Left, Right>;
109
+ declare type ExtendsUsingBranding<L, R> = Extends<DeepBrand<L>, DeepBrand<R>>;
110
+ declare type ExtendsExcludingAnyOrNever<L, R> = IsAny<L> extends true ? IsAny<R> : Extends<L, R>;
111
+ 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;
112
+ declare type StrictEqualUsingBranding<Left, Right> = And<[
113
+ ExtendsUsingBranding<Left, Right>,
114
+ ExtendsUsingBranding<Right, Left>
115
+ ]>;
95
116
  declare type Params<Actual> = Actual extends (...args: infer P) => any ? P : never;
96
117
  declare type ConstructorParams<Actual> = Actual extends new (...args: infer P) => any ? Actual extends new () => any ? P | [] : P : never;
97
- declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [never];
98
- interface ExpectTypeOfOptions {
118
+ declare const mismatch: unique symbol;
119
+ declare type Mismatch = {
120
+ [mismatch]: 'mismatch';
121
+ };
122
+ /** A type which should match anything passed as a value but *doesn't* match `Mismatch` - helps TypeScript select the right overload for `toEqualTypeOf` and `toMatchTypeOf`. */
123
+ declare const avalue: unique symbol;
124
+ declare type AValue = {
125
+ [avalue]?: undefined;
126
+ } | string | number | boolean | symbol | bigint | null | undefined | void;
127
+ declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [Mismatch];
128
+ declare const inverted: unique symbol;
129
+ declare type Inverted<T> = {
130
+ [inverted]: T;
131
+ };
132
+ declare const expectNull: unique symbol;
133
+ declare type ExpectNull<T> = {
134
+ [expectNull]: T;
135
+ result: ExtendsExcludingAnyOrNever<T, null>;
136
+ };
137
+ declare const expectUndefined: unique symbol;
138
+ declare type ExpectUndefined<T> = {
139
+ [expectUndefined]: T;
140
+ result: ExtendsExcludingAnyOrNever<T, undefined>;
141
+ };
142
+ declare const expectNumber: unique symbol;
143
+ declare type ExpectNumber<T> = {
144
+ [expectNumber]: T;
145
+ result: ExtendsExcludingAnyOrNever<T, number>;
146
+ };
147
+ declare const expectString: unique symbol;
148
+ declare type ExpectString<T> = {
149
+ [expectString]: T;
150
+ result: ExtendsExcludingAnyOrNever<T, string>;
151
+ };
152
+ declare const expectBoolean: unique symbol;
153
+ declare type ExpectBoolean<T> = {
154
+ [expectBoolean]: T;
155
+ result: ExtendsExcludingAnyOrNever<T, boolean>;
156
+ };
157
+ declare const expectVoid: unique symbol;
158
+ declare type ExpectVoid<T> = {
159
+ [expectVoid]: T;
160
+ result: ExtendsExcludingAnyOrNever<T, void>;
161
+ };
162
+ declare const expectFunction: unique symbol;
163
+ declare type ExpectFunction<T> = {
164
+ [expectFunction]: T;
165
+ result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>;
166
+ };
167
+ declare const expectObject: unique symbol;
168
+ declare type ExpectObject<T> = {
169
+ [expectObject]: T;
170
+ result: ExtendsExcludingAnyOrNever<T, object>;
171
+ };
172
+ declare const expectArray: unique symbol;
173
+ declare type ExpectArray<T> = {
174
+ [expectArray]: T;
175
+ result: ExtendsExcludingAnyOrNever<T, any[]>;
176
+ };
177
+ declare const expectSymbol: unique symbol;
178
+ declare type ExpectSymbol<T> = {
179
+ [expectSymbol]: T;
180
+ result: ExtendsExcludingAnyOrNever<T, symbol>;
181
+ };
182
+ declare const expectAny: unique symbol;
183
+ declare type ExpectAny<T> = {
184
+ [expectAny]: T;
185
+ result: IsAny<T>;
186
+ };
187
+ declare const expectUnknown: unique symbol;
188
+ declare type ExpectUnknown<T> = {
189
+ [expectUnknown]: T;
190
+ result: IsUnknown<T>;
191
+ };
192
+ declare const expectNever: unique symbol;
193
+ declare type ExpectNever<T> = {
194
+ [expectNever]: T;
195
+ result: IsNever<T>;
196
+ };
197
+ declare const expectNullable: unique symbol;
198
+ declare type ExpectNullable<T> = {
199
+ [expectNullable]: T;
200
+ result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>;
201
+ };
202
+ declare type Scolder<Expecter extends {
203
+ result: boolean;
204
+ }, Options extends {
99
205
  positive: boolean;
100
- branded: boolean;
101
- }
102
- interface ExpectTypeOf<Actual, Options extends ExpectTypeOfOptions> {
103
- toBeAny: (...MISMATCH: MismatchArgs<IsAny<Actual>, Options['positive']>) => true;
104
- toBeUnknown: (...MISMATCH: MismatchArgs<IsUnknown<Actual>, Options['positive']>) => true;
105
- toBeNever: (...MISMATCH: MismatchArgs<IsNever<Actual>, Options['positive']>) => true;
106
- toBeFunction: (...MISMATCH: MismatchArgs<Extends<Actual, (...args: any[]) => any>, Options['positive']>) => true;
107
- toBeObject: (...MISMATCH: MismatchArgs<Extends<Actual, object>, Options['positive']>) => true;
108
- toBeArray: (...MISMATCH: MismatchArgs<Extends<Actual, any[]>, Options['positive']>) => true;
109
- toBeNumber: (...MISMATCH: MismatchArgs<Extends<Actual, number>, Options['positive']>) => true;
110
- toBeString: (...MISMATCH: MismatchArgs<Extends<Actual, string>, Options['positive']>) => true;
111
- toBeBoolean: (...MISMATCH: MismatchArgs<Extends<Actual, boolean>, Options['positive']>) => true;
112
- toBeVoid: (...MISMATCH: MismatchArgs<Extends<Actual, void>, Options['positive']>) => true;
113
- toBeSymbol: (...MISMATCH: MismatchArgs<Extends<Actual, symbol>, Options['positive']>) => true;
114
- toBeNull: (...MISMATCH: MismatchArgs<Extends<Actual, null>, Options['positive']>) => true;
115
- toBeUndefined: (...MISMATCH: MismatchArgs<Extends<Actual, undefined>, Options['positive']>) => true;
116
- toBeNullable: (...MISMATCH: MismatchArgs<Not<Equal<Actual, NonNullable<Actual>, Options['branded']>>, Options['positive']>) => true;
206
+ }> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>;
207
+ interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
208
+ positive: true;
209
+ branded: false;
210
+ }> {
211
+ toEqualTypeOf: {
212
+ <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`.
213
+ ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
214
+ <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
215
+ };
117
216
  toMatchTypeOf: {
118
- <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, Options['positive']>): true;
119
- <Expected>(expected: Expected, ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, Options['positive']>): true;
217
+ <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`.
218
+ ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
219
+ <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
120
220
  };
221
+ toHaveProperty: <K extends keyof Actual>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, true>) => K extends keyof Actual ? PositiveExpectTypeOf<Actual[K]> : true;
222
+ not: NegativeExpectTypeOf<Actual>;
223
+ branded: {
224
+ toEqualTypeOf: <Expected extends StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true;
225
+ };
226
+ }
227
+ interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
228
+ positive: false;
229
+ }> {
121
230
  toEqualTypeOf: {
122
- <Expected>(...MISMATCH: MismatchArgs<Equal<Actual, Expected, Options['branded']>, Options['positive']>): true;
123
- <Expected>(expected: Expected, ...MISMATCH: MismatchArgs<Equal<Actual, Expected, Options['branded']>, Options['positive']>): true;
231
+ <Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
232
+ <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
124
233
  };
234
+ toMatchTypeOf: {
235
+ <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`.
236
+ ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
237
+ <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
238
+ };
239
+ toHaveProperty: <K extends string | number | symbol>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, false>) => true;
240
+ }
241
+ declare type ExpectTypeOf<Actual, Options extends {
242
+ positive: boolean;
243
+ }> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>;
244
+ interface BaseExpectTypeOf<Actual, Options extends {
245
+ positive: boolean;
246
+ }> {
247
+ toBeAny: Scolder<ExpectAny<Actual>, Options>;
248
+ toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>;
249
+ toBeNever: Scolder<ExpectNever<Actual>, Options>;
250
+ toBeFunction: Scolder<ExpectFunction<Actual>, Options>;
251
+ toBeObject: Scolder<ExpectObject<Actual>, Options>;
252
+ toBeArray: Scolder<ExpectArray<Actual>, Options>;
253
+ toBeNumber: Scolder<ExpectNumber<Actual>, Options>;
254
+ toBeString: Scolder<ExpectString<Actual>, Options>;
255
+ toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>;
256
+ toBeVoid: Scolder<ExpectVoid<Actual>, Options>;
257
+ toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>;
258
+ toBeNull: Scolder<ExpectNull<Actual>, Options>;
259
+ toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>;
260
+ toBeNullable: Scolder<ExpectNullable<Actual>, Options>;
125
261
  toBeCallableWith: Options['positive'] extends true ? (...args: Params<Actual>) => true : never;
126
262
  toBeConstructibleWith: Options['positive'] extends true ? (...args: ConstructorParams<Actual>) => true : never;
127
- toHaveProperty: <K extends string>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, Options['positive']>) => K extends keyof Actual ? ExpectTypeOf<Actual[K], Options> : true;
128
263
  extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
129
264
  exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
130
265
  parameter: <K extends keyof Params<Actual>>(number: K) => ExpectTypeOf<Params<Actual>[K], Options>;
@@ -137,14 +272,6 @@ interface ExpectTypeOf<Actual, Options extends ExpectTypeOfOptions> {
137
272
  items: Actual extends ArrayLike<infer R> ? ExpectTypeOf<R, Options> : never;
138
273
  guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
139
274
  asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
140
- branded: Omit<ExpectTypeOf<Actual, {
141
- positive: Options['positive'];
142
- branded: true;
143
- }>, 'branded'>;
144
- not: Omit<ExpectTypeOf<Actual, {
145
- positive: Not<Options['positive']>;
146
- branded: Options['branded'];
147
- }>, 'not'>;
148
275
  }
149
276
  declare type _ExpectTypeOf = {
150
277
  <Actual>(actual: Actual): ExpectTypeOf<Actual, {
@@ -226,87 +353,232 @@ interface WaitUntilOptions extends Pick<WaitForOptions, 'interval' | 'timeout'>
226
353
  }
227
354
  declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<T>;
228
355
 
356
+ type ESModuleExports = Record<string, unknown>;
229
357
  interface VitestUtils {
358
+ /**
359
+ * Checks if fake timers are enabled.
360
+ */
230
361
  isFakeTimers(): boolean;
231
- useFakeTimers(config?: FakeTimerInstallOpts): this;
232
- useRealTimers(): this;
233
- runOnlyPendingTimers(): this;
234
- runOnlyPendingTimersAsync(): Promise<this>;
235
- runAllTimers(): this;
236
- runAllTimersAsync(): Promise<this>;
237
- runAllTicks(): this;
238
- advanceTimersByTime(ms: number): this;
239
- advanceTimersByTimeAsync(ms: number): Promise<this>;
240
- advanceTimersToNextTimer(): this;
241
- advanceTimersToNextTimerAsync(): Promise<this>;
362
+ /**
363
+ * This method wraps all further calls to timers until [`vi.useRealTimers()`](https://vitest.dev/api/vi#vi-userealtimers) is called.
364
+ */
365
+ useFakeTimers(config?: FakeTimerInstallOpts): VitestUtils;
366
+ /**
367
+ * Restores mocked timers to their original implementations. All timers that were scheduled before will be discarded.
368
+ */
369
+ useRealTimers(): VitestUtils;
370
+ /**
371
+ * This method will call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call.
372
+ * It will not fire any timer that was initiated during its call.
373
+ */
374
+ runOnlyPendingTimers(): VitestUtils;
375
+ /**
376
+ * This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call, even asynchronous ones.
377
+ * It will not fire any timer that was initiated during its call.
378
+ */
379
+ runOnlyPendingTimersAsync(): Promise<VitestUtils>;
380
+ /**
381
+ * This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired.
382
+ * 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)).
383
+ */
384
+ runAllTimers(): VitestUtils;
385
+ /**
386
+ * 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.
387
+ * 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)).
388
+ */
389
+ runAllTimersAsync(): Promise<VitestUtils>;
390
+ /**
391
+ * Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves.
392
+ */
393
+ runAllTicks(): VitestUtils;
394
+ /**
395
+ * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first.
396
+ */
397
+ advanceTimersByTime(ms: number): VitestUtils;
398
+ /**
399
+ * 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.
400
+ */
401
+ advanceTimersByTimeAsync(ms: number): Promise<VitestUtils>;
402
+ /**
403
+ * Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself.
404
+ */
405
+ advanceTimersToNextTimer(): VitestUtils;
406
+ /**
407
+ * Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call.
408
+ */
409
+ advanceTimersToNextTimerAsync(): Promise<VitestUtils>;
410
+ /**
411
+ * Get the number of waiting timers.
412
+ */
242
413
  getTimerCount(): number;
243
- setSystemTime(time: number | string | Date): this;
414
+ /**
415
+ * 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.
416
+ * If fake timers are not enabled, this method will only mock `Date.*` and `new Date()` calls.
417
+ */
418
+ setSystemTime(time: number | string | Date): VitestUtils;
419
+ /**
420
+ * Returns mocked current date that was set using `setSystemTime`. If date is not mocked the method will return `null`.
421
+ */
244
422
  getMockedSystemTime(): Date | null;
423
+ /**
424
+ * When using `vi.useFakeTimers`, `Date.now` calls are mocked. If you need to get real time in milliseconds, you can call this function.
425
+ */
245
426
  getRealSystemTime(): number;
246
- clearAllTimers(): this;
427
+ /**
428
+ * Removes all timers that are scheduled to run. These timers will never run in the future.
429
+ */
430
+ clearAllTimers(): VitestUtils;
431
+ /**
432
+ * 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).
433
+ *
434
+ * @example
435
+ * const cart = {
436
+ * getApples: () => 42
437
+ * }
438
+ *
439
+ * const spy = vi.spyOn(cart, 'getApples').mockReturnValue(10)
440
+ *
441
+ * expect(cart.getApples()).toBe(10)
442
+ * expect(spy).toHaveBeenCalled()
443
+ * expect(spy).toHaveReturnedWith(10)
444
+ */
247
445
  spyOn: typeof spyOn;
446
+ /**
447
+ * 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).
448
+ *
449
+ * If no function is given, mock will return `undefined`, when invoked.
450
+ *
451
+ * @example
452
+ * const getApples = vi.fn(() => 0)
453
+ *
454
+ * getApples()
455
+ *
456
+ * expect(getApples).toHaveBeenCalled()
457
+ * expect(getApples).toHaveReturnedWith(0)
458
+ *
459
+ * getApples.mockReturnValueOnce(5)
460
+ *
461
+ * expect(getApples()).toBe(5)
462
+ * expect(getApples).toHaveNthReturnedWith(2, 5)
463
+ */
248
464
  fn: typeof fn;
465
+ /**
466
+ * 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.
467
+ *
468
+ * 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.
469
+ *
470
+ * @example
471
+ * const server = createServer()
472
+ *
473
+ * await vi.waitFor(
474
+ * () => {
475
+ * if (!server.isReady)
476
+ * throw new Error('Server not started')
477
+ *
478
+ * console.log('Server started')
479
+ * }, {
480
+ * timeout: 500, // default is 1000
481
+ * interval: 20, // default is 50
482
+ * }
483
+ * )
484
+ */
249
485
  waitFor: typeof waitFor;
486
+ /**
487
+ * 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.
488
+ *
489
+ * 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.
490
+ *
491
+ * @example
492
+ * const element = await vi.waitUntil(
493
+ * () => document.querySelector('.element'),
494
+ * {
495
+ * timeout: 500, // default is 1000
496
+ * interval: 20, // default is 50
497
+ * }
498
+ * )
499
+ *
500
+ * // do something with the element
501
+ * expect(element.querySelector('.element-child')).toBeTruthy()
502
+ */
250
503
  waitUntil: typeof waitUntil;
251
504
  /**
252
505
  * Run the factory before imports are evaluated. You can return a value from the factory
253
- * to reuse it inside your `vi.mock` factory and tests.
506
+ * to reuse it inside your [`vi.mock`](https://vitest.dev/api/vi#vi-mock) factory and tests.
507
+ *
508
+ * If used with [`vi.mock`](https://vitest.dev/api/vi#vi-mock), both will be hoisted in the order they are defined in.
254
509
  */
255
510
  hoisted<T>(factory: () => T): T;
256
511
  /**
257
- * Makes all `imports` to passed module to be mocked.
258
- * - If there is a factory, will return it's result. The call to `vi.mock` is hoisted to the top of the file,
259
- * so you don't have access to variables declared in the global file scope, if you didn't put them before imports!
260
- * - If `__mocks__` folder with file of the same name exist, all imports will
261
- * return it.
262
- * - If there is no `__mocks__` folder or a file with the same name inside, will call original
263
- * module and mock it.
264
- * @param path Path to the module. Can be aliased, if your config supports it
265
- * @param factory Factory for the mocked module. Has the highest priority.
512
+ * Mocks every import call to the module even if it was already statically imported.
513
+ *
514
+ * 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
515
+ * unless they are defined with [`vi.hoisted`](https://vitest.dev/api/vi#vi-hoisted) before this call.
516
+ *
517
+ * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
518
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
519
+ * @param factory Mocked module factory. The result of this function will be an exports object
266
520
  */
267
521
  mock(path: string, factory?: MockFactoryWithHelper): void;
268
522
  /**
269
- * Removes module from mocked registry. All subsequent calls to import will
270
- * return original module even if it was mocked.
271
- * @param path Path to the module. Can be aliased, if your config supports it
523
+ * Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
524
+ *
525
+ * This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
526
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
272
527
  */
273
528
  unmock(path: string): void;
274
- doMock(path: string, factory?: () => any): void;
529
+ /**
530
+ * Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
531
+ *
532
+ * 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.
533
+ *
534
+ * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
535
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
536
+ * @param factory Mocked module factory. The result of this function will be an exports object
537
+ */
538
+ doMock(path: string, factory?: MockFactoryWithHelper): void;
539
+ /**
540
+ * Removes module from mocked registry. All subsequent calls to import will return original module.
541
+ *
542
+ * Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
543
+ * @param path Path to the module. Can be aliased, if your Vitest config supports it
544
+ */
275
545
  doUnmock(path: string): void;
276
546
  /**
277
547
  * Imports module, bypassing all checks if it should be mocked.
278
548
  * Can be useful if you want to mock module partially.
279
549
  * @example
280
- * vi.mock('./example', async () => {
281
- * const axios = await vi.importActual('./example')
550
+ * vi.mock('./example.js', async () => {
551
+ * const axios = await vi.importActual<typeof import('./example.js')>('./example.js')
282
552
  *
283
553
  * return { ...axios, get: vi.fn() }
284
554
  * })
285
555
  * @param path Path to the module. Can be aliased, if your config supports it
286
- * @returns Actual module without spies
287
556
  */
288
- importActual<T = unknown>(path: string): Promise<T>;
557
+ importActual<T = ESModuleExports>(path: string): Promise<T>;
289
558
  /**
290
559
  * Imports a module with all of its properties and nested properties mocked.
291
- * For the rules applied, see docs.
560
+ *
561
+ * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
562
+ * @example
563
+ * const example = await vi.importMock<typeof import('./example.js')>('./example.js')
564
+ * example.calc.mockReturnValue(10)
565
+ * expect(example.calc()).toBe(10)
292
566
  * @param path Path to the module. Can be aliased, if your config supports it
293
567
  * @returns Fully mocked module
294
568
  */
295
- importMock<T>(path: string): Promise<MaybeMockedDeep<T>>;
569
+ importMock<T = ESModuleExports>(path: string): Promise<MaybeMockedDeep<T>>;
296
570
  /**
297
- * Type helpers for TypeScript. In reality just returns the object that was passed.
571
+ * Type helper for TypeScript. Just returns the object that was passed.
298
572
  *
299
- * When `partial` is `true` it will expect a `Partial<T>` as a return value.
573
+ * When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
574
+ * 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.
300
575
  * @example
301
- * import example from './example'
302
- * vi.mock('./example')
303
- *
304
- * test('1+1 equals 2' async () => {
305
- * vi.mocked(example.calc).mockRestore()
576
+ * import example from './example.js'
577
+ * vi.mock('./example.js')
306
578
  *
307
- * const res = example.calc(1, '+', 1)
308
- *
309
- * expect(res).toBe(2)
579
+ * test('1 + 1 equals 10' async () => {
580
+ * vi.mocked(example.calc).mockReturnValue(10)
581
+ * expect(example.calc(1, '+', 1)).toBe(10)
310
582
  * })
311
583
  * @param item Anything that can be mocked
312
584
  * @param deep If the object is deeply mocked
@@ -331,30 +603,52 @@ interface VitestUtils {
331
603
  deep: true;
332
604
  }): MaybePartiallyMockedDeep<T>;
333
605
  mocked<T>(item: T): MaybeMocked<T>;
334
- isMockFunction(fn: any): fn is EnhancedSpy;
335
- clearAllMocks(): this;
336
- resetAllMocks(): this;
337
- restoreAllMocks(): this;
606
+ /**
607
+ * Checks that a given parameter is a mock function. If you are using TypeScript, it will also narrow down its type.
608
+ */
609
+ isMockFunction(fn: any): fn is MockInstance;
610
+ /**
611
+ * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation.
612
+ *
613
+ * It is useful if you need to clean up mock between different assertions.
614
+ */
615
+ clearAllMocks(): VitestUtils;
616
+ /**
617
+ * 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.
618
+ *
619
+ * This is useful when you want to completely reset a mock to the default state.
620
+ */
621
+ resetAllMocks(): VitestUtils;
622
+ /**
623
+ * Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This will restore all original implementations.
624
+ */
625
+ restoreAllMocks(): VitestUtils;
338
626
  /**
339
627
  * Makes value available on global namespace.
340
628
  * Useful, if you want to have global variables available, like `IntersectionObserver`.
341
629
  * You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option.
342
630
  */
343
- stubGlobal(name: string | symbol | number, value: unknown): this;
631
+ stubGlobal(name: string | symbol | number, value: unknown): VitestUtils;
344
632
  /**
345
633
  * Changes the value of `import.meta.env` and `process.env`.
346
634
  * You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
347
635
  */
348
- stubEnv(name: string, value: string): this;
636
+ stubEnv(name: string, value: string): VitestUtils;
349
637
  /**
350
638
  * Reset the value to original value that was available before first `vi.stubGlobal` was called.
351
639
  */
352
- unstubAllGlobals(): this;
640
+ unstubAllGlobals(): VitestUtils;
353
641
  /**
354
642
  * Reset environmental variables to the ones that were available before first `vi.stubEnv` was called.
355
643
  */
356
- unstubAllEnvs(): this;
357
- resetModules(): this;
644
+ unstubAllEnvs(): VitestUtils;
645
+ /**
646
+ * Resets modules registry by clearing the cache of all modules. This allows modules to be reevaluated when reimported.
647
+ * Top-level imports cannot be re-evaluated. Might be useful to isolate modules where local state conflicts between tests.
648
+ *
649
+ * 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).
650
+ */
651
+ resetModules(): VitestUtils;
358
652
  /**
359
653
  * Wait for all imports to load. Useful, if you have a synchronous call that starts
360
654
  * importing a module that you cannot await otherwise.
@@ -373,9 +667,15 @@ interface VitestUtils {
373
667
  declare const vitest: VitestUtils;
374
668
  declare const vi: VitestUtils;
375
669
 
376
- declare function getRunningMode(): "watch" | "run";
670
+ declare function getRunningMode(): "run" | "watch";
377
671
  declare function isWatchMode(): boolean;
378
672
 
673
+ /**
674
+ * Gives access to injected context provided from the main thread.
675
+ * This usually returns a value provided by `globalSetup` or an external library.
676
+ */
677
+ declare function inject<T extends keyof ProvidedContext>(key: T): ProvidedContext[T];
678
+
379
679
  interface TransformResultWithSource extends TransformResult {
380
680
  source?: string;
381
681
  }
@@ -403,9 +703,10 @@ interface WebSocketHandlers {
403
703
  snapshotSaved(snapshot: SnapshotResult): void;
404
704
  rerun(files: string[]): Promise<void>;
405
705
  updateSnapshot(file?: File): Promise<void>;
706
+ getProvidedContext(): ProvidedContext;
406
707
  }
407
708
  interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog' | 'onPathsCollected'> {
408
709
  onCancel(reason: CancelReason): void;
409
710
  }
410
711
 
411
- export { AfterSuiteRunMeta, type AssertType, type ExpectTypeOf, ModuleGraphData, Reporter, ResolvedConfig, RuntimeConfig, type TransformResultWithSource, UserConsoleLog, type VitestUtils, type WebSocketEvents, type WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, isFirstRun, isWatchMode, runOnce, vi, vitest };
712
+ export { AfterSuiteRunMeta, type AssertType, type ExpectTypeOf, ModuleGraphData, ProvidedContext, Reporter, ResolvedConfig, RuntimeConfig, type TransformResultWithSource, UserConsoleLog, type VitestUtils, type WebSocketEvents, type WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };