vitest 3.0.0-beta.4 → 3.0.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 -2
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.BJ8KO-VX.js → base.gZAre3Yy.js} +3 -3
- package/dist/chunks/{cac.BAYqQ2aM.js → cac.Davy6Tyx.js} +24 -24
- package/dist/chunks/{cli-api.Dhl34Trr.js → cli-api.DO-hp2Kx.js} +1031 -162
- package/dist/chunks/{console.CN7AiMGV.js → console.BxE0RUCr.js} +3 -3
- package/dist/chunks/{creator.Ot9GlSGw.js → creator.B8v1wNyQ.js} +3 -3
- package/dist/chunks/{execute.BMOaRArH.js → execute.4vt3NSmG.js} +3 -4
- package/dist/chunks/global.CnI8_G5V.d.ts +133 -0
- package/dist/chunks/{globals.C5RQxaV3.js → globals.BSNBk3vE.js} +2 -2
- package/dist/chunks/{index.BQbxGbG9.js → index.Bf4FgyZN.js} +1 -1
- package/dist/chunks/{index.BJDntFik.js → index.Bh7wTRhh.js} +8 -8
- package/dist/chunks/{index.B2M9nD1V.js → index.C2XSkjNu.js} +5 -5
- package/dist/chunks/{index.DQboAxJm.js → index.DfqWks-F.js} +2 -1
- package/dist/chunks/{index.CAueP3cK.js → index.DyQPL4DO.js} +200 -945
- package/dist/chunks/{index.68735LiX.js → index.TH3f4LSA.js} +2 -2
- package/dist/chunks/{index.K90BXFOx.js → index.cYxyd29h.js} +12 -12
- package/dist/chunks/{inspector.DKLceBVD.js → inspector.CU9GlB9I.js} +1 -1
- package/dist/chunks/{reporters.Dcdq51WE.d.ts → reporters.Y8BYiXBN.d.ts} +340 -239
- package/dist/chunks/{resolveConfig.kZFMjKCQ.js → resolveConfig.DATSOo7x.js} +150 -65
- package/dist/chunks/{rpc.C3q9uwRX.js → rpc.Bf456uf4.js} +1 -2
- package/dist/chunks/{runBaseTests.URiUrnWK.js → runBaseTests.Ba8jtu6O.js} +8 -8
- package/dist/chunks/{setup-common.D0zLenuv.js → setup-common.jLbIuaww.js} +1 -1
- package/dist/chunks/{RandomSequencer.DB__To1b.js → typechecker.ChNaIV36.js} +62 -115
- package/dist/chunks/{utils.yHKcm4dz.js → utils.DJWL04yX.js} +1 -1
- package/dist/chunks/{vi.Da_PT3Vw.js → vi.CjhMlMwf.js} +6 -6
- package/dist/chunks/{vite.DzluO1Kj.d.ts → vite.CQ0dHgkN.d.ts} +1 -1
- package/dist/chunks/{vm.DrFVeTXo.js → vm.CUw7ChSp.js} +5 -5
- package/dist/chunks/{worker.BIVMnzXw.d.ts → worker.B1y96qmv.d.ts} +1 -1
- package/dist/chunks/{worker.Hz_LAzfd.d.ts → worker.CIpff8Eg.d.ts} +2 -4
- package/dist/cli.js +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +12 -11
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +17 -118
- package/dist/index.js +2 -2
- package/dist/node.d.ts +11 -8
- package/dist/node.js +27 -25
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +4 -6
- package/dist/runners.d.ts +1 -0
- package/dist/runners.js +10 -10
- package/dist/worker.js +5 -5
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +7 -7
- 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 +2 -2
- package/dist/workers.js +8 -8
- package/package.json +17 -17
- package/dist/chunks/types.BOjykUpq.d.ts +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { slash, createDefer, toArray } from '@vitest/utils';
|
|
1
|
+
import { slash, createDefer, shuffle, toArray } from '@vitest/utils';
|
|
2
2
|
import fs, { statSync, realpathSync, promises as promises$1 } from 'node:fs';
|
|
3
3
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { builtinModules, createRequire } from 'node:module';
|
|
@@ -13,17 +13,20 @@ 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 {
|
|
16
|
+
import { w as wrapSerializableConfig, a as Typechecker, b as isWindows } from './typechecker.ChNaIV36.js';
|
|
17
17
|
import { isCI, provider } from 'std-env';
|
|
18
|
+
import crypto from 'node:crypto';
|
|
19
|
+
import { isatty } from 'node:tty';
|
|
18
20
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
19
21
|
import require$$0 from 'util';
|
|
20
22
|
import require$$0$1 from 'path';
|
|
21
23
|
import EventEmitter from 'node:events';
|
|
22
|
-
import { c as createBirpc } from './index.
|
|
24
|
+
import { c as createBirpc } from './index.TH3f4LSA.js';
|
|
23
25
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
24
26
|
import { MessageChannel } from 'node:worker_threads';
|
|
25
27
|
import { hasFailed } from '@vitest/runner/utils';
|
|
26
28
|
import { rootDir } from '../path.js';
|
|
29
|
+
import { slash as slash$1 } from 'vite-node/utils';
|
|
27
30
|
|
|
28
31
|
function groupBy(collection, iteratee) {
|
|
29
32
|
return collection.reduce((acc, item) => {
|
|
@@ -51,6 +54,8 @@ function wildcardPatternToRegExp(pattern) {
|
|
|
51
54
|
return new RegExp(`^${regexp}`, "i");
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
|
|
58
|
+
|
|
54
59
|
class FilesStatsCache {
|
|
55
60
|
cache = /* @__PURE__ */ new Map();
|
|
56
61
|
getStats(key) {
|
|
@@ -2277,7 +2282,7 @@ function resolveModule(name, options = {}) {
|
|
|
2277
2282
|
try {
|
|
2278
2283
|
return _resolve(name, options);
|
|
2279
2284
|
} catch {
|
|
2280
|
-
return
|
|
2285
|
+
return undefined;
|
|
2281
2286
|
}
|
|
2282
2287
|
}
|
|
2283
2288
|
function isPackageExists(name, options = {}) {
|
|
@@ -2637,7 +2642,7 @@ function requireToRegexRange () {
|
|
|
2637
2642
|
throw new TypeError('toRegexRange: expected the first argument to be a number');
|
|
2638
2643
|
}
|
|
2639
2644
|
|
|
2640
|
-
if (max ===
|
|
2645
|
+
if (max === undefined || min === max) {
|
|
2641
2646
|
return String(min);
|
|
2642
2647
|
}
|
|
2643
2648
|
|
|
@@ -5480,7 +5485,7 @@ function requireParse () {
|
|
|
5480
5485
|
}
|
|
5481
5486
|
|
|
5482
5487
|
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
5483
|
-
const end = rest[1] !==
|
|
5488
|
+
const end = rest[1] !== undefined ? '|$' : '';
|
|
5484
5489
|
|
|
5485
5490
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
5486
5491
|
prior.output = `(?:${prior.output}`;
|
|
@@ -6436,7 +6441,7 @@ function requireMicromatch () {
|
|
|
6436
6441
|
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
6437
6442
|
|
|
6438
6443
|
if (match) {
|
|
6439
|
-
return match.slice(1).map(v => v ===
|
|
6444
|
+
return match.slice(1).map(v => v === undefined ? '' : v);
|
|
6440
6445
|
}
|
|
6441
6446
|
};
|
|
6442
6447
|
|
|
@@ -6553,7 +6558,7 @@ function getTransformMode(patterns, filename) {
|
|
|
6553
6558
|
if (patterns.ssr && mm.isMatch(filename, patterns.ssr)) {
|
|
6554
6559
|
return "ssr";
|
|
6555
6560
|
}
|
|
6556
|
-
return
|
|
6561
|
+
return undefined;
|
|
6557
6562
|
}
|
|
6558
6563
|
async function groupFilesByEnv(files) {
|
|
6559
6564
|
const filesWithEnv = await Promise.all(
|
|
@@ -6600,7 +6605,7 @@ async function groupFilesByEnv(files) {
|
|
|
6600
6605
|
const created = /* @__PURE__ */ new Set();
|
|
6601
6606
|
const promises = /* @__PURE__ */ new Map();
|
|
6602
6607
|
function createMethodsRPC(project, options = {}) {
|
|
6603
|
-
const ctx = project.
|
|
6608
|
+
const ctx = project.vitest;
|
|
6604
6609
|
const cacheFs = options.cacheFs ?? false;
|
|
6605
6610
|
return {
|
|
6606
6611
|
snapshotSaved(snapshot) {
|
|
@@ -6658,38 +6663,40 @@ function createMethodsRPC(project, options = {}) {
|
|
|
6658
6663
|
transform(id, environment) {
|
|
6659
6664
|
return project.vitenode.transformModule(id, environment).catch(handleRollupError);
|
|
6660
6665
|
},
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
const testModule = ctx.state.getReportedEntity(file);
|
|
6668
|
-
return ctx.report("onTestModuleQueued", testModule);
|
|
6666
|
+
async onQueued(file) {
|
|
6667
|
+
if (options.collect) {
|
|
6668
|
+
ctx.state.collectFiles(project, [file]);
|
|
6669
|
+
} else {
|
|
6670
|
+
await ctx._testRun.enqueued(project, file);
|
|
6671
|
+
}
|
|
6669
6672
|
},
|
|
6670
|
-
onCollected(files) {
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
+
async onCollected(files) {
|
|
6674
|
+
if (options.collect) {
|
|
6675
|
+
ctx.state.collectFiles(project, files);
|
|
6676
|
+
} else {
|
|
6677
|
+
await ctx._testRun.collected(project, files);
|
|
6678
|
+
}
|
|
6673
6679
|
},
|
|
6674
6680
|
onAfterSuiteRun(meta) {
|
|
6675
6681
|
ctx.coverageProvider?.onAfterSuiteRun(meta);
|
|
6676
6682
|
},
|
|
6677
|
-
onTaskUpdate(packs) {
|
|
6678
|
-
|
|
6679
|
-
|
|
6683
|
+
async onTaskUpdate(packs, events) {
|
|
6684
|
+
if (options.collect) {
|
|
6685
|
+
ctx.state.updateTasks(packs);
|
|
6686
|
+
} else {
|
|
6687
|
+
await ctx._testRun.updated(packs, events);
|
|
6688
|
+
}
|
|
6680
6689
|
},
|
|
6681
|
-
onUserConsoleLog(log) {
|
|
6682
|
-
|
|
6683
|
-
|
|
6690
|
+
async onUserConsoleLog(log) {
|
|
6691
|
+
if (options.collect) {
|
|
6692
|
+
ctx.state.updateUserLog(log);
|
|
6693
|
+
} else {
|
|
6694
|
+
await ctx._testRun.log(log);
|
|
6695
|
+
}
|
|
6684
6696
|
},
|
|
6685
6697
|
onUnhandledError(err, type) {
|
|
6686
6698
|
ctx.state.catchError(err, type);
|
|
6687
6699
|
},
|
|
6688
|
-
onFinished(files) {
|
|
6689
|
-
const errors = ctx.state.getUnhandledErrors();
|
|
6690
|
-
ctx._checkUnhandledErrors(errors);
|
|
6691
|
-
return ctx.report("onFinished", files, errors);
|
|
6692
|
-
},
|
|
6693
6700
|
onCancel(reason) {
|
|
6694
6701
|
ctx.cancelCurrentRun(reason);
|
|
6695
6702
|
},
|
|
@@ -6716,7 +6723,7 @@ function handleRollupError(e) {
|
|
|
6716
6723
|
throw e;
|
|
6717
6724
|
}
|
|
6718
6725
|
|
|
6719
|
-
function createChildProcessChannel$1(project) {
|
|
6726
|
+
function createChildProcessChannel$1(project, collect = false) {
|
|
6720
6727
|
const emitter = new EventEmitter();
|
|
6721
6728
|
const cleanup = () => emitter.removeAllListeners();
|
|
6722
6729
|
const events = { message: "message", response: "response" };
|
|
@@ -6724,7 +6731,7 @@ function createChildProcessChannel$1(project) {
|
|
|
6724
6731
|
onMessage: (callback) => emitter.on(events.message, callback),
|
|
6725
6732
|
postMessage: (message) => emitter.emit(events.response, message)
|
|
6726
6733
|
};
|
|
6727
|
-
const rpc = createBirpc(createMethodsRPC(project, { cacheFs: true }), {
|
|
6734
|
+
const rpc = createBirpc(createMethodsRPC(project, { cacheFs: true, collect }), {
|
|
6728
6735
|
eventNames: ["onCancel"],
|
|
6729
6736
|
serialize: v8.serialize,
|
|
6730
6737
|
deserialize: (v) => v8.deserialize(Buffer.from(v)),
|
|
@@ -6772,7 +6779,7 @@ function createForksPool(ctx, { execArgv, env }) {
|
|
|
6772
6779
|
async function runFiles(project, config, files, environment, invalidates = []) {
|
|
6773
6780
|
const paths = files.map((f) => f.filepath);
|
|
6774
6781
|
ctx.state.clearFiles(project, paths);
|
|
6775
|
-
const { channel, cleanup } = createChildProcessChannel$1(project);
|
|
6782
|
+
const { channel, cleanup } = createChildProcessChannel$1(project, name === "collect");
|
|
6776
6783
|
const workerId = ++id;
|
|
6777
6784
|
const data = {
|
|
6778
6785
|
pool: "forks",
|
|
@@ -6907,11 +6914,11 @@ function createForksPool(ctx, { execArgv, env }) {
|
|
|
6907
6914
|
};
|
|
6908
6915
|
}
|
|
6909
6916
|
|
|
6910
|
-
function createWorkerChannel$1(project) {
|
|
6917
|
+
function createWorkerChannel$1(project, collect) {
|
|
6911
6918
|
const channel = new MessageChannel();
|
|
6912
6919
|
const port = channel.port2;
|
|
6913
6920
|
const workerPort = channel.port1;
|
|
6914
|
-
const rpc = createBirpc(createMethodsRPC(project), {
|
|
6921
|
+
const rpc = createBirpc(createMethodsRPC(project, { collect }), {
|
|
6915
6922
|
eventNames: ["onCancel"],
|
|
6916
6923
|
post(v) {
|
|
6917
6924
|
port.postMessage(v);
|
|
@@ -6959,7 +6966,7 @@ function createThreadsPool(ctx, { execArgv, env }) {
|
|
|
6959
6966
|
async function runFiles(project, config, files, environment, invalidates = []) {
|
|
6960
6967
|
const paths = files.map((f) => f.filepath);
|
|
6961
6968
|
ctx.state.clearFiles(project, paths);
|
|
6962
|
-
const { workerPort, port } = createWorkerChannel$1(project);
|
|
6969
|
+
const { workerPort, port } = createWorkerChannel$1(project, name === "collect");
|
|
6963
6970
|
const workerId = ++id;
|
|
6964
6971
|
const data = {
|
|
6965
6972
|
pool: "threads",
|
|
@@ -7103,7 +7110,8 @@ function createTypecheckPool(ctx) {
|
|
|
7103
7110
|
const rerunTriggered = /* @__PURE__ */ new WeakSet();
|
|
7104
7111
|
async function onParseEnd(project, { files, sourceErrors }) {
|
|
7105
7112
|
const checker = project.typechecker;
|
|
7106
|
-
|
|
7113
|
+
const { packs, events } = checker.getTestPacksAndEvents();
|
|
7114
|
+
await ctx._testRun.updated(packs, events);
|
|
7107
7115
|
if (!project.config.typecheck.ignoreSourceErrors) {
|
|
7108
7116
|
sourceErrors.forEach(
|
|
7109
7117
|
(error) => ctx.state.catchError(error, "Unhandled Source Error")
|
|
@@ -7133,8 +7141,11 @@ function createTypecheckPool(ctx) {
|
|
|
7133
7141
|
project.typechecker = checker;
|
|
7134
7142
|
checker.setFiles(files);
|
|
7135
7143
|
checker.onParseStart(async () => {
|
|
7136
|
-
|
|
7137
|
-
|
|
7144
|
+
const files2 = checker.getTestFiles();
|
|
7145
|
+
for (const file of files2) {
|
|
7146
|
+
await ctx._testRun.enqueued(project, file);
|
|
7147
|
+
}
|
|
7148
|
+
await ctx._testRun.collected(project, files2);
|
|
7138
7149
|
});
|
|
7139
7150
|
checker.onParseEnd((result) => onParseEnd(project, result));
|
|
7140
7151
|
checker.onWatcherRerun(async () => {
|
|
@@ -7148,9 +7159,13 @@ function createTypecheckPool(ctx) {
|
|
|
7148
7159
|
);
|
|
7149
7160
|
}
|
|
7150
7161
|
await checker.collectTests();
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7162
|
+
const testFiles = checker.getTestFiles();
|
|
7163
|
+
for (const file of testFiles) {
|
|
7164
|
+
await ctx._testRun.enqueued(project, file);
|
|
7165
|
+
}
|
|
7166
|
+
await ctx._testRun.collected(project, testFiles);
|
|
7167
|
+
const { packs, events } = checker.getTestPacksAndEvents();
|
|
7168
|
+
await ctx._testRun.updated(packs, events);
|
|
7154
7169
|
});
|
|
7155
7170
|
await checker.prepare();
|
|
7156
7171
|
return checker;
|
|
@@ -7171,8 +7186,11 @@ function createTypecheckPool(ctx) {
|
|
|
7171
7186
|
const checker = await createWorkspaceTypechecker(project, files);
|
|
7172
7187
|
checker.setFiles(files);
|
|
7173
7188
|
await checker.collectTests();
|
|
7174
|
-
|
|
7175
|
-
|
|
7189
|
+
const testFiles = checker.getTestFiles();
|
|
7190
|
+
for (const file of testFiles) {
|
|
7191
|
+
await ctx._testRun.enqueued(project, file);
|
|
7192
|
+
}
|
|
7193
|
+
await ctx._testRun.collected(project, testFiles);
|
|
7176
7194
|
}
|
|
7177
7195
|
}
|
|
7178
7196
|
async function runTests(specs) {
|
|
@@ -7196,8 +7214,11 @@ function createTypecheckPool(ctx) {
|
|
|
7196
7214
|
});
|
|
7197
7215
|
const triggered = await _p;
|
|
7198
7216
|
if (project.typechecker && !triggered) {
|
|
7199
|
-
|
|
7200
|
-
|
|
7217
|
+
const testFiles = project.typechecker.getTestFiles();
|
|
7218
|
+
for (const file of testFiles) {
|
|
7219
|
+
await ctx._testRun.enqueued(project, file);
|
|
7220
|
+
}
|
|
7221
|
+
await ctx._testRun.collected(project, testFiles);
|
|
7201
7222
|
await onParseEnd(project, project.typechecker.getResult());
|
|
7202
7223
|
continue;
|
|
7203
7224
|
}
|
|
@@ -7232,7 +7253,7 @@ function getWorkerMemoryLimit(config) {
|
|
|
7232
7253
|
return 1 / (config.poolOptions?.vmThreads?.maxThreads ?? getDefaultThreadsCount(config));
|
|
7233
7254
|
}
|
|
7234
7255
|
function stringToBytes(input, percentageReference) {
|
|
7235
|
-
if (input === null || input ===
|
|
7256
|
+
if (input === null || input === undefined) {
|
|
7236
7257
|
return input;
|
|
7237
7258
|
}
|
|
7238
7259
|
if (typeof input === "string") {
|
|
@@ -7285,7 +7306,7 @@ function stringToBytes(input, percentageReference) {
|
|
|
7285
7306
|
}
|
|
7286
7307
|
|
|
7287
7308
|
const suppressWarningsPath$1 = resolve$1(rootDir, "./suppress-warnings.cjs");
|
|
7288
|
-
function createChildProcessChannel(project) {
|
|
7309
|
+
function createChildProcessChannel(project, collect) {
|
|
7289
7310
|
const emitter = new EventEmitter();
|
|
7290
7311
|
const cleanup = () => emitter.removeAllListeners();
|
|
7291
7312
|
const events = { message: "message", response: "response" };
|
|
@@ -7294,7 +7315,7 @@ function createChildProcessChannel(project) {
|
|
|
7294
7315
|
postMessage: (message) => emitter.emit(events.response, message)
|
|
7295
7316
|
};
|
|
7296
7317
|
const rpc = createBirpc(
|
|
7297
|
-
createMethodsRPC(project, { cacheFs: true }),
|
|
7318
|
+
createMethodsRPC(project, { cacheFs: true, collect }),
|
|
7298
7319
|
{
|
|
7299
7320
|
eventNames: ["onCancel"],
|
|
7300
7321
|
serialize: v8.serialize,
|
|
@@ -7336,7 +7357,7 @@ function createVmForksPool(ctx, { execArgv, env }) {
|
|
|
7336
7357
|
],
|
|
7337
7358
|
terminateTimeout: ctx.config.teardownTimeout,
|
|
7338
7359
|
concurrentTasksPerWorker: 1,
|
|
7339
|
-
maxMemoryLimitBeforeRecycle: getMemoryLimit$1(ctx.config) ||
|
|
7360
|
+
maxMemoryLimitBeforeRecycle: getMemoryLimit$1(ctx.config) || undefined
|
|
7340
7361
|
};
|
|
7341
7362
|
if (poolOptions.singleFork || !ctx.config.fileParallelism) {
|
|
7342
7363
|
options.maxThreads = 1;
|
|
@@ -7348,7 +7369,7 @@ function createVmForksPool(ctx, { execArgv, env }) {
|
|
|
7348
7369
|
async function runFiles(project, config, files, environment, invalidates = []) {
|
|
7349
7370
|
const paths = files.map((f) => f.filepath);
|
|
7350
7371
|
ctx.state.clearFiles(project, paths);
|
|
7351
|
-
const { channel, cleanup } = createChildProcessChannel(project);
|
|
7372
|
+
const { channel, cleanup } = createChildProcessChannel(project, name === "collect");
|
|
7352
7373
|
const workerId = ++id;
|
|
7353
7374
|
const data = {
|
|
7354
7375
|
pool: "forks",
|
|
@@ -7431,11 +7452,11 @@ function getMemoryLimit$1(config) {
|
|
|
7431
7452
|
}
|
|
7432
7453
|
|
|
7433
7454
|
const suppressWarningsPath = resolve$1(rootDir, "./suppress-warnings.cjs");
|
|
7434
|
-
function createWorkerChannel(project) {
|
|
7455
|
+
function createWorkerChannel(project, collect) {
|
|
7435
7456
|
const channel = new MessageChannel();
|
|
7436
7457
|
const port = channel.port2;
|
|
7437
7458
|
const workerPort = channel.port1;
|
|
7438
|
-
const rpc = createBirpc(createMethodsRPC(project), {
|
|
7459
|
+
const rpc = createBirpc(createMethodsRPC(project, { collect }), {
|
|
7439
7460
|
eventNames: ["onCancel"],
|
|
7440
7461
|
post(v) {
|
|
7441
7462
|
port.postMessage(v);
|
|
@@ -7475,7 +7496,7 @@ function createVmThreadsPool(ctx, { execArgv, env }) {
|
|
|
7475
7496
|
],
|
|
7476
7497
|
terminateTimeout: ctx.config.teardownTimeout,
|
|
7477
7498
|
concurrentTasksPerWorker: 1,
|
|
7478
|
-
maxMemoryLimitBeforeRecycle: getMemoryLimit(ctx.config) ||
|
|
7499
|
+
maxMemoryLimitBeforeRecycle: getMemoryLimit(ctx.config) || undefined
|
|
7479
7500
|
};
|
|
7480
7501
|
if (poolOptions.singleThread || !ctx.config.fileParallelism) {
|
|
7481
7502
|
options.maxThreads = 1;
|
|
@@ -7487,7 +7508,7 @@ function createVmThreadsPool(ctx, { execArgv, env }) {
|
|
|
7487
7508
|
async function runFiles(project, config, files, environment, invalidates = []) {
|
|
7488
7509
|
const paths = files.map((f) => f.filepath);
|
|
7489
7510
|
ctx.state.clearFiles(project, paths);
|
|
7490
|
-
const { workerPort, port } = createWorkerChannel(project);
|
|
7511
|
+
const { workerPort, port } = createWorkerChannel(project, name === "collect");
|
|
7491
7512
|
const workerId = ++id;
|
|
7492
7513
|
const data = {
|
|
7493
7514
|
pool: "vmThreads",
|
|
@@ -7634,6 +7655,7 @@ function createPool(ctx) {
|
|
|
7634
7655
|
VITEST: "true",
|
|
7635
7656
|
NODE_ENV: process.env.NODE_ENV || "test",
|
|
7636
7657
|
VITEST_MODE: ctx.config.watch ? "WATCH" : "RUN",
|
|
7658
|
+
FORCE_TTY: isatty(1) ? "true" : "",
|
|
7637
7659
|
...process.env,
|
|
7638
7660
|
...ctx.config.env
|
|
7639
7661
|
}
|
|
@@ -7730,13 +7752,68 @@ function createPool(ctx) {
|
|
|
7730
7752
|
};
|
|
7731
7753
|
}
|
|
7732
7754
|
|
|
7755
|
+
class BaseSequencer {
|
|
7756
|
+
ctx;
|
|
7757
|
+
constructor(ctx) {
|
|
7758
|
+
this.ctx = ctx;
|
|
7759
|
+
}
|
|
7760
|
+
// async so it can be extended by other sequelizers
|
|
7761
|
+
async shard(files) {
|
|
7762
|
+
const { config } = this.ctx;
|
|
7763
|
+
const { index, count } = config.shard;
|
|
7764
|
+
const shardSize = Math.ceil(files.length / count);
|
|
7765
|
+
const shardStart = shardSize * (index - 1);
|
|
7766
|
+
const shardEnd = shardSize * index;
|
|
7767
|
+
return [...files].map((spec) => {
|
|
7768
|
+
const fullPath = resolve(slash$1(config.root), slash$1(spec.moduleId));
|
|
7769
|
+
const specPath = fullPath?.slice(config.root.length);
|
|
7770
|
+
return {
|
|
7771
|
+
spec,
|
|
7772
|
+
hash: hash("sha1", specPath, "hex")
|
|
7773
|
+
};
|
|
7774
|
+
}).sort((a, b) => a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0).slice(shardStart, shardEnd).map(({ spec }) => spec);
|
|
7775
|
+
}
|
|
7776
|
+
// async so it can be extended by other sequelizers
|
|
7777
|
+
async sort(files) {
|
|
7778
|
+
const cache = this.ctx.cache;
|
|
7779
|
+
return [...files].sort((a, b) => {
|
|
7780
|
+
const keyA = `${a.project.name}:${relative(this.ctx.config.root, a.moduleId)}`;
|
|
7781
|
+
const keyB = `${b.project.name}:${relative(this.ctx.config.root, b.moduleId)}`;
|
|
7782
|
+
const aState = cache.getFileTestResults(keyA);
|
|
7783
|
+
const bState = cache.getFileTestResults(keyB);
|
|
7784
|
+
if (!aState || !bState) {
|
|
7785
|
+
const statsA = cache.getFileStats(keyA);
|
|
7786
|
+
const statsB = cache.getFileStats(keyB);
|
|
7787
|
+
if (!statsA || !statsB) {
|
|
7788
|
+
return !statsA && statsB ? -1 : !statsB && statsA ? 1 : 0;
|
|
7789
|
+
}
|
|
7790
|
+
return statsB.size - statsA.size;
|
|
7791
|
+
}
|
|
7792
|
+
if (aState.failed && !bState.failed) {
|
|
7793
|
+
return -1;
|
|
7794
|
+
}
|
|
7795
|
+
if (!aState.failed && bState.failed) {
|
|
7796
|
+
return 1;
|
|
7797
|
+
}
|
|
7798
|
+
return bState.duration - aState.duration;
|
|
7799
|
+
});
|
|
7800
|
+
}
|
|
7801
|
+
}
|
|
7802
|
+
|
|
7803
|
+
class RandomSequencer extends BaseSequencer {
|
|
7804
|
+
async sort(files) {
|
|
7805
|
+
const { sequence } = this.ctx.config;
|
|
7806
|
+
return shuffle(files, sequence.seed);
|
|
7807
|
+
}
|
|
7808
|
+
}
|
|
7809
|
+
|
|
7733
7810
|
function resolvePath(path, root) {
|
|
7734
7811
|
return normalize(
|
|
7735
7812
|
/* @__PURE__ */ resolveModule(path, { paths: [root] }) ?? resolve(root, path)
|
|
7736
7813
|
);
|
|
7737
7814
|
}
|
|
7738
7815
|
function parseInspector(inspect) {
|
|
7739
|
-
if (typeof inspect === "boolean" || inspect ===
|
|
7816
|
+
if (typeof inspect === "boolean" || inspect === undefined) {
|
|
7740
7817
|
return {};
|
|
7741
7818
|
}
|
|
7742
7819
|
if (typeof inspect === "number") {
|
|
@@ -7889,15 +7966,22 @@ function resolveConfig(mode, options, viteConfig, logger) {
|
|
|
7889
7966
|
].join(""));
|
|
7890
7967
|
}
|
|
7891
7968
|
}
|
|
7892
|
-
|
|
7893
|
-
|
|
7969
|
+
const playwrightChromiumOnly = browser.provider === "playwright" && (browser.name === "chromium" || browser.instances?.every((i) => i.browser === "chromium"));
|
|
7970
|
+
if (browser.enabled && !playwrightChromiumOnly) {
|
|
7971
|
+
const browserConfig = {
|
|
7972
|
+
browser: {
|
|
7973
|
+
provider: browser.provider,
|
|
7974
|
+
name: browser.name,
|
|
7975
|
+
instances: browser.instances
|
|
7976
|
+
}
|
|
7977
|
+
};
|
|
7894
7978
|
if (resolved.coverage.enabled && resolved.coverage.provider === "v8") {
|
|
7895
7979
|
throw new Error(
|
|
7896
7980
|
`@vitest/coverage-v8 does not work with
|
|
7897
7981
|
${JSON.stringify(browserConfig, null, 2)}
|
|
7898
7982
|
|
|
7899
7983
|
Use either:
|
|
7900
|
-
${JSON.stringify({ browser: { provider: "playwright",
|
|
7984
|
+
${JSON.stringify({ browser: { provider: "playwright", instances: [{ browser: "chromium" }] } }, null, 2)}
|
|
7901
7985
|
|
|
7902
7986
|
...or change your coverage provider to:
|
|
7903
7987
|
${JSON.stringify({ coverage: { provider: "istanbul" } }, null, 2)}
|
|
@@ -7911,7 +7995,7 @@ ${JSON.stringify({ coverage: { provider: "istanbul" } }, null, 2)}
|
|
|
7911
7995
|
${JSON.stringify(browserConfig, null, 2)}
|
|
7912
7996
|
|
|
7913
7997
|
Use either:
|
|
7914
|
-
${JSON.stringify({ browser: { provider: "playwright",
|
|
7998
|
+
${JSON.stringify({ browser: { provider: "playwright", instances: [{ browser: "chromium" }] } }, null, 2)}
|
|
7915
7999
|
|
|
7916
8000
|
...or disable ${inspectOption}
|
|
7917
8001
|
`
|
|
@@ -7976,6 +8060,7 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
7976
8060
|
)}`
|
|
7977
8061
|
)
|
|
7978
8062
|
);
|
|
8063
|
+
resolved.coverage.exclude.push(...resolved.include);
|
|
7979
8064
|
resolved.forceRerunTriggers = [
|
|
7980
8065
|
...resolved.forceRerunTriggers,
|
|
7981
8066
|
...resolved.setupFiles
|
|
@@ -7984,7 +8069,7 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
7984
8069
|
resolved.server.deps ??= {};
|
|
7985
8070
|
const deprecatedDepsOptions = ["inline", "external", "fallbackCJS"];
|
|
7986
8071
|
deprecatedDepsOptions.forEach((option) => {
|
|
7987
|
-
if (resolved.deps[option] ===
|
|
8072
|
+
if (resolved.deps[option] === undefined) {
|
|
7988
8073
|
return;
|
|
7989
8074
|
}
|
|
7990
8075
|
if (option === "fallbackCJS") {
|
|
@@ -8005,7 +8090,7 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
8005
8090
|
)
|
|
8006
8091
|
);
|
|
8007
8092
|
}
|
|
8008
|
-
if (resolved.server.deps[option] ===
|
|
8093
|
+
if (resolved.server.deps[option] === undefined) {
|
|
8009
8094
|
resolved.server.deps[option] = resolved.deps[option];
|
|
8010
8095
|
}
|
|
8011
8096
|
});
|
|
@@ -8036,7 +8121,7 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
8036
8121
|
resolved.root
|
|
8037
8122
|
);
|
|
8038
8123
|
}
|
|
8039
|
-
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) :
|
|
8124
|
+
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : undefined;
|
|
8040
8125
|
if (resolved.snapshotFormat && "plugins" in resolved.snapshotFormat) {
|
|
8041
8126
|
resolved.snapshotFormat.plugins = [];
|
|
8042
8127
|
}
|
|
@@ -8383,4 +8468,4 @@ function resolveCoverageReporters(configReporters) {
|
|
|
8383
8468
|
return resolvedReporters;
|
|
8384
8469
|
}
|
|
8385
8470
|
|
|
8386
|
-
export { VitestCache as V, resolveConfig as a, resolveApiServerConfig as b, coverageConfigDefaults as c, createMethodsRPC as d, requireMicromatch as e, configDefaults as f, getFilePoolName as g,
|
|
8471
|
+
export { BaseSequencer as B, RandomSequencer as R, VitestCache as V, resolveConfig as a, resolveApiServerConfig as b, coverageConfigDefaults as c, createMethodsRPC as d, requireMicromatch as e, configDefaults as f, getFilePoolName as g, hash as h, isPackageExists as i, isBrowserEnabled as j, groupBy as k, createPool as l, mm as m, resolveCoverageReporters as r, stdout as s, wildcardPatternToRegExp as w };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSafeTimers } from '@vitest/utils';
|
|
2
|
-
import { c as createBirpc } from './index.
|
|
2
|
+
import { c as createBirpc } from './index.TH3f4LSA.js';
|
|
3
3
|
import { g as getWorkerState } from './utils.C8RiOc4B.js';
|
|
4
4
|
|
|
5
5
|
const { get } = Reflect;
|
|
@@ -54,7 +54,6 @@ function createRuntimeRpc(options) {
|
|
|
54
54
|
{
|
|
55
55
|
eventNames: [
|
|
56
56
|
"onUserConsoleLog",
|
|
57
|
-
"onFinished",
|
|
58
57
|
"onCollected",
|
|
59
58
|
"onCancel"
|
|
60
59
|
],
|
|
@@ -1,9 +1,9 @@
|
|
|
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.C2XSkjNu.js';
|
|
4
4
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BWeNbfBa.js';
|
|
5
|
-
import { a as globalExpect, v as vi } from './vi.
|
|
6
|
-
import { c as closeInspector } from './inspector.
|
|
5
|
+
import { a as globalExpect, v as vi } from './vi.CjhMlMwf.js';
|
|
6
|
+
import { c as closeInspector } from './inspector.CU9GlB9I.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import timers from 'node:timers';
|
|
9
9
|
import timersPromises from 'node:timers/promises';
|
|
@@ -11,15 +11,15 @@ import util from 'node:util';
|
|
|
11
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
12
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
13
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
14
|
-
import { V as VitestIndex } from './index.
|
|
15
|
-
import { s as setupCommonEnv } from './setup-common.
|
|
14
|
+
import { V as VitestIndex } from './index.Bf4FgyZN.js';
|
|
15
|
+
import { s as setupCommonEnv } from './setup-common.jLbIuaww.js';
|
|
16
16
|
import { g as getWorkerState, r as resetModules } from './utils.C8RiOc4B.js';
|
|
17
17
|
import 'chai';
|
|
18
18
|
import 'node:path';
|
|
19
19
|
import '../path.js';
|
|
20
20
|
import 'node:url';
|
|
21
|
-
import './rpc.
|
|
22
|
-
import './index.
|
|
21
|
+
import './rpc.Bf456uf4.js';
|
|
22
|
+
import './index.TH3f4LSA.js';
|
|
23
23
|
import '@vitest/expect';
|
|
24
24
|
import '@vitest/runner/utils';
|
|
25
25
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
@@ -79,7 +79,7 @@ function resolveAsset(mod, url) {
|
|
|
79
79
|
mod.exports = url;
|
|
80
80
|
}
|
|
81
81
|
async function setupConsoleLogSpy() {
|
|
82
|
-
const { createCustomConsole } = await import('./console.
|
|
82
|
+
const { createCustomConsole } = await import('./console.BxE0RUCr.js');
|
|
83
83
|
globalThis.console = createCustomConsole();
|
|
84
84
|
}
|
|
85
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.BSNBk3vE.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function setupDefines(defines) {
|