vitest 4.0.0-beta.4 → 4.0.0-beta.5
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 +8 -9
- package/dist/browser.js +3 -2
- package/dist/chunks/base.DMfOuRWD.js +48 -0
- package/dist/chunks/{benchmark.CYdenmiT.js → benchmark.CtuRzf-i.js} +4 -1
- package/dist/chunks/{browser.d.BRP8scJf.d.ts → browser.d.Cawq_X_N.d.ts} +1 -1
- package/dist/chunks/{cac.CY0IAxC4.js → cac.CKnbxhn2.js} +8 -9
- package/dist/chunks/{cli-api.B8xRY9Zt.js → cli-api.COn58yrl.js} +540 -342
- package/dist/chunks/{config.d.DZo8c7fw.d.ts → config.d.CKNVOKm0.d.ts} +3 -8
- package/dist/chunks/{console.DoJHFxmj.js → console.Duv2dVIC.js} +1 -1
- package/dist/chunks/{constants.CXzqaLmq.js → constants.D_Q9UYh-.js} +1 -6
- package/dist/chunks/{coverage.C84l9G-M.js → coverage.B6cReEn1.js} +232 -133
- package/dist/chunks/{coverage.DVF1vEu8.js → coverage.D_JHT54q.js} +2 -2
- package/dist/chunks/{coverage.d.CNYjU4GF.d.ts → coverage.d.BZtK59WP.d.ts} +7 -5
- package/dist/chunks/{creator.yfA2ExGt.js → creator.DUVZ6rfm.js} +1 -1
- package/dist/chunks/{environment.d.Bhm9oc0v.d.ts → environment.d.2fYMoz3o.d.ts} +26 -4
- package/dist/chunks/{global.d.DAhT2emn.d.ts → global.d.K6uBQHzY.d.ts} +1 -1
- package/dist/chunks/{globals.Dgo-vS5G.js → globals.CJQ63oO0.js} +6 -5
- package/dist/chunks/{index.CmSc2RE5.js → index.BRtIe7r8.js} +4 -4
- package/dist/chunks/{index.Bz6b0Ib7.js → index.DQhAfQQU.js} +12 -4
- package/dist/chunks/{index.D3SKT3tv.js → index.DgN0Zk9a.js} +1 -1
- package/dist/chunks/{index.D1_MsKEt.js → index.QZr3S3vQ.js} +4 -2
- package/dist/chunks/{index.CtUvr1c8.js → index.oWRWx-nj.js} +18 -18
- package/dist/chunks/moduleRunner.d.mmOmOGrW.d.ts +202 -0
- package/dist/chunks/moduleTransport.I-bgQy0S.js +19 -0
- package/dist/chunks/{node.fjCdwEIl.js → node.4JV5OXkt.js} +1 -1
- package/dist/chunks/{plugin.d.CLhMcYdD.d.ts → plugin.d.CvOlgjxK.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DWg40D2B.d.ts → reporters.d.CYE9sT5z.d.ts} +37 -69
- package/dist/chunks/resolver.D5bG4zy5.js +162 -0
- package/dist/chunks/{rpc.jnQO9F8a.js → rpc.DGoW_Vl-.js} +1 -1
- package/dist/chunks/{runBaseTests.DBVVLMSb.js → runBaseTests.B3KcKqlF.js} +22 -23
- package/dist/chunks/{setup-common.Ebx5x0eP.js → setup-common.lgPs-bYv.js} +11 -10
- package/dist/chunks/{execute.Dt-pCVcL.js → startModuleRunner.C8FtT_BY.js} +381 -312
- package/dist/chunks/{typechecker.CMNPqJOo.js → typechecker.BgoW4nTA.js} +1 -1
- package/dist/chunks/{utils.XdZDrNZV.js → utils.B9FY3b73.js} +7 -8
- package/dist/chunks/{vi.CA0EPI9Y.js → vi.DGAfBY4R.js} +12 -8
- package/dist/chunks/{vm.BUnLJt_P.js → vm.BKfKvaKl.js} +36 -56
- package/dist/chunks/{worker.d.zjyR34Pb.d.ts → worker.d.D9QWnzAe.d.ts} +16 -13
- package/dist/chunks/{worker.d.C-1AbnVe.d.ts → worker.d.Db-UVmXc.d.ts} +1 -1
- package/dist/cli.js +4 -4
- package/dist/config.cjs +3 -9
- package/dist/config.d.ts +10 -12
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +10 -11
- package/dist/coverage.js +5 -6
- package/dist/environments.d.ts +2 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.js +5 -4
- package/dist/module-evaluator.d.ts +12 -0
- package/dist/module-evaluator.js +327 -0
- package/dist/module-runner.js +15 -0
- package/dist/node.d.ts +12 -13
- package/dist/node.js +15 -14
- package/dist/reporters.d.ts +7 -8
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +3 -3
- package/dist/runners.js +16 -10
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +84 -31
- package/dist/workers/forks.js +10 -9
- package/dist/workers/runVmTests.js +16 -17
- package/dist/workers/threads.js +10 -9
- package/dist/workers/vmForks.js +9 -8
- package/dist/workers/vmThreads.js +9 -8
- package/dist/workers.d.ts +5 -4
- package/dist/workers.js +14 -13
- package/package.json +21 -16
- package/dist/chunks/base.BaCDDRPG.js +0 -38
- package/dist/execute.d.ts +0 -148
- package/dist/execute.js +0 -13
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.
|
|
2
|
-
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.
|
|
1
|
+
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.CKNVOKm0.js';
|
|
2
|
+
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
|
-
import {
|
|
4
|
+
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.mmOmOGrW.js';
|
|
5
5
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
6
6
|
import * as spy from '@vitest/spy';
|
|
7
7
|
export { spy as SpyModule };
|
|
@@ -9,11 +9,10 @@ export { LoupeOptions, ParsedStack, StringifyOptions, format, getSafeTimers, ins
|
|
|
9
9
|
export { TraceMap, originalPositionFor } from '@vitest/utils/source-map';
|
|
10
10
|
import '@vitest/pretty-format';
|
|
11
11
|
import '@vitest/snapshot';
|
|
12
|
-
import 'vite-node/client';
|
|
13
|
-
import 'vite-node';
|
|
14
|
-
import './chunks/worker.d.zjyR34Pb.js';
|
|
15
|
-
import './chunks/environment.d.Bhm9oc0v.js';
|
|
16
12
|
import 'node:vm';
|
|
13
|
+
import 'vite/module-runner';
|
|
14
|
+
import './chunks/worker.d.D9QWnzAe.js';
|
|
15
|
+
import './chunks/environment.d.2fYMoz3o.js';
|
|
17
16
|
import '@vitest/mocker';
|
|
18
17
|
import './chunks/mocker.d.BE_2ls6u.js';
|
|
19
18
|
|
|
@@ -26,7 +25,7 @@ declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | un
|
|
|
26
25
|
}): Promise<unknown>;
|
|
27
26
|
|
|
28
27
|
declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
|
|
29
|
-
declare function loadDiffConfig(config: SerializedConfig,
|
|
30
|
-
declare function loadSnapshotSerializers(config: SerializedConfig,
|
|
28
|
+
declare function loadDiffConfig(config: SerializedConfig, moduleRunner: VitestModuleRunner): Promise<SerializedDiffOptions | undefined>;
|
|
29
|
+
declare function loadSnapshotSerializers(config: SerializedConfig, moduleRunner: VitestModuleRunner): Promise<void>;
|
|
31
30
|
|
|
32
31
|
export { loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
|
package/dist/browser.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.
|
|
1
|
+
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.lgPs-bYv.js';
|
|
2
2
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
3
3
|
import * as spy from '@vitest/spy';
|
|
4
4
|
export { spy as SpyModule };
|
|
5
5
|
export { format, getSafeTimers, inspect, stringify } from '@vitest/utils';
|
|
6
6
|
export { TraceMap, originalPositionFor } from '@vitest/utils/source-map';
|
|
7
|
-
import './chunks/coverage.
|
|
7
|
+
import './chunks/coverage.D_JHT54q.js';
|
|
8
8
|
import '@vitest/snapshot';
|
|
9
|
+
import './chunks/utils.B9FY3b73.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EvaluatedModules } from 'vite/module-runner';
|
|
2
|
+
import { s as startVitestModuleRunner } from './startModuleRunner.C8FtT_BY.js';
|
|
3
|
+
import { p as provideWorkerState } from './utils.B9FY3b73.js';
|
|
4
|
+
|
|
5
|
+
let _moduleRunner;
|
|
6
|
+
const evaluatedModules = new EvaluatedModules();
|
|
7
|
+
const moduleExecutionInfo = /* @__PURE__ */ new Map();
|
|
8
|
+
async function startModuleRunner(options) {
|
|
9
|
+
if (_moduleRunner) return _moduleRunner;
|
|
10
|
+
_moduleRunner = await startVitestModuleRunner(options);
|
|
11
|
+
return _moduleRunner;
|
|
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.evaluatedModules = evaluatedModules;
|
|
17
|
+
state.moduleExecutionInfo = moduleExecutionInfo;
|
|
18
|
+
provideWorkerState(globalThis, state);
|
|
19
|
+
if (ctx.invalidates) ctx.invalidates.forEach((filepath) => {
|
|
20
|
+
const modules = state.evaluatedModules.fileToModulesMap.get(filepath) || [];
|
|
21
|
+
modules.forEach((module) => {
|
|
22
|
+
state.evaluatedModules.invalidateModule(module);
|
|
23
|
+
});
|
|
24
|
+
// evaluatedModules.delete(fsPath)
|
|
25
|
+
// evaluatedModules.delete(`mock:${fsPath}`)
|
|
26
|
+
});
|
|
27
|
+
ctx.files.forEach((i) => {
|
|
28
|
+
const filepath = typeof i === "string" ? i : i.filepath;
|
|
29
|
+
const modules = state.evaluatedModules.fileToModulesMap.get(filepath) || [];
|
|
30
|
+
modules.forEach((module) => {
|
|
31
|
+
state.evaluatedModules.invalidateModule(module);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const [executor, { run }] = await Promise.all([startModuleRunner({
|
|
35
|
+
state,
|
|
36
|
+
evaluatedModules: state.evaluatedModules
|
|
37
|
+
}), import('./runBaseTests.B3KcKqlF.js')]);
|
|
38
|
+
const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
|
|
39
|
+
filepath: f,
|
|
40
|
+
testLocations: void 0
|
|
41
|
+
} : f);
|
|
42
|
+
await run(method, fileSpecs, ctx.config, {
|
|
43
|
+
environment: state.environment,
|
|
44
|
+
options: ctx.environment.options
|
|
45
|
+
}, executor);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { runBaseTests as r };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable } from '@vitest/runner/utils';
|
|
3
3
|
import { noop } from '@vitest/utils';
|
|
4
|
-
import { g as getWorkerState } from './utils.
|
|
4
|
+
import { g as getWorkerState } from './utils.B9FY3b73.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -19,6 +19,9 @@ const bench = createBenchmark(function(name, fn = noop, options = {}) {
|
|
|
19
19
|
});
|
|
20
20
|
benchFns.set(task, fn);
|
|
21
21
|
benchOptsMap.set(task, options);
|
|
22
|
+
// vitest runner sets mode to `todo` if handler is not passed down
|
|
23
|
+
// but we store handler separetly
|
|
24
|
+
if (!this.todo && task.mode === "todo") task.mode = "run";
|
|
22
25
|
});
|
|
23
26
|
function createBenchmark(fn) {
|
|
24
27
|
const benchmark = createChainable([
|
|
@@ -2,8 +2,8 @@ import { toArray } from '@vitest/utils';
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
|
-
import { a as defaultPort, d as defaultBrowserPort } from './constants.
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
5
|
+
import { a as defaultPort, d as defaultBrowserPort } from './constants.D_Q9UYh-.js';
|
|
6
|
+
import { R as ReportersMap } from './index.DQhAfQQU.js';
|
|
7
7
|
|
|
8
8
|
function toArr(any) {
|
|
9
9
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "4.0.0-beta.
|
|
622
|
+
var version = "4.0.0-beta.5";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -1208,7 +1208,6 @@ const cliOptionsConfig = {
|
|
|
1208
1208
|
uiBase: null,
|
|
1209
1209
|
benchmark: null,
|
|
1210
1210
|
include: null,
|
|
1211
|
-
testTransformMode: null,
|
|
1212
1211
|
fakeTimers: null,
|
|
1213
1212
|
chaiConfig: null,
|
|
1214
1213
|
clearMocks: null,
|
|
@@ -1398,11 +1397,11 @@ async function start(mode, cliFilters, options) {
|
|
|
1398
1397
|
process.title = "node (vitest)";
|
|
1399
1398
|
} catch {}
|
|
1400
1399
|
try {
|
|
1401
|
-
const { startVitest } = await import('./cli-api.
|
|
1400
|
+
const { startVitest } = await import('./cli-api.COn58yrl.js').then(function (n) { return n.f; });
|
|
1402
1401
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1403
1402
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1404
1403
|
} catch (e) {
|
|
1405
|
-
const { errorBanner } = await import('./index.
|
|
1404
|
+
const { errorBanner } = await import('./index.DQhAfQQU.js').then(function (n) { return n.u; });
|
|
1406
1405
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
1407
1406
|
console.error(e);
|
|
1408
1407
|
console.error("\n\n");
|
|
@@ -1415,7 +1414,7 @@ async function init(project) {
|
|
|
1415
1414
|
console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
1416
1415
|
process.exit(1);
|
|
1417
1416
|
}
|
|
1418
|
-
const { create } = await import('./creator.
|
|
1417
|
+
const { create } = await import('./creator.DUVZ6rfm.js');
|
|
1419
1418
|
await create();
|
|
1420
1419
|
}
|
|
1421
1420
|
async function collect(mode, cliFilters, options) {
|
|
@@ -1423,7 +1422,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1423
1422
|
process.title = "node (vitest)";
|
|
1424
1423
|
} catch {}
|
|
1425
1424
|
try {
|
|
1426
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1425
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.COn58yrl.js').then(function (n) { return n.f; });
|
|
1427
1426
|
const ctx = await prepareVitest(mode, {
|
|
1428
1427
|
...normalizeCliOptions(cliFilters, options),
|
|
1429
1428
|
watch: false,
|
|
@@ -1445,7 +1444,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1445
1444
|
}
|
|
1446
1445
|
await ctx.close();
|
|
1447
1446
|
} catch (e) {
|
|
1448
|
-
const { errorBanner } = await import('./index.
|
|
1447
|
+
const { errorBanner } = await import('./index.DQhAfQQU.js').then(function (n) { return n.u; });
|
|
1449
1448
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
1450
1449
|
console.error(e);
|
|
1451
1450
|
console.error("\n\n");
|