vitest 3.0.0-beta.2 → 3.0.0-beta.4
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 +1 -315
- package/config.d.ts +2 -0
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +1 -1
- package/dist/chunks/{RandomSequencer.gisBJ77r.js → RandomSequencer.DB__To1b.js} +38 -8
- package/dist/chunks/{base.CUgXReRN.js → base.BJ8KO-VX.js} +2 -2
- package/dist/chunks/{cac.Xzv7eNWw.js → cac.BAYqQ2aM.js} +21 -10
- package/dist/chunks/{cli-api.CETCDGgZ.js → cli-api.Dhl34Trr.js} +263 -58
- package/dist/chunks/{config.BTPBhmK5.d.ts → config.BRtC-JeT.d.ts} +6 -0
- package/dist/chunks/{console.BYGVloWk.js → console.CN7AiMGV.js} +16 -7
- package/dist/chunks/{creator.DcAcUhMD.js → creator.Ot9GlSGw.js} +16 -14
- package/dist/chunks/{execute.2pr0rHgK.js → execute.BMOaRArH.js} +27 -16
- package/dist/chunks/{globals.BFncSRNA.js → globals.C5RQxaV3.js} +2 -2
- package/dist/chunks/{index.DoV7W5gc.js → index.B2M9nD1V.js} +6 -1
- package/dist/chunks/{index.CkWmZCXU.js → index.BQbxGbG9.js} +1 -1
- package/dist/chunks/index.CAueP3cK.js +3205 -0
- package/dist/chunks/{reporters.DTtxC3KQ.d.ts → reporters.Dcdq51WE.d.ts} +211 -257
- package/dist/chunks/{resolveConfig.BA-_OKEx.js → resolveConfig.kZFMjKCQ.js} +28 -6
- package/dist/chunks/{runBaseTests.D0dWpzZV.js → runBaseTests.URiUrnWK.js} +8 -6
- package/dist/chunks/{setup-common.Cp_bu5q3.js → setup-common.D0zLenuv.js} +1 -1
- package/dist/chunks/{utils.CMUTX-p8.js → utils.yHKcm4dz.js} +10 -21
- package/dist/chunks/{vi.S4Fq8wSo.js → vi.Da_PT3Vw.js} +554 -272
- package/dist/chunks/{vite.CXaetSK3.d.ts → vite.DzluO1Kj.d.ts} +1 -1
- package/dist/chunks/{vm.DGhTouO3.js → vm.DrFVeTXo.js} +4 -4
- package/dist/chunks/{worker.ClntunZp.d.ts → worker.BIVMnzXw.d.ts} +1 -1
- package/dist/chunks/{worker.o1PBoDdo.d.ts → worker.Hz_LAzfd.d.ts} +2 -1
- package/dist/cli.js +1 -1
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +4 -4
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +2 -2
- package/dist/coverage.js +33 -8
- package/dist/execute.d.ts +3 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +2 -2
- package/dist/node.d.ts +6 -6
- package/dist/node.js +10 -11
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +3 -7
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +5 -12
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +7 -5
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +3 -3
- package/dist/workers/vmThreads.js +3 -3
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +4 -4
- package/package.json +17 -19
- package/dist/chunks/index.9ZEBV_TJ.js +0 -5442
|
@@ -13,7 +13,7 @@ import c from 'tinyrainbow';
|
|
|
13
13
|
import { e as extraInlineDeps, d as defaultPort, a as defaultBrowserPort, b as defaultInspectPort } from './constants.fzPh7AOq.js';
|
|
14
14
|
import * as nodeos from 'node:os';
|
|
15
15
|
import nodeos__default from 'node:os';
|
|
16
|
-
import { h as hash, w as wrapSerializableConfig,
|
|
16
|
+
import { h as hash, w as wrapSerializableConfig, a as Typechecker, b as isWindows, R as RandomSequencer, B as BaseSequencer } from './RandomSequencer.DB__To1b.js';
|
|
17
17
|
import { isCI, provider } from 'std-env';
|
|
18
18
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
19
19
|
import require$$0 from 'util';
|
|
@@ -2709,9 +2709,9 @@ function requireToRegexRange () {
|
|
|
2709
2709
|
};
|
|
2710
2710
|
|
|
2711
2711
|
function collatePatterns(neg, pos, options) {
|
|
2712
|
-
let onlyNegative = filterPatterns(neg, pos, '-', false)
|
|
2713
|
-
let onlyPositive = filterPatterns(pos, neg, '', false)
|
|
2714
|
-
let intersected = filterPatterns(neg, pos, '-?', true)
|
|
2712
|
+
let onlyNegative = filterPatterns(neg, pos, '-', false);
|
|
2713
|
+
let onlyPositive = filterPatterns(pos, neg, '', false);
|
|
2714
|
+
let intersected = filterPatterns(neg, pos, '-?', true);
|
|
2715
2715
|
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
2716
2716
|
return subpatterns.join('|');
|
|
2717
2717
|
}
|
|
@@ -6662,6 +6662,11 @@ function createMethodsRPC(project, options = {}) {
|
|
|
6662
6662
|
ctx.state.collectPaths(paths);
|
|
6663
6663
|
return ctx.report("onPathsCollected", paths);
|
|
6664
6664
|
},
|
|
6665
|
+
onQueued(file) {
|
|
6666
|
+
ctx.state.collectFiles(project, [file]);
|
|
6667
|
+
const testModule = ctx.state.getReportedEntity(file);
|
|
6668
|
+
return ctx.report("onTestModuleQueued", testModule);
|
|
6669
|
+
},
|
|
6665
6670
|
onCollected(files) {
|
|
6666
6671
|
ctx.state.collectFiles(project, files);
|
|
6667
6672
|
return ctx.report("onCollected", files);
|
|
@@ -7868,8 +7873,24 @@ function resolveConfig(mode, options, viteConfig, logger) {
|
|
|
7868
7873
|
);
|
|
7869
7874
|
}
|
|
7870
7875
|
}
|
|
7871
|
-
|
|
7872
|
-
|
|
7876
|
+
const browser = resolved.browser;
|
|
7877
|
+
if (browser.enabled) {
|
|
7878
|
+
if (!browser.name && !browser.instances) {
|
|
7879
|
+
throw new Error(`Vitest Browser Mode requires "browser.name" (deprecated) or "browser.instances" options, none were set.`);
|
|
7880
|
+
}
|
|
7881
|
+
const configs = browser.instances;
|
|
7882
|
+
if (browser.name && browser.instances) {
|
|
7883
|
+
browser.instances = browser.instances.filter((instance) => instance.browser === browser.name);
|
|
7884
|
+
}
|
|
7885
|
+
if (browser.instances && !browser.instances.length) {
|
|
7886
|
+
throw new Error([
|
|
7887
|
+
`"browser.instances" was set in the config, but the array is empty. Define at least one browser config.`,
|
|
7888
|
+
browser.name && configs?.length ? ` The "browser.name" was set to "${browser.name}" which filtered all configs (${configs.map((c2) => c2.browser).join(", ")}). Did you mean to use another name?` : ""
|
|
7889
|
+
].join(""));
|
|
7890
|
+
}
|
|
7891
|
+
}
|
|
7892
|
+
if (browser.enabled && !(browser.provider === "playwright" && browser.name === "chromium")) {
|
|
7893
|
+
const browserConfig = { browser: { provider: browser.provider, name: browser.name } };
|
|
7873
7894
|
if (resolved.coverage.enabled && resolved.coverage.provider === "v8") {
|
|
7874
7895
|
throw new Error(
|
|
7875
7896
|
`@vitest/coverage-v8 does not work with
|
|
@@ -8140,6 +8161,7 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
8140
8161
|
...resolved.benchmark
|
|
8141
8162
|
};
|
|
8142
8163
|
resolved.coverage.enabled = false;
|
|
8164
|
+
resolved.typecheck.enabled = false;
|
|
8143
8165
|
resolved.include = resolved.benchmark.include;
|
|
8144
8166
|
resolved.exclude = resolved.benchmark.exclude;
|
|
8145
8167
|
resolved.includeSource = resolved.benchmark.includeSource;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
3
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.B2M9nD1V.js';
|
|
4
4
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BWeNbfBa.js';
|
|
5
|
-
import { a as globalExpect, v as vi } from './vi.
|
|
5
|
+
import { a as globalExpect, v as vi } from './vi.Da_PT3Vw.js';
|
|
6
6
|
import { c as closeInspector } from './inspector.DKLceBVD.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import timers from 'node:timers';
|
|
9
|
+
import timersPromises from 'node:timers/promises';
|
|
9
10
|
import util from 'node:util';
|
|
10
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
11
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
12
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
13
|
-
import { V as VitestIndex } from './index.
|
|
14
|
-
import { s as setupCommonEnv } from './setup-common.
|
|
14
|
+
import { V as VitestIndex } from './index.BQbxGbG9.js';
|
|
15
|
+
import { s as setupCommonEnv } from './setup-common.D0zLenuv.js';
|
|
15
16
|
import { g as getWorkerState, r as resetModules } from './utils.C8RiOc4B.js';
|
|
16
17
|
import 'chai';
|
|
17
18
|
import 'node:path';
|
|
@@ -61,7 +62,8 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
61
62
|
}
|
|
62
63
|
globalThis.__vitest_required__ = {
|
|
63
64
|
util,
|
|
64
|
-
timers
|
|
65
|
+
timers,
|
|
66
|
+
timersPromises
|
|
65
67
|
};
|
|
66
68
|
installSourcemapsSupport({
|
|
67
69
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
@@ -77,7 +79,7 @@ function resolveAsset(mod, url) {
|
|
|
77
79
|
mod.exports = url;
|
|
78
80
|
}
|
|
79
81
|
async function setupConsoleLogSpy() {
|
|
80
|
-
const { createCustomConsole } = await import('./console.
|
|
82
|
+
const { createCustomConsole } = await import('./console.CN7AiMGV.js');
|
|
81
83
|
globalThis.console = createCustomConsole();
|
|
82
84
|
}
|
|
83
85
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals) {
|
|
16
|
-
(await import('./globals.
|
|
16
|
+
(await import('./globals.C5RQxaV3.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function setupDefines(defines) {
|
|
@@ -14,7 +14,6 @@ const F_LONG_DASH = "\u23AF";
|
|
|
14
14
|
const F_TREE_NODE_MIDDLE = "\u251C\u2500\u2500";
|
|
15
15
|
const F_TREE_NODE_END = "\u2514\u2500\u2500";
|
|
16
16
|
|
|
17
|
-
const spinnerMap = /* @__PURE__ */ new WeakMap();
|
|
18
17
|
const pointer = c.yellow(F_POINTER);
|
|
19
18
|
const skipped = c.dim(c.gray(F_DOWN));
|
|
20
19
|
const benchmarkPass = c.green(F_DOT);
|
|
@@ -126,16 +125,10 @@ function getStateSymbol(task) {
|
|
|
126
125
|
if (!task.result) {
|
|
127
126
|
return pending;
|
|
128
127
|
}
|
|
129
|
-
if (task.result.state === "run") {
|
|
128
|
+
if (task.result.state === "run" || task.result.state === "queued") {
|
|
130
129
|
if (task.type === "suite") {
|
|
131
130
|
return pointer;
|
|
132
131
|
}
|
|
133
|
-
let spinner = spinnerMap.get(task);
|
|
134
|
-
if (!spinner) {
|
|
135
|
-
spinner = elegantSpinner();
|
|
136
|
-
spinnerMap.set(task, spinner);
|
|
137
|
-
}
|
|
138
|
-
return c.yellow(spinner());
|
|
139
132
|
}
|
|
140
133
|
if (task.result.state === "pass") {
|
|
141
134
|
return task.meta?.benchmark ? benchmarkPass : testPass;
|
|
@@ -145,14 +138,6 @@ function getStateSymbol(task) {
|
|
|
145
138
|
}
|
|
146
139
|
return " ";
|
|
147
140
|
}
|
|
148
|
-
const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
149
|
-
function elegantSpinner() {
|
|
150
|
-
let index = 0;
|
|
151
|
-
return () => {
|
|
152
|
-
index = ++index % spinnerFrames.length;
|
|
153
|
-
return spinnerFrames[index];
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
141
|
function formatTimeString(date) {
|
|
157
142
|
return date.toTimeString().split(" ")[0];
|
|
158
143
|
}
|
|
@@ -179,18 +164,23 @@ function withLabel(color, label, message) {
|
|
|
179
164
|
function padSummaryTitle(str) {
|
|
180
165
|
return c.dim(`${str.padStart(11)} `);
|
|
181
166
|
}
|
|
167
|
+
function truncateString(text, maxLength) {
|
|
168
|
+
const plainText = stripVTControlCharacters(text);
|
|
169
|
+
if (plainText.length <= maxLength) {
|
|
170
|
+
return text;
|
|
171
|
+
}
|
|
172
|
+
return `${plainText.slice(0, maxLength - 1)}\u2026`;
|
|
173
|
+
}
|
|
182
174
|
|
|
183
175
|
var utils = /*#__PURE__*/Object.freeze({
|
|
184
176
|
__proto__: null,
|
|
185
177
|
benchmarkPass: benchmarkPass,
|
|
186
178
|
countTestErrors: countTestErrors,
|
|
187
179
|
divider: divider,
|
|
188
|
-
elegantSpinner: elegantSpinner,
|
|
189
180
|
formatProjectName: formatProjectName,
|
|
190
181
|
formatTestPath: formatTestPath,
|
|
191
182
|
formatTime: formatTime,
|
|
192
183
|
formatTimeString: formatTimeString,
|
|
193
|
-
getCols: getCols,
|
|
194
184
|
getStateString: getStateString,
|
|
195
185
|
getStateSymbol: getStateSymbol,
|
|
196
186
|
padSummaryTitle: padSummaryTitle,
|
|
@@ -198,12 +188,11 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
198
188
|
pointer: pointer,
|
|
199
189
|
renderSnapshotSummary: renderSnapshotSummary,
|
|
200
190
|
skipped: skipped,
|
|
201
|
-
spinnerFrames: spinnerFrames,
|
|
202
|
-
spinnerMap: spinnerMap,
|
|
203
191
|
suiteFail: suiteFail,
|
|
204
192
|
taskFail: taskFail,
|
|
205
193
|
testPass: testPass,
|
|
194
|
+
truncateString: truncateString,
|
|
206
195
|
withLabel: withLabel
|
|
207
196
|
});
|
|
208
197
|
|
|
209
|
-
export { F_POINTER as F, formatTimeString as a,
|
|
198
|
+
export { F_POINTER as F, formatTimeString as a, taskFail as b, F_RIGHT as c, divider as d, F_CHECK as e, formatProjectName as f, getStateSymbol as g, getStateString as h, formatTime as i, countTestErrors as j, F_TREE_NODE_END as k, F_TREE_NODE_MIDDLE as l, padSummaryTitle as p, renderSnapshotSummary as r, truncateString as t, utils as u, withLabel as w };
|