vitest 3.0.8 → 3.1.0-beta.1

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 (60) hide show
  1. package/dist/browser.d.ts +12 -23
  2. package/dist/browser.js +2 -2
  3. package/dist/chunks/{base.XvKTsMeK.js → base.DV59CbtV.js} +1 -1
  4. package/dist/chunks/{benchmark.Cdu9hjj4.js → benchmark.DL72EVN-.js} +1 -1
  5. package/dist/chunks/{benchmark.CFFwLv-O.d.ts → benchmark.d.BwvBVTda.d.ts} +11 -11
  6. package/dist/chunks/{cac.VN5q-TPC.js → cac.BjmXy7OV.js} +11 -6
  7. package/dist/chunks/{cli-api.Dis64jtY.js → cli-api.BwkkJsRe.js} +13 -8
  8. package/dist/chunks/config.d.DevWltVl.d.ts +218 -0
  9. package/dist/chunks/{constants.fzPh7AOq.js → constants.DTYd6dNH.js} +1 -1
  10. package/dist/chunks/{coverage.DnNIv-kJ.js → coverage.A3sS5-Wm.js} +1 -29
  11. package/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
  12. package/dist/chunks/{resolveConfig.L1_HR0_0.js → coverage.gV8doR2Y.js} +496 -127
  13. package/dist/chunks/{creator.2CFRE1Yx.js → creator.BsBnpTzI.js} +1 -1
  14. package/dist/chunks/defaults.C2Ndd9wx.js +119 -0
  15. package/dist/chunks/env.D4Lgay0q.js +8 -0
  16. package/dist/chunks/environment.d.C8UItCbf.d.ts +170 -0
  17. package/dist/chunks/global.d.Cg2sEPIm.d.ts +127 -0
  18. package/dist/chunks/{globals.CydvVTgC.js → globals.BEpDe-k3.js} +4 -4
  19. package/dist/chunks/{index.CNRemkXW.js → index.D7Ny8f_s.js} +2 -2
  20. package/dist/chunks/{index.B7vJpkTD.js → index.DOyx6FYJ.js} +48 -18
  21. package/dist/chunks/{index.BmFgJtkv.js → index.uXkkC4xl.js} +1 -2
  22. package/dist/chunks/{mocker.cRtM890J.d.ts → mocker.d.BE_2ls6u.d.ts} +6 -6
  23. package/dist/chunks/reporters.d.r7poTZjA.d.ts +3012 -0
  24. package/dist/chunks/{runBaseTests.DnaAUBKD.js → runBaseTests.BVrL_ow3.js} +8 -8
  25. package/dist/chunks/{setup-common.Uaw6Zgv9.js → setup-common.CPvtqi8q.js} +25 -2
  26. package/dist/chunks/{suite.qtkXWc6R.d.ts → suite.d.FvehnV49.d.ts} +1 -1
  27. package/dist/chunks/{typechecker.cZ0LjdSi.js → typechecker.BlF3eHsb.js} +2 -7
  28. package/dist/chunks/{vi.B5EKKJdE.js → vi.nSCvwQ7l.js} +3 -3
  29. package/dist/chunks/vite.d.Fvq-NZoa.d.ts +11 -0
  30. package/dist/chunks/{worker.BmVno_ab.d.ts → worker.d.C58isfFm.d.ts} +62 -62
  31. package/dist/chunks/{worker.BT4v-DKx.d.ts → worker.d.CSFlSYJg.d.ts} +2 -2
  32. package/dist/cli.js +2 -2
  33. package/dist/config.d.ts +48 -45
  34. package/dist/config.js +6 -123
  35. package/dist/coverage.d.ts +82 -79
  36. package/dist/coverage.js +19 -469
  37. package/dist/environments.d.ts +11 -11
  38. package/dist/execute.d.ts +109 -109
  39. package/dist/index.d.ts +414 -412
  40. package/dist/index.js +3 -3
  41. package/dist/node.d.ts +51 -48
  42. package/dist/node.js +13 -10
  43. package/dist/reporters.d.ts +7 -4
  44. package/dist/reporters.js +3 -2
  45. package/dist/runners.d.ts +28 -28
  46. package/dist/runners.js +2 -3
  47. package/dist/snapshot.d.ts +2 -2
  48. package/dist/suite.d.ts +2 -2
  49. package/dist/suite.js +1 -1
  50. package/dist/workers/forks.js +1 -1
  51. package/dist/workers/runVmTests.js +8 -8
  52. package/dist/workers/threads.js +1 -1
  53. package/dist/workers.d.ts +13 -13
  54. package/dist/workers.js +1 -1
  55. package/package.json +11 -11
  56. package/dist/chunks/config.BCv-fVdT.d.ts +0 -215
  57. package/dist/chunks/environment.d8YfPkTm.d.ts +0 -173
  58. package/dist/chunks/global.CnI8_G5V.d.ts +0 -133
  59. package/dist/chunks/reporters.66aFHiyX.d.ts +0 -3051
  60. package/dist/chunks/vite.BCQa3xFG.d.ts +0 -11
