vitest 4.0.12 → 4.0.14
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 +7 -10
- package/dist/chunks/{base.CDEiaaLz.js → base.BEv8sRbK.js} +2 -2
- package/dist/chunks/{browser.d.Bq3zc1l_.d.ts → browser.d.F6jMf15V.d.ts} +1 -1
- package/dist/chunks/{cac.D9QaLeSz.js → cac.DnEx6DOX.js} +6 -6
- package/dist/chunks/{cli-api.BJh-POxZ.js → cli-api.CbjxIXjQ.js} +80 -71
- package/dist/chunks/{traces.d.Brik_NWu.d.ts → config.d.g6OOauRt.d.ts} +1 -18
- package/dist/chunks/{global.d.Dheepru6.d.ts → global.d.B15mdLcR.d.ts} +1 -1
- package/dist/chunks/{index.CMvpbrsJ.js → index.B88tjlE5.js} +1 -1
- package/dist/chunks/{index.QWbK7rHY.js → index.BspFP3mn.js} +12 -7
- package/dist/chunks/{index.DWDW6mLz.js → index.D6PC4Dpu.js} +9 -4
- package/dist/chunks/{init-forks.FphdQhPI.js → init-forks.DmvIFK4U.js} +1 -1
- package/dist/chunks/{init-threads.BfqfWDNi.js → init-threads.De6b3S3g.js} +1 -1
- package/dist/chunks/{init.D-GGeAxo.js → init.a5SCIJ0x.js} +4 -4
- package/dist/chunks/{plugin.d.DGpEw-QV.d.ts → plugin.d.B6hlg3fN.d.ts} +1 -1
- package/dist/chunks/{reporters.d.C2PtoEFY.d.ts → reporters.d.DeFcIuza.d.ts} +7 -5
- package/dist/chunks/rpc.d.RH3apGEf.d.ts +64 -0
- package/dist/chunks/{startModuleRunner.BEYtrq5Y.js → startModuleRunner.W28wBIgJ.js} +3 -0
- package/dist/chunks/traces.d.402V_yFI.d.ts +18 -0
- package/dist/chunks/{vm.tWlKAMXr.js → vm.BbVD4fJ5.js} +2 -2
- package/dist/chunks/{worker.d.Dxl5oW0C.d.ts → worker.d.DhEa3KzY.d.ts} +5 -63
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +10 -8
- package/dist/coverage.d.ts +8 -6
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +16 -9
- package/dist/module-evaluator.d.ts +117 -12
- package/dist/module-evaluator.js +4 -1
- package/dist/module-runner.js +1 -1
- package/dist/node.d.ts +11 -9
- package/dist/node.js +6 -6
- package/dist/reporters.d.ts +10 -8
- package/dist/reporters.js +2 -2
- package/dist/runners.d.ts +2 -1
- package/dist/worker.d.ts +6 -4
- package/dist/worker.js +4 -4
- package/dist/workers/forks.js +5 -5
- package/dist/workers/threads.js +5 -5
- package/dist/workers/vmForks.js +5 -5
- package/dist/workers/vmThreads.js +5 -5
- package/package.json +13 -18
- package/dist/chunks/mocker.d.BE_2ls6u.d.ts +0 -17
- package/dist/chunks/moduleRunner.d.RBEiFdiW.d.ts +0 -204
package/dist/reporters.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
export { aR as BaseReporter, aS as BenchmarkBuiltinReporters, aE as BenchmarkReporter, aF as BenchmarkReportsMap, aT as BuiltinReporterOptions, aU as BuiltinReporters, aG as DefaultReporter, aH as DotReporter, aI as GithubActionsReporter, aJ as HangingProcessReporter, aL as JUnitReporter, aV as JsonAssertionResult, aK as JsonReporter, aW as JsonTestResult, aX as JsonTestResults, aB as ReportedHookContext, aC as Reporter, aM as ReportersMap, aN as TapFlatReporter, aO as TapReporter, aD as TestRunEndReason, aP as VerboseBenchmarkReporter, aQ as VerboseReporter } from './chunks/reporters.d.
|
|
1
|
+
export { aR as BaseReporter, aS as BenchmarkBuiltinReporters, aE as BenchmarkReporter, aF as BenchmarkReportsMap, aT as BuiltinReporterOptions, aU as BuiltinReporters, aG as DefaultReporter, aH as DotReporter, aI as GithubActionsReporter, aJ as HangingProcessReporter, aL as JUnitReporter, aV as JsonAssertionResult, aK as JsonReporter, aW as JsonTestResult, aX as JsonTestResults, aB as ReportedHookContext, aC as Reporter, aM as ReportersMap, aN as TapFlatReporter, aO as TapReporter, aD as TestRunEndReason, aP as VerboseBenchmarkReporter, aQ as VerboseReporter } from './chunks/reporters.d.DeFcIuza.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils';
|
|
4
|
-
import './chunks/
|
|
5
|
-
import 'vite/module-runner';
|
|
6
|
-
import './chunks/traces.d.Brik_NWu.js';
|
|
7
|
-
import '@vitest/pretty-format';
|
|
4
|
+
import './chunks/rpc.d.RH3apGEf.js';
|
|
8
5
|
import '@vitest/snapshot';
|
|
9
|
-
import '
|
|
10
|
-
import './chunks/
|
|
6
|
+
import 'vite/module-runner';
|
|
7
|
+
import './chunks/traces.d.402V_yFI.js';
|
|
11
8
|
import 'node:stream';
|
|
12
9
|
import 'vite';
|
|
13
10
|
import '@vitest/mocker';
|
|
14
11
|
import '@vitest/utils/source-map';
|
|
15
12
|
import 'vitest/browser';
|
|
16
|
-
import './chunks/
|
|
13
|
+
import './chunks/config.d.g6OOauRt.js';
|
|
14
|
+
import '@vitest/pretty-format';
|
|
15
|
+
import '@vitest/utils/diff';
|
|
16
|
+
import './chunks/browser.d.F6jMf15V.js';
|
|
17
|
+
import './chunks/worker.d.DhEa3KzY.js';
|
|
18
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
17
19
|
import '@vitest/expect';
|
|
18
20
|
import 'vitest/optional-types.js';
|
|
19
21
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
package/dist/reporters.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.
|
|
2
|
-
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.
|
|
1
|
+
export { D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.D6PC4Dpu.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.B88tjlE5.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'pathe';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as tinybench from 'tinybench';
|
|
2
2
|
import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, Test, TestContext, ImportDuration } from '@vitest/runner';
|
|
3
3
|
export { VitestRunner } from '@vitest/runner';
|
|
4
|
-
import { S as SerializedConfig
|
|
4
|
+
import { S as SerializedConfig } from './chunks/config.d.g6OOauRt.js';
|
|
5
|
+
import { T as Traces } from './chunks/traces.d.402V_yFI.js';
|
|
5
6
|
import '@vitest/pretty-format';
|
|
6
7
|
import '@vitest/snapshot';
|
|
7
8
|
import '@vitest/utils/diff';
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { W as WorkerGlobalState, B as BirpcOptions,
|
|
2
|
-
import { T as Traces } from './chunks/traces.d.
|
|
1
|
+
import { W as WorkerGlobalState, B as BirpcOptions, a as WorkerSetupContext } from './chunks/worker.d.DhEa3KzY.js';
|
|
2
|
+
import { T as Traces } from './chunks/traces.d.402V_yFI.js';
|
|
3
3
|
import { Awaitable } from '@vitest/utils';
|
|
4
|
+
import { R as RuntimeRPC } from './chunks/rpc.d.RH3apGEf.js';
|
|
4
5
|
import '@vitest/runner';
|
|
5
6
|
import 'vite/module-runner';
|
|
6
|
-
import './chunks/
|
|
7
|
-
import '@vitest/snapshot';
|
|
7
|
+
import './chunks/config.d.g6OOauRt.js';
|
|
8
8
|
import '@vitest/pretty-format';
|
|
9
|
+
import '@vitest/snapshot';
|
|
9
10
|
import '@vitest/utils/diff';
|
|
11
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
10
12
|
|
|
11
13
|
/** @experimental */
|
|
12
14
|
declare function runBaseTests(method: "run" | "collect", state: WorkerGlobalState, traces: Traces): Promise<void>;
|
package/dist/worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { r as runBaseTests } from './chunks/base.
|
|
2
|
-
export { i as init } from './chunks/init.
|
|
1
|
+
export { r as runBaseTests } from './chunks/base.BEv8sRbK.js';
|
|
2
|
+
export { i as init } from './chunks/init.a5SCIJ0x.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
5
|
import './chunks/index.CQwQ_SLL.js';
|
|
@@ -25,7 +25,7 @@ import './chunks/_commonjsHelpers.D26ty3Ew.js';
|
|
|
25
25
|
import './chunks/date.Bq6ZW5rf.js';
|
|
26
26
|
import './chunks/evaluatedModules.Dg1zASAC.js';
|
|
27
27
|
import 'vite/module-runner';
|
|
28
|
-
import './chunks/startModuleRunner.
|
|
28
|
+
import './chunks/startModuleRunner.W28wBIgJ.js';
|
|
29
29
|
import 'node:fs';
|
|
30
30
|
import 'node:module';
|
|
31
31
|
import 'node:url';
|
|
@@ -43,5 +43,5 @@ import 'node:util';
|
|
|
43
43
|
import '@vitest/utils/constants';
|
|
44
44
|
import './chunks/index.DBx1AtPJ.js';
|
|
45
45
|
import 'expect-type';
|
|
46
|
-
import './chunks/index.
|
|
46
|
+
import './chunks/index.BspFP3mn.js';
|
|
47
47
|
import 'node:console';
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as runBaseTests, s as setupEnvironment } from '../chunks/base.
|
|
2
|
-
import { w as workerInit } from '../chunks/init-forks.
|
|
1
|
+
import { r as runBaseTests, s as setupEnvironment } from '../chunks/base.BEv8sRbK.js';
|
|
2
|
+
import { w as workerInit } from '../chunks/init-forks.DmvIFK4U.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
5
|
import '../chunks/index.CQwQ_SLL.js';
|
|
@@ -23,19 +23,19 @@ import '@vitest/utils/offset';
|
|
|
23
23
|
import '@vitest/utils/source-map';
|
|
24
24
|
import '../chunks/_commonjsHelpers.D26ty3Ew.js';
|
|
25
25
|
import '../chunks/date.Bq6ZW5rf.js';
|
|
26
|
-
import '../chunks/init.
|
|
26
|
+
import '../chunks/init.a5SCIJ0x.js';
|
|
27
27
|
import 'node:fs';
|
|
28
28
|
import 'node:module';
|
|
29
29
|
import 'node:url';
|
|
30
30
|
import 'vite/module-runner';
|
|
31
|
-
import '../chunks/startModuleRunner.
|
|
31
|
+
import '../chunks/startModuleRunner.W28wBIgJ.js';
|
|
32
32
|
import '../path.js';
|
|
33
33
|
import 'node:path';
|
|
34
34
|
import '@vitest/utils/serialize';
|
|
35
35
|
import '../module-evaluator.js';
|
|
36
36
|
import '../chunks/traces.U4xDYhzZ.js';
|
|
37
37
|
import '@vitest/mocker';
|
|
38
|
-
import '../chunks/index.
|
|
38
|
+
import '../chunks/index.BspFP3mn.js';
|
|
39
39
|
import 'node:console';
|
|
40
40
|
import '../chunks/inspector.CvyFGlXm.js';
|
|
41
41
|
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as setupEnvironment, r as runBaseTests } from '../chunks/base.
|
|
2
|
-
import { w as workerInit } from '../chunks/init-threads.
|
|
1
|
+
import { s as setupEnvironment, r as runBaseTests } from '../chunks/base.BEv8sRbK.js';
|
|
2
|
+
import { w as workerInit } from '../chunks/init-threads.De6b3S3g.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
5
|
import '../chunks/index.CQwQ_SLL.js';
|
|
@@ -23,19 +23,19 @@ import '@vitest/utils/offset';
|
|
|
23
23
|
import '@vitest/utils/source-map';
|
|
24
24
|
import '../chunks/_commonjsHelpers.D26ty3Ew.js';
|
|
25
25
|
import '../chunks/date.Bq6ZW5rf.js';
|
|
26
|
-
import '../chunks/init.
|
|
26
|
+
import '../chunks/init.a5SCIJ0x.js';
|
|
27
27
|
import 'node:fs';
|
|
28
28
|
import 'node:module';
|
|
29
29
|
import 'node:url';
|
|
30
30
|
import 'vite/module-runner';
|
|
31
|
-
import '../chunks/startModuleRunner.
|
|
31
|
+
import '../chunks/startModuleRunner.W28wBIgJ.js';
|
|
32
32
|
import '../path.js';
|
|
33
33
|
import 'node:path';
|
|
34
34
|
import '@vitest/utils/serialize';
|
|
35
35
|
import '../module-evaluator.js';
|
|
36
36
|
import '../chunks/traces.U4xDYhzZ.js';
|
|
37
37
|
import '@vitest/mocker';
|
|
38
|
-
import '../chunks/index.
|
|
38
|
+
import '../chunks/index.BspFP3mn.js';
|
|
39
39
|
import 'node:console';
|
|
40
40
|
import '../chunks/inspector.CvyFGlXm.js';
|
|
41
41
|
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { w as workerInit } from '../chunks/init-forks.
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
3
|
-
import '../chunks/init.
|
|
1
|
+
import { w as workerInit } from '../chunks/init-forks.DmvIFK4U.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.BbVD4fJ5.js';
|
|
3
|
+
import '../chunks/init.a5SCIJ0x.js';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:module';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import 'pathe';
|
|
8
8
|
import 'vite/module-runner';
|
|
9
|
-
import '../chunks/startModuleRunner.
|
|
9
|
+
import '../chunks/startModuleRunner.W28wBIgJ.js';
|
|
10
10
|
import '@vitest/utils/helpers';
|
|
11
11
|
import '../path.js';
|
|
12
12
|
import 'node:path';
|
|
@@ -15,7 +15,7 @@ import '../module-evaluator.js';
|
|
|
15
15
|
import 'node:vm';
|
|
16
16
|
import '../chunks/traces.U4xDYhzZ.js';
|
|
17
17
|
import '@vitest/mocker';
|
|
18
|
-
import '../chunks/index.
|
|
18
|
+
import '../chunks/index.BspFP3mn.js';
|
|
19
19
|
import 'node:console';
|
|
20
20
|
import '@vitest/utils/error';
|
|
21
21
|
import '../chunks/rpc.BytlcPfC.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { w as workerInit } from '../chunks/init-threads.
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
1
|
+
import { w as workerInit } from '../chunks/init-threads.De6b3S3g.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.BbVD4fJ5.js';
|
|
3
3
|
import 'node:worker_threads';
|
|
4
|
-
import '../chunks/init.
|
|
4
|
+
import '../chunks/init.a5SCIJ0x.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:module';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'pathe';
|
|
9
9
|
import 'vite/module-runner';
|
|
10
|
-
import '../chunks/startModuleRunner.
|
|
10
|
+
import '../chunks/startModuleRunner.W28wBIgJ.js';
|
|
11
11
|
import '@vitest/utils/helpers';
|
|
12
12
|
import '../path.js';
|
|
13
13
|
import 'node:path';
|
|
@@ -16,7 +16,7 @@ import '../module-evaluator.js';
|
|
|
16
16
|
import 'node:vm';
|
|
17
17
|
import '../chunks/traces.U4xDYhzZ.js';
|
|
18
18
|
import '@vitest/mocker';
|
|
19
|
-
import '../chunks/index.
|
|
19
|
+
import '../chunks/index.BspFP3mn.js';
|
|
20
20
|
import 'node:console';
|
|
21
21
|
import '@vitest/utils/error';
|
|
22
22
|
import '../chunks/rpc.BytlcPfC.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.14",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -131,14 +131,13 @@
|
|
|
131
131
|
"peerDependencies": {
|
|
132
132
|
"@edge-runtime/vm": "*",
|
|
133
133
|
"@opentelemetry/api": "^1.9.0",
|
|
134
|
-
"@types/debug": "^4.1.12",
|
|
135
134
|
"@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
|
|
136
135
|
"happy-dom": "*",
|
|
137
136
|
"jsdom": "*",
|
|
138
|
-
"@vitest/browser-playwright": "4.0.
|
|
139
|
-
"@vitest/browser-preview": "4.0.
|
|
140
|
-
"@vitest/browser-webdriverio": "4.0.
|
|
141
|
-
"@vitest/ui": "4.0.
|
|
137
|
+
"@vitest/browser-playwright": "4.0.14",
|
|
138
|
+
"@vitest/browser-preview": "4.0.14",
|
|
139
|
+
"@vitest/browser-webdriverio": "4.0.14",
|
|
140
|
+
"@vitest/ui": "4.0.14"
|
|
142
141
|
},
|
|
143
142
|
"peerDependenciesMeta": {
|
|
144
143
|
"@edge-runtime/vm": {
|
|
@@ -147,9 +146,6 @@
|
|
|
147
146
|
"@opentelemetry/api": {
|
|
148
147
|
"optional": true
|
|
149
148
|
},
|
|
150
|
-
"@types/debug": {
|
|
151
|
-
"optional": true
|
|
152
|
-
},
|
|
153
149
|
"@types/node": {
|
|
154
150
|
"optional": true
|
|
155
151
|
},
|
|
@@ -173,10 +169,10 @@
|
|
|
173
169
|
}
|
|
174
170
|
},
|
|
175
171
|
"dependencies": {
|
|
176
|
-
"debug": "^4.4.3",
|
|
177
172
|
"es-module-lexer": "^1.7.0",
|
|
178
173
|
"expect-type": "^1.2.2",
|
|
179
174
|
"magic-string": "^0.30.21",
|
|
175
|
+
"obug": "^2.1.1",
|
|
180
176
|
"pathe": "^2.0.3",
|
|
181
177
|
"picomatch": "^4.0.3",
|
|
182
178
|
"std-env": "^3.10.0",
|
|
@@ -186,13 +182,13 @@
|
|
|
186
182
|
"tinyrainbow": "^3.0.3",
|
|
187
183
|
"vite": "^6.0.0 || ^7.0.0",
|
|
188
184
|
"why-is-node-running": "^2.3.0",
|
|
189
|
-
"@vitest/expect": "4.0.
|
|
190
|
-
"@vitest/
|
|
191
|
-
"@vitest/
|
|
192
|
-
"@vitest/
|
|
193
|
-
"@vitest/spy": "4.0.
|
|
194
|
-
"@vitest/
|
|
195
|
-
"@vitest/
|
|
185
|
+
"@vitest/expect": "4.0.14",
|
|
186
|
+
"@vitest/pretty-format": "4.0.14",
|
|
187
|
+
"@vitest/snapshot": "4.0.14",
|
|
188
|
+
"@vitest/runner": "4.0.14",
|
|
189
|
+
"@vitest/spy": "4.0.14",
|
|
190
|
+
"@vitest/mocker": "4.0.14",
|
|
191
|
+
"@vitest/utils": "4.0.14"
|
|
196
192
|
},
|
|
197
193
|
"devDependencies": {
|
|
198
194
|
"@antfu/install-pkg": "^1.1.0",
|
|
@@ -200,7 +196,6 @@
|
|
|
200
196
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
201
197
|
"@opentelemetry/api": "^1.9.0",
|
|
202
198
|
"@sinonjs/fake-timers": "14.0.0",
|
|
203
|
-
"@types/debug": "^4.1.12",
|
|
204
199
|
"@types/estree": "^1.0.8",
|
|
205
200
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
206
201
|
"@types/istanbul-reports": "^3.0.4",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { MockedModuleType } from '@vitest/mocker';
|
|
2
|
-
|
|
3
|
-
type Promisable<T> = T | Promise<T>;
|
|
4
|
-
type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M = M>() => Promise<T>) => Promisable<Partial<M>>;
|
|
5
|
-
type MockFactory = () => any;
|
|
6
|
-
interface MockOptions {
|
|
7
|
-
spy?: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface PendingSuiteMock {
|
|
10
|
-
id: string;
|
|
11
|
-
importer: string;
|
|
12
|
-
action: "mock" | "unmock";
|
|
13
|
-
type?: MockedModuleType;
|
|
14
|
-
factory?: MockFactory;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type { MockFactoryWithHelper as M, PendingSuiteMock as P, MockOptions as a, MockFactory as b };
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import * as _vitest_spy from '@vitest/spy';
|
|
2
|
-
import vm from 'node:vm';
|
|
3
|
-
import * as viteModuleRunner from 'vite/module-runner';
|
|
4
|
-
import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode, FetchFunction, EvaluatedModules } from 'vite/module-runner';
|
|
5
|
-
import { R as RuntimeRPC, e as ResolveFunctionResult, W as WorkerGlobalState } from './worker.d.Dxl5oW0C.js';
|
|
6
|
-
import { MockedModule, MockedModuleType } from '@vitest/mocker';
|
|
7
|
-
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './mocker.d.BE_2ls6u.js';
|
|
8
|
-
|
|
9
|
-
declare class FileMap {
|
|
10
|
-
private fsCache;
|
|
11
|
-
private fsBufferCache;
|
|
12
|
-
readFileAsync(path: string): Promise<string>;
|
|
13
|
-
readFile(path: string): string;
|
|
14
|
-
readBuffer(path: string): Buffer<ArrayBuffer>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface ModuleEvaluateOptions {
|
|
18
|
-
timeout?: vm.RunningScriptOptions["timeout"] | undefined;
|
|
19
|
-
breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
|
|
20
|
-
}
|
|
21
|
-
type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
|
|
22
|
-
assert: object;
|
|
23
|
-
}) => VMModule | Promise<VMModule>;
|
|
24
|
-
type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored";
|
|
25
|
-
declare class VMModule {
|
|
26
|
-
dependencySpecifiers: readonly string[];
|
|
27
|
-
error: any;
|
|
28
|
-
identifier: string;
|
|
29
|
-
context: vm.Context;
|
|
30
|
-
namespace: object;
|
|
31
|
-
status: ModuleStatus;
|
|
32
|
-
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
|
|
33
|
-
link(linker: ModuleLinker): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface ExternalModulesExecutorOptions {
|
|
37
|
-
context: vm.Context;
|
|
38
|
-
fileMap: FileMap;
|
|
39
|
-
packageCache: Map<string, any>;
|
|
40
|
-
transform: RuntimeRPC["transform"];
|
|
41
|
-
interopDefault?: boolean;
|
|
42
|
-
viteClientModule: Record<string, unknown>;
|
|
43
|
-
}
|
|
44
|
-
declare class ExternalModulesExecutor {
|
|
45
|
-
#private;
|
|
46
|
-
private options;
|
|
47
|
-
private cjs;
|
|
48
|
-
private esm;
|
|
49
|
-
private vite;
|
|
50
|
-
private context;
|
|
51
|
-
private fs;
|
|
52
|
-
private resolvers;
|
|
53
|
-
constructor(options: ExternalModulesExecutorOptions);
|
|
54
|
-
import(identifier: string): Promise<object>;
|
|
55
|
-
require(identifier: string): any;
|
|
56
|
-
createRequire(identifier: string): NodeJS.Require;
|
|
57
|
-
importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
|
|
58
|
-
resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
|
|
59
|
-
resolve(specifier: string, parent: string): string;
|
|
60
|
-
private getModuleInformation;
|
|
61
|
-
private createModule;
|
|
62
|
-
private get isNetworkSupported();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
type ModuleExecutionInfo = Map<string, ModuleExecutionInfoEntry>;
|
|
66
|
-
interface ModuleExecutionInfoEntry {
|
|
67
|
-
startOffset: number;
|
|
68
|
-
/** The duration that was spent executing the module. */
|
|
69
|
-
duration: number;
|
|
70
|
-
/** The time that was spent executing the module itself and externalized imports. */
|
|
71
|
-
selfTime: number;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface VitestModuleEvaluatorOptions {
|
|
75
|
-
interopDefault?: boolean | undefined;
|
|
76
|
-
moduleExecutionInfo?: ModuleExecutionInfo;
|
|
77
|
-
getCurrentTestFilepath?: () => string | undefined;
|
|
78
|
-
compiledFunctionArgumentsNames?: string[];
|
|
79
|
-
compiledFunctionArgumentsValues?: unknown[];
|
|
80
|
-
}
|
|
81
|
-
declare class VitestModuleEvaluator implements ModuleEvaluator {
|
|
82
|
-
private options;
|
|
83
|
-
stubs: Record<string, any>;
|
|
84
|
-
env: ModuleRunnerImportMeta["env"];
|
|
85
|
-
private vm;
|
|
86
|
-
private compiledFunctionArgumentsNames?;
|
|
87
|
-
private compiledFunctionArgumentsValues;
|
|
88
|
-
private primitives;
|
|
89
|
-
private debug;
|
|
90
|
-
private _otel;
|
|
91
|
-
constructor(vmOptions?: VitestVmOptions | undefined, options?: VitestModuleEvaluatorOptions);
|
|
92
|
-
private convertIdToImportUrl;
|
|
93
|
-
runExternalModule(id: string): Promise<any>;
|
|
94
|
-
runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
|
|
95
|
-
private _runInlinedModule;
|
|
96
|
-
private createRequire;
|
|
97
|
-
private shouldInterop;
|
|
98
|
-
}
|
|
99
|
-
declare function createImportMetaEnvProxy(): ModuleRunnerImportMeta["env"];
|
|
100
|
-
declare function getDefaultRequestStubs(context?: vm.Context): Record<string, any>;
|
|
101
|
-
declare function isPrimitive(v: any): boolean;
|
|
102
|
-
declare function wrapId(id: string): string;
|
|
103
|
-
declare function unwrapId(id: string): string;
|
|
104
|
-
|
|
105
|
-
interface VitestTransportOptions {
|
|
106
|
-
fetchModule: FetchFunction;
|
|
107
|
-
resolveId: (id: string, importer?: string) => Promise<ResolveFunctionResult | null>;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
interface MockContext {
|
|
111
|
-
/**
|
|
112
|
-
* When mocking with a factory, this refers to the module that imported the mock.
|
|
113
|
-
*/
|
|
114
|
-
callstack: null | string[];
|
|
115
|
-
}
|
|
116
|
-
interface VitestMockerOptions {
|
|
117
|
-
context?: vm.Context;
|
|
118
|
-
spyModule?: typeof _vitest_spy;
|
|
119
|
-
root: string;
|
|
120
|
-
moduleDirectories: string[];
|
|
121
|
-
resolveId: (id: string, importer?: string) => Promise<{
|
|
122
|
-
id: string;
|
|
123
|
-
file: string;
|
|
124
|
-
url: string;
|
|
125
|
-
} | null>;
|
|
126
|
-
getCurrentTestFilepath: () => string | undefined;
|
|
127
|
-
}
|
|
128
|
-
declare class VitestMocker {
|
|
129
|
-
moduleRunner: VitestModuleRunner;
|
|
130
|
-
private options;
|
|
131
|
-
static pendingIds: PendingSuiteMock[];
|
|
132
|
-
private spyModule?;
|
|
133
|
-
private primitives;
|
|
134
|
-
private filterPublicKeys;
|
|
135
|
-
private registries;
|
|
136
|
-
private mockContext;
|
|
137
|
-
private _otel;
|
|
138
|
-
constructor(moduleRunner: VitestModuleRunner, options: VitestMockerOptions);
|
|
139
|
-
private get root();
|
|
140
|
-
private get evaluatedModules();
|
|
141
|
-
private get moduleDirectories();
|
|
142
|
-
initializeSpyModule(): Promise<void>;
|
|
143
|
-
private getMockerRegistry;
|
|
144
|
-
reset(): void;
|
|
145
|
-
private invalidateModuleById;
|
|
146
|
-
private isModuleDirectory;
|
|
147
|
-
getSuiteFilepath(): string;
|
|
148
|
-
private createError;
|
|
149
|
-
resolveId(rawId: string, importer?: string): Promise<{
|
|
150
|
-
id: string;
|
|
151
|
-
url: string;
|
|
152
|
-
external: string | null;
|
|
153
|
-
}>;
|
|
154
|
-
resolveMocks(): Promise<void>;
|
|
155
|
-
private ensureModule;
|
|
156
|
-
private callFunctionMock;
|
|
157
|
-
getMockContext(): MockContext;
|
|
158
|
-
getMockPath(dep: string): string;
|
|
159
|
-
getDependencyMock(id: string): MockedModule | undefined;
|
|
160
|
-
findMockRedirect(mockPath: string, external: string | null): string | null;
|
|
161
|
-
mockObject(object: Record<string | symbol, any>, mockExports?: Record<string | symbol, any>, behavior?: "automock" | "autospy"): Record<string | symbol, any>;
|
|
162
|
-
unmockPath(id: string): void;
|
|
163
|
-
mockPath(originalId: string, id: string, url: string, external: string | null, mockType: MockedModuleType | undefined, factory: MockFactory | undefined): void;
|
|
164
|
-
importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
|
|
165
|
-
importMock(rawId: string, importer: string): Promise<any>;
|
|
166
|
-
requestWithMockedModule(url: string, evaluatedNode: EvaluatedModuleNode, callstack: string[], mock: MockedModule): Promise<any>;
|
|
167
|
-
mockedRequest(url: string, evaluatedNode: EvaluatedModuleNode, callstack: string[]): Promise<any>;
|
|
168
|
-
queueMock(id: string, importer: string, factoryOrOptions?: MockFactory | MockOptions): void;
|
|
169
|
-
queueUnmock(id: string, importer: string): void;
|
|
170
|
-
}
|
|
171
|
-
declare module "vite/module-runner" {
|
|
172
|
-
interface EvaluatedModuleNode {
|
|
173
|
-
mockedExports?: Record<string, any>;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
type CreateImportMeta = NonNullable<viteModuleRunner.ModuleRunnerOptions["createImportMeta"]>;
|
|
178
|
-
declare class VitestModuleRunner extends viteModuleRunner.ModuleRunner {
|
|
179
|
-
private vitestOptions;
|
|
180
|
-
mocker: VitestMocker;
|
|
181
|
-
moduleExecutionInfo: ModuleExecutionInfo;
|
|
182
|
-
private _otel;
|
|
183
|
-
constructor(vitestOptions: VitestModuleRunnerOptions);
|
|
184
|
-
import(rawId: string): Promise<any>;
|
|
185
|
-
fetchModule(url: string, importer?: string): Promise<EvaluatedModuleNode>;
|
|
186
|
-
private _cachedRequest;
|
|
187
|
-
}
|
|
188
|
-
interface VitestModuleRunnerOptions {
|
|
189
|
-
transport: VitestTransportOptions;
|
|
190
|
-
evaluator: VitestModuleEvaluator;
|
|
191
|
-
evaluatedModules: EvaluatedModules;
|
|
192
|
-
getWorkerState: () => WorkerGlobalState;
|
|
193
|
-
mocker?: VitestMocker;
|
|
194
|
-
vm?: VitestVmOptions;
|
|
195
|
-
spyModule?: typeof _vitest_spy;
|
|
196
|
-
createImportMeta?: CreateImportMeta;
|
|
197
|
-
}
|
|
198
|
-
interface VitestVmOptions {
|
|
199
|
-
context: vm.Context;
|
|
200
|
-
externalModulesExecutor: ExternalModulesExecutor;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export { VitestModuleRunner as V, VitestModuleEvaluator as b, createImportMetaEnvProxy as c, getDefaultRequestStubs as g, isPrimitive as i, unwrapId as u, wrapId as w };
|
|
204
|
-
export type { VitestModuleEvaluatorOptions as a };
|