vitest 2.0.0-beta.11 → 2.0.0-beta.13
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 +0 -21
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +2 -2
- package/dist/chunks/browser-creator.DSqYDthP.js +673 -0
- package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
- package/dist/chunks/{integrations-globals.CC2ed6Py.js → integrations-globals.CzYWb38r.js} +6 -6
- package/dist/chunks/{runtime-console.Ckl0vEQr.js → runtime-console.O41g23Zj.js} +1 -1
- package/dist/chunks/{runtime-runBaseTests.BXW_BJeO.js → runtime-runBaseTests.DX3h28Mp.js} +15 -11
- package/dist/cli.js +2 -2
- package/dist/config.cjs +6 -4
- package/dist/config.d.ts +2 -1
- package/dist/config.js +6 -4
- package/dist/coverage.d.ts +4 -2
- package/dist/coverage.js +3 -2
- package/dist/environments.d.ts +2 -1
- package/dist/execute.d.ts +4 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.js +6 -6
- package/dist/node.d.ts +19 -5
- package/dist/node.js +15 -14
- package/dist/{reporters-fiIq_dT9.d.ts → reporters-DrywOHjt.d.ts} +73 -23
- package/dist/reporters.d.ts +2 -1
- package/dist/reporters.js +5 -5
- package/dist/runners.d.ts +3 -1
- package/dist/runners.js +5 -4
- package/dist/snapshot.js +2 -2
- package/dist/{suite-D4aoU9rI.d.ts → suite-CrOPuDIk.d.ts} +1 -1
- package/dist/suite.d.ts +3 -2
- package/dist/suite.js +3 -3
- package/dist/vendor/{base.C2DbLEfT.js → base.CdA1i5tB.js} +4 -3
- package/dist/vendor/{benchmark.CMp8QfyL.js → benchmark.B6pblCp2.js} +1 -1
- package/dist/vendor/{cac.BcJW7n2j.js → cac.CpoEMnGk.js} +71 -14
- package/dist/vendor/{cli-api.C8t8m4__.js → cli-api.CXFLjKVN.js} +400 -6675
- package/dist/vendor/{constants.BWsVtsAj.js → constants.CsnA4eRy.js} +1 -2
- package/dist/vendor/env.2ltrQNq0.js +8 -0
- package/dist/vendor/{execute.T3gg2ZK6.js → execute.Dx503nGn.js} +12 -4
- package/dist/vendor/{index.BC5zhX9y.js → index.3x3MdmUV.js} +139 -82
- package/dist/vendor/{index.C9Thslzw.js → index.BJmtb_7W.js} +1 -1
- package/dist/vendor/{index.-dbR4KUi.js → index.CROIsoiT.js} +2 -2
- package/dist/vendor/index.D6GZqexG.js +6575 -0
- package/dist/vendor/{index.CQJ2m700.js → index.Hqvcg1pf.js} +2 -2
- package/dist/vendor/{setup-common.uqZOEWuR.js → setup-common.yHaxjRhz.js} +1 -1
- package/dist/vendor/{utils.DSO2UK15.js → utils.BVMrsl6E.js} +15 -5
- package/dist/vendor/{vi.BPjl8cAZ.js → vi.DXACdGTu.js} +1 -1
- package/dist/vendor/{vm.CycSoHnJ.js → vm.BrDS6p7h.js} +8 -6
- package/dist/worker.js +11 -4
- package/dist/workers/forks.js +10 -4
- package/dist/workers/runVmTests.js +14 -10
- package/dist/workers/threads.js +6 -3
- package/dist/workers/vmForks.js +12 -6
- package/dist/workers/vmThreads.js +8 -5
- package/dist/workers.d.ts +7 -4
- package/dist/workers.js +6 -6
- package/package.json +12 -12
- package/dist/vendor/env.bmJgw1qP.js +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
2
|
-
import { b as bench } from './benchmark.
|
|
2
|
+
import { b as bench } from './benchmark.B6pblCp2.js';
|
|
3
3
|
import { i as isFirstRun, a as runOnce } from './run-once.Db8Hgq9X.js';
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DXACdGTu.js';
|
|
5
5
|
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals) {
|
|
16
|
-
(await import('../chunks/integrations-globals.
|
|
16
|
+
(await import('../chunks/integrations-globals.CzYWb38r.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function setupDefines(defines) {
|
|
@@ -37,6 +37,11 @@ const spinnerMap = /* @__PURE__ */ new WeakMap();
|
|
|
37
37
|
const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
|
|
38
38
|
const pointer = c.yellow(F_POINTER);
|
|
39
39
|
const skipped = c.dim(c.gray(F_DOWN));
|
|
40
|
+
const benchmarkPass = c.green(F_DOT);
|
|
41
|
+
const testPass = c.green(F_CHECK);
|
|
42
|
+
const taskFail = c.red(F_CROSS);
|
|
43
|
+
const suiteFail = c.red(F_POINTER);
|
|
44
|
+
const pending = c.gray("\xB7");
|
|
40
45
|
function getCols(delta = 0) {
|
|
41
46
|
var _a;
|
|
42
47
|
let length = (_a = process.stdout) == null ? void 0 : _a.columns;
|
|
@@ -151,7 +156,7 @@ function getStateSymbol(task) {
|
|
|
151
156
|
return skipped;
|
|
152
157
|
}
|
|
153
158
|
if (!task.result) {
|
|
154
|
-
return
|
|
159
|
+
return pending;
|
|
155
160
|
}
|
|
156
161
|
if (task.result.state === "run") {
|
|
157
162
|
if (task.type === "suite") {
|
|
@@ -165,10 +170,10 @@ function getStateSymbol(task) {
|
|
|
165
170
|
return c.yellow(spinner());
|
|
166
171
|
}
|
|
167
172
|
if (task.result.state === "pass") {
|
|
168
|
-
return ((_a = task.meta) == null ? void 0 : _a.benchmark) ?
|
|
173
|
+
return ((_a = task.meta) == null ? void 0 : _a.benchmark) ? benchmarkPass : testPass;
|
|
169
174
|
}
|
|
170
175
|
if (task.result.state === "fail") {
|
|
171
|
-
return task.type === "suite" ?
|
|
176
|
+
return task.type === "suite" ? suiteFail : taskFail;
|
|
172
177
|
}
|
|
173
178
|
return " ";
|
|
174
179
|
}
|
|
@@ -211,6 +216,7 @@ function formatProjectName(name, suffix = " ") {
|
|
|
211
216
|
|
|
212
217
|
var utils = /*#__PURE__*/Object.freeze({
|
|
213
218
|
__proto__: null,
|
|
219
|
+
benchmarkPass: benchmarkPass,
|
|
214
220
|
countTestErrors: countTestErrors,
|
|
215
221
|
divider: divider,
|
|
216
222
|
elegantSpinner: elegantSpinner,
|
|
@@ -222,11 +228,15 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
222
228
|
getStateString: getStateString,
|
|
223
229
|
getStateSymbol: getStateSymbol,
|
|
224
230
|
hookSpinnerMap: hookSpinnerMap,
|
|
231
|
+
pending: pending,
|
|
225
232
|
pointer: pointer,
|
|
226
233
|
renderSnapshotSummary: renderSnapshotSummary,
|
|
227
234
|
skipped: skipped,
|
|
228
235
|
spinnerFrames: spinnerFrames,
|
|
229
|
-
spinnerMap: spinnerMap
|
|
236
|
+
spinnerMap: spinnerMap,
|
|
237
|
+
suiteFail: suiteFail,
|
|
238
|
+
taskFail: taskFail,
|
|
239
|
+
testPass: testPass
|
|
230
240
|
});
|
|
231
241
|
|
|
232
|
-
export { F_RIGHT as F, F_POINTER as a, getStateString as b, formatTimeString as c, countTestErrors as d, divider as e, formatProjectName as f, getStateSymbol as g, getCols as h, getHookStateSymbol as i,
|
|
242
|
+
export { F_RIGHT as F, F_POINTER as a, getStateString as b, formatTimeString as c, countTestErrors as d, divider as e, formatProjectName as f, getStateSymbol as g, getCols as h, getHookStateSymbol as i, renderSnapshotSummary as r, stripAnsi as s, taskFail as t, utils as u };
|
|
@@ -9,7 +9,7 @@ import { g as getTestName } from './tasks.DhVtQBtW.js';
|
|
|
9
9
|
import { g as getWorkerState, a as getCurrentEnvironment } from './global.7bFbnyXl.js';
|
|
10
10
|
import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
|
|
11
11
|
import 'pathe';
|
|
12
|
-
import './env.
|
|
12
|
+
import './env.2ltrQNq0.js';
|
|
13
13
|
import { parseSingleStack } from '@vitest/utils/source-map';
|
|
14
14
|
import { i as isChildProcess } from './base.CTYV4Gnz.js';
|
|
15
15
|
import { R as RealDate, r as resetDate, m as mockDate } from './date.W2xKR2qe.js';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import vm, { isContext } from 'node:vm';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
|
|
4
|
-
import { createCustomConsole } from '../chunks/runtime-console.
|
|
5
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
4
|
+
import { createCustomConsole } from '../chunks/runtime-console.O41g23Zj.js';
|
|
5
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.Dx503nGn.js';
|
|
6
6
|
import { distDir } from '../path.js';
|
|
7
7
|
import { dirname as dirname$1 } from 'node:path';
|
|
8
|
-
import
|
|
8
|
+
import fs from 'node:fs';
|
|
9
9
|
import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData } from 'vite-node/utils';
|
|
10
10
|
import { createRequire, Module } from 'node:module';
|
|
11
11
|
import { CSS_LANGS_RE, KNOWN_ASSET_RE } from 'vite-node/constants';
|
|
12
12
|
import '@vitest/runner/utils';
|
|
13
13
|
import '@vitest/utils';
|
|
14
14
|
import { p as provideWorkerState } from './global.7bFbnyXl.js';
|
|
15
|
-
import './env.
|
|
15
|
+
import './env.2ltrQNq0.js';
|
|
16
16
|
|
|
17
17
|
const _require = createRequire(import.meta.url);
|
|
18
18
|
const requiresCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -567,6 +567,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
567
567
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
568
568
|
var _networkSupported;
|
|
569
569
|
const SyntheticModule = vm.SyntheticModule;
|
|
570
|
+
const { existsSync, statSync } = fs;
|
|
570
571
|
const nativeResolve = import.meta.resolve;
|
|
571
572
|
class ExternalModulesExecutor {
|
|
572
573
|
constructor(options) {
|
|
@@ -770,6 +771,7 @@ class ExternalModulesExecutor {
|
|
|
770
771
|
}
|
|
771
772
|
_networkSupported = new WeakMap();
|
|
772
773
|
|
|
774
|
+
const { promises, readFileSync } = fs;
|
|
773
775
|
class FileMap {
|
|
774
776
|
fsCache = /* @__PURE__ */ new Map();
|
|
775
777
|
fsBufferCache = /* @__PURE__ */ new Map();
|
|
@@ -805,7 +807,7 @@ class FileMap {
|
|
|
805
807
|
const entryFile = pathToFileURL(resolve(distDir, "workers/runVmTests.js")).href;
|
|
806
808
|
const fileMap = new FileMap();
|
|
807
809
|
const packageCache = /* @__PURE__ */ new Map();
|
|
808
|
-
async function runVmTests(state) {
|
|
810
|
+
async function runVmTests(method, state) {
|
|
809
811
|
var _a;
|
|
810
812
|
const { environment, ctx, rpc } = state;
|
|
811
813
|
if (!environment.setupVM) {
|
|
@@ -858,7 +860,7 @@ async function runVmTests(state) {
|
|
|
858
860
|
entryFile
|
|
859
861
|
);
|
|
860
862
|
try {
|
|
861
|
-
await run(ctx.files, ctx.config, executor);
|
|
863
|
+
await run(method, ctx.files, ctx.config, executor);
|
|
862
864
|
} finally {
|
|
863
865
|
await ((_a = vm.teardown) == null ? void 0 : _a.call(vm));
|
|
864
866
|
state.environmentTeardownRun = true;
|
package/dist/worker.js
CHANGED
|
@@ -62,7 +62,7 @@ async function loadEnvironment(ctx, rpc) {
|
|
|
62
62
|
if (isChildProcess()) {
|
|
63
63
|
setProcessTitle(`vitest ${workerId}`);
|
|
64
64
|
}
|
|
65
|
-
async function
|
|
65
|
+
async function execute(mehtod, ctx) {
|
|
66
66
|
const prepareStart = performance.now();
|
|
67
67
|
const inspectorCleanup = setupInspect(ctx);
|
|
68
68
|
process.env.VITEST_WORKER_ID = String(ctx.workerId);
|
|
@@ -107,17 +107,24 @@ async function run(ctx) {
|
|
|
107
107
|
rpc,
|
|
108
108
|
providedContext: ctx.providedContext
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
const methodName = mehtod === "collect" ? "collectTests" : "runTests";
|
|
111
|
+
if (!worker[methodName] || typeof worker[methodName] !== "function") {
|
|
111
112
|
throw new TypeError(
|
|
112
113
|
`Test worker should expose "runTests" method. Received "${typeof worker.runTests}".`
|
|
113
114
|
);
|
|
114
115
|
}
|
|
115
|
-
await worker
|
|
116
|
+
await worker[methodName](state);
|
|
116
117
|
} finally {
|
|
117
118
|
await rpcDone().catch(() => {
|
|
118
119
|
});
|
|
119
120
|
inspectorCleanup();
|
|
120
121
|
}
|
|
121
122
|
}
|
|
123
|
+
function run(ctx) {
|
|
124
|
+
return execute("run", ctx);
|
|
125
|
+
}
|
|
126
|
+
function collect(ctx) {
|
|
127
|
+
return execute("collect", ctx);
|
|
128
|
+
}
|
|
122
129
|
|
|
123
|
-
export { run };
|
|
130
|
+
export { collect, run };
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.DkxLWvS1.js';
|
|
3
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
3
|
+
import { r as runBaseTests } from '../vendor/base.CdA1i5tB.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
6
|
import '../vendor/global.7bFbnyXl.js';
|
|
7
|
-
import '../vendor/execute.
|
|
7
|
+
import '../vendor/execute.Dx503nGn.js';
|
|
8
8
|
import 'node:vm';
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'node:fs';
|
|
@@ -18,15 +18,21 @@ class ForksBaseWorker {
|
|
|
18
18
|
getRpcOptions() {
|
|
19
19
|
return createForksRpcOptions(v8);
|
|
20
20
|
}
|
|
21
|
-
async
|
|
21
|
+
async executeTests(method, state) {
|
|
22
22
|
const exit = process.exit;
|
|
23
23
|
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
|
|
24
24
|
try {
|
|
25
|
-
await runBaseTests(state);
|
|
25
|
+
await runBaseTests(method, state);
|
|
26
26
|
} finally {
|
|
27
27
|
process.exit = exit;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
runTests(state) {
|
|
31
|
+
return this.executeTests("run", state);
|
|
32
|
+
}
|
|
33
|
+
collectTests(state) {
|
|
34
|
+
return this.executeTests("collect", state);
|
|
35
|
+
}
|
|
30
36
|
}
|
|
31
37
|
var forks = new ForksBaseWorker();
|
|
32
38
|
|
|
@@ -3,14 +3,14 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import util from 'node:util';
|
|
4
4
|
import timers from 'node:timers';
|
|
5
5
|
import { performance } from 'node:perf_hooks';
|
|
6
|
-
import { startTests } from '@vitest/runner';
|
|
6
|
+
import { startTests, collectTests } from '@vitest/runner';
|
|
7
7
|
import { setupColors, createColors } from '@vitest/utils';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
-
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index
|
|
9
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.CROIsoiT.js';
|
|
10
10
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.BhYSDdTT.js';
|
|
11
11
|
import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
|
|
12
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
13
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
12
|
+
import { V as VitestIndex } from '../vendor/index.Hqvcg1pf.js';
|
|
13
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.yHaxjRhz.js';
|
|
14
14
|
import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
|
|
15
15
|
import 'chai';
|
|
16
16
|
import 'pathe';
|
|
@@ -18,13 +18,13 @@ import '../path.js';
|
|
|
18
18
|
import 'node:url';
|
|
19
19
|
import '../vendor/rpc.BGx7q_k2.js';
|
|
20
20
|
import '../vendor/index.BpSiYbpB.js';
|
|
21
|
-
import '../vendor/benchmark.
|
|
21
|
+
import '../vendor/benchmark.B6pblCp2.js';
|
|
22
22
|
import '@vitest/runner/utils';
|
|
23
|
-
import '../vendor/index.
|
|
24
|
-
import '../vendor/env.
|
|
23
|
+
import '../vendor/index.BJmtb_7W.js';
|
|
24
|
+
import '../vendor/env.2ltrQNq0.js';
|
|
25
25
|
import 'std-env';
|
|
26
26
|
import '../vendor/run-once.Db8Hgq9X.js';
|
|
27
|
-
import '../vendor/vi.
|
|
27
|
+
import '../vendor/vi.DXACdGTu.js';
|
|
28
28
|
import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
29
29
|
import '@vitest/expect';
|
|
30
30
|
import '@vitest/snapshot';
|
|
@@ -35,7 +35,7 @@ import '../vendor/base.CTYV4Gnz.js';
|
|
|
35
35
|
import '../vendor/date.W2xKR2qe.js';
|
|
36
36
|
import '@vitest/spy';
|
|
37
37
|
|
|
38
|
-
async function run(files, config, executor) {
|
|
38
|
+
async function run(method, files, config, executor) {
|
|
39
39
|
const workerState = getWorkerState();
|
|
40
40
|
await setupCommonEnv(config);
|
|
41
41
|
Object.defineProperty(globalThis, "__vitest_index__", {
|
|
@@ -75,7 +75,11 @@ async function run(files, config, executor) {
|
|
|
75
75
|
const { vi } = VitestIndex;
|
|
76
76
|
for (const file of files) {
|
|
77
77
|
workerState.filepath = file;
|
|
78
|
-
|
|
78
|
+
if (method === "run") {
|
|
79
|
+
await startTests([file], runner);
|
|
80
|
+
} else {
|
|
81
|
+
await collectTests([file], runner);
|
|
82
|
+
}
|
|
79
83
|
vi.resetConfig();
|
|
80
84
|
vi.restoreAllMocks();
|
|
81
85
|
}
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
1
|
+
import { r as runBaseTests } from '../vendor/base.CdA1i5tB.js';
|
|
2
2
|
import { a as createThreadsRpcOptions } from '../vendor/utils.DkxLWvS1.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
4
|
import '../vendor/global.7bFbnyXl.js';
|
|
5
|
-
import '../vendor/execute.
|
|
5
|
+
import '../vendor/execute.Dx503nGn.js';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:fs';
|
|
@@ -18,7 +18,10 @@ class ThreadsBaseWorker {
|
|
|
18
18
|
return createThreadsRpcOptions(ctx);
|
|
19
19
|
}
|
|
20
20
|
runTests(state) {
|
|
21
|
-
return runBaseTests(state);
|
|
21
|
+
return runBaseTests("run", state);
|
|
22
|
+
}
|
|
23
|
+
collectTests(state) {
|
|
24
|
+
return runBaseTests("collect", state);
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
var threads = new ThreadsBaseWorker();
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.DkxLWvS1.js';
|
|
3
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
3
|
+
import { r as runVmTests } from '../vendor/vm.BrDS6p7h.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'node:vm';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import 'pathe';
|
|
8
|
-
import '../chunks/runtime-console.
|
|
8
|
+
import '../chunks/runtime-console.O41g23Zj.js';
|
|
9
9
|
import 'node:stream';
|
|
10
10
|
import 'node:console';
|
|
11
11
|
import 'node:path';
|
|
12
12
|
import '../vendor/date.W2xKR2qe.js';
|
|
13
13
|
import '@vitest/runner/utils';
|
|
14
14
|
import '../vendor/global.7bFbnyXl.js';
|
|
15
|
-
import '../vendor/env.
|
|
15
|
+
import '../vendor/env.2ltrQNq0.js';
|
|
16
16
|
import 'std-env';
|
|
17
|
-
import '../vendor/execute.
|
|
17
|
+
import '../vendor/execute.Dx503nGn.js';
|
|
18
18
|
import 'node:fs';
|
|
19
19
|
import 'vite-node/client';
|
|
20
20
|
import 'vite-node/utils';
|
|
@@ -28,15 +28,21 @@ class ForksVmWorker {
|
|
|
28
28
|
getRpcOptions() {
|
|
29
29
|
return createForksRpcOptions(v8);
|
|
30
30
|
}
|
|
31
|
-
async
|
|
31
|
+
async executeTests(method, state) {
|
|
32
32
|
const exit = process.exit;
|
|
33
33
|
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
|
|
34
34
|
try {
|
|
35
|
-
await runVmTests(state);
|
|
35
|
+
await runVmTests(method, state);
|
|
36
36
|
} finally {
|
|
37
37
|
process.exit = exit;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
runTests(state) {
|
|
41
|
+
return this.executeTests("run", state);
|
|
42
|
+
}
|
|
43
|
+
collectTests(state) {
|
|
44
|
+
return this.executeTests("collect", state);
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
var vmForks = new ForksVmWorker();
|
|
42
48
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { a as createThreadsRpcOptions } from '../vendor/utils.DkxLWvS1.js';
|
|
2
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
2
|
+
import { r as runVmTests } from '../vendor/vm.BrDS6p7h.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import 'node:vm';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'pathe';
|
|
7
|
-
import '../chunks/runtime-console.
|
|
7
|
+
import '../chunks/runtime-console.O41g23Zj.js';
|
|
8
8
|
import 'node:stream';
|
|
9
9
|
import 'node:console';
|
|
10
10
|
import 'node:path';
|
|
11
11
|
import '../vendor/date.W2xKR2qe.js';
|
|
12
12
|
import '@vitest/runner/utils';
|
|
13
13
|
import '../vendor/global.7bFbnyXl.js';
|
|
14
|
-
import '../vendor/env.
|
|
14
|
+
import '../vendor/env.2ltrQNq0.js';
|
|
15
15
|
import 'std-env';
|
|
16
|
-
import '../vendor/execute.
|
|
16
|
+
import '../vendor/execute.Dx503nGn.js';
|
|
17
17
|
import 'node:fs';
|
|
18
18
|
import 'vite-node/client';
|
|
19
19
|
import 'vite-node/utils';
|
|
@@ -28,7 +28,10 @@ class ThreadsVmWorker {
|
|
|
28
28
|
return createThreadsRpcOptions(ctx);
|
|
29
29
|
}
|
|
30
30
|
runTests(state) {
|
|
31
|
-
return runVmTests(state);
|
|
31
|
+
return runVmTests("run", state);
|
|
32
|
+
}
|
|
33
|
+
collectTests(state) {
|
|
34
|
+
return runVmTests("collect", state);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
var vmThreads = new ThreadsVmWorker();
|
package/dist/workers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v8 from 'v8';
|
|
2
|
-
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-DrywOHjt.js';
|
|
3
3
|
import { Awaitable } from '@vitest/utils';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|
|
@@ -13,6 +13,7 @@ import 'vite-node/client';
|
|
|
13
13
|
import '@vitest/snapshot/manager';
|
|
14
14
|
import 'vite-node/server';
|
|
15
15
|
import 'node:worker_threads';
|
|
16
|
+
import '@vitest/utils/source-map';
|
|
16
17
|
import 'node:fs';
|
|
17
18
|
import 'chai';
|
|
18
19
|
|
|
@@ -20,6 +21,7 @@ type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, 'on' | 'post' | 'serializ
|
|
|
20
21
|
interface VitestWorker {
|
|
21
22
|
getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions;
|
|
22
23
|
runTests: (state: WorkerGlobalState) => Awaitable<unknown>;
|
|
24
|
+
collectTests: (state: WorkerGlobalState) => Awaitable<unknown>;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
declare function createThreadsRpcOptions({ port, }: WorkerContext): WorkerRpcOptions;
|
|
@@ -32,9 +34,10 @@ declare function unwrapSerializableConfig(config: ResolvedConfig): ResolvedConfi
|
|
|
32
34
|
declare function provideWorkerState(context: any, state: WorkerGlobalState): WorkerGlobalState;
|
|
33
35
|
|
|
34
36
|
declare function run(ctx: ContextRPC): Promise<void>;
|
|
37
|
+
declare function collect(ctx: ContextRPC): Promise<void>;
|
|
35
38
|
|
|
36
|
-
declare function runVmTests(state: WorkerGlobalState): Promise<void>;
|
|
39
|
+
declare function runVmTests(method: 'run' | 'collect', state: WorkerGlobalState): Promise<void>;
|
|
37
40
|
|
|
38
|
-
declare function runBaseTests(state: WorkerGlobalState): Promise<void>;
|
|
41
|
+
declare function runBaseTests(method: 'run' | 'collect', state: WorkerGlobalState): Promise<void>;
|
|
39
42
|
|
|
40
|
-
export { type VitestWorker, type WorkerRpcOptions, createForksRpcOptions, createThreadsRpcOptions, provideWorkerState, runBaseTests, run as runVitestWorker, runVmTests, unwrapSerializableConfig };
|
|
43
|
+
export { type VitestWorker, type WorkerRpcOptions, collect as collectVitestWorkerTests, createForksRpcOptions, createThreadsRpcOptions, provideWorkerState, runBaseTests, run as runVitestWorker, runVmTests, unwrapSerializableConfig };
|
package/dist/workers.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.DkxLWvS1.js';
|
|
2
2
|
export { p as provideWorkerState } from './vendor/global.7bFbnyXl.js';
|
|
3
|
-
export { run as runVitestWorker } from './worker.js';
|
|
4
|
-
export { r as runVmTests } from './vendor/vm.
|
|
5
|
-
export { r as runBaseTests } from './vendor/base.
|
|
3
|
+
export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
|
|
4
|
+
export { r as runVmTests } from './vendor/vm.BrDS6p7h.js';
|
|
5
|
+
export { r as runBaseTests } from './vendor/base.CdA1i5tB.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
|
@@ -17,14 +17,14 @@ import 'node:module';
|
|
|
17
17
|
import './vendor/rpc.BGx7q_k2.js';
|
|
18
18
|
import './vendor/index.BpSiYbpB.js';
|
|
19
19
|
import 'node:vm';
|
|
20
|
-
import './chunks/runtime-console.
|
|
20
|
+
import './chunks/runtime-console.O41g23Zj.js';
|
|
21
21
|
import 'node:stream';
|
|
22
22
|
import 'node:path';
|
|
23
23
|
import './vendor/date.W2xKR2qe.js';
|
|
24
24
|
import '@vitest/runner/utils';
|
|
25
|
-
import './vendor/env.
|
|
25
|
+
import './vendor/env.2ltrQNq0.js';
|
|
26
26
|
import 'std-env';
|
|
27
|
-
import './vendor/execute.
|
|
27
|
+
import './vendor/execute.Dx503nGn.js';
|
|
28
28
|
import 'vite-node/utils';
|
|
29
29
|
import '@vitest/utils/error';
|
|
30
30
|
import './path.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.13",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
120
120
|
"happy-dom": "*",
|
|
121
121
|
"jsdom": "*",
|
|
122
|
-
"@vitest/browser": "2.0.0-beta.
|
|
123
|
-
"@vitest/ui": "2.0.0-beta.
|
|
122
|
+
"@vitest/browser": "2.0.0-beta.13",
|
|
123
|
+
"@vitest/ui": "2.0.0-beta.13"
|
|
124
124
|
},
|
|
125
125
|
"peerDependenciesMeta": {
|
|
126
126
|
"@edge-runtime/vm": {
|
|
@@ -155,12 +155,12 @@
|
|
|
155
155
|
"tinypool": "^1.0.0",
|
|
156
156
|
"vite": "^5.0.0",
|
|
157
157
|
"why-is-node-running": "^2.2.2",
|
|
158
|
-
"@vitest/expect": "2.0.0-beta.
|
|
159
|
-
"@vitest/runner": "2.0.0-beta.
|
|
160
|
-
"@vitest/spy": "2.0.0-beta.
|
|
161
|
-
"@vitest/utils": "2.0.0-beta.
|
|
162
|
-
"vite-node": "2.0.0-beta.
|
|
163
|
-
"@vitest/snapshot": "2.0.0-beta.
|
|
158
|
+
"@vitest/expect": "2.0.0-beta.13",
|
|
159
|
+
"@vitest/runner": "2.0.0-beta.13",
|
|
160
|
+
"@vitest/spy": "2.0.0-beta.13",
|
|
161
|
+
"@vitest/utils": "2.0.0-beta.13",
|
|
162
|
+
"vite-node": "2.0.0-beta.13",
|
|
163
|
+
"@vitest/snapshot": "2.0.0-beta.13"
|
|
164
164
|
},
|
|
165
165
|
"devDependencies": {
|
|
166
166
|
"@antfu/install-pkg": "0.3.1",
|
|
@@ -171,8 +171,8 @@
|
|
|
171
171
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
172
172
|
"@types/istanbul-reports": "^3.0.4",
|
|
173
173
|
"@types/jsdom": "^21.1.7",
|
|
174
|
-
"@types/micromatch": "^4.0.
|
|
175
|
-
"@types/node": "^20.14.
|
|
174
|
+
"@types/micromatch": "^4.0.9",
|
|
175
|
+
"@types/node": "^20.14.9",
|
|
176
176
|
"@types/prompts": "^2.4.9",
|
|
177
177
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
178
178
|
"acorn-walk": "^8.3.3",
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"find-up": "^6.3.0",
|
|
186
186
|
"flatted": "^3.3.1",
|
|
187
187
|
"get-tsconfig": "^4.7.5",
|
|
188
|
-
"happy-dom": "^14.12.
|
|
188
|
+
"happy-dom": "^14.12.3",
|
|
189
189
|
"jsdom": "^24.1.0",
|
|
190
190
|
"local-pkg": "^0.5.0",
|
|
191
191
|
"log-update": "^5.0.1",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import 'std-env';
|
|
2
|
-
|
|
3
|
-
var _a;
|
|
4
|
-
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
5
|
-
const isWindows = isNode && process.platform === "win32";
|
|
6
|
-
|
|
7
|
-
export { isWindows as a, isNode as i };
|