vitest 0.16.0 → 0.17.0

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.
@@ -9007,6 +9007,7 @@ ${getStack()}`), 2e3);
9007
9007
  if (transformed == null)
9008
9008
  throw new Error(`[vite-node] Failed to load ${id}`);
9009
9009
  const url = pathToFileURL(fsPath).href;
9010
+ const meta = { url };
9010
9011
  const exports = /* @__PURE__ */ Object.create(null);
9011
9012
  exports[Symbol.toStringTag] = "Module";
9012
9013
  this.moduleCache.set(id, { code: transformed, exports });
@@ -9020,12 +9021,23 @@ ${getStack()}`), 2e3);
9020
9021
  return exports;
9021
9022
  }
9022
9023
  };
9024
+ let hotContext;
9025
+ if (this.options.createHotContext) {
9026
+ Object.defineProperty(meta, "hot", {
9027
+ enumerable: true,
9028
+ get: () => {
9029
+ var _a, _b;
9030
+ hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? void 0 : _b.call(_a, this, `/@fs/${fsPath}`));
9031
+ return hotContext;
9032
+ }
9033
+ });
9034
+ }
9023
9035
  const context = this.prepareContext({
9024
9036
  __vite_ssr_import__: request,
9025
9037
  __vite_ssr_dynamic_import__: request,
9026
9038
  __vite_ssr_exports__: exports,
9027
9039
  __vite_ssr_exportAll__: (obj) => exportAll(exports, obj),
9028
- __vite_ssr_import_meta__: { url },
9040
+ __vite_ssr_import_meta__: meta,
9029
9041
  __vitest_resolve_id__: resolveId,
9030
9042
  require: createRequire(url),
9031
9043
  exports,
package/dist/cli.mjs CHANGED
@@ -1,30 +1,30 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { p as picocolors } from './chunk-utils-global.79a8b1cc.mjs';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.58e10976.mjs';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.1efbe319.mjs';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
7
- import 'vite';
8
- import 'url';
9
- import 'process';
7
+ import './chunk-env-node.dc514f41.mjs';
10
8
  import 'fs';
11
- import './chunk-defaults.dc6dc23d.mjs';
12
9
  import 'module';
13
- import './chunk-constants.7b9cfc82.mjs';
10
+ import 'url';
11
+ import 'vite';
12
+ import 'process';
13
+ import './chunk-constants.511c6e9b.mjs';
14
14
  import 'readline';
15
15
  import 'os';
16
16
  import 'util';
17
17
  import 'stream';
18
18
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
19
- import './chunk-vite-node-utils.7450fc0c.mjs';
19
+ import './chunk-vite-node-utils.4b58ae05.mjs';
20
20
  import 'vm';
21
21
  import 'assert';
22
22
  import 'debug';
23
23
  import 'worker_threads';
24
- import 'crypto';
25
24
  import 'tinypool';
25
+ import 'crypto';
26
26
  import 'perf_hooks';
27
- import './chunk-utils-source-map.2556cba8.mjs';
27
+ import './chunk-utils-source-map.f52527bc.mjs';
28
28
  import './vendor-index.e5dc6622.mjs';
29
29
  import 'child_process';
30
30
  import 'buffer';
package/dist/entry.mjs CHANGED
@@ -1,17 +1,17 @@
1
- export { r as run } from './vendor-entry.efeeaa5c.mjs';
1
+ export { r as run } from './vendor-entry.2edaf3e0.mjs';
2
2
  import 'fs';
3
3
  import './chunk-utils-global.79a8b1cc.mjs';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
7
- import './chunk-runtime-chain.7103058b.mjs';
7
+ import './chunk-env-node.dc514f41.mjs';
8
+ import 'module';
9
+ import 'url';
10
+ import './chunk-runtime-chain.68f305d0.mjs';
8
11
  import 'chai';
9
12
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
10
13
  import './chunk-runtime-rpc.5e78af38.mjs';
11
- import './chunk-utils-source-map.2556cba8.mjs';
14
+ import './chunk-utils-source-map.f52527bc.mjs';
12
15
  import './chunk-integrations-spy.674b628e.mjs';
13
16
  import 'tinyspy';
14
17
  import 'util';
15
- import './chunk-defaults.dc6dc23d.mjs';
16
- import 'module';
17
- import 'url';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ViteDevServer, TransformResult, CommonServerOptions } from 'vite';
2
+ import { Stats } from 'fs';
2
3
  import { SpyImpl } from 'tinyspy';
3
4
  import { MessagePort } from 'worker_threads';
4
5
  export { assert, default as chai, should } from 'chai';
@@ -156,6 +157,87 @@ interface FakeTimerInstallOpts {
156
157
  shouldClearNativeTimers?: boolean | undefined;
157
158
  }
158
159
 
160
+ interface UpdatePayload {
161
+ type: 'update'
162
+ updates: Update[]
163
+ }
164
+
165
+ interface Update {
166
+ type: 'js-update' | 'css-update'
167
+ path: string
168
+ acceptedPath: string
169
+ timestamp: number
170
+ }
171
+
172
+ interface PrunePayload {
173
+ type: 'prune'
174
+ paths: string[]
175
+ }
176
+
177
+ interface FullReloadPayload {
178
+ type: 'full-reload'
179
+ path?: string
180
+ }
181
+
182
+ interface ErrorPayload {
183
+ type: 'error'
184
+ err: {
185
+ [name: string]: any
186
+ message: string
187
+ stack: string
188
+ id?: string
189
+ frame?: string
190
+ plugin?: string
191
+ pluginCode?: string
192
+ loc?: {
193
+ file?: string
194
+ line: number
195
+ column: number
196
+ }
197
+ }
198
+ }
199
+
200
+ interface CustomEventMap {
201
+ 'vite:beforeUpdate': UpdatePayload
202
+ 'vite:beforePrune': PrunePayload
203
+ 'vite:beforeFullReload': FullReloadPayload
204
+ 'vite:error': ErrorPayload
205
+ }
206
+
207
+ type InferCustomEventPayload<T extends string> =
208
+ T extends keyof CustomEventMap ? CustomEventMap[T] : any
209
+
210
+ type ModuleNamespace = Record<string, any> & {
211
+ [Symbol.toStringTag]: 'Module'
212
+ }
213
+
214
+ interface ViteHotContext {
215
+ readonly data: any
216
+
217
+ accept(): void
218
+ accept(cb: (mod: ModuleNamespace | undefined) => void): void
219
+ accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
220
+ accept(
221
+ deps: readonly string[],
222
+ cb: (mods: Array<ModuleNamespace | undefined>) => void
223
+ ): void
224
+
225
+ acceptExports(exportNames: string | readonly string[]): void
226
+ acceptExports(
227
+ exportNames: string | readonly string[],
228
+ cb: (mod: ModuleNamespace | undefined) => void
229
+ ): void
230
+
231
+ dispose(cb: (data: any) => void): void
232
+ decline(): void
233
+ invalidate(): void
234
+
235
+ on<T extends string>(
236
+ event: T,
237
+ cb: (payload: InferCustomEventPayload<T>) => void
238
+ ): void
239
+ send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
240
+ }
159
241
  declare class ModuleCacheMap extends Map<string, ModuleCache$1> {
160
242
  normalizePath(fsPath: string): string;
161
243
  set(fsPath: string, mod: Partial<ModuleCache$1>): this;
@@ -217,8 +299,10 @@ interface FetchResult {
217
299
  externalize?: string;
218
300
  map?: RawSourceMap;
219
301
  }
302
+ declare type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
220
303
  declare type FetchFunction = (id: string) => Promise<FetchResult>;
221
304
  declare type ResolveIdFunction$1 = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
305
+ declare type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
222
306
  interface ModuleCache$1 {
223
307
  promise?: Promise<any>;
224
308
  exports?: any;
@@ -228,6 +312,7 @@ interface ViteNodeRunnerOptions {
228
312
  root: string;
229
313
  fetchModule: FetchFunction;
230
314
  resolveId?: ResolveIdFunction$1;
315
+ createHotContext?: CreateHotContextFunction;
231
316
  base?: string;
232
317
  moduleCache?: ModuleCacheMap;
233
318
  interopDefault?: boolean;
@@ -295,11 +380,42 @@ interface WorkerPool {
295
380
  close: () => Promise<void>;
296
381
  }
297
382
 
383
+ interface SuiteResultCache {
384
+ failed: boolean;
385
+ duration: number;
386
+ }
387
+ declare class ResultsCache {
388
+ private cache;
389
+ private cachePath;
390
+ private version;
391
+ private root;
392
+ setConfig(root: string, config: ResolvedConfig['cache']): void;
393
+ getResults(fsPath: string): SuiteResultCache | undefined;
394
+ readFromCache(): Promise<void>;
395
+ updateResults(files: File[]): void;
396
+ removeFromCache(filepath: string): void;
397
+ writeToCache(): Promise<void>;
398
+ }
399
+
400
+ declare type FileStatsCache = Pick<Stats, 'size'>;
401
+ declare class FilesStatsCache {
402
+ cache: Map<string, FileStatsCache>;
403
+ getStats(fsPath: string): FileStatsCache | undefined;
404
+ updateStats(fsPath: string): Promise<void>;
405
+ removeStats(fsPath: string): void;
406
+ }
407
+
298
408
  declare class StateManager {
299
409
  filesMap: Map<string, File>;
300
410
  idMap: Map<string, Task>;
301
411
  taskFileMap: WeakMap<Task, File>;
302
412
  errorsSet: Set<unknown>;
413
+ results: ResultsCache;
414
+ stats: FilesStatsCache;
415
+ getFileTestResults(id: string): SuiteResultCache | undefined;
416
+ getFileStats(id: string): {
417
+ size: number;
418
+ } | undefined;
303
419
  catchError(err: unknown, type: string): void;
304
420
  clearErrors(): void;
305
421
  getUnhandledErrors(): unknown[];
@@ -342,7 +458,7 @@ declare class Vitest {
342
458
  start(filters?: string[]): Promise<void>;
343
459
  private getTestDependencies;
344
460
  filterTestsBySource(tests: string[]): Promise<string[]>;
345
- runFiles(files: string[]): Promise<void>;
461
+ runFiles(paths: string[]): Promise<void>;
346
462
  rerunFiles(files?: string[], trigger?: string): Promise<void>;
347
463
  changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
348
464
  rerunFailed(): Promise<void>;
@@ -865,7 +981,7 @@ interface SnapshotSummary {
865
981
  updated: number;
866
982
  }
867
983
 
868
- declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom';
984
+ declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
869
985
  declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
870
986
 
871
987
  interface EnvironmentOptions {
@@ -943,7 +1059,7 @@ interface InlineConfig {
943
1059
  /**
944
1060
  * Running environment
945
1061
  *
946
- * Supports 'node', 'jsdom', 'happy-dom'
1062
+ * Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
947
1063
  *
948
1064
  * @default 'node'
949
1065
  */
@@ -1168,6 +1284,13 @@ interface InlineConfig {
1168
1284
  * @default 5
1169
1285
  */
1170
1286
  maxConcurrency?: number;
1287
+ /**
1288
+ * Options for configuring cache policy.
1289
+ * @default { dir: 'node_modules/.vitest' }
1290
+ */
1291
+ cache?: false | {
1292
+ dir?: string;
1293
+ };
1171
1294
  }
1172
1295
  interface UserConfig extends InlineConfig {
1173
1296
  /**
@@ -1207,7 +1330,7 @@ interface UserConfig extends InlineConfig {
1207
1330
  */
1208
1331
  shard?: string;
1209
1332
  }
1210
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard'> {
1333
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache'> {
1211
1334
  base?: string;
1212
1335
  config?: string;
1213
1336
  filters?: string[];
@@ -1222,6 +1345,9 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
1222
1345
  index: number;
1223
1346
  count: number;
1224
1347
  };
1348
+ cache: {
1349
+ dir: string;
1350
+ } | false;
1225
1351
  }
1226
1352
 
1227
1353
  declare type VitestInlineConfig = InlineConfig;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.7103058b.mjs';
1
+ export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.68f305d0.mjs';
2
2
  export { assert, default as chai, should } from 'chai';
3
3
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
4
4
  import './chunk-runtime-rpc.5e78af38.mjs';
@@ -7,7 +7,7 @@ import 'tty';
7
7
  import 'local-pkg';
8
8
  import 'path';
9
9
  import 'fs';
10
- import './chunk-utils-source-map.2556cba8.mjs';
10
+ import './chunk-utils-source-map.f52527bc.mjs';
11
11
  import './chunk-integrations-spy.674b628e.mjs';
12
12
  import 'tinyspy';
13
13
  import 'util';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,87 @@
1
1
  import { ViteDevServer, TransformResult, CommonServerOptions, UserConfig as UserConfig$1, Plugin as Plugin$1 } from 'vite';
2
+ import { Stats } from 'fs';
2
3
 
4
+ interface UpdatePayload {
5
+ type: 'update'
6
+ updates: Update[]
7
+ }
8
+
9
+ interface Update {
10
+ type: 'js-update' | 'css-update'
11
+ path: string
12
+ acceptedPath: string
13
+ timestamp: number
14
+ }
15
+
16
+ interface PrunePayload {
17
+ type: 'prune'
18
+ paths: string[]
19
+ }
20
+
21
+ interface FullReloadPayload {
22
+ type: 'full-reload'
23
+ path?: string
24
+ }
25
+
26
+ interface ErrorPayload {
27
+ type: 'error'
28
+ err: {
29
+ [name: string]: any
30
+ message: string
31
+ stack: string
32
+ id?: string
33
+ frame?: string
34
+ plugin?: string
35
+ pluginCode?: string
36
+ loc?: {
37
+ file?: string
38
+ line: number
39
+ column: number
40
+ }
41
+ }
42
+ }
43
+
44
+ interface CustomEventMap {
45
+ 'vite:beforeUpdate': UpdatePayload
46
+ 'vite:beforePrune': PrunePayload
47
+ 'vite:beforeFullReload': FullReloadPayload
48
+ 'vite:error': ErrorPayload
49
+ }
50
+
51
+ type InferCustomEventPayload<T extends string> =
52
+ T extends keyof CustomEventMap ? CustomEventMap[T] : any
53
+
54
+ type ModuleNamespace = Record<string, any> & {
55
+ [Symbol.toStringTag]: 'Module'
56
+ }
57
+
58
+ interface ViteHotContext {
59
+ readonly data: any
60
+
61
+ accept(): void
62
+ accept(cb: (mod: ModuleNamespace | undefined) => void): void
63
+ accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
64
+ accept(
65
+ deps: readonly string[],
66
+ cb: (mods: Array<ModuleNamespace | undefined>) => void
67
+ ): void
68
+
69
+ acceptExports(exportNames: string | readonly string[]): void
70
+ acceptExports(
71
+ exportNames: string | readonly string[],
72
+ cb: (mod: ModuleNamespace | undefined) => void
73
+ ): void
74
+
75
+ dispose(cb: (data: any) => void): void
76
+ decline(): void
77
+ invalidate(): void
78
+
79
+ on<T extends string>(
80
+ event: T,
81
+ cb: (payload: InferCustomEventPayload<T>) => void
82
+ ): void
83
+ send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
84
+ }
3
85
  declare class ModuleCacheMap extends Map<string, ModuleCache> {
4
86
  normalizePath(fsPath: string): string;
5
87
  set(fsPath: string, mod: Partial<ModuleCache>): this;
@@ -61,8 +143,10 @@ interface FetchResult {
61
143
  externalize?: string;
62
144
  map?: RawSourceMap;
63
145
  }
146
+ declare type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
64
147
  declare type FetchFunction = (id: string) => Promise<FetchResult>;
65
148
  declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
149
+ declare type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
66
150
  interface ModuleCache {
67
151
  promise?: Promise<any>;
68
152
  exports?: any;
@@ -72,6 +156,7 @@ interface ViteNodeRunnerOptions {
72
156
  root: string;
73
157
  fetchModule: FetchFunction;
74
158
  resolveId?: ResolveIdFunction;
159
+ createHotContext?: CreateHotContextFunction;
75
160
  base?: string;
76
161
  moduleCache?: ModuleCacheMap;
77
162
  interopDefault?: boolean;
@@ -685,7 +770,7 @@ interface SnapshotSummary {
685
770
  updated: number;
686
771
  }
687
772
 
688
- declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom';
773
+ declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
689
774
  declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
690
775
 
691
776
  interface EnvironmentOptions {
@@ -763,7 +848,7 @@ interface InlineConfig {
763
848
  /**
764
849
  * Running environment
765
850
  *
766
- * Supports 'node', 'jsdom', 'happy-dom'
851
+ * Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
767
852
  *
768
853
  * @default 'node'
769
854
  */
@@ -988,6 +1073,13 @@ interface InlineConfig {
988
1073
  * @default 5
989
1074
  */
990
1075
  maxConcurrency?: number;
1076
+ /**
1077
+ * Options for configuring cache policy.
1078
+ * @default { dir: 'node_modules/.vitest' }
1079
+ */
1080
+ cache?: false | {
1081
+ dir?: string;
1082
+ };
991
1083
  }
992
1084
  interface UserConfig extends InlineConfig {
993
1085
  /**
@@ -1027,7 +1119,7 @@ interface UserConfig extends InlineConfig {
1027
1119
  */
1028
1120
  shard?: string;
1029
1121
  }
1030
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard'> {
1122
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache'> {
1031
1123
  base?: string;
1032
1124
  config?: string;
1033
1125
  filters?: string[];
@@ -1042,6 +1134,9 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
1042
1134
  index: number;
1043
1135
  count: number;
1044
1136
  };
1137
+ cache: {
1138
+ dir: string;
1139
+ } | false;
1045
1140
  }
1046
1141
 
1047
1142
  declare type VitestInlineConfig = InlineConfig;
@@ -1322,11 +1417,42 @@ interface WorkerPool {
1322
1417
  close: () => Promise<void>;
1323
1418
  }
1324
1419
 
1420
+ interface SuiteResultCache {
1421
+ failed: boolean;
1422
+ duration: number;
1423
+ }
1424
+ declare class ResultsCache {
1425
+ private cache;
1426
+ private cachePath;
1427
+ private version;
1428
+ private root;
1429
+ setConfig(root: string, config: ResolvedConfig['cache']): void;
1430
+ getResults(fsPath: string): SuiteResultCache | undefined;
1431
+ readFromCache(): Promise<void>;
1432
+ updateResults(files: File[]): void;
1433
+ removeFromCache(filepath: string): void;
1434
+ writeToCache(): Promise<void>;
1435
+ }
1436
+
1437
+ declare type FileStatsCache = Pick<Stats, 'size'>;
1438
+ declare class FilesStatsCache {
1439
+ cache: Map<string, FileStatsCache>;
1440
+ getStats(fsPath: string): FileStatsCache | undefined;
1441
+ updateStats(fsPath: string): Promise<void>;
1442
+ removeStats(fsPath: string): void;
1443
+ }
1444
+
1325
1445
  declare class StateManager {
1326
1446
  filesMap: Map<string, File>;
1327
1447
  idMap: Map<string, Task>;
1328
1448
  taskFileMap: WeakMap<Task, File>;
1329
1449
  errorsSet: Set<unknown>;
1450
+ results: ResultsCache;
1451
+ stats: FilesStatsCache;
1452
+ getFileTestResults(id: string): SuiteResultCache | undefined;
1453
+ getFileStats(id: string): {
1454
+ size: number;
1455
+ } | undefined;
1330
1456
  catchError(err: unknown, type: string): void;
1331
1457
  clearErrors(): void;
1332
1458
  getUnhandledErrors(): unknown[];
@@ -1369,7 +1495,7 @@ declare class Vitest {
1369
1495
  start(filters?: string[]): Promise<void>;
1370
1496
  private getTestDependencies;
1371
1497
  filterTestsBySource(tests: string[]): Promise<string[]>;
1372
- runFiles(files: string[]): Promise<void>;
1498
+ runFiles(paths: string[]): Promise<void>;
1373
1499
  rerunFiles(files?: string[], trigger?: string): Promise<void>;
1374
1500
  changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
1375
1501
  rerunFailed(): Promise<void>;
@@ -1407,7 +1533,6 @@ interface CliOptions extends UserConfig {
1407
1533
  }
1408
1534
  declare function startVitest(cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<boolean>;
1409
1535
 
1410
- declare type Callback = (...args: any[]) => unknown;
1411
1536
  interface ViteRunnerRequest {
1412
1537
  (dep: string): any;
1413
1538
  callstack: string[];
@@ -1415,15 +1540,13 @@ interface ViteRunnerRequest {
1415
1540
  declare class VitestMocker {
1416
1541
  options: ExecuteOptions;
1417
1542
  private moduleCache;
1543
+ private request;
1418
1544
  private static pendingIds;
1419
1545
  private static spyModule?;
1420
- private request;
1421
- private root;
1422
- private callbacks;
1423
- constructor(options: ExecuteOptions, moduleCache: ModuleCacheMap, request?: ViteRunnerRequest);
1424
- get mockMap(): MockMap;
1425
- on(event: string, cb: Callback): void;
1426
- private emit;
1546
+ constructor(options: ExecuteOptions, moduleCache: ModuleCacheMap, request: ViteRunnerRequest);
1547
+ private get root();
1548
+ private get base();
1549
+ private get mockMap();
1427
1550
  getSuiteFilepath(): string;
1428
1551
  getMocks(): {
1429
1552
  [x: string]: string | (() => unknown) | null;
@@ -1432,7 +1555,6 @@ declare class VitestMocker {
1432
1555
  private resolveMocks;
1433
1556
  private callFunctionMock;
1434
1557
  getDependencyMock(dep: string): string | (() => unknown) | null;
1435
- resolveDependency(dep: string): string;
1436
1558
  normalizePath(path: string): string;
1437
1559
  getFsPath(path: string, external: string | null): string;
1438
1560
  resolveMockPath(mockPath: string, external: string | null): string | null;
@@ -1445,7 +1567,6 @@ declare class VitestMocker {
1445
1567
  requestWithMock(dep: string): Promise<any>;
1446
1568
  queueMock(id: string, importer: string, factory?: () => unknown): void;
1447
1569
  queueUnmock(id: string, importer: string): void;
1448
- withRequest(request: ViteRunnerRequest): VitestMocker;
1449
1570
  }
1450
1571
 
1451
1572
  interface ExecuteOptions extends ViteNodeRunnerOptions {
@@ -1453,8 +1574,6 @@ interface ExecuteOptions extends ViteNodeRunnerOptions {
1453
1574
  }
1454
1575
  declare class VitestRunner extends ViteNodeRunner {
1455
1576
  options: ExecuteOptions;
1456
- mocker: VitestMocker;
1457
- entries: Set<string>;
1458
1577
  constructor(options: ExecuteOptions);
1459
1578
  prepareContext(context: Record<string, any>): Record<string, any> & {
1460
1579
  __vite_ssr_import__: (dep: string) => Promise<any>;
package/dist/node.mjs CHANGED
@@ -1,31 +1,31 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.58e10976.mjs';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.110e3634.mjs';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.1efbe319.mjs';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.1c207219.mjs';
3
+ import './chunk-env-node.dc514f41.mjs';
4
+ import 'local-pkg';
5
+ import 'fs';
6
+ import 'module';
7
+ import 'url';
3
8
  import './chunk-utils-global.79a8b1cc.mjs';
4
9
  import 'tty';
5
- import 'local-pkg';
6
10
  import 'path';
7
11
  import 'vite';
8
- import 'url';
9
12
  import 'process';
10
- import 'fs';
11
- import './chunk-defaults.dc6dc23d.mjs';
12
- import 'module';
13
- import './chunk-constants.7b9cfc82.mjs';
13
+ import './chunk-constants.511c6e9b.mjs';
14
14
  import 'readline';
15
15
  import 'os';
16
16
  import 'util';
17
17
  import 'stream';
18
18
  import 'events';
19
19
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
20
- import './chunk-vite-node-utils.7450fc0c.mjs';
20
+ import './chunk-vite-node-utils.4b58ae05.mjs';
21
21
  import 'vm';
22
22
  import 'assert';
23
23
  import 'debug';
24
24
  import 'worker_threads';
25
- import 'crypto';
26
25
  import 'tinypool';
26
+ import 'crypto';
27
27
  import 'perf_hooks';
28
- import './chunk-utils-source-map.2556cba8.mjs';
28
+ import './chunk-utils-source-map.f52527bc.mjs';
29
29
  import './vendor-index.e5dc6622.mjs';
30
30
  import 'child_process';
31
31
  import 'buffer';