@@ -1,21 +1,21 @@
1
- import { E as Environment } from './chunks/environment.d8YfPkTm.js';
2
- export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d8YfPkTm.js';
1
+ import { E as Environment } from './chunks/environment.d.C8UItCbf.js';
2
+ export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.C8UItCbf.js';
3
3
 
4
4
  declare const environments: {
5
- 'node': Environment;
6
- 'jsdom': Environment;
7
- 'happy-dom': Environment;
8
- 'edge-runtime': Environment;
5
+ "node": Environment
6
+ "jsdom": Environment
7
+ "happy-dom": Environment
8
+ "edge-runtime": Environment
9
9
  };
10
10
 
11
11
  interface PopulateOptions {
12
- bindFunctions?: boolean;
13
- additionalKeys?: string[];
12
+ bindFunctions?: boolean;
13
+ additionalKeys?: string[];
14
14
  }
15
15
  declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
16
- keys: Set<string>;
17
- skipKeys: string[];
18
- originals: Map<string | symbol, any>;
16
+ keys: Set<string>
17
+ skipKeys: string[]
18
+ originals: Map<string | symbol, any>
19
19
  };
20
20
 
21
21
  export { Environment, environments as builtinEnvironments, populateGlobal };
package/dist/execute.d.ts CHANGED
@@ -1,145 +1,145 @@
1
1
  import { ViteNodeRunnerOptions } from 'vite-node';
2
2
  import { ViteNodeRunner, ModuleExecutionInfo } from 'vite-node/client';
3
- import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.BmVno_ab.js';
3
+ import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.C58isfFm.js';
4
4
  import vm from 'node:vm';
5
5
  import { MockedModule, MockedModuleType } from '@vitest/mocker';
6
- import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.cRtM890J.js';
6
+ import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
7
7
  import '@vitest/runner';
8
- import './chunks/config.BCv-fVdT.js';
8
+ import './chunks/config.d.DevWltVl.js';
9
9
  import '@vitest/pretty-format';
10
10
  import '@vitest/snapshot';
11
11
  import '@vitest/snapshot/environment';
12
12
  import '@vitest/utils/diff';
13
- import './chunks/environment.d8YfPkTm.js';
13
+ import './chunks/environment.d.C8UItCbf.js';
14
14
 
15
15
  declare class FileMap {
16
- private fsCache;
17
- private fsBufferCache;
18
- readFileAsync(path: string): Promise<string>;
19
- readFile(path: string): string;
20
- readBuffer(path: string): Buffer;
16
+ private fsCache;
17
+ private fsBufferCache;
18
+ readFileAsync(path: string): Promise<string>;
19
+ readFile(path: string): string;
20
+ readBuffer(path: string): Buffer;
21
21
  }
22
22
 
23
23
  interface ModuleEvaluateOptions {
24
- timeout?: vm.RunningScriptOptions['timeout'] | undefined;
25
- breakOnSigint?: vm.RunningScriptOptions['breakOnSigint'] | undefined;
24
+ timeout?: vm.RunningScriptOptions["timeout"] | undefined;
25
+ breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
26
26
  }
27
27
  type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
28
- assert: object;
28
+ assert: object
29
29
  }) => VMModule | Promise<VMModule>;
