vitest 1.0.0-beta.4 → 1.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 (66) hide show
  1. package/LICENSE.md +1 -513
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +4 -4
  4. package/dist/child.js +13 -17
  5. package/dist/{chunk-api-setup.6d19ab38.js → chunks/api-setup.jHV5vgr2.js} +97 -39
  6. package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
  7. package/dist/chunks/integrations-globals.eip0xL77.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.hf2msWA9.js} +1 -1
  10. package/dist/cli-wrapper.js +2 -18
  11. package/dist/cli.js +19 -24
  12. package/dist/config.cjs +1 -1
  13. package/dist/config.d.ts +4 -6
  14. package/dist/config.js +1 -1
  15. package/dist/coverage.d.ts +25 -15
  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 -1
  20. package/dist/environments.js +1 -1
  21. package/dist/execute.d.ts +1 -1
  22. package/dist/execute.js +3 -3
  23. package/dist/index.d.ts +168 -39
  24. package/dist/index.js +10 -10
  25. package/dist/node.d.ts +5 -5
  26. package/dist/node.js +17 -22
  27. package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
  28. package/dist/{reporters-50c2bd49.d.ts → reporters-vMlHjCdM.d.ts} +335 -365
  29. package/dist/reporters.d.ts +1 -1
  30. package/dist/reporters.js +7 -8
  31. package/dist/runners.d.ts +1 -1
  32. package/dist/runners.js +8 -8
  33. package/dist/{suite-ad69b7cd.d.ts → suite-vfxzpeqE.d.ts} +1 -1
  34. package/dist/suite.d.ts +2 -2
  35. package/dist/suite.js +3 -3
  36. package/dist/{vendor-benchmark.b6befc50.js → vendor/benchmark.WVm6DARl.js} +1 -1
  37. package/dist/{vendor-date.6e993429.js → vendor/date.Ns1pGd_X.js} +1 -0
  38. package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.ewIbzajW.js} +2 -1
  39. package/dist/{vendor-execute.157302d6.js → vendor/execute.aMjV5C9u.js} +2 -4
  40. package/dist/{vendor-index.72df742e.js → vendor/index.VL3WbvjT.js} +4 -4
  41. package/dist/{vendor-index.2b92937b.js → vendor/index.XU72Rmy8.js} +1 -1
  42. package/dist/{vendor-index.57925a34.js → vendor/index.h0j9y5vy.js} +5 -5
  43. package/dist/vendor/index.xL8XjTLv.js +3962 -0
  44. package/dist/vendor/loader.-JDdZ5RJ.js +39 -0
  45. package/dist/{vendor-node.65461b16.js → vendor/node.1xm0UoNi.js} +1904 -5957
  46. package/dist/{vendor-reporters.d24d80a4.js → vendor/reporters.pr8MinP9.js} +429 -377
  47. package/dist/{vendor-rpc.171f65fb.js → vendor/rpc.Bl-ysZIr.js} +1 -1
  48. package/dist/{vendor-run-once.fb836747.js → vendor/run-once.X3E7xx3F.js} +1 -1
  49. package/dist/{vendor-vi.3baa7c4a.js → vendor/vi.JXuS6emb.js} +4 -4
  50. package/dist/vm.js +13 -18
  51. package/dist/worker.js +13 -18
  52. package/import-meta.d.ts +5 -0
  53. package/index.cjs +5 -0
  54. package/package.json +52 -53
  55. package/dist/chunk-install-pkg.e1d6323e.js +0 -1740
  56. package/dist/chunk-integrations-globals.2b099e04.js +0 -29
  57. package/dist/vendor-index.8efe7746.js +0 -2236
  58. package/dist/vendor-loader.9c966f23.js +0 -2089
  59. /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
  60. /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
  61. /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
  62. /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
  63. /package/dist/{vendor-global.c3664e75.js → vendor/global.L7JRz1qU.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,10 +1,10 @@
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-ad69b7cd.js';
3
+ export { b as bench } from './suite-vfxzpeqE.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, l as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, m as UserConsoleLog, R as ResolvedConfig, n as ModuleGraphData, o as Reporter } from './reporters-50c2bd49.js';
7
- export { G as ApiConfig, a5 as ArgumentsType, a4 as Arrayable, a2 as Awaitable, B as BaseCoverageOptions, aj as BenchFunction, ah as Benchmark, ak as BenchmarkAPI, ai as BenchmarkResult, ag as BenchmarkUserOptions, y as BuiltinEnvironment, D as CSSModuleScopeStrategy, r as CollectLineNumbers, t as CollectLines, a7 as Constructable, v as Context, Z as ContextRPC, X as ContextTestEnvironment, ae as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ad as CoverageReporter, C as CoverageV8Options, af as CustomProviderOptions, K as DepsOptimizationOptions, E as Environment, I as EnvironmentOptions, a9 as EnvironmentReturn, H as HappyDOMOptions, N as InlineConfig, J as JSDOMOptions, a8 as ModuleCache, a6 as MutableArray, a3 as Nullable, ab as OnServerRestartHandler, w as Pool, x as PoolOptions, P as ProjectConfig, p as RawErrsMap, ac as ReportContext, $ as ResolveIdFunction, a as ResolvedCoverageOptions, Y as ResolvedTestEnvironment, u as RootAndTarget, S as RunnerRPC, Q as RuntimeRPC, L as TransformModePatterns, q as TscErrorInfo, O as TypecheckConfig, U as UserConfig, e as Vitest, z as VitestEnvironment, V as VitestRunMode, aa as VmEnvironmentReturn, _ as WorkerContext, a1 as WorkerGlobalState, a0 as WorkerRPC } from './reporters-50c2bd49.js';
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-vMlHjCdM.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-vMlHjCdM.js';
8
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
9
9
  export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
@@ -34,6 +34,19 @@ declare type Secret = typeof secret;
34
34
  declare type IsNever<T> = [T] extends [never] ? true : false;
35
35
  declare type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false;
36
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>>}`;
37
50
  /**
38
51
  * Recursively walk a type and replace it with a branded type related to the original. This is useful for
39
52
  * equality-checking stricter than `A extends B ? B extends A ? true : false : false`, because it detects
@@ -41,6 +54,9 @@ declare type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;
41
54
  * - `any` vs `unknown`
42
55
  * - `{ readonly a: string }` vs `{ a: string }`
43
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`.
44
60
  */
