vitest 4.0.16 → 4.1.0-beta.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/dist/browser.d.ts +2 -1
- package/dist/browser.js +2 -1
- package/dist/chunks/{base.Bin-9uYm.js → base.CBRNZa3k.js} +8 -7
- package/dist/chunks/{browser.d.Bz3lxTX-.d.ts → browser.d.8hOapKZr.d.ts} +5 -1
- package/dist/chunks/{cac.BGonGPac.js → cac.B1v3xxoC.js} +26 -8
- package/dist/chunks/{cli-api.BKg19Fvw.js → cli-api.B4CqEpI6.js} +225 -110
- package/dist/chunks/{config.d.CzIjkicf.d.ts → config.d.idH22YSr.d.ts} +13 -11
- package/dist/chunks/{console.Cf-YriPC.js → console.uGgdMhyZ.js} +2 -1
- package/dist/chunks/{coverage.BuJUwVtg.js → coverage.BMlOMIWl.js} +18 -4
- package/dist/chunks/{creator.DAmOKTvJ.js → creator.C7WwjkuR.js} +32 -1
- package/dist/chunks/{globals.DOayXfHP.js → globals.DjuGMoMc.js} +10 -9
- package/dist/chunks/{index.Z5E_ObnR.js → index.BEFi2-_3.js} +3 -1
- package/dist/chunks/{index.6Qv1eEA6.js → index.BiOAd_ki.js} +16 -4
- package/dist/chunks/{index.BspFP3mn.js → index.CyBMJtT7.js} +1 -1
- package/dist/chunks/{index.456_DGfR.js → index.Dm4xqZ0s.js} +28 -4
- package/dist/chunks/{index.Drsj_6e7.js → index.DyBZXrH3.js} +1 -1
- package/dist/chunks/{init-forks.v9UONQS6.js → init-forks.CHeQ9Moq.js} +1 -1
- package/dist/chunks/{init-threads.DqYg3Trk.js → init-threads.uZiNAuPk.js} +1 -1
- package/dist/chunks/{init.KmQZdqFg.js → init.DVtKdFty.js} +24 -11
- package/dist/chunks/{plugin.d.v1sC_bv1.d.ts → plugin.d.D8KU2PY_.d.ts} +1 -1
- package/dist/chunks/{reporters.d.Rsi0PyxX.d.ts → reporters.d.Db3MiIWX.d.ts} +51 -22
- package/dist/chunks/rpc.HLmECnw_.js +148 -0
- package/dist/chunks/{setup-common.Cm-kSBVi.js → setup-common.BcqLPsn5.js} +1 -1
- package/dist/chunks/{startModuleRunner.DpqpB8k3.js → startModuleRunner.C5CcWyXW.js} +23 -23
- package/dist/chunks/{vi.2VT5v0um.js → test.prxIahgM.js} +500 -119
- package/dist/chunks/{traces.U4xDYhzZ.js → traces.CCmnQaNT.js} +46 -1
- package/dist/chunks/{vm.qFl6P1nF.js → vm.CrifS09m.js} +5 -8
- package/dist/chunks/{worker.d.5JNaocaN.d.ts → worker.d.Bji1eq5g.d.ts} +2 -1
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +9 -9
- package/dist/coverage.d.ts +8 -8
- package/dist/coverage.js +3 -1
- package/dist/environments.js +3 -1
- package/dist/index.d.ts +22 -10
- package/dist/index.js +8 -7
- package/dist/module-evaluator.js +2 -6
- package/dist/node.d.ts +14 -11
- package/dist/node.js +20 -20
- package/dist/reporters.d.ts +7 -7
- package/dist/reporters.js +4 -2
- package/dist/runners.d.ts +23 -4
- package/dist/runners.js +4 -4
- package/dist/runtime.d.ts +6 -0
- package/dist/runtime.js +36 -0
- package/dist/snapshot.js +2 -0
- package/dist/suite.js +2 -0
- package/dist/worker.d.ts +4 -3
- package/dist/worker.js +10 -12
- package/dist/workers/forks.js +11 -13
- package/dist/workers/runVmTests.js +10 -12
- package/dist/workers/threads.js +11 -13
- package/dist/workers/vmForks.js +8 -9
- package/dist/workers/vmThreads.js +8 -9
- package/package.json +23 -27
- package/dist/chunks/date.Bq6ZW5rf.js +0 -73
- package/dist/chunks/rpc.BoxB0q7B.js +0 -76
- package/dist/chunks/test.B8ej_ZHS.js +0 -254
- package/dist/mocker.d.ts +0 -1
- package/dist/mocker.js +0 -1
- package/dist/module-runner.js +0 -17
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.
|
|
1
|
+
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.idH22YSr.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
|
+
export { O as OTELCarrier, T as Traces } from './chunks/traces.d.402V_yFI.js';
|
|
4
5
|
export { collectTests, startTests } from '@vitest/runner';
|
|
5
6
|
import * as _vitest_spy from '@vitest/spy';
|
|
6
7
|
export { _vitest_spy as SpyModule };
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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.BcqLPsn5.js';
|
|
2
|
+
export { T as Traces } from './chunks/traces.CCmnQaNT.js';
|
|
2
3
|
export { collectTests, startTests } from '@vitest/runner';
|
|
3
4
|
import * as spyModule from '@vitest/spy';
|
|
4
5
|
export { spyModule as SpyModule };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { runInThisContext } from 'node:vm';
|
|
2
2
|
import * as spyModule from '@vitest/spy';
|
|
3
|
-
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, s as setupChaiConfig } from './index.
|
|
4
|
-
import { l as loadEnvironment } from './init.
|
|
3
|
+
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, s as setupChaiConfig } from './index.BiOAd_ki.js';
|
|
4
|
+
import { l as loadEnvironment, e as emitModuleRunner } from './init.DVtKdFty.js';
|
|
5
5
|
import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
|
|
6
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startModuleRunner.
|
|
6
|
+
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startModuleRunner.C5CcWyXW.js';
|
|
7
7
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
8
8
|
import { startTests, collectTests } from '@vitest/runner';
|
|
9
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.
|
|
10
|
-
import { g as globalExpect, v as vi } from './
|
|
9
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.BcqLPsn5.js';
|
|
10
|
+
import { g as globalExpect, v as vi } from './test.prxIahgM.js';
|
|
11
11
|
import { c as closeInspector } from './inspector.CvyFGlXm.js';
|
|
12
12
|
import { createRequire } from 'node:module';
|
|
13
13
|
import timers from 'node:timers';
|
|
14
14
|
import timersPromises from 'node:timers/promises';
|
|
15
15
|
import util from 'node:util';
|
|
16
16
|
import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
|
|
17
|
-
import { i as index } from './index.
|
|
17
|
+
import { i as index } from './index.BEFi2-_3.js';
|
|
18
18
|
import { g as getWorkerState, r as resetModules, p as provideWorkerState } from './utils.DvEY5TfP.js';
|
|
19
19
|
|
|
20
20
|
// this should only be used in Node
|
|
@@ -56,7 +56,7 @@ function resolveAsset(mod, url) {
|
|
|
56
56
|
mod.exports = url;
|
|
57
57
|
}
|
|
58
58
|
async function setupConsoleLogSpy() {
|
|
59
|
-
const { createCustomConsole } = await import('./console.
|
|
59
|
+
const { createCustomConsole } = await import('./console.uGgdMhyZ.js');
|
|
60
60
|
globalThis.console = createCustomConsole();
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -158,6 +158,7 @@ async function runBaseTests(method, state, traces) {
|
|
|
158
158
|
createImportMeta: createNodeImportMeta,
|
|
159
159
|
traces
|
|
160
160
|
});
|
|
161
|
+
emitModuleRunner(moduleRunner);
|
|
161
162
|
await run(method, ctx.files, ctx.config, moduleRunner, _currentEnvironment, traces);
|
|
162
163
|
}
|
|
163
164
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileSpecification } from '@vitest/runner';
|
|
2
|
-
import {
|
|
2
|
+
import { O as OTELCarrier } from './traces.d.402V_yFI.js';
|
|
3
|
+
import { T as TestExecutionMethod } from './worker.d.Bji1eq5g.js';
|
|
3
4
|
|
|
4
5
|
type SerializedTestSpecification = [project: {
|
|
5
6
|
name: string | undefined;
|
|
@@ -7,6 +8,8 @@ type SerializedTestSpecification = [project: {
|
|
|
7
8
|
}, file: string, options: {
|
|
8
9
|
pool: string;
|
|
9
10
|
testLines?: number[] | undefined;
|
|
11
|
+
testIds?: string[] | undefined;
|
|
12
|
+
testNamePattern?: RegExp | undefined;
|
|
10
13
|
}];
|
|
11
14
|
|
|
12
15
|
interface ModuleDefinitionLocation {
|
|
@@ -52,6 +55,7 @@ interface BrowserTesterOptions {
|
|
|
52
55
|
method: TestExecutionMethod;
|
|
53
56
|
files: FileSpecification[];
|
|
54
57
|
providedContext: string;
|
|
58
|
+
otelCarrier?: OTELCarrier;
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
export type { BrowserTesterOptions as B, ModuleDefinitionDurationsDiagnostic as M, SerializedTestSpecification as S, UntrackedModuleDefinitionDiagnostic as U, ModuleDefinitionDiagnostic as a, ModuleDefinitionLocation as b, SourceModuleDiagnostic as c, SourceModuleLocations as d };
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
5
|
import { a as defaultPort, d as defaultBrowserPort } from './constants.D_Q9UYh-.js';
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
6
|
+
import { R as ReportersMap } from './index.Dm4xqZ0s.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.
|
|
622
|
+
var version = "4.1.0-beta.1";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -968,7 +968,25 @@ const cliOptionsConfig = {
|
|
|
968
968
|
},
|
|
969
969
|
retry: {
|
|
970
970
|
description: "Retry the test specific number of times if it fails (default: `0`)",
|
|
971
|
-
argument: "<times>"
|
|
971
|
+
argument: "<times>",
|
|
972
|
+
subcommands: {
|
|
973
|
+
count: {
|
|
974
|
+
description: "Number of times to retry a test if it fails (default: `0`)",
|
|
975
|
+
argument: "<times>"
|
|
976
|
+
},
|
|
977
|
+
delay: {
|
|
978
|
+
description: "Delay in milliseconds between retry attempts (default: `0`)",
|
|
979
|
+
argument: "<ms>"
|
|
980
|
+
},
|
|
981
|
+
condition: {
|
|
982
|
+
description: "Regex pattern to match error messages that should trigger a retry. Only errors matching this pattern will cause a retry (default: retry on all errors)",
|
|
983
|
+
argument: "<pattern>",
|
|
984
|
+
transform: (value) => {
|
|
985
|
+
if (typeof value === "string") return new RegExp(value, "i");
|
|
986
|
+
return value;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
972
990
|
},
|
|
973
991
|
diff: {
|
|
974
992
|
description: "DiffOptions object or a path to a module which exports DiffOptions object",
|
|
@@ -1356,11 +1374,11 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1356
1374
|
}
|
|
1357
1375
|
async function start(mode, cliFilters, options) {
|
|
1358
1376
|
try {
|
|
1359
|
-
const { startVitest } = await import('./cli-api.
|
|
1377
|
+
const { startVitest } = await import('./cli-api.B4CqEpI6.js').then(function (n) { return n.q; });
|
|
1360
1378
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1361
1379
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1362
1380
|
} catch (e) {
|
|
1363
|
-
const { errorBanner } = await import('./index.
|
|
1381
|
+
const { errorBanner } = await import('./index.Dm4xqZ0s.js').then(function (n) { return n.A; });
|
|
1364
1382
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
1365
1383
|
console.error(e);
|
|
1366
1384
|
console.error("\n\n");
|
|
@@ -1373,12 +1391,12 @@ async function init(project) {
|
|
|
1373
1391
|
console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
1374
1392
|
process.exit(1);
|
|
1375
1393
|
}
|
|
1376
|
-
const { create } = await import('./creator.
|
|
1394
|
+
const { create } = await import('./creator.C7WwjkuR.js');
|
|
1377
1395
|
await create();
|
|
1378
1396
|
}
|
|
1379
1397
|
async function collect(mode, cliFilters, options) {
|
|
1380
1398
|
try {
|
|
1381
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1399
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.B4CqEpI6.js').then(function (n) { return n.q; });
|
|
1382
1400
|
const ctx = await prepareVitest(mode, {
|
|
1383
1401
|
...normalizeCliOptions(cliFilters, options),
|
|
1384
1402
|
watch: false,
|
|
@@ -1397,7 +1415,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1397
1415
|
} else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
|
|
1398
1416
|
await ctx.close();
|
|
1399
1417
|
} catch (e) {
|
|
1400
|
-
const { errorBanner } = await import('./index.
|
|
1418
|
+
const { errorBanner } = await import('./index.Dm4xqZ0s.js').then(function (n) { return n.A; });
|
|
1401
1419
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
1402
1420
|
console.error(e);
|
|
1403
1421
|
console.error("\n\n");
|