30
- type ModuleStatus = 'unlinked' | 'linking' | 'linked' | 'evaluating' | 'evaluated' | 'errored';
30
+ type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored";
31
31
  declare class VMModule {
32
- dependencySpecifiers: readonly string[];
33
- error: any;
34
- identifier: string;
35
- context: vm.Context;
36
- namespace: object;
37
- status: ModuleStatus;
38
- evaluate(options?: ModuleEvaluateOptions): Promise<void>;
39
- link(linker: ModuleLinker): Promise<void>;
32
+ dependencySpecifiers: readonly string[];
33
+ error: any;
34
+ identifier: string;
35
+ context: vm.Context;
36
+ namespace: object;
37
+ status: ModuleStatus;
38
+ evaluate(options?: ModuleEvaluateOptions): Promise<void>;
39
+ link(linker: ModuleLinker): Promise<void>;
40
40
  }
41
41
 
42
42
  interface ExternalModulesExecutorOptions {
43
- context: vm.Context;
44
- fileMap: FileMap;
45
- packageCache: Map<string, any>;
46
- transform: RuntimeRPC['transform'];
47
- interopDefault?: boolean;
48
- viteClientModule: Record<string, unknown>;
43
+ context: vm.Context;
44
+ fileMap: FileMap;
45
+ packageCache: Map<string, any>;
46
+ transform: RuntimeRPC["transform"];
47
+ interopDefault?: boolean;
48
+ viteClientModule: Record<string, unknown>;
49
49
  }
50
50
  declare class ExternalModulesExecutor {
51
- #private;
52
- private options;
53
- private cjs;
54
- private esm;
55
- private vite;
56
- private context;
57
- private fs;
58
- private resolvers;
59
- constructor(options: ExternalModulesExecutorOptions);
60
- import(identifier: string): Promise<object>;
61
- require(identifier: string): any;
62
- createRequire(identifier: string): NodeJS.Require;
63
- importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
64
- resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
65
- resolve(specifier: string, parent: string): string;
66
- private findNearestPackageData;
67
- private wrapCoreSyntheticModule;
68
- private wrapCommonJsSynteticModule;
69
- private getModuleInformation;
70
- private createModule;
71
- private get isNetworkSupported();
51
+ #private;
52
+ private options;
53
+ private cjs;
54
+ private esm;
55
+ private vite;
56
+ private context;
57
+ private fs;
58
+ private resolvers;
59
+ constructor(options: ExternalModulesExecutorOptions);
60
+ import(identifier: string): Promise<object>;
61
+ require(identifier: string): any;
62
+ createRequire(identifier: string): NodeJS.Require;
63
+ importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
64
+ resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
65
+ resolve(specifier: string, parent: string): string;
66
+ private findNearestPackageData;
67
+ private wrapCoreSyntheticModule;
68
+ private wrapCommonJsSynteticModule;
69
+ private getModuleInformation;
70
+ private createModule;
71
+ private get isNetworkSupported();
72
72
  }
73
73
 
74
74
  interface MockContext {
75
- /**
76
- * When mocking with a factory, this refers to the module that imported the mock.
77
- */
78
- callstack: null | string[];
75
+ /**
76
+ * When mocking with a factory, this refers to the module that imported the mock.
77
+ */
78
+ callstack: null | string[];
79
79
  }
