vitest 3.0.7 → 3.0.9
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.
- package/dist/browser.d.ts +14 -43
- package/dist/browser.js +4 -4
- package/dist/chunks/{base.BgUWWWYp.js → base.DV59CbtV.js} +2 -2
- package/dist/chunks/{benchmark.Cdu9hjj4.js → benchmark.DL72EVN-.js} +1 -1
- package/dist/chunks/{benchmark.CFFwLv-O.d.ts → benchmark.d.BwvBVTda.d.ts} +11 -11
- package/dist/chunks/{cac.87F_onld.js → cac.CeVHgzve.js} +30 -6
- package/dist/chunks/{cli-api.BZbq1zTX.js → cli-api.Ckwz_xSb.js} +21 -23
- package/dist/chunks/config.d.DevWltVl.d.ts +218 -0
- package/dist/chunks/{constants.fzPh7AOq.js → constants.DTYd6dNH.js} +1 -1
- package/dist/chunks/{coverage.DnNIv-kJ.js → coverage.A3sS5-Wm.js} +1 -29
- package/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
- package/dist/chunks/{resolveConfig.BbcK25zb.js → coverage.gV8doR2Y.js} +500 -131
- package/dist/chunks/{creator.2CFRE1Yx.js → creator.BsBnpTzI.js} +1 -1
- package/dist/chunks/defaults.C2Ndd9wx.js +119 -0
- package/dist/chunks/env.D4Lgay0q.js +8 -0
- package/dist/chunks/environment.d.C8UItCbf.d.ts +170 -0
- package/dist/chunks/{execute.Bhwls1-Z.js → execute.eDH0aFFd.js} +4 -4
- package/dist/chunks/global.d.Cg2sEPIm.d.ts +127 -0
- package/dist/chunks/{globals.BCtI_nQG.js → globals.BEpDe-k3.js} +5 -5
- package/dist/chunks/{index.C1f-_gvH.js → index.B8tIoLPT.js} +8 -3
- package/dist/chunks/{index.B8haHJlQ.js → index.D7Ny8f_s.js} +2 -2
- package/dist/chunks/{index.BmFFzXX_.js → index.uXkkC4xl.js} +1 -2
- package/dist/chunks/{mocker.cRtM890J.d.ts → mocker.d.BE_2ls6u.d.ts} +6 -6
- package/dist/chunks/reporters.d.CqBhtcTq.d.ts +3006 -0
- package/dist/chunks/{runBaseTests.9XCQcSZC.js → runBaseTests.BVrL_ow3.js} +9 -9
- package/dist/chunks/{setup-common.wObu9a36.js → setup-common.CPvtqi8q.js} +25 -2
- package/dist/chunks/{suite.qtkXWc6R.d.ts → suite.d.FvehnV49.d.ts} +1 -1
- package/dist/chunks/{typechecker.cZ0LjdSi.js → typechecker.BlF3eHsb.js} +2 -7
- package/dist/chunks/{vi.DT3m61kS.js → vi.nSCvwQ7l.js} +4 -4
- package/dist/chunks/vite.d.BUZTGxQ3.d.ts +11 -0
- package/dist/chunks/{vm.6kNys9FN.js → vm.jEFQDlX_.js} +1 -1
- package/dist/chunks/{worker.DaAIyCKm.d.ts → worker.d.C58isfFm.d.ts} +62 -62
- package/dist/chunks/{worker.B2JXutr8.d.ts → worker.d.CSFlSYJg.d.ts} +2 -2
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +48 -45
- package/dist/config.js +6 -123
- package/dist/coverage.d.ts +82 -79
- package/dist/coverage.js +19 -469
- package/dist/environments.d.ts +11 -11
- package/dist/execute.d.ts +109 -109
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +414 -412
- package/dist/index.js +4 -4
- package/dist/node.d.ts +51 -48
- package/dist/node.js +13 -10
- package/dist/reporters.d.ts +7 -4
- package/dist/reporters.js +3 -2
- package/dist/runners.d.ts +28 -28
- package/dist/runners.js +3 -4
- package/dist/snapshot.d.ts +2 -2
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +1 -1
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +9 -9
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +2 -2
- package/dist/workers/vmThreads.js +2 -2
- package/dist/workers.d.ts +13 -13
- package/dist/workers.js +3 -3
- package/package.json +12 -12
- package/dist/chunks/config.BRtC-JeT.d.ts +0 -215
- package/dist/chunks/environment.d8YfPkTm.d.ts +0 -173
- package/dist/chunks/global.CnI8_G5V.d.ts +0 -133
- package/dist/chunks/reporters.QZ837uWx.d.ts +0 -3051
- package/dist/chunks/spy.Cf_4R5Oe.js +0 -22
- package/dist/chunks/vite.vM3UZq1q.d.ts +0 -11
package/dist/environments.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { E as Environment } from './chunks/environment.
|
|
2
|
-
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
"node": Environment
|
|
6
|
+
"jsdom": Environment
|
|
7
|
+
"happy-dom": Environment
|
|
8
|
+
"edge-runtime": Environment
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
interface PopulateOptions {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
bindFunctions?: boolean;
|
|
13
|
+
additionalKeys?: string[];
|
|
14
14
|
}
|
|
15
15
|
declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
13
|
+
import './chunks/environment.d.C8UItCbf.js';
|
|
14
14
|
|
|
15
15
|
declare class FileMap {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
25
|
-
|
|
24
|
+
timeout?: vm.RunningScriptOptions["timeout"] | undefined;
|
|
25
|
+
breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
|
|
26
26
|
}
|
|
27
27
|
type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
|
|
28
|
-
|
|
28
|
+
assert: object
|
|
29
29
|
}) => VMModule | Promise<VMModule>;
|
|
30
|
-
type ModuleStatus =
|
|
30
|
+
type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored";
|
|
31
31
|
declare class VMModule {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
moduleDirectories?: string[];
|
|
119
|
+
state: WorkerGlobalState;
|
|
120
|
+
context?: vm.Context;
|
|
121
|
+
externalModulesExecutor?: ExternalModulesExecutor;
|
|
122
122
|
}
|
|
123
123
|
declare class VitestExecutor extends ViteNodeRunner {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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 };
|
package/dist/execute.js
CHANGED