vitest 2.1.3 → 2.1.4
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/LICENSE.md +1 -209
- package/dist/browser.d.ts +21 -21
- package/dist/browser.js +7 -7
- package/dist/chunks/{RandomSequencer.Bh5-tlNJ.js → RandomSequencer.CMRlh2v4.js} +143 -142
- package/dist/chunks/{base.BO5Jx7vw.js → base.C3xNdjV6.js} +3 -3
- package/dist/chunks/{benchmark.C8CRJYG4.js → benchmark.Cdu9hjj4.js} +2 -2
- package/dist/chunks/{benchmark.JVlTzojj.d.ts → benchmark.geERunq4.d.ts} +1 -1
- package/dist/chunks/{cac.BSMVokHR.js → cac.DrfPaMvZ.js} +11 -10
- package/dist/chunks/{cli-api.btGgw3PC.js → cli-api.CKrRYkw8.js} +732 -577
- package/dist/chunks/{console.CfT1Wjed.js → console.BYGVloWk.js} +2 -6
- package/dist/chunks/{coverage.zlNdAMHK.js → coverage.BoMDb1ip.js} +1 -1
- package/dist/chunks/{creator.CBPphXqR.js → creator.IIqd8RWT.js} +8 -8
- package/dist/chunks/{execute._eQQfgI8.js → execute.2pr0rHgK.js} +8 -6
- package/dist/chunks/{globals.Bdzt04Qm.js → globals.Bp645TTJ.js} +8 -13
- package/dist/chunks/{index.BpSiYbpB.js → index.68735LiX.js} +28 -5
- package/dist/chunks/{index.X0nbfr6-.js → index.BJDntFik.js} +7 -7
- package/dist/chunks/{index.Dz2opmmU.js → index.Bn81VaWg.js} +3808 -3787
- package/dist/chunks/{index.CPD77dLA.js → index.CqYx2Nsr.js} +7 -7
- package/dist/chunks/{index.4GFF2h22.js → index.D3d79vc8.js} +6 -6
- package/dist/chunks/index.Dqe5k2Rk.js +54 -0
- package/dist/chunks/{node.Bx4JZjMG.js → node.AKq966Jp.js} +1 -5
- package/dist/chunks/{reporters.C4ZHgdxQ.d.ts → reporters.anwo7Y6a.d.ts} +1328 -1313
- package/dist/chunks/{resolveConfig.Dha6ilPI.js → resolveConfig.DPmbhVlP.js} +3193 -3175
- package/dist/chunks/{rpc.B7Mfb-Yf.js → rpc.C3q9uwRX.js} +2 -2
- package/dist/chunks/{run-once.Sxe67Wng.js → run-once.2ogXb3JV.js} +1 -1
- package/dist/chunks/{runBaseTests.Cx4wXyTR.js → runBaseTests.Dm-659zB.js} +21 -25
- package/dist/chunks/{setup-common.BKyF15v_.js → setup-common.DDmVKp6O.js} +3 -3
- package/dist/chunks/{suite.BMWOKiTe.d.ts → suite.B2jumIFP.d.ts} +2 -2
- package/dist/chunks/{utils.CY6Spixo.js → utils.BB4zjzR8.js} +2 -2
- package/dist/chunks/utils.C8RiOc4B.js +77 -0
- package/dist/chunks/{vi.BskyZC5g.js → vi.JMQoNY_Z.js} +94 -141
- package/dist/chunks/{vite.YH7MrecS.d.ts → vite.BdBj-UWY.d.ts} +1 -1
- package/dist/chunks/{vm.DB_hLchi.js → vm.jpyrB0xy.js} +5 -8
- package/dist/chunks/{worker.B6RjTtbk.d.ts → worker.BAlI9hII.d.ts} +12 -3
- package/dist/chunks/{worker.CcJLfX8w.d.ts → worker.DHnGaO2M.d.ts} +1 -1
- package/dist/cli.js +3 -4
- package/dist/config.cjs +4 -4
- package/dist/config.d.ts +10 -10
- package/dist/config.js +4 -4
- package/dist/coverage.d.ts +9 -9
- package/dist/coverage.js +8 -11
- package/dist/environments.d.ts +2 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +53 -53
- package/dist/execute.js +7 -6
- package/dist/index.d.ts +75 -1099
- package/dist/index.js +7 -18
- package/dist/node.d.ts +43 -41
- package/dist/node.js +22 -28
- package/dist/path.js +1 -1
- package/dist/reporters.d.ts +10 -10
- package/dist/reporters.js +12 -18
- package/dist/runners.d.ts +12 -19
- package/dist/runners.js +142 -148
- package/dist/snapshot.js +2 -6
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -6
- package/dist/worker.js +5 -6
- package/dist/workers/forks.js +9 -8
- package/dist/workers/runVmTests.js +16 -20
- package/dist/workers/threads.js +9 -8
- package/dist/workers/vmForks.js +9 -12
- package/dist/workers/vmThreads.js +9 -12
- package/dist/workers.d.ts +13 -13
- package/dist/workers.js +14 -18
- package/package.json +26 -26
- package/dist/chunks/base.DwXGwWst.js +0 -89
- package/dist/chunks/env.CmHVDJnw.js +0 -7
- package/dist/chunks/index.-d_XpZEA.js +0 -140
- package/dist/chunks/index.CxRxs566.js +0 -23
- package/dist/chunks/tasks.BZnCS9aT.js +0 -18
- package/dist/chunks/utils.Ck2hJTRs.js +0 -23
- package/dist/chunks/{environment.CzISCQ7o.d.ts → environment.LoooBwUu.d.ts} +24 -24
- package/dist/chunks/{index.lVXYBqEP.js → index.BMoXz_-n.js} +186 -186
package/dist/coverage.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '@vitest/runner';
|
|
5
|
-
import '@vitest/pretty-format';
|
|
2
|
+
import { R as ResolvedCoverageOptions, V as Vitest, a as ReportContext } from './chunks/reporters.anwo7Y6a.js';
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/environment.LoooBwUu.js';
|
|
6
4
|
import './chunks/config.Crbj2GAb.js';
|
|
5
|
+
import '@vitest/pretty-format';
|
|
6
|
+
import '@vitest/runner';
|
|
7
7
|
import '@vitest/snapshot';
|
|
8
8
|
import '@vitest/snapshot/environment';
|
|
9
9
|
import 'vite-node';
|
|
10
|
+
import 'chai';
|
|
10
11
|
import 'node:stream';
|
|
11
|
-
import 'vite-node/client';
|
|
12
|
-
import '@vitest/snapshot/manager';
|
|
13
|
-
import 'vite-node/server';
|
|
14
12
|
import '@vitest/utils';
|
|
15
13
|
import '@vitest/utils/source-map';
|
|
14
|
+
import 'vite-node/client';
|
|
15
|
+
import 'vite-node/server';
|
|
16
|
+
import '@vitest/snapshot/manager';
|
|
16
17
|
import 'node:fs';
|
|
17
|
-
import '
|
|
18
|
-
import './chunks/benchmark.JVlTzojj.js';
|
|
18
|
+
import './chunks/benchmark.geERunq4.js';
|
|
19
19
|
import '@vitest/runner/utils';
|
|
20
20
|
import 'tinybench';
|
|
21
21
|
|
package/dist/coverage.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync, promises, readdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { c as coverageConfigDefaults, r as resolveCoverageReporters, m as mm } from './chunks/resolveConfig.DPmbhVlP.js';
|
|
2
3
|
import { resolve, relative } from 'pathe';
|
|
3
|
-
import { c as coverageConfigDefaults, r as resolveCoverageReporters, m as mm } from './chunks/resolveConfig.Dha6ilPI.js';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
|
+
import '@vitest/utils';
|
|
5
6
|
import 'node:path';
|
|
6
7
|
import 'node:fs/promises';
|
|
7
8
|
import 'node:process';
|
|
@@ -12,26 +13,22 @@ import 'node:v8';
|
|
|
12
13
|
import 'node:util';
|
|
13
14
|
import './chunks/constants.fzPh7AOq.js';
|
|
14
15
|
import 'node:os';
|
|
15
|
-
import './chunks/
|
|
16
|
+
import './chunks/RandomSequencer.CMRlh2v4.js';
|
|
16
17
|
import 'std-env';
|
|
17
|
-
import '@vitest/runner/utils';
|
|
18
|
-
import './chunks/base.DwXGwWst.js';
|
|
19
|
-
import '@vitest/utils';
|
|
20
|
-
import 'node:crypto';
|
|
21
|
-
import './chunks/RandomSequencer.Bh5-tlNJ.js';
|
|
22
18
|
import 'node:perf_hooks';
|
|
19
|
+
import '@vitest/runner/utils';
|
|
23
20
|
import '@vitest/utils/source-map';
|
|
24
21
|
import 'tinyexec';
|
|
25
|
-
import 'path';
|
|
26
|
-
import 'fs';
|
|
27
|
-
import 'module';
|
|
28
22
|
import 'vite';
|
|
23
|
+
import 'fs';
|
|
29
24
|
import 'vite-node/utils';
|
|
25
|
+
import 'node:crypto';
|
|
30
26
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
31
27
|
import 'util';
|
|
28
|
+
import 'path';
|
|
32
29
|
import 'node:events';
|
|
30
|
+
import './chunks/index.68735LiX.js';
|
|
33
31
|
import 'tinypool';
|
|
34
|
-
import './chunks/index.BpSiYbpB.js';
|
|
35
32
|
import 'node:worker_threads';
|
|
36
33
|
import './path.js';
|
|
37
34
|
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.LoooBwUu.js';
|
|
2
|
+
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.LoooBwUu.js';
|
|
3
3
|
|
|
4
4
|
declare const environments: {
|
|
5
5
|
node: Environment;
|
package/dist/environments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.BMoXz_-n.js';
|
|
2
2
|
import 'node:console';
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import vm from 'node:vm';
|
|
2
|
-
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
1
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
4
|
-
import {
|
|
2
|
+
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
|
+
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.BAlI9hII.js';
|
|
4
|
+
import vm from 'node:vm';
|
|
5
5
|
import * as _vitest_mocker from '@vitest/mocker';
|
|
6
6
|
import { MockedModuleType } from '@vitest/mocker';
|
|
7
7
|
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.cRtM890J.js';
|
|
@@ -10,49 +10,14 @@ import './chunks/config.Crbj2GAb.js';
|
|
|
10
10
|
import '@vitest/pretty-format';
|
|
11
11
|
import '@vitest/snapshot';
|
|
12
12
|
import '@vitest/snapshot/environment';
|
|
13
|
-
import './chunks/environment.
|
|
13
|
+
import './chunks/environment.LoooBwUu.js';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
declare class VitestMocker {
|
|
22
|
-
executor: VitestExecutor;
|
|
23
|
-
static pendingIds: PendingSuiteMock[];
|
|
24
|
-
private spyModule?;
|
|
25
|
-
private primitives;
|
|
26
|
-
private filterPublicKeys;
|
|
27
|
-
private registries;
|
|
28
|
-
private mockContext;
|
|
29
|
-
constructor(executor: VitestExecutor);
|
|
30
|
-
private get root();
|
|
31
|
-
private get moduleCache();
|
|
32
|
-
private get moduleDirectories();
|
|
33
|
-
initializeSpyModule(): Promise<void>;
|
|
34
|
-
private getMockerRegistry;
|
|
35
|
-
reset(): void;
|
|
36
|
-
private deleteCachedItem;
|
|
37
|
-
private isModuleDirectory;
|
|
38
|
-
getSuiteFilepath(): string;
|
|
39
|
-
private createError;
|
|
40
|
-
private resolvePath;
|
|
41
|
-
resolveMocks(): Promise<void>;
|
|
42
|
-
private callFunctionMock;
|
|
43
|
-
getMockContext(): MockContext;
|
|
44
|
-
getMockPath(dep: string): string;
|
|
45
|
-
getDependencyMock(id: string): _vitest_mocker.MockedModule | undefined;
|
|
46
|
-
normalizePath(path: string): string;
|
|
47
|
-
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
48
|
-
mockObject(object: Record<string | symbol, any>, mockExports?: Record<string | symbol, any>, behavior?: MockedModuleType): Record<string | symbol, any>;
|
|
49
|
-
unmockPath(path: string): void;
|
|
50
|
-
mockPath(originalId: string, path: string, external: string | null, mockType: MockedModuleType | undefined, factory: MockFactory | undefined): void;
|
|
51
|
-
importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
|
|
52
|
-
importMock(rawId: string, importee: string): Promise<any>;
|
|
53
|
-
requestWithMock(url: string, callstack: string[]): Promise<any>;
|
|
54
|
-
queueMock(id: string, importer: string, factoryOrOptions?: MockFactory | MockOptions): void;
|
|
55
|
-
queueUnmock(id: string, importer: string): void;
|
|
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;
|
|
56
21
|
}
|
|
57
22
|
|
|
58
23
|
interface ModuleEvaluateOptions {
|
|
@@ -74,14 +39,6 @@ declare class VMModule {
|
|
|
74
39
|
link(linker: ModuleLinker): Promise<void>;
|
|
75
40
|
}
|
|
76
41
|
|
|
77
|
-
declare class FileMap {
|
|
78
|
-
private fsCache;
|
|
79
|
-
private fsBufferCache;
|
|
80
|
-
readFileAsync(path: string): Promise<string>;
|
|
81
|
-
readFile(path: string): string;
|
|
82
|
-
readBuffer(path: string): Buffer;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
42
|
interface ExternalModulesExecutorOptions {
|
|
86
43
|
context: vm.Context;
|
|
87
44
|
fileMap: FileMap;
|
|
@@ -114,6 +71,49 @@ declare class ExternalModulesExecutor {
|
|
|
114
71
|
private get isNetworkSupported();
|
|
115
72
|
}
|
|
116
73
|
|
|
74
|
+
interface MockContext {
|
|
75
|
+
/**
|
|
76
|
+
* When mocking with a factory, this refers to the module that imported the mock.
|
|
77
|
+
*/
|
|
78
|
+
callstack: null | string[];
|
|
79
|
+
}
|
|
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): _vitest_mocker.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
|
+
}
|
|
116
|
+
|
|
117
117
|
interface ExecuteOptions extends ViteNodeRunnerOptions {
|
|
118
118
|
moduleDirectories?: string[];
|
|
119
119
|
state: WorkerGlobalState;
|
package/dist/execute.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { V as VitestExecutor } from './chunks/execute.
|
|
2
|
-
import 'node:vm';
|
|
3
|
-
import 'node:url';
|
|
1
|
+
export { V as VitestExecutor } from './chunks/execute.2pr0rHgK.js';
|
|
4
2
|
import 'node:fs';
|
|
3
|
+
import 'node:url';
|
|
4
|
+
import 'node:vm';
|
|
5
|
+
import '@vitest/utils/error';
|
|
6
|
+
import 'pathe';
|
|
5
7
|
import 'vite-node/client';
|
|
6
8
|
import 'vite-node/utils';
|
|
7
|
-
import 'pathe';
|
|
8
|
-
import '@vitest/utils/error';
|
|
9
9
|
import './path.js';
|
|
10
|
-
import '
|
|
10
|
+
import 'node:path';
|
|
11
11
|
import '@vitest/mocker';
|
|
12
12
|
import 'node:module';
|
|
13
|
+
import '@vitest/utils';
|