vitest 4.0.0-beta.9 → 4.0.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.
- package/LICENSE.md +86 -102
- package/browser/context.d.ts +7 -0
- package/browser/context.js +20 -0
- package/dist/browser.d.ts +24 -7
- package/dist/browser.js +15 -5
- package/dist/chunks/{base.CA5N8Af0.js → base.BYPMk0VN.js} +36 -36
- package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.DHKMYAts.js} +2 -2
- package/dist/chunks/{browser.d.DtfyY9yS.d.ts → browser.d.B9iJzZyn.d.ts} +3 -3
- package/dist/chunks/{cac.Dt7e1TIu.js → cac.DrF4Gm0S.js} +47 -73
- package/dist/chunks/{cli-api.eAzsLIxz.js → cli-api.W2Q-JQoO.js} +1524 -296
- package/dist/chunks/{config.d.DacWrqWe.d.ts → config.d.u2CUDWwS.d.ts} +5 -19
- package/dist/chunks/{console.7h5kHUIf.js → console.CTJL2nuH.js} +4 -6
- package/dist/chunks/{coverage.CDRAMTt7.js → coverage.FU3w4IrQ.js} +125 -1108
- package/dist/chunks/{creator.KEg6n5IC.js → creator.DucAaYBz.js} +10 -37
- package/dist/chunks/{defaults.CXFFjsi8.js → defaults.BOqNVLsY.js} +0 -1
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/{global.d.K6uBQHzY.d.ts → global.d.BgJSTpgQ.d.ts} +2 -17
- package/dist/chunks/{globals.CJrTTbxC.js → globals.BGT_RUsD.js} +11 -7
- package/dist/chunks/{index.BjKEiSn0.js → index.BdSLhLDZ.js} +3 -3
- package/dist/chunks/{index.DfviD7lX.js → index.CbWINfS7.js} +49 -21
- package/dist/chunks/{index.BIP7prJq.js → index.CcRZ6fUh.js} +1493 -114
- package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
- package/dist/chunks/{index.C832ioot.js → index.RwjEGCQ0.js} +4 -4
- package/dist/chunks/init-forks.WglB-sfY.js +54 -0
- package/dist/chunks/init-threads.Czek6eA5.js +17 -0
- package/dist/chunks/init.94FWN9pW.js +213 -0
- package/dist/chunks/{inspector.CvQD-Nie.js → inspector.DLZxSeU3.js} +2 -6
- package/dist/chunks/{moduleRunner.d.DxTLreRD.d.ts → moduleRunner.d.YtNsMIoJ.d.ts} +9 -14
- package/dist/chunks/{node.CyipiPvJ.js → node.BwAWWjHZ.js} +3 -4
- package/dist/chunks/{plugin.d.CIk0YiKb.d.ts → plugin.d.DQU1R5px.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DmP-iHLr.d.ts → reporters.d.BMKt7f6I.d.ts} +1064 -1021
- package/dist/chunks/{resolveSnapshotEnvironment.Bvv2zr69.js → resolveSnapshotEnvironment.DJJKMKxb.js} +7 -8
- package/dist/chunks/{rpc.BKr6mtxz.js → rpc.cD77ENhU.js} +13 -14
- package/dist/chunks/{setup-common.B7I37Tji.js → setup-common.DR1sucx6.js} +6 -6
- package/dist/chunks/{startModuleRunner.BDRvKSdz.js → startModuleRunner.iF1E9Bt4.js} +126 -110
- package/dist/chunks/{test.BAlBebnP.js → test.C3RPt8JR.js} +7 -7
- package/dist/chunks/{utils.D2R2NiOH.js → utils.CG9h5ccR.js} +2 -5
- package/dist/chunks/{vi.BB37KeLx.js → vi.BZvkKVkM.js} +61 -164
- package/dist/chunks/{vm.CjLTDaST.js → vm.CuMWYx_F.js} +20 -29
- package/dist/chunks/{worker.d.B2r4Ln6p.d.ts → worker.d.BFk-vvBU.d.ts} +42 -6
- package/dist/cli.js +12 -11
- package/dist/config.cjs +0 -1
- package/dist/config.d.ts +11 -13
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +7 -6
- package/dist/coverage.js +3 -14
- package/dist/environments.d.ts +3 -6
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +20 -25
- package/dist/index.js +11 -7
- package/dist/module-evaluator.d.ts +5 -4
- package/dist/module-evaluator.js +11 -13
- package/dist/module-runner.js +5 -5
- package/dist/node.d.ts +82 -25
- package/dist/node.js +23 -20
- package/dist/reporters.d.ts +10 -9
- package/dist/reporters.js +12 -11
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +9 -7
- package/dist/snapshot.js +3 -3
- package/dist/suite.js +4 -3
- package/dist/worker.d.ts +26 -0
- package/dist/worker.js +45 -165
- package/dist/workers/forks.js +26 -43
- package/dist/workers/runVmTests.js +16 -12
- package/dist/workers/threads.js +26 -31
- package/dist/workers/vmForks.js +26 -39
- package/dist/workers/vmThreads.js +26 -29
- package/package.json +48 -32
- package/worker.d.ts +1 -0
- package/browser.d.ts +0 -1
- package/dist/chunks/environment.d.2fYMoz3o.d.ts +0 -66
- package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
- package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
- package/dist/chunks/typechecker.DB-fIMaH.js +0 -805
- package/dist/chunks/utils.C2YI6McM.js +0 -52
- package/dist/chunks/worker.d.DJ6qxO2w.d.ts +0 -8
- package/dist/workers.d.ts +0 -38
- package/dist/workers.js +0 -49
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
package/dist/workers/threads.js
CHANGED
|
@@ -1,55 +1,50 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
2
|
-
import {
|
|
1
|
+
import { r as runBaseTests } from '../chunks/base.BYPMk0VN.js';
|
|
2
|
+
import { w as workerInit } from '../chunks/init-threads.Czek6eA5.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
|
+
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
|
6
|
+
import 'pathe';
|
|
5
7
|
import 'vite/module-runner';
|
|
6
|
-
import '../chunks/startModuleRunner.
|
|
8
|
+
import '../chunks/startModuleRunner.iF1E9Bt4.js';
|
|
7
9
|
import 'node:fs';
|
|
8
10
|
import 'node:module';
|
|
9
|
-
import '@vitest/utils';
|
|
11
|
+
import '@vitest/utils/helpers';
|
|
10
12
|
import 'node:url';
|
|
11
|
-
import 'pathe';
|
|
12
13
|
import '../path.js';
|
|
13
14
|
import 'node:path';
|
|
14
|
-
import '@vitest/utils/
|
|
15
|
+
import '@vitest/utils/serialize';
|
|
15
16
|
import '../module-evaluator.js';
|
|
16
17
|
import '@vitest/mocker';
|
|
17
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
18
18
|
import 'node:perf_hooks';
|
|
19
19
|
import '@vitest/runner';
|
|
20
|
-
import '../chunks/resolveSnapshotEnvironment.
|
|
20
|
+
import '../chunks/resolveSnapshotEnvironment.DJJKMKxb.js';
|
|
21
21
|
import '@vitest/expect';
|
|
22
|
-
import '../chunks/setup-common.
|
|
22
|
+
import '../chunks/setup-common.DR1sucx6.js';
|
|
23
23
|
import '../chunks/coverage.D_JHT54q.js';
|
|
24
24
|
import '@vitest/snapshot';
|
|
25
|
-
import '
|
|
26
|
-
import '../chunks/
|
|
25
|
+
import '@vitest/utils/timers';
|
|
26
|
+
import '../chunks/utils.CG9h5ccR.js';
|
|
27
|
+
import '../chunks/rpc.cD77ENhU.js';
|
|
27
28
|
import '../chunks/index.Bgo3tNWt.js';
|
|
28
|
-
import '../chunks/test.
|
|
29
|
-
import '../chunks/benchmark.
|
|
29
|
+
import '../chunks/test.C3RPt8JR.js';
|
|
30
|
+
import '../chunks/benchmark.DHKMYAts.js';
|
|
30
31
|
import '@vitest/runner/utils';
|
|
31
|
-
import '
|
|
32
|
-
import '../chunks/
|
|
32
|
+
import '@vitest/utils/error';
|
|
33
|
+
import '../chunks/vi.BZvkKVkM.js';
|
|
34
|
+
import '@vitest/utils/offset';
|
|
33
35
|
import '@vitest/utils/source-map';
|
|
36
|
+
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
34
37
|
import '../chunks/date.-jtEtIeV.js';
|
|
35
|
-
import '../chunks/inspector.
|
|
38
|
+
import '../chunks/inspector.DLZxSeU3.js';
|
|
36
39
|
import 'node:timers';
|
|
37
40
|
import 'node:timers/promises';
|
|
38
41
|
import 'node:util';
|
|
39
|
-
import '
|
|
42
|
+
import '@vitest/utils/constants';
|
|
43
|
+
import '../chunks/index.RwjEGCQ0.js';
|
|
40
44
|
import 'expect-type';
|
|
45
|
+
import 'node:worker_threads';
|
|
46
|
+
import '../chunks/init.94FWN9pW.js';
|
|
47
|
+
import '../chunks/index.CbWINfS7.js';
|
|
48
|
+
import 'node:console';
|
|
41
49
|
|
|
42
|
-
|
|
43
|
-
getRpcOptions(ctx) {
|
|
44
|
-
return createThreadsRpcOptions(ctx);
|
|
45
|
-
}
|
|
46
|
-
runTests(state) {
|
|
47
|
-
return runBaseTests("run", state);
|
|
48
|
-
}
|
|
49
|
-
collectTests(state) {
|
|
50
|
-
return runBaseTests("collect", state);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const worker = new ThreadsBaseWorker();
|
|
54
|
-
|
|
55
|
-
export { worker as default };
|
|
50
|
+
workerInit({ runTests: runBaseTests });
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,48 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import '
|
|
1
|
+
import { w as workerInit } from '../chunks/init-forks.WglB-sfY.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.CuMWYx_F.js';
|
|
3
|
+
import 'node:v8';
|
|
4
|
+
import '../chunks/init.94FWN9pW.js';
|
|
5
|
+
import '@vitest/utils/error';
|
|
6
|
+
import '@vitest/utils/source-map';
|
|
7
|
+
import 'node:fs';
|
|
8
|
+
import 'node:module';
|
|
5
9
|
import 'node:url';
|
|
6
|
-
import 'node:vm';
|
|
7
10
|
import 'pathe';
|
|
11
|
+
import 'vite/module-runner';
|
|
12
|
+
import '../chunks/startModuleRunner.iF1E9Bt4.js';
|
|
13
|
+
import '@vitest/utils/helpers';
|
|
8
14
|
import '../path.js';
|
|
9
15
|
import 'node:path';
|
|
10
|
-
import '
|
|
16
|
+
import '@vitest/utils/serialize';
|
|
17
|
+
import '../module-evaluator.js';
|
|
18
|
+
import 'node:vm';
|
|
19
|
+
import '@vitest/mocker';
|
|
20
|
+
import '../chunks/index.CbWINfS7.js';
|
|
11
21
|
import 'node:console';
|
|
22
|
+
import '../chunks/inspector.DLZxSeU3.js';
|
|
23
|
+
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
|
24
|
+
import '../chunks/rpc.cD77ENhU.js';
|
|
25
|
+
import '@vitest/utils/timers';
|
|
26
|
+
import '../chunks/index.Bgo3tNWt.js';
|
|
27
|
+
import '../chunks/utils.CG9h5ccR.js';
|
|
28
|
+
import '../chunks/console.CTJL2nuH.js';
|
|
12
29
|
import 'node:stream';
|
|
13
30
|
import 'tinyrainbow';
|
|
14
31
|
import '../chunks/date.-jtEtIeV.js';
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
17
|
-
import 'node:module';
|
|
18
|
-
import '../chunks/resolver.Bx6lE0iq.js';
|
|
19
|
-
import '../module-evaluator.js';
|
|
20
|
-
import 'vite/module-runner';
|
|
21
|
-
import '../chunks/startModuleRunner.BDRvKSdz.js';
|
|
22
|
-
import '@vitest/utils/error';
|
|
23
|
-
import '@vitest/mocker';
|
|
24
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
25
|
-
|
|
26
|
-
class ForksVmWorker {
|
|
27
|
-
getRpcOptions() {
|
|
28
|
-
return createForksRpcOptions(v8);
|
|
29
|
-
}
|
|
30
|
-
async executeTests(method, state) {
|
|
31
|
-
const exit = process.exit;
|
|
32
|
-
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
|
|
33
|
-
try {
|
|
34
|
-
await runVmTests(method, state);
|
|
35
|
-
} finally {
|
|
36
|
-
process.exit = exit;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
runTests(state) {
|
|
40
|
-
return this.executeTests("run", state);
|
|
41
|
-
}
|
|
42
|
-
collectTests(state) {
|
|
43
|
-
return this.executeTests("collect", state);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const worker = new ForksVmWorker();
|
|
32
|
+
import '@vitest/utils/resolver';
|
|
33
|
+
import '@vitest/utils/constants';
|
|
47
34
|
|
|
48
|
-
|
|
35
|
+
workerInit({ runTests: runVmTests });
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
3
|
-
import '
|
|
1
|
+
import { w as workerInit } from '../chunks/init-threads.Czek6eA5.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.CuMWYx_F.js';
|
|
3
|
+
import 'node:worker_threads';
|
|
4
|
+
import '../chunks/init.94FWN9pW.js';
|
|
5
|
+
import '@vitest/utils/error';
|
|
6
|
+
import '@vitest/utils/source-map';
|
|
7
|
+
import 'node:fs';
|
|
8
|
+
import 'node:module';
|
|
4
9
|
import 'node:url';
|
|
5
|
-
import 'node:vm';
|
|
6
10
|
import 'pathe';
|
|
11
|
+
import 'vite/module-runner';
|
|
12
|
+
import '../chunks/startModuleRunner.iF1E9Bt4.js';
|
|
13
|
+
import '@vitest/utils/helpers';
|
|
7
14
|
import '../path.js';
|
|
8
15
|
import 'node:path';
|
|
9
|
-
import '
|
|
16
|
+
import '@vitest/utils/serialize';
|
|
17
|
+
import '../module-evaluator.js';
|
|
18
|
+
import 'node:vm';
|
|
19
|
+
import '@vitest/mocker';
|
|
20
|
+
import '../chunks/index.CbWINfS7.js';
|
|
10
21
|
import 'node:console';
|
|
22
|
+
import '../chunks/inspector.DLZxSeU3.js';
|
|
23
|
+
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
|
24
|
+
import '../chunks/rpc.cD77ENhU.js';
|
|
25
|
+
import '@vitest/utils/timers';
|
|
26
|
+
import '../chunks/index.Bgo3tNWt.js';
|
|
27
|
+
import '../chunks/utils.CG9h5ccR.js';
|
|
28
|
+
import '../chunks/console.CTJL2nuH.js';
|
|
11
29
|
import 'node:stream';
|
|
12
30
|
import 'tinyrainbow';
|
|
13
31
|
import '../chunks/date.-jtEtIeV.js';
|
|
14
|
-
import '
|
|
15
|
-
import '
|
|
16
|
-
import 'node:module';
|
|
17
|
-
import '../chunks/resolver.Bx6lE0iq.js';
|
|
18
|
-
import '../module-evaluator.js';
|
|
19
|
-
import 'vite/module-runner';
|
|
20
|
-
import '../chunks/startModuleRunner.BDRvKSdz.js';
|
|
21
|
-
import '@vitest/utils/error';
|
|
22
|
-
import '@vitest/mocker';
|
|
23
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
24
|
-
|
|
25
|
-
class ThreadsVmWorker {
|
|
26
|
-
getRpcOptions(ctx) {
|
|
27
|
-
return createThreadsRpcOptions(ctx);
|
|
28
|
-
}
|
|
29
|
-
runTests(state) {
|
|
30
|
-
return runVmTests("run", state);
|
|
31
|
-
}
|
|
32
|
-
collectTests(state) {
|
|
33
|
-
return runVmTests("collect", state);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const worker = new ThreadsVmWorker();
|
|
32
|
+
import '@vitest/utils/resolver';
|
|
33
|
+
import '@vitest/utils/constants';
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
workerInit({ runTests: runVmTests });
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.1",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://opencollective.com/vitest",
|
|
9
|
-
"homepage": "https://
|
|
9
|
+
"homepage": "https://vitest.dev",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git+https://github.com/vitest-dev/vitest.git",
|
|
@@ -39,7 +39,15 @@
|
|
|
39
39
|
"default": "./index.cjs"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"./browser": {
|
|
43
|
+
"types": "./browser/context.d.ts",
|
|
44
|
+
"default": "./browser/context.js"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json",
|
|
47
|
+
"./optional-types.js": {
|
|
48
|
+
"types": "./optional-types.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./src/*": "./src/*",
|
|
43
51
|
"./globals": {
|
|
44
52
|
"types": "./globals.d.ts"
|
|
45
53
|
},
|
|
@@ -56,10 +64,6 @@
|
|
|
56
64
|
"types": "./dist/node.d.ts",
|
|
57
65
|
"default": "./dist/node.js"
|
|
58
66
|
},
|
|
59
|
-
"./workers": {
|
|
60
|
-
"types": "./dist/workers.d.ts",
|
|
61
|
-
"import": "./dist/workers.js"
|
|
62
|
-
},
|
|
63
67
|
"./internal/browser": {
|
|
64
68
|
"types": "./dist/browser.d.ts",
|
|
65
69
|
"default": "./dist/browser.js"
|
|
@@ -100,6 +104,10 @@
|
|
|
100
104
|
"./mocker": {
|
|
101
105
|
"types": "./dist/mocker.d.ts",
|
|
102
106
|
"default": "./dist/mocker.js"
|
|
107
|
+
},
|
|
108
|
+
"./worker": {
|
|
109
|
+
"types": "./worker.d.ts",
|
|
110
|
+
"default": "./dist/worker.js"
|
|
103
111
|
}
|
|
104
112
|
},
|
|
105
113
|
"main": "./dist/index.js",
|
|
@@ -114,19 +122,22 @@
|
|
|
114
122
|
"*.d.ts",
|
|
115
123
|
"*.mjs",
|
|
116
124
|
"bin",
|
|
125
|
+
"browser",
|
|
117
126
|
"dist"
|
|
118
127
|
],
|
|
119
128
|
"engines": {
|
|
120
|
-
"node": "^
|
|
129
|
+
"node": "^20.0.0 || ^22.0.0 || >=24.0.0"
|
|
121
130
|
},
|
|
122
131
|
"peerDependencies": {
|
|
123
132
|
"@edge-runtime/vm": "*",
|
|
124
133
|
"@types/debug": "^4.1.12",
|
|
125
|
-
"@types/node": "^
|
|
134
|
+
"@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
|
|
126
135
|
"happy-dom": "*",
|
|
127
136
|
"jsdom": "*",
|
|
128
|
-
"@vitest/browser": "4.0.
|
|
129
|
-
"@vitest/
|
|
137
|
+
"@vitest/browser-preview": "4.0.1",
|
|
138
|
+
"@vitest/browser-playwright": "4.0.1",
|
|
139
|
+
"@vitest/browser-webdriverio": "4.0.1",
|
|
140
|
+
"@vitest/ui": "4.0.1"
|
|
130
141
|
},
|
|
131
142
|
"peerDependenciesMeta": {
|
|
132
143
|
"@edge-runtime/vm": {
|
|
@@ -138,7 +149,13 @@
|
|
|
138
149
|
"@types/node": {
|
|
139
150
|
"optional": true
|
|
140
151
|
},
|
|
141
|
-
"@vitest/browser": {
|
|
152
|
+
"@vitest/browser-playwright": {
|
|
153
|
+
"optional": true
|
|
154
|
+
},
|
|
155
|
+
"@vitest/browser-preview": {
|
|
156
|
+
"optional": true
|
|
157
|
+
},
|
|
158
|
+
"@vitest/browser-webdriverio": {
|
|
142
159
|
"optional": true
|
|
143
160
|
},
|
|
144
161
|
"@vitest/ui": {
|
|
@@ -152,57 +169,56 @@
|
|
|
152
169
|
}
|
|
153
170
|
},
|
|
154
171
|
"dependencies": {
|
|
155
|
-
"debug": "^4.4.
|
|
172
|
+
"debug": "^4.4.3",
|
|
156
173
|
"es-module-lexer": "^1.7.0",
|
|
157
174
|
"expect-type": "^1.2.2",
|
|
158
|
-
"magic-string": "^0.30.
|
|
175
|
+
"magic-string": "^0.30.19",
|
|
159
176
|
"pathe": "^2.0.3",
|
|
160
177
|
"picomatch": "^4.0.3",
|
|
161
178
|
"std-env": "^3.9.0",
|
|
162
179
|
"tinybench": "^2.9.0",
|
|
163
180
|
"tinyexec": "^0.3.2",
|
|
164
|
-
"tinyglobby": "^0.2.
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"vite": "^6.0.0 || ^7.0.0-0",
|
|
181
|
+
"tinyglobby": "^0.2.15",
|
|
182
|
+
"tinyrainbow": "^3.0.3",
|
|
183
|
+
"vite": "^6.0.0 || ^7.0.0",
|
|
168
184
|
"why-is-node-running": "^2.3.0",
|
|
169
|
-
"@vitest/
|
|
170
|
-
"@vitest/
|
|
171
|
-
"@vitest/
|
|
172
|
-
"@vitest/
|
|
173
|
-
"@vitest/
|
|
174
|
-
"@vitest/spy": "4.0.
|
|
175
|
-
"@vitest/
|
|
185
|
+
"@vitest/expect": "4.0.1",
|
|
186
|
+
"@vitest/mocker": "4.0.1",
|
|
187
|
+
"@vitest/pretty-format": "4.0.1",
|
|
188
|
+
"@vitest/runner": "4.0.1",
|
|
189
|
+
"@vitest/snapshot": "4.0.1",
|
|
190
|
+
"@vitest/spy": "4.0.1",
|
|
191
|
+
"@vitest/utils": "4.0.1"
|
|
176
192
|
},
|
|
177
193
|
"devDependencies": {
|
|
178
194
|
"@antfu/install-pkg": "^1.1.0",
|
|
179
195
|
"@edge-runtime/vm": "^5.0.0",
|
|
196
|
+
"@jridgewell/trace-mapping": "0.3.31",
|
|
180
197
|
"@sinonjs/fake-timers": "14.0.0",
|
|
181
198
|
"@types/debug": "^4.1.12",
|
|
182
199
|
"@types/estree": "^1.0.8",
|
|
183
200
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
184
201
|
"@types/istanbul-reports": "^3.0.4",
|
|
185
202
|
"@types/jsdom": "^21.1.7",
|
|
186
|
-
"@types/node": "^22.
|
|
203
|
+
"@types/node": "^22.18.6",
|
|
187
204
|
"@types/picomatch": "^4.0.2",
|
|
188
205
|
"@types/prompts": "^2.4.9",
|
|
189
206
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
190
207
|
"acorn-walk": "^8.3.4",
|
|
191
208
|
"birpc": "^2.5.0",
|
|
192
209
|
"cac": "^6.7.14",
|
|
193
|
-
"
|
|
194
|
-
"find-up": "^6.3.0",
|
|
210
|
+
"empathic": "^2.0.0",
|
|
195
211
|
"flatted": "^3.3.3",
|
|
196
|
-
"happy-dom": "^
|
|
212
|
+
"happy-dom": "^20.0.0",
|
|
197
213
|
"jsdom": "^26.1.0",
|
|
198
|
-
"local-pkg": "^1.1.
|
|
199
|
-
"mime": "^4.0
|
|
214
|
+
"local-pkg": "^1.1.2",
|
|
215
|
+
"mime": "^4.1.0",
|
|
200
216
|
"prompts": "^2.4.2",
|
|
201
217
|
"strip-literal": "^3.0.0",
|
|
202
218
|
"ws": "^8.18.3"
|
|
203
219
|
},
|
|
204
220
|
"scripts": {
|
|
205
|
-
"build": "
|
|
221
|
+
"build": "premove dist && rollup -c",
|
|
206
222
|
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" rollup -c --watch -m inline"
|
|
207
223
|
}
|
|
208
224
|
}
|
package/worker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/worker.js'
|
package/browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/browser.js'
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
type Awaitable<T> = T | PromiseLike<T>;
|
|
2
|
-
type Arrayable<T> = T | Array<T>;
|
|
3
|
-
interface AfterSuiteRunMeta {
|
|
4
|
-
coverage?: unknown;
|
|
5
|
-
testFiles: string[];
|
|
6
|
-
environment: string;
|
|
7
|
-
projectName?: string;
|
|
8
|
-
}
|
|
9
|
-
interface UserConsoleLog {
|
|
10
|
-
content: string;
|
|
11
|
-
origin?: string;
|
|
12
|
-
browser?: boolean;
|
|
13
|
-
type: "stdout" | "stderr";
|
|
14
|
-
taskId?: string;
|
|
15
|
-
time: number;
|
|
16
|
-
size: number;
|
|
17
|
-
}
|
|
18
|
-
interface ModuleGraphData {
|
|
19
|
-
graph: Record<string, string[]>;
|
|
20
|
-
externalized: string[];
|
|
21
|
-
inlined: string[];
|
|
22
|
-
}
|
|
23
|
-
interface ProvidedContext {}
|
|
24
|
-
interface ResolveFunctionResult {
|
|
25
|
-
id: string;
|
|
26
|
-
file: string;
|
|
27
|
-
url: string;
|
|
28
|
-
}
|
|
29
|
-
interface FetchCachedFileSystemResult {
|
|
30
|
-
cached: true;
|
|
31
|
-
tmp: string;
|
|
32
|
-
id: string;
|
|
33
|
-
file: string | null;
|
|
34
|
-
url: string;
|
|
35
|
-
invalidate: boolean;
|
|
36
|
-
}
|
|
37
|
-
// These need to be compatible with Tinyrainbow's bg-colors, and CSS's background-color
|
|
38
|
-
type LabelColor = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white";
|
|
39
|
-
|
|
40
|
-
interface EnvironmentReturn {
|
|
41
|
-
teardown: (global: any) => Awaitable<void>;
|
|
42
|
-
}
|
|
43
|
-
interface VmEnvironmentReturn {
|
|
44
|
-
getVmContext: () => {
|
|
45
|
-
[key: string]: any;
|
|
46
|
-
};
|
|
47
|
-
teardown: () => Awaitable<void>;
|
|
48
|
-
}
|
|
49
|
-
interface Environment {
|
|
50
|
-
name: string;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated use `viteEnvironment` instead. Uses `name` by default
|
|
53
|
-
*/
|
|
54
|
-
transformMode?: "web" | "ssr";
|
|
55
|
-
/**
|
|
56
|
-
* Environment initiated by the Vite server. It is usually available
|
|
57
|
-
* as `vite.server.environments.${name}`.
|
|
58
|
-
*
|
|
59
|
-
* By default, fallbacks to `name`.
|
|
60
|
-
*/
|
|
61
|
-
viteEnvironment?: "client" | "ssr" | ({} & string);
|
|
62
|
-
setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
|
|
63
|
-
setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type { AfterSuiteRunMeta as A, Environment as E, FetchCachedFileSystemResult as F, LabelColor as L, ModuleGraphData as M, ProvidedContext as P, ResolveFunctionResult as R, UserConsoleLog as U, VmEnvironmentReturn as V, EnvironmentReturn as a, Awaitable as b, Arrayable as c };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
class VitestTransport {
|
|
2
|
-
constructor(options) {
|
|
3
|
-
this.options = options;
|
|
4
|
-
}
|
|
5
|
-
async invoke(event) {
|
|
6
|
-
if (event.type !== "custom") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support Vite HMR events.`) };
|
|
7
|
-
if (event.event !== "vite:invoke") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support ${event.event} event.`) };
|
|
8
|
-
const { name, data } = event.data;
|
|
9
|
-
if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
|
|
10
|
-
try {
|
|
11
|
-
const result = await this.options.fetchModule(...data);
|
|
12
|
-
return { result };
|
|
13
|
-
} catch (error) {
|
|
14
|
-
return { error };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { VitestTransport as V };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
|
|
3
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
4
|
-
function normalizeWindowsPath(input = "") {
|
|
5
|
-
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
6
|
-
}
|
|
7
|
-
const _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, normalize = function(path) {
|
|
8
|
-
if (path.length === 0) return ".";
|
|
9
|
-
path = normalizeWindowsPath(path);
|
|
10
|
-
const isUNCPath = path.match(_UNC_REGEX), isPathAbsolute = isAbsolute(path), trailingSeparator = path[path.length - 1] === "/";
|
|
11
|
-
if (path = normalizeString(path, !isPathAbsolute), path.length === 0) return isPathAbsolute ? "/" : trailingSeparator ? "./" : ".";
|
|
12
|
-
if (trailingSeparator) path += "/";
|
|
13
|
-
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
14
|
-
return isUNCPath ? isPathAbsolute ? `//${path}` : `//./${path}` : isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
15
|
-
}, join = function(...segments) {
|
|
16
|
-
let path = "";
|
|
17
|
-
for (const seg of segments) {
|
|
18
|
-
if (!seg) continue;
|
|
19
|
-
if (path.length > 0) {
|
|
20
|
-
const pathTrailing = path[path.length - 1] === "/", segLeading = seg[0] === "/", both = pathTrailing && segLeading;
|
|
21
|
-
if (both) path += seg.slice(1);
|
|
22
|
-
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
23
|
-
} else path += seg;
|
|
24
|
-
}
|
|
25
|
-
return normalize(path);
|
|
26
|
-
};
|
|
27
|
-
function normalizeString(path, allowAboveRoot) {
|
|
28
|
-
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
29
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
30
|
-
if (index < path.length) char = path[index];
|
|
31
|
-
else if (char === "/") break;
|
|
32
|
-
else char = "/";
|
|
33
|
-
if (char === "/") {
|
|
34
|
-
if (lastSlash === index - 1 || dots === 1);
|
|
35
|
-
else if (dots === 2) {
|
|
36
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
37
|
-
if (res.length > 2) {
|
|
38
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
39
|
-
if (lastSlashIndex === -1) res = "", lastSegmentLength = 0;
|
|
40
|
-
else res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
41
|
-
lastSlash = index, dots = 0;
|
|
42
|
-
continue;
|
|
43
|
-
} else if (res.length > 0) {
|
|
44
|
-
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (allowAboveRoot) res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2;
|
|
49
|
-
} else {
|
|
50
|
-
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
51
|
-
else res = path.slice(lastSlash + 1, index);
|
|
52
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
53
|
-
}
|
|
54
|
-
lastSlash = index, dots = 0;
|
|
55
|
-
} else if (char === "." && dots !== -1) ++dots;
|
|
56
|
-
else dots = -1;
|
|
57
|
-
}
|
|
58
|
-
return res;
|
|
59
|
-
}
|
|
60
|
-
const isAbsolute = function(p) {
|
|
61
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
62
|
-
}, dirname = function(p) {
|
|
63
|
-
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
64
|
-
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
65
|
-
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const packageCache = /* @__PURE__ */ new Map();
|
|
69
|
-
function findNearestPackageData(basedir) {
|
|
70
|
-
const originalBasedir = basedir;
|
|
71
|
-
while (basedir) {
|
|
72
|
-
var _tryStatSync;
|
|
73
|
-
const cached = getCachedData(packageCache, basedir, originalBasedir);
|
|
74
|
-
if (cached) return cached;
|
|
75
|
-
const pkgPath = join(basedir, "package.json");
|
|
76
|
-
if ((_tryStatSync = tryStatSync(pkgPath)) === null || _tryStatSync === void 0 ? void 0 : _tryStatSync.isFile()) {
|
|
77
|
-
const pkgData = JSON.parse(stripBomTag(fs.readFileSync(pkgPath, "utf8")));
|
|
78
|
-
if (packageCache) setCacheData(packageCache, pkgData, basedir, originalBasedir);
|
|
79
|
-
return pkgData;
|
|
80
|
-
}
|
|
81
|
-
const nextBasedir = dirname(basedir);
|
|
82
|
-
if (nextBasedir === basedir) break;
|
|
83
|
-
basedir = nextBasedir;
|
|
84
|
-
}
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
function stripBomTag(content) {
|
|
88
|
-
return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
89
|
-
}
|
|
90
|
-
function tryStatSync(file) {
|
|
91
|
-
try {
|
|
92
|
-
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
93
|
-
return fs.statSync(file, { throwIfNoEntry: false });
|
|
94
|
-
} catch {}
|
|
95
|
-
}
|
|
96
|
-
function getCachedData(cache, basedir, originalBasedir) {
|
|
97
|
-
const pkgData = cache.get(getFnpdCacheKey(basedir));
|
|
98
|
-
if (pkgData) return traverseBetweenDirs(originalBasedir, basedir, (dir) => {
|
|
99
|
-
cache.set(getFnpdCacheKey(dir), pkgData);
|
|
100
|
-
}), pkgData;
|
|
101
|
-
}
|
|
102
|
-
function setCacheData(cache, data, basedir, originalBasedir) {
|
|
103
|
-
cache.set(getFnpdCacheKey(basedir), data), traverseBetweenDirs(originalBasedir, basedir, (dir) => {
|
|
104
|
-
cache.set(getFnpdCacheKey(dir), data);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function getFnpdCacheKey(basedir) {
|
|
108
|
-
return `fnpd_${basedir}`;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Traverse between `longerDir` (inclusive) and `shorterDir` (exclusive) and call `cb` for each dir.
|
|
112
|
-
* @param longerDir Longer dir path, e.g. `/User/foo/bar/baz`
|
|
113
|
-
* @param shorterDir Shorter dir path, e.g. `/User/foo`
|
|
114
|
-
*/
|
|
115
|
-
function traverseBetweenDirs(longerDir, shorterDir, cb) {
|
|
116
|
-
while (longerDir !== shorterDir) cb(longerDir), longerDir = dirname(longerDir);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export { findNearestPackageData as f };
|