vitest 4.0.0-beta.1 → 4.0.0-beta.11
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 +83 -2
- package/dist/browser.d.ts +19 -16
- package/dist/browser.js +11 -7
- package/dist/chunks/{benchmark.CYdenmiT.js → benchmark.LXhJ0F0X.js} +7 -9
- package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
- package/dist/chunks/{browser.d.q8Z0P0q1.d.ts → browser.d.Dx7DO_Ce.d.ts} +5 -5
- package/dist/chunks/{cac.D3EzDDZd.js → cac.elvK37c9.js} +71 -153
- package/dist/chunks/{cli-api.Dn5gKePv.js → cli-api.C7plPyhs.js} +1376 -1693
- package/dist/chunks/{config.d.HJdfX-8k.d.ts → config.d.B_LthbQq.d.ts} +58 -63
- package/dist/chunks/{console.CtFJOzRO.js → console.CiTi59Jy.js} +35 -71
- package/dist/chunks/{constants.DnKduX2e.js → constants.D_Q9UYh-.js} +1 -9
- package/dist/chunks/{coverage.Cwa-XhJt.js → coverage.CG6Uhorw.js} +522 -792
- package/dist/chunks/{coverage.DVF1vEu8.js → coverage.D_JHT54q.js} +2 -2
- package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.BZtK59WP.d.ts} +10 -8
- package/dist/chunks/{creator.GK6I-cL4.js → creator.08Gi-vCA.js} +93 -77
- package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
- package/dist/chunks/{environment.d.CUq4cUgQ.d.ts → environment.d.BsToaxti.d.ts} +27 -6
- package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
- package/dist/chunks/{global.d.CVbXEflG.d.ts → global.d.BK3X7FW1.d.ts} +2 -5
- package/dist/chunks/{globals.Cxal6MLI.js → globals.BjvYA-AD.js} +11 -9
- package/dist/chunks/{index.BWf_gE5n.js → index.AZOjjqWP.js} +7 -6
- package/dist/chunks/{index.B521nVV-.js → index.Bgo3tNWt.js} +23 -4
- package/dist/chunks/{index.TfbsX-3I.js → index.BhY64fF0.js} +16 -26
- package/dist/chunks/{index.CZI_8rVt.js → index.BwBttQPf.js} +340 -663
- package/dist/chunks/{index.CmSc2RE5.js → index.DIWhzsUh.js} +72 -118
- package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
- package/dist/chunks/moduleRunner.d.BNa-CL9e.d.ts +201 -0
- package/dist/chunks/{node.fjCdwEIl.js → node.BsdMi6DV.js} +2 -2
- package/dist/chunks/{plugin.d.C2EcJUjo.d.ts → plugin.d.C5phQR6o.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DxZg19fy.d.ts → reporters.d.CVzhsTvK.d.ts} +1233 -1293
- package/dist/chunks/resolveSnapshotEnvironment.DQVamkje.js +81 -0
- package/dist/chunks/rpc.jKGRSXIH.js +65 -0
- package/dist/chunks/{setup-common.D7ZqXFx-.js → setup-common.NAWRuMRP.js} +18 -30
- package/dist/chunks/startModuleRunner.oAuCu1yL.js +682 -0
- package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
- package/dist/chunks/test.KC5tH8hC.js +214 -0
- package/dist/chunks/typechecker.gXq-5P3n.js +1438 -0
- package/dist/chunks/{utils.XdZDrNZV.js → utils.DGKhod2J.js} +9 -28
- package/dist/chunks/{vi.bdSIJ99Y.js → vi.CiJ0Laa6.js} +159 -306
- package/dist/chunks/worker.d.B_Fd9M_w.d.ts +100 -0
- package/dist/chunks/worker.rPGLlbkW.js +200 -0
- package/dist/cli.js +8 -6
- package/dist/config.cjs +3 -9
- package/dist/config.d.ts +49 -54
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +27 -26
- package/dist/coverage.js +6 -8
- package/dist/environments.d.ts +9 -13
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +38 -45
- package/dist/index.js +10 -10
- package/dist/module-evaluator.d.ts +13 -0
- package/dist/module-evaluator.js +276 -0
- package/dist/module-runner.js +15 -0
- package/dist/node.d.ts +44 -42
- package/dist/node.js +30 -36
- package/dist/reporters.d.ts +12 -13
- package/dist/reporters.js +7 -5
- package/dist/runners.d.ts +3 -3
- package/dist/runners.js +15 -232
- package/dist/snapshot.js +3 -3
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +4 -3
- package/dist/worker-base.js +203 -0
- package/dist/{chunks/vm.BThCzidc.js → worker-vm.js} +179 -228
- package/dist/workers/runVmTests.js +39 -56
- package/globals.d.ts +17 -17
- package/package.json +40 -38
- package/browser.d.ts +0 -1
- package/dist/chunks/base.Bj3pWTr1.js +0 -38
- package/dist/chunks/execute.B7h3T_Hc.js +0 -708
- package/dist/chunks/index.D-VkfKhf.js +0 -105
- package/dist/chunks/rpc.CsFtxqeq.js +0 -83
- package/dist/chunks/runBaseTests.BC7ZIH5L.js +0 -129
- package/dist/chunks/typechecker.CVytUJuF.js +0 -874
- package/dist/chunks/utils.CAioKnHs.js +0 -61
- package/dist/chunks/worker.d.CmvJfRGs.d.ts +0 -8
- package/dist/chunks/worker.d.DoNjFAiv.d.ts +0 -169
- package/dist/execute.d.ts +0 -148
- package/dist/execute.js +0 -13
- package/dist/worker.js +0 -124
- package/dist/workers/forks.js +0 -43
- package/dist/workers/threads.js +0 -31
- package/dist/workers/vmForks.js +0 -47
- package/dist/workers/vmThreads.js +0 -37
- package/dist/workers.d.ts +0 -37
- package/dist/workers.js +0 -30
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
|
@@ -4,81 +4,64 @@ import timers from 'node:timers';
|
|
|
4
4
|
import timersPromises from 'node:timers/promises';
|
|
5
5
|
import util from 'node:util';
|
|
6
6
|
import { startTests, collectTests } from '@vitest/runner';
|
|
7
|
-
import { KNOWN_ASSET_TYPES } from '
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { g as
|
|
14
|
-
import 'chai';
|
|
15
|
-
import 'node:path';
|
|
16
|
-
import '../path.js';
|
|
17
|
-
import 'node:url';
|
|
18
|
-
import '../chunks/rpc.CsFtxqeq.js';
|
|
19
|
-
import '@vitest/utils';
|
|
20
|
-
import '../chunks/index.B521nVV-.js';
|
|
21
|
-
import '../chunks/coverage.DVF1vEu8.js';
|
|
22
|
-
import '@vitest/snapshot';
|
|
23
|
-
import '../chunks/vi.bdSIJ99Y.js';
|
|
7
|
+
import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
|
|
8
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/resolveSnapshotEnvironment.DQVamkje.js';
|
|
9
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/setup-common.NAWRuMRP.js';
|
|
10
|
+
import { i as index } from '../chunks/index.AZOjjqWP.js';
|
|
11
|
+
import { c as closeInspector } from '../chunks/inspector.CvQD-Nie.js';
|
|
12
|
+
import { g as getWorkerState } from '../chunks/utils.DGKhod2J.js';
|
|
13
|
+
import { g as globalExpect } from '../chunks/vi.CiJ0Laa6.js';
|
|
24
14
|
import '@vitest/expect';
|
|
15
|
+
import '../chunks/rpc.jKGRSXIH.js';
|
|
16
|
+
import '@vitest/utils/timers';
|
|
17
|
+
import '../chunks/index.Bgo3tNWt.js';
|
|
18
|
+
import '../chunks/test.KC5tH8hC.js';
|
|
19
|
+
import '@vitest/utils/helpers';
|
|
20
|
+
import '../chunks/benchmark.LXhJ0F0X.js';
|
|
25
21
|
import '@vitest/runner/utils';
|
|
26
|
-
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
27
22
|
import '@vitest/utils/error';
|
|
23
|
+
import 'pathe';
|
|
24
|
+
import '../chunks/coverage.D_JHT54q.js';
|
|
25
|
+
import '@vitest/snapshot';
|
|
26
|
+
import 'expect-type';
|
|
27
|
+
import 'vite/module-runner';
|
|
28
|
+
import 'node:url';
|
|
29
|
+
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
28
30
|
import '@vitest/spy';
|
|
31
|
+
import '@vitest/utils/offset';
|
|
29
32
|
import '@vitest/utils/source-map';
|
|
30
|
-
import '../chunks/date.
|
|
31
|
-
import '../chunks/benchmark.CYdenmiT.js';
|
|
32
|
-
import 'expect-type';
|
|
33
|
+
import '../chunks/date.-jtEtIeV.js';
|
|
33
34
|
|
|
34
|
-
async function run(method, files, config,
|
|
35
|
+
async function run(method, files, config, moduleRunner) {
|
|
35
36
|
const workerState = getWorkerState();
|
|
36
|
-
await setupCommonEnv(config)
|
|
37
|
-
|
|
38
|
-
value: VitestIndex,
|
|
37
|
+
await setupCommonEnv(config), Object.defineProperty(globalThis, "__vitest_index__", {
|
|
38
|
+
value: index,
|
|
39
39
|
enumerable: false
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
const viteEnvironment = workerState.environment.viteEnvironment || workerState.environment.name;
|
|
42
|
+
if (globalExpect.setState({ environment: workerState.environment.name }), viteEnvironment === "client") {
|
|
42
43
|
const _require = createRequire(import.meta.url);
|
|
43
|
-
|
|
44
|
-
_require.extensions[".css"] = resolveCss;
|
|
45
|
-
_require.extensions[".scss"] = resolveCss;
|
|
46
|
-
_require.extensions[".sass"] = resolveCss;
|
|
47
|
-
_require.extensions[".less"] = resolveCss;
|
|
48
|
-
// since we are using Vite, we can assume how these will be resolved
|
|
49
|
-
KNOWN_ASSET_TYPES.forEach((type) => {
|
|
44
|
+
_require.extensions[".css"] = resolveCss, _require.extensions[".scss"] = resolveCss, _require.extensions[".sass"] = resolveCss, _require.extensions[".less"] = resolveCss, KNOWN_ASSET_TYPES.forEach((type) => {
|
|
50
45
|
_require.extensions[`.${type}`] = resolveAsset;
|
|
51
|
-
});
|
|
52
|
-
process.env.SSR = "";
|
|
46
|
+
}), process.env.SSR = "";
|
|
53
47
|
} else process.env.SSR = "1";
|
|
54
|
-
|
|
55
|
-
globalThis.__vitest_required__ = {
|
|
48
|
+
if (globalThis.__vitest_required__ = {
|
|
56
49
|
util,
|
|
57
50
|
timers,
|
|
58
51
|
timersPromises
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
runner.getWorkerContext = void 0;
|
|
66
|
-
workerState.onCancel.then((reason) => {
|
|
67
|
-
closeInspector(config);
|
|
68
|
-
runner.cancel?.(reason);
|
|
69
|
-
});
|
|
70
|
-
workerState.durations.prepare = performance.now() - workerState.durations.prepare;
|
|
71
|
-
const { vi } = VitestIndex;
|
|
52
|
+
}, await startCoverageInsideWorker(config.coverage, moduleRunner, { isolate: false }), config.chaiConfig) setupChaiConfig(config.chaiConfig);
|
|
53
|
+
const [runner, snapshotEnvironment] = await Promise.all([resolveTestRunner(config, moduleRunner), resolveSnapshotEnvironment(config, moduleRunner)]);
|
|
54
|
+
config.snapshotOptions.snapshotEnvironment = snapshotEnvironment, runner.getWorkerContext = void 0, workerState.onCancel.then((reason) => {
|
|
55
|
+
closeInspector(config), runner.cancel?.(reason);
|
|
56
|
+
}), workerState.durations.prepare = performance.now() - workerState.durations.prepare;
|
|
57
|
+
const { vi } = index;
|
|
72
58
|
for (const file of files) {
|
|
73
|
-
workerState.filepath = file.filepath;
|
|
74
|
-
if (method === "run") await startTests([file], runner);
|
|
59
|
+
if (workerState.filepath = file.filepath, method === "run") await startTests([file], runner);
|
|
75
60
|
else await collectTests([file], runner);
|
|
76
|
-
// reset after tests, because user might call `vi.setConfig` in setupFile
|
|
77
|
-
vi.resetConfig();
|
|
78
61
|
// mocks should not affect different files
|
|
79
|
-
vi.restoreAllMocks();
|
|
62
|
+
vi.resetConfig(), vi.restoreAllMocks();
|
|
80
63
|
}
|
|
81
|
-
await stopCoverageInsideWorker(config.coverage,
|
|
64
|
+
await stopCoverageInsideWorker(config.coverage, moduleRunner, { isolate: false });
|
|
82
65
|
}
|
|
83
66
|
function resolveCss(mod) {
|
|
84
67
|
mod.exports = "";
|
package/globals.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
let suite: typeof import('vitest')['suite']
|
|
3
|
+
let test: typeof import('vitest')['test']
|
|
4
|
+
let chai: typeof import("vitest")["chai"]
|
|
5
|
+
let describe: typeof import('vitest')['describe']
|
|
6
|
+
let it: typeof import('vitest')['it']
|
|
7
|
+
let expectTypeOf: typeof import('vitest')['expectTypeOf']
|
|
8
|
+
let assertType: typeof import('vitest')['assertType']
|
|
9
|
+
let expect: typeof import('vitest')['expect']
|
|
10
|
+
let assert: typeof import('vitest')['assert']
|
|
11
|
+
let vitest: typeof import('vitest')['vitest']
|
|
12
|
+
let vi: typeof import('vitest')['vitest']
|
|
13
|
+
let beforeAll: typeof import('vitest')['beforeAll']
|
|
14
|
+
let afterAll: typeof import('vitest')['afterAll']
|
|
15
|
+
let beforeEach: typeof import('vitest')['beforeEach']
|
|
16
|
+
let afterEach: typeof import('vitest')['afterEach']
|
|
17
|
+
let onTestFailed: typeof import('vitest')['onTestFailed']
|
|
18
|
+
let onTestFinished: typeof import('vitest')['onTestFinished']
|
|
19
19
|
}
|
|
20
20
|
export {}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.11",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
"jest"
|
|
23
23
|
],
|
|
24
24
|
"sideEffects": false,
|
|
25
|
+
"imports": {
|
|
26
|
+
"#module-evaluator": {
|
|
27
|
+
"types": "./dist/module-evaluator.d.ts",
|
|
28
|
+
"default": "./dist/module-evaluator.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
25
31
|
"exports": {
|
|
26
32
|
".": {
|
|
27
33
|
"import": {
|
|
@@ -33,7 +39,11 @@
|
|
|
33
39
|
"default": "./index.cjs"
|
|
34
40
|
}
|
|
35
41
|
},
|
|
36
|
-
"
|
|
42
|
+
"./package.json": "./package.json",
|
|
43
|
+
"./optional-types.js": {
|
|
44
|
+
"types": "./optional-types.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./src/*": "./src/*",
|
|
37
47
|
"./globals": {
|
|
38
48
|
"types": "./globals.d.ts"
|
|
39
49
|
},
|
|
@@ -50,18 +60,14 @@
|
|
|
50
60
|
"types": "./dist/node.d.ts",
|
|
51
61
|
"default": "./dist/node.js"
|
|
52
62
|
},
|
|
53
|
-
"./execute": {
|
|
54
|
-
"types": "./dist/execute.d.ts",
|
|
55
|
-
"default": "./dist/execute.js"
|
|
56
|
-
},
|
|
57
|
-
"./workers": {
|
|
58
|
-
"types": "./dist/workers.d.ts",
|
|
59
|
-
"import": "./dist/workers.js"
|
|
60
|
-
},
|
|
61
63
|
"./internal/browser": {
|
|
62
64
|
"types": "./dist/browser.d.ts",
|
|
63
65
|
"default": "./dist/browser.js"
|
|
64
66
|
},
|
|
67
|
+
"./internal/module-runner": {
|
|
68
|
+
"types": "./dist/module-runner.d.ts",
|
|
69
|
+
"default": "./dist/module-runner.js"
|
|
70
|
+
},
|
|
65
71
|
"./runners": {
|
|
66
72
|
"types": "./dist/runners.d.ts",
|
|
67
73
|
"default": "./dist/runners.js"
|
|
@@ -119,8 +125,8 @@
|
|
|
119
125
|
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
|
|
120
126
|
"happy-dom": "*",
|
|
121
127
|
"jsdom": "*",
|
|
122
|
-
"@vitest/browser": "4.0.0-beta.
|
|
123
|
-
"@vitest/ui": "4.0.0-beta.
|
|
128
|
+
"@vitest/browser": "4.0.0-beta.11",
|
|
129
|
+
"@vitest/ui": "4.0.0-beta.11"
|
|
124
130
|
},
|
|
125
131
|
"peerDependenciesMeta": {
|
|
126
132
|
"@edge-runtime/vm": {
|
|
@@ -146,59 +152,55 @@
|
|
|
146
152
|
}
|
|
147
153
|
},
|
|
148
154
|
"dependencies": {
|
|
149
|
-
"@types/chai": "^5.2.2",
|
|
150
|
-
"chai": "^5.2.0",
|
|
151
155
|
"debug": "^4.4.1",
|
|
152
|
-
"
|
|
153
|
-
"
|
|
156
|
+
"es-module-lexer": "^1.7.0",
|
|
157
|
+
"expect-type": "^1.2.2",
|
|
158
|
+
"magic-string": "^0.30.19",
|
|
154
159
|
"pathe": "^2.0.3",
|
|
155
|
-
"picomatch": "^4.0.
|
|
160
|
+
"picomatch": "^4.0.3",
|
|
156
161
|
"std-env": "^3.9.0",
|
|
157
162
|
"tinybench": "^2.9.0",
|
|
158
163
|
"tinyexec": "^0.3.2",
|
|
159
|
-
"tinyglobby": "^0.2.
|
|
160
|
-
"tinypool": "^
|
|
161
|
-
"tinyrainbow": "^
|
|
162
|
-
"vite": "^
|
|
164
|
+
"tinyglobby": "^0.2.15",
|
|
165
|
+
"tinypool": "^2.0.0",
|
|
166
|
+
"tinyrainbow": "^3.0.3",
|
|
167
|
+
"vite": "^6.0.0 || ^7.0.0-0",
|
|
163
168
|
"why-is-node-running": "^2.3.0",
|
|
164
|
-
"@vitest/expect": "4.0.0-beta.
|
|
165
|
-
"@vitest/mocker": "4.0.0-beta.
|
|
166
|
-
"@vitest/
|
|
167
|
-
"@vitest/snapshot": "4.0.0-beta.
|
|
168
|
-
"@vitest/spy": "4.0.0-beta.
|
|
169
|
-
"@vitest/
|
|
170
|
-
"@vitest/
|
|
171
|
-
"vite-node": "4.0.0-beta.1"
|
|
169
|
+
"@vitest/expect": "4.0.0-beta.11",
|
|
170
|
+
"@vitest/mocker": "4.0.0-beta.11",
|
|
171
|
+
"@vitest/pretty-format": "^4.0.0-beta.11",
|
|
172
|
+
"@vitest/snapshot": "4.0.0-beta.11",
|
|
173
|
+
"@vitest/spy": "4.0.0-beta.11",
|
|
174
|
+
"@vitest/utils": "4.0.0-beta.11",
|
|
175
|
+
"@vitest/runner": "4.0.0-beta.11"
|
|
172
176
|
},
|
|
173
177
|
"devDependencies": {
|
|
174
|
-
"@ampproject/remapping": "^2.3.0",
|
|
175
178
|
"@antfu/install-pkg": "^1.1.0",
|
|
176
179
|
"@edge-runtime/vm": "^5.0.0",
|
|
180
|
+
"@jridgewell/trace-mapping": "0.3.30",
|
|
177
181
|
"@sinonjs/fake-timers": "14.0.0",
|
|
178
182
|
"@types/debug": "^4.1.12",
|
|
179
183
|
"@types/estree": "^1.0.8",
|
|
180
184
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
181
185
|
"@types/istanbul-reports": "^3.0.4",
|
|
182
186
|
"@types/jsdom": "^21.1.7",
|
|
183
|
-
"@types/
|
|
184
|
-
"@types/
|
|
185
|
-
"@types/picomatch": "^4.0.0",
|
|
187
|
+
"@types/node": "^22.18.1",
|
|
188
|
+
"@types/picomatch": "^4.0.2",
|
|
186
189
|
"@types/prompts": "^2.4.9",
|
|
187
190
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
188
191
|
"acorn-walk": "^8.3.4",
|
|
189
|
-
"birpc": "2.
|
|
192
|
+
"birpc": "^2.5.0",
|
|
190
193
|
"cac": "^6.7.14",
|
|
191
194
|
"chai-subset": "^1.6.0",
|
|
192
195
|
"find-up": "^6.3.0",
|
|
193
196
|
"flatted": "^3.3.3",
|
|
194
|
-
"happy-dom": "^
|
|
197
|
+
"happy-dom": "^18.0.1",
|
|
195
198
|
"jsdom": "^26.1.0",
|
|
196
|
-
"local-pkg": "^1.1.
|
|
199
|
+
"local-pkg": "^1.1.2",
|
|
197
200
|
"mime": "^4.0.7",
|
|
198
|
-
"pretty-format": "^29.7.0",
|
|
199
201
|
"prompts": "^2.4.2",
|
|
200
202
|
"strip-literal": "^3.0.0",
|
|
201
|
-
"ws": "^8.18.
|
|
203
|
+
"ws": "^8.18.3"
|
|
202
204
|
},
|
|
203
205
|
"scripts": {
|
|
204
206
|
"build": "rimraf dist && rollup -c",
|
package/browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/browser.js'
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.B7h3T_Hc.js';
|
|
3
|
-
import { p as provideWorkerState } from './utils.XdZDrNZV.js';
|
|
4
|
-
|
|
5
|
-
let _viteNode;
|
|
6
|
-
const moduleCache = new ModuleCacheMap();
|
|
7
|
-
const moduleExecutionInfo = /* @__PURE__ */ new Map();
|
|
8
|
-
async function startViteNode(options) {
|
|
9
|
-
if (_viteNode) return _viteNode;
|
|
10
|
-
_viteNode = await startVitestExecutor(options);
|
|
11
|
-
return _viteNode;
|
|
12
|
-
}
|
|
13
|
-
async function runBaseTests(method, state) {
|
|
14
|
-
const { ctx } = state;
|
|
15
|
-
// state has new context, but we want to reuse existing ones
|
|
16
|
-
state.moduleCache = moduleCache;
|
|
17
|
-
state.moduleExecutionInfo = moduleExecutionInfo;
|
|
18
|
-
provideWorkerState(globalThis, state);
|
|
19
|
-
if (ctx.invalidates) ctx.invalidates.forEach((fsPath) => {
|
|
20
|
-
moduleCache.delete(fsPath);
|
|
21
|
-
moduleCache.delete(`mock:${fsPath}`);
|
|
22
|
-
});
|
|
23
|
-
ctx.files.forEach((i) => state.moduleCache.delete(typeof i === "string" ? i : i.filepath));
|
|
24
|
-
const [executor, { run }] = await Promise.all([startViteNode({
|
|
25
|
-
state,
|
|
26
|
-
requestStubs: getDefaultRequestStubs()
|
|
27
|
-
}), import('./runBaseTests.BC7ZIH5L.js')]);
|
|
28
|
-
const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
|
|
29
|
-
filepath: f,
|
|
30
|
-
testLocations: void 0
|
|
31
|
-
} : f);
|
|
32
|
-
await run(method, fileSpecs, ctx.config, {
|
|
33
|
-
environment: state.environment,
|
|
34
|
-
options: ctx.environment.options
|
|
35
|
-
}, executor);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { runBaseTests as r };
|