80
80
  declare class VitestMocker {
81
- executor: VitestExecutor;
82
- static pendingIds: PendingSuiteMock[];
83
- private spyModule?;
84
- private primitives;
85
- private filterPublicKeys;
86
- private registries;
87
- private mockContext;
88
- constructor(executor: VitestExecutor);
89
- private get root();
90
- private get moduleCache();
91
- private get moduleDirectories();
92
- initializeSpyModule(): Promise<void>;
93
- private getMockerRegistry;
94
- reset(): void;
95
- private deleteCachedItem;
96
- private isModuleDirectory;
97
- getSuiteFilepath(): string;
98
- private createError;
99
- private resolvePath;
100
- resolveMocks(): Promise<void>;
101
- private callFunctionMock;
102
- getMockContext(): MockContext;
103
- getMockPath(dep: string): string;
104
- getDependencyMock(id: string): MockedModule | undefined;
105
- normalizePath(path: string): string;
106
- resolveMockPath(mockPath: string, external: string | null): string | null;
107
- mockObject(object: Record<string | symbol, any>, mockExports?: Record<string | symbol, any>, behavior?: MockedModuleType): Record<string | symbol, any>;
108
- unmockPath(path: string): void;
109
- mockPath(originalId: string, path: string, external: string | null, mockType: MockedModuleType | undefined, factory: MockFactory | undefined): void;
110
- importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
111
- importMock(rawId: string, importee: string): Promise<any>;
112
- requestWithMock(url: string, callstack: string[]): Promise<any>;
113
- queueMock(id: string, importer: string, factoryOrOptions?: MockFactory | MockOptions): void;
114
- queueUnmock(id: string, importer: string): void;
81
+ executor: VitestExecutor;
82
+ static pendingIds: PendingSuiteMock[];
83
+ private spyModule?;
84
+ private primitives;
85
+ private filterPublicKeys;
86
+ private registries;
87
+ private mockContext;
88
+ constructor(executor: VitestExecutor);
89
+ private get root();
90
+ private get moduleCache();
91
+ private get moduleDirectories();
92
+ initializeSpyModule(): Promise<void>;
93
+ private getMockerRegistry;
94
+ reset(): void;
95
+ private deleteCachedItem;
96
+ private isModuleDirectory;
97
+ getSuiteFilepath(): string;
98
+ private createError;
99
+ private resolvePath;
100
+ resolveMocks(): Promise<void>;
101
+ private callFunctionMock;
102
+ getMockContext(): MockContext;
103
+ getMockPath(dep: string): string;
104
+ getDependencyMock(id: string): MockedModule | undefined;
105
+ normalizePath(path: string): string;
106
+ resolveMockPath(mockPath: string, external: string | null): string | null;
107
+ mockObject(object: Record<string | symbol, any>, mockExports?: Record<string | symbol, any>, behavior?: MockedModuleType): Record<string | symbol, any>;
108
+ unmockPath(path: string): void;
109
+ mockPath(originalId: string, path: string, external: string | null, mockType: MockedModuleType | undefined, factory: MockFactory | undefined): void;
110
+ importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
111
+ importMock(rawId: string, importee: string): Promise<any>;
112
+ requestWithMock(url: string, callstack: string[]): Promise<any>;
113
+ queueMock(id: string, importer: string, factoryOrOptions?: MockFactory | MockOptions): void;
114
+ queueUnmock(id: string, importer: string): void;
115
115
  }
116
116
 
117
117
  interface ExecuteOptions extends ViteNodeRunnerOptions {
118
- moduleDirectories?: string[];
119
- state: WorkerGlobalState;
120
- context?: vm.Context;
121
- externalModulesExecutor?: ExternalModulesExecutor;
118
+ moduleDirectories?: string[];
119
+ state: WorkerGlobalState;
120
+ context?: vm.Context;
121
+ externalModulesExecutor?: ExternalModulesExecutor;
122
122
  }
123
123
  declare class VitestExecutor extends ViteNodeRunner {
124
- options: ExecuteOptions;
125
- mocker: VitestMocker;
126
- externalModules?: ExternalModulesExecutor;
127
- private primitives;
128
- constructor(options: ExecuteOptions);
129
- protected getContextPrimitives(): {
130
- Object: typeof Object;
131
- Reflect: typeof Reflect;
132
- Symbol: typeof Symbol;
133
- };
134
- get state(): WorkerGlobalState;
135
- get moduleExecutionInfo(): ModuleExecutionInfo | undefined;
136
- shouldResolveId(id: string, _importee?: string | undefined): boolean;
137
- originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
138
- resolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
139
- protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
140
- importExternalModule(path: string): Promise<any>;
141
- dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
142
- prepareContext(context: Record<string, any>): Record<string, any>;
124
+ options: ExecuteOptions;
125
+ mocker: VitestMocker;
126
+ externalModules?: ExternalModulesExecutor;
127
+ private primitives;
128
+ constructor(options: ExecuteOptions);
129
+ protected getContextPrimitives(): {
130
+ Object: typeof Object
131
+ Reflect: typeof Reflect
132
+ Symbol: typeof Symbol
133
+ };
134
+ get state(): WorkerGlobalState;
135
+ get moduleExecutionInfo(): ModuleExecutionInfo | undefined;
136
+ shouldResolveId(id: string, _importee?: string | undefined): boolean;
137
+ originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
138
+ resolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
139
+ protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
140
+ importExternalModule(path: string): Promise<any>;
141
+ dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
142
+ prepareContext(context: Record<string, any>): Record<string, any>;
143
143
  }
144
144
 
145
145
  export { VitestExecutor };