45
61
  declare type DeepBrand<T> = IsNever<T> extends true ? {
46
62
  type: 'never';
@@ -60,6 +76,7 @@ declare type DeepBrand<T> = IsNever<T> extends true ? {
60
76
  params: DeepBrand<P>;
61
77
  return: DeepBrand<R>;
62
78
  this: DeepBrand<ThisParameterType<T>>;
79
+ props: DeepBrand<Omit<T, keyof Function>>;
63
80
  } : T extends any[] ? {
64
81
  type: 'array';
65
82
  items: {
@@ -87,43 +104,162 @@ declare type ReadonlyKeys<T> = Extract<{
87
104
  }> extends true ? never : K;
88
105
  }[keyof T], keyof T>;
89
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. */
90
108
  declare type Extends<L, R> = IsNever<L> extends true ? IsNever<R> : [L] extends [R] ? true : false;
91
- declare type StrictExtends<L, R> = Extends<DeepBrand<L>, DeepBrand<R>>;
92
- 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;
93
- 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
+ ]>;
94
116
  declare type Params<Actual> = Actual extends (...args: infer P) => any ? P : never;
95
117
  declare type ConstructorParams<Actual> = Actual extends new (...args: infer P) => any ? Actual extends new () => any ? P | [] : P : never;
96
- declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [never];
97
- 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 {
98
205
  positive: boolean;
99
- branded: boolean;
100
- }
101
- interface ExpectTypeOf<Actual, Options extends ExpectTypeOfOptions> {
102
- toBeAny: (...MISMATCH: MismatchArgs<IsAny<Actual>, Options['positive']>) => true;
103
- toBeUnknown: (...MISMATCH: MismatchArgs<IsUnknown<Actual>, Options['positive']>) => true;
104
- toBeNever: (...MISMATCH: MismatchArgs<IsNever<Actual>, Options['positive']>) => true;
105
- toBeFunction: (...MISMATCH: MismatchArgs<Extends<Actual, (...args: any[]) => any>, Options['positive']>) => true;
106
- toBeObject: (...MISMATCH: MismatchArgs<Extends<Actual, object>, Options['positive']>) => true;
107
- toBeArray: (...MISMATCH: MismatchArgs<Extends<Actual, any[]>, Options['positive']>) => true;
108
- toBeNumber: (...MISMATCH: MismatchArgs<Extends<Actual, number>, Options['positive']>) => true;
109
- toBeString: (...MISMATCH: MismatchArgs<Extends<Actual, string>, Options['positive']>) => true;
110
- toBeBoolean: (...MISMATCH: MismatchArgs<Extends<Actual, boolean>, Options['positive']>) => true;
111
- toBeVoid: (...MISMATCH: MismatchArgs<Extends<Actual, void>, Options['positive']>) => true;
112
- toBeSymbol: (...MISMATCH: MismatchArgs<Extends<Actual, symbol>, Options['positive']>) => true;
113
- toBeNull: (...MISMATCH: MismatchArgs<Extends<Actual, null>, Options['positive']>) => true;
114
- toBeUndefined: (...MISMATCH: MismatchArgs<Extends<Actual, undefined>, Options['positive']>) => true;
115
- 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
+ };
116
216
  toMatchTypeOf: {
117
- <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, Options['positive']>): true;
118
- <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;
119
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
+ }> {
120
230
  toEqualTypeOf: {
121
- <Expected>(...MISMATCH: MismatchArgs<Equal<Actual, Expected, Options['branded']>, Options['positive']>): true;
122
- <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;
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;
123
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>;
124
261
  toBeCallableWith: Options['positive'] extends true ? (...args: Params<Actual>) => true : never;
125
262
  toBeConstructibleWith: Options['positive'] extends true ? (...args: ConstructorParams<Actual>) => true : never;
126
- toHaveProperty: <K extends string>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, Options['positive']>) => K extends keyof Actual ? ExpectTypeOf<Actual[K], Options> : true;
127
263
  extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
128
264
  exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
129
265
  parameter: <K extends keyof Params<Actual>>(number: K) => ExpectTypeOf<Params<Actual>[K], Options>;
@@ -136,14 +272,6 @@ interface ExpectTypeOf<Actual, Options extends ExpectTypeOfOptions> {
136
272
  items: Actual extends ArrayLike<infer R> ? ExpectTypeOf<R, Options> : never;
137
273
  guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
138
274
  asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
139
- branded: Omit<ExpectTypeOf<Actual, {
140
- positive: Options['positive'];
141
- branded: true;
142
- }>, 'branded'>;
143
- not: Omit<ExpectTypeOf<Actual, {
144
- positive: Not<Options['positive']>;
145
- branded: Options['branded'];
146
- }>, 'not'>;
147
275
  }
148
276
  declare type _ExpectTypeOf = {
149
277
  <Actual>(actual: Actual): ExpectTypeOf<Actual, {
@@ -223,7 +351,8 @@ declare function waitFor<T>(callback: WaitForCallback<T>, options?: number | Wai
223
351
  type WaitUntilCallback<T> = () => T | Promise<T>;
224
352
  interface WaitUntilOptions extends Pick<WaitForOptions, 'interval' | 'timeout'> {
225
353
  }
226
- declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<T>;
354
+ type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
355
+ declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<Truthy<T>>;
227
356
 
228
357
  type ESModuleExports = Record<string, unknown>;
229
358
  interface VitestUtils {
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- export { b as bench } from './vendor-benchmark.b6befc50.js';
3
- export { i as isFirstRun, r as runOnce } from './vendor-run-once.fb836747.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor-vi.3baa7c4a.js';
5
- import { d as dist } from './vendor-index.72df742e.js';
6
- export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor-index.72df742e.js';
2
+ export { b as bench } from './vendor/benchmark.WVm6DARl.js';
3
+ export { i as isFirstRun, r as runOnce } from './vendor/run-once.X3E7xx3F.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.JXuS6emb.js';
5
+ import { d as dist } from './vendor/index.VL3WbvjT.js';
6
+ export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.VL3WbvjT.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
10
10
  import '@vitest/runner/utils';
11
11
  import '@vitest/utils';
12
- import './vendor-index.2b92937b.js';
12
+ import './vendor/index.XU72Rmy8.js';
13
13
  import 'pathe';
14
14
  import 'std-env';
15
- import './vendor-global.c3664e75.js';
16
- import './vendor-_commonjsHelpers.7d1333e8.js';
15
+ import './vendor/global.L7JRz1qU.js';
16
+ import './vendor/_commonjsHelpers.jjO7Zipk.js';
17
17
  import '@vitest/expect';
18
18
  import '@vitest/snapshot';
19
19
  import '@vitest/utils/error';
20
- import './vendor-tasks.f9d75aed.js';
20
+ import './vendor/tasks.IknbGB2n.js';
21
21
  import '@vitest/utils/source-map';
22
- import './vendor-date.6e993429.js';
22
+ import './vendor/date.Ns1pGd_X.js';
23
23
  import '@vitest/spy';
24
24
 
25
25
 
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, T as TestSequencer, W as WorkspaceSpec } from './reporters-50c2bd49.js';
2
- export { j as BrowserProvider, i as BrowserProviderInitializationOptions, k as BrowserProviderOptions, h as TestSequencerConstructor, g as WorkspaceProject, s as startVitest } from './reporters-50c2bd49.js';
1
+ import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-vMlHjCdM.js';
2
+ export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-vMlHjCdM.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
@@ -26,6 +26,8 @@ interface GlobalSetupContext {
26
26
  provide<T extends keyof ProvidedContext>(key: T, value: ProvidedContext[T]): void;
27
27
  }
28
28
 
29
+ declare function createMethodsRPC(project: WorkspaceProject): RuntimeRPC;
30
+
29
31
  declare class BaseSequencer implements TestSequencer {
30
32
  protected ctx: Vitest;
31
33
  constructor(ctx: Vitest);
@@ -33,6 +35,4 @@ declare class BaseSequencer implements TestSequencer {
33
35
  sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
34
36
  }
35
37
 
36
- declare function ensurePackageInstalled(dependency: string, root: string): Promise<boolean>;
37
-
38
- export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceSpec, createVitest, ensurePackageInstalled, registerConsoleShortcuts };
38
+ export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, registerConsoleShortcuts };
package/dist/node.js CHANGED
@@ -1,14 +1,15 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, e as ensurePackageInstalled, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.65461b16.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.1xm0UoNi.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
5
5
  import 'node:url';
6
6
  import 'node:process';
7
7
  import 'node:fs';
8
- import './vendor-constants.538d9b49.js';
9
- import './vendor-_commonjsHelpers.7d1333e8.js';
8
+ import './vendor/constants.WSvnD_fn.js';
9
+ import './vendor/_commonjsHelpers.jjO7Zipk.js';
10
10
  import 'os';
11
11
  import 'path';
12
+ import './vendor/index.xL8XjTLv.js';
12
13
  import 'util';
13
14
  import 'stream';
14
15
  import 'events';
@@ -18,44 +19,38 @@ import 'vite-node/utils';
18
19
  import 'vite-node/client';
19
20
  import '@vitest/snapshot/manager';
20
21
  import 'vite-node/server';
21
- import './vendor-index.2b92937b.js';
22
+ import './vendor/index.XU72Rmy8.js';
22
23
  import 'std-env';
23
24
  import '@vitest/runner/utils';
24
25
  import '@vitest/utils';
25
- import './vendor-global.c3664e75.js';
26
- import './vendor-coverage.78040316.js';
27
- import './vendor-paths.84fc7a99.js';
26
+ import './vendor/global.L7JRz1qU.js';
27
+ import './vendor/coverage.v6aD8iAh.js';
28
+ import './paths.js';
28
29
  import 'node:v8';
29
30
  import 'node:os';
30
31
  import 'node:events';
31
32
  import 'tinypool';
32
- import './vendor-index.1ca68bd5.js';
33
- import './vendor-base.9c08bbd0.js';
33
+ import './vendor/index.cAUulNDf.js';
34
+ import './vendor/base._79unx2z.js';
34
35
  import 'node:worker_threads';
35
36
  import 'node:fs/promises';
36
37
  import 'node:perf_hooks';
37
- import './vendor-index.8efe7746.js';
38
- import 'node:buffer';
39
- import 'node:child_process';
40
- import 'child_process';
41
- import 'assert';
42
- import 'buffer';
43
- import 'node:util';
38
+ import 'execa';
44
39
  import '@vitest/utils/source-map';
45
40
  import 'local-pkg';
46
41
  import 'module';
47
- import 'acorn';
48
42
  import 'acorn-walk';
49
- import './vendor-reporters.d24d80a4.js';
50
- import './chunk-runtime-console.f3263f87.js';
43
+ import './vendor/reporters.pr8MinP9.js';
44
+ import './chunks/runtime-console.hf2msWA9.js';
51
45
  import 'node:stream';
52
46
  import 'node:console';
53
- import './vendor-date.6e993429.js';
54
- import './vendor-tasks.f9d75aed.js';
47
+ import './vendor/date.Ns1pGd_X.js';
48
+ import './vendor/tasks.IknbGB2n.js';
55
49
  import 'node:module';
56
50
  import 'node:crypto';
51
+ import 'assert';
57
52
  import 'magic-string';
58
53
  import 'strip-literal';
59
- import './vendor-environments.dcc4a34e.js';
54
+ import './vendor/environments.ewIbzajW.js';
60
55
  import 'node:readline';
61
56
  import 'readline';
@@ -4,4 +4,4 @@ import { resolve } from 'pathe';
4
4
  const rootDir = resolve(url.fileURLToPath(import.meta.url), "../../");
5
5
  const distDir = resolve(url.fileURLToPath(import.meta.url), "../../dist");
6
6
 
7
- export { distDir as d, rootDir as r };
7
+ export { distDir, rootDir };