vitest 4.0.0-beta.3 → 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.BSPEQIuf.d.ts → browser.d.Cawq_X_N.d.ts} +1 -1
- package/dist/chunks/{cac.C30xmylc.js → cac.CKnbxhn2.js} +16 -11
- package/dist/chunks/{cli-api.DE98RCgs.js → cli-api.COn58yrl.js} +548 -348
- 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.OOpN1tMC.js → coverage.B6cReEn1.js} +272 -171
- 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.CJNzQTzZ.js → creator.DUVZ6rfm.js} +64 -3
- 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.B521nVV-.js → index.Bgo3tNWt.js} +23 -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.Dppt57hu.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.CKCmge5g.d.ts → plugin.d.CvOlgjxK.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BBuiUFDc.d.ts → reporters.d.CYE9sT5z.d.ts} +132 -69
- package/dist/chunks/resolver.D5bG4zy5.js +162 -0
- package/dist/chunks/{rpc.CsFtxqeq.js → rpc.DGoW_Vl-.js} +5 -9
- package/dist/chunks/{runBaseTests.Bbi_gTJQ.js → runBaseTests.B3KcKqlF.js} +23 -24
- 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.xTcinSQw.d.ts → worker.d.D9QWnzAe.d.ts} +25 -13
- package/dist/chunks/{worker.d.DyXSTmRq.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 +6 -7
- 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 +13 -14
- package/dist/node.js +16 -15
- package/dist/reporters.d.ts +7 -8
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +3 -3
- package/dist/runners.js +17 -11
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +93 -34
- package/dist/workers/forks.js +10 -9
- package/dist/workers/runVmTests.js +17 -18
- 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 +15 -14
- package/package.json +25 -20
- package/dist/chunks/base.D5_IXzht.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.xTcinSQw.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: {
|
|
@@ -886,7 +886,8 @@ const cliOptionsConfig = {
|
|
|
886
886
|
screenshotFailures: null,
|
|
887
887
|
locators: null,
|
|
888
888
|
testerHtmlPath: null,
|
|
889
|
-
instances: null
|
|
889
|
+
instances: null,
|
|
890
|
+
expect: null
|
|
890
891
|
}
|
|
891
892
|
},
|
|
892
893
|
pool: {
|
|
@@ -1207,7 +1208,6 @@ const cliOptionsConfig = {
|
|
|
1207
1208
|
uiBase: null,
|
|
1208
1209
|
benchmark: null,
|
|
1209
1210
|
include: null,
|
|
1210
|
-
testTransformMode: null,
|
|
1211
1211
|
fakeTimers: null,
|
|
1212
1212
|
chaiConfig: null,
|
|
1213
1213
|
clearMocks: null,
|
|
@@ -1234,11 +1234,16 @@ const benchCliOptionsConfig = {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
};
|
|
1236
1236
|
const collectCliOptionsConfig = {
|
|
1237
|
+
...cliOptionsConfig,
|
|
1237
1238
|
json: {
|
|
1238
1239
|
description: "Print collected tests as JSON or write to a file (Default: false)",
|
|
1239
1240
|
argument: "[true/path]"
|
|
1240
1241
|
},
|
|
1241
|
-
filesOnly: { description: "Print only test files with out the test cases" }
|
|
1242
|
+
filesOnly: { description: "Print only test files with out the test cases" },
|
|
1243
|
+
changed: {
|
|
1244
|
+
description: "Print only tests that are affected by the changed files (default: `false`)",
|
|
1245
|
+
argument: "[since]"
|
|
1246
|
+
}
|
|
1242
1247
|
};
|
|
1243
1248
|
|
|
1244
1249
|
function addCommand(cli, name, option) {
|
|
@@ -1392,11 +1397,11 @@ async function start(mode, cliFilters, options) {
|
|
|
1392
1397
|
process.title = "node (vitest)";
|
|
1393
1398
|
} catch {}
|
|
1394
1399
|
try {
|
|
1395
|
-
const { startVitest } = await import('./cli-api.
|
|
1400
|
+
const { startVitest } = await import('./cli-api.COn58yrl.js').then(function (n) { return n.f; });
|
|
1396
1401
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1397
1402
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1398
1403
|
} catch (e) {
|
|
1399
|
-
const { errorBanner } = await import('./index.
|
|
1404
|
+
const { errorBanner } = await import('./index.DQhAfQQU.js').then(function (n) { return n.u; });
|
|
1400
1405
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
1401
1406
|
console.error(e);
|
|
1402
1407
|
console.error("\n\n");
|
|
@@ -1409,7 +1414,7 @@ async function init(project) {
|
|
|
1409
1414
|
console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
1410
1415
|
process.exit(1);
|
|
1411
1416
|
}
|
|
1412
|
-
const { create } = await import('./creator.
|
|
1417
|
+
const { create } = await import('./creator.DUVZ6rfm.js');
|
|
1413
1418
|
await create();
|
|
1414
1419
|
}
|
|
1415
1420
|
async function collect(mode, cliFilters, options) {
|
|
@@ -1417,7 +1422,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1417
1422
|
process.title = "node (vitest)";
|
|
1418
1423
|
} catch {}
|
|
1419
1424
|
try {
|
|
1420
|
-
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; });
|
|
1421
1426
|
const ctx = await prepareVitest(mode, {
|
|
1422
1427
|
...normalizeCliOptions(cliFilters, options),
|
|
1423
1428
|
watch: false,
|
|
@@ -1439,7 +1444,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1439
1444
|
}
|
|
1440
1445
|
await ctx.close();
|
|
1441
1446
|
} catch (e) {
|
|
1442
|
-
const { errorBanner } = await import('./index.
|
|
1447
|
+
const { errorBanner } = await import('./index.DQhAfQQU.js').then(function (n) { return n.u; });
|
|
1443
1448
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
1444
1449
|
console.error(e);
|
|
1445
1450
|
console.error("\n\n");
|