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,18 +1,18 @@
|
|
|
1
1
|
import { existsSync, promises, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { normalize, relative, dirname, resolve, join, basename, isAbsolute } from 'pathe';
|
|
2
|
+
import { extname, normalize, relative, dirname, resolve, join, basename, isAbsolute } from 'pathe';
|
|
3
3
|
import { g as getCoverageProvider, C as CoverageProviderMap } from './coverage.BWeNbfBa.js';
|
|
4
4
|
import a, { resolve as resolve$1 } from 'node:path';
|
|
5
|
-
import { noop, isPrimitive, createDefer, toArray, deepMerge, nanoid, slash, deepClone, notNullish } from '@vitest/utils';
|
|
6
|
-
import { f as findUp, p as prompt } from './index.
|
|
5
|
+
import { noop, isPrimitive, createDefer, highlight, toArray, deepMerge, nanoid, slash, deepClone, notNullish } from '@vitest/utils';
|
|
6
|
+
import { f as findUp, p as prompt } from './index.Bh7wTRhh.js';
|
|
7
7
|
import { searchForWorkspaceRoot, version, createServer, mergeConfig } from 'vite';
|
|
8
8
|
import { A as API_PATH, c as configFiles, a as defaultBrowserPort, w as workspacesFiles, d as defaultPort } from './constants.fzPh7AOq.js';
|
|
9
|
-
import { createFileTask, limitConcurrency,
|
|
9
|
+
import { generateFileHash, createFileTask, limitConcurrency, hasFailed, getTasks, getTests } from '@vitest/runner/utils';
|
|
10
10
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
11
11
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
12
12
|
import { ViteNodeServer } from 'vite-node/server';
|
|
13
|
-
import { v as version$1 } from './cac.
|
|
14
|
-
import { c as createBirpc } from './index.
|
|
15
|
-
import { s as stringify, p as parse,
|
|
13
|
+
import { v as version$1 } from './cac.Davy6Tyx.js';
|
|
14
|
+
import { c as createBirpc } from './index.TH3f4LSA.js';
|
|
15
|
+
import { s as stringify, p as parse, g as printError, h as generateCodeFrame, R as ReportersMap, b as BenchmarkReportsMap, i as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.DyQPL4DO.js';
|
|
16
16
|
import require$$0$2 from 'stream';
|
|
17
17
|
import require$$0 from 'zlib';
|
|
18
18
|
import require$$0$1 from 'buffer';
|
|
@@ -26,11 +26,13 @@ import require$$7 from 'url';
|
|
|
26
26
|
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers.BFTU3MAI.js';
|
|
27
27
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
28
28
|
import { distDir, rootDir } from '../path.js';
|
|
29
|
-
import { i as isPackageExists, e as requireMicromatch, V as VitestCache, f as configDefaults, g as getFilePoolName,
|
|
29
|
+
import { R as RandomSequencer, i as isPackageExists, e as requireMicromatch, h as hash, V as VitestCache, f as configDefaults, g as getFilePoolName, j as isBrowserEnabled, m as mm, a as resolveConfig, k as groupBy, w as wildcardPatternToRegExp, l as createPool, b as resolveApiServerConfig, s as stdout } from './resolveConfig.DATSOo7x.js';
|
|
30
|
+
import { i as isTTY, b as isWindows, c as convertTasksToEvents } from './typechecker.ChNaIV36.js';
|
|
31
|
+
import { Console } from 'node:console';
|
|
32
|
+
import c from 'tinyrainbow';
|
|
33
|
+
import { a as formatProjectName, w as withLabel, d as divider } from './utils.DJWL04yX.js';
|
|
30
34
|
import { createRequire } from 'node:module';
|
|
31
35
|
import url from 'node:url';
|
|
32
|
-
import c from 'tinyrainbow';
|
|
33
|
-
import { i as isTTY, h as hash, b as isWindows } from './RandomSequencer.DB__To1b.js';
|
|
34
36
|
import { rm } from 'node:fs/promises';
|
|
35
37
|
import nodeos__default, { tmpdir } from 'node:os';
|
|
36
38
|
import require$$0$4 from 'os';
|
|
@@ -39,7 +41,8 @@ import require$$0$6 from 'fs';
|
|
|
39
41
|
import { normalizeRequestId, cleanUrl } from 'vite-node/utils';
|
|
40
42
|
import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
|
|
41
43
|
import MagicString from 'magic-string';
|
|
42
|
-
import
|
|
44
|
+
import assert$1 from 'node:assert';
|
|
45
|
+
import { serializeError } from '@vitest/utils/error';
|
|
43
46
|
import readline from 'node:readline';
|
|
44
47
|
import { stripVTControlCharacters } from 'node:util';
|
|
45
48
|
|
|
@@ -4900,9 +4903,8 @@ function setup(ctx, _server) {
|
|
|
4900
4903
|
function setupClient(ws) {
|
|
4901
4904
|
const rpc = createBirpc(
|
|
4902
4905
|
{
|
|
4903
|
-
async onTaskUpdate(packs) {
|
|
4904
|
-
ctx.
|
|
4905
|
-
await ctx.report("onTaskUpdate", packs);
|
|
4906
|
+
async onTaskUpdate(packs, events) {
|
|
4907
|
+
await ctx._testRun.updated(packs, events);
|
|
4906
4908
|
},
|
|
4907
4909
|
getFiles() {
|
|
4908
4910
|
return ctx.state.getFiles();
|
|
@@ -4925,7 +4927,7 @@ function setup(ctx, _server) {
|
|
|
4925
4927
|
return promises.writeFile(id, content, "utf-8");
|
|
4926
4928
|
},
|
|
4927
4929
|
async rerun(files, resetTestNamePattern) {
|
|
4928
|
-
await ctx.rerunFiles(files,
|
|
4930
|
+
await ctx.rerunFiles(files, undefined, true, resetTestNamePattern);
|
|
4929
4931
|
},
|
|
4930
4932
|
async rerunTask(id) {
|
|
4931
4933
|
await ctx.rerunTask(id);
|
|
@@ -4933,6 +4935,9 @@ function setup(ctx, _server) {
|
|
|
4933
4935
|
getConfig() {
|
|
4934
4936
|
return ctx.getRootProject().serializedConfig;
|
|
4935
4937
|
},
|
|
4938
|
+
getResolvedProjectNames() {
|
|
4939
|
+
return ctx.resolvedProjects.map((p) => p.name);
|
|
4940
|
+
},
|
|
4936
4941
|
async getTransformResult(projectName, id, browser = false) {
|
|
4937
4942
|
const project = ctx.getProjectByName(projectName);
|
|
4938
4943
|
const result = browser ? await project.browser.vite.transformRequest(id) : await project.vitenode.transformRequest(id);
|
|
@@ -5119,6 +5124,292 @@ class RangeLocationFilterProvidedError extends Error {
|
|
|
5119
5124
|
}
|
|
5120
5125
|
}
|
|
5121
5126
|
|
|
5127
|
+
const HIGHLIGHT_SUPPORTED_EXTS = new Set(
|
|
5128
|
+
["js", "ts"].flatMap((lang) => [
|
|
5129
|
+
`.${lang}`,
|
|
5130
|
+
`.m${lang}`,
|
|
5131
|
+
`.c${lang}`,
|
|
5132
|
+
`.${lang}x`,
|
|
5133
|
+
`.m${lang}x`,
|
|
5134
|
+
`.c${lang}x`
|
|
5135
|
+
])
|
|
5136
|
+
);
|
|
5137
|
+
function highlightCode(id, source, colors) {
|
|
5138
|
+
const ext = extname(id);
|
|
5139
|
+
if (!HIGHLIGHT_SUPPORTED_EXTS.has(ext)) {
|
|
5140
|
+
return source;
|
|
5141
|
+
}
|
|
5142
|
+
const isJsx = ext.endsWith("x");
|
|
5143
|
+
return highlight(source, { jsx: isJsx, colors: c });
|
|
5144
|
+
}
|
|
5145
|
+
|
|
5146
|
+
const PAD = " ";
|
|
5147
|
+
const ESC$1 = "\x1B[";
|
|
5148
|
+
const ERASE_DOWN = `${ESC$1}J`;
|
|
5149
|
+
const ERASE_SCROLLBACK = `${ESC$1}3J`;
|
|
5150
|
+
const CURSOR_TO_START = `${ESC$1}1;1H`;
|
|
5151
|
+
const HIDE_CURSOR = `${ESC$1}?25l`;
|
|
5152
|
+
const SHOW_CURSOR = `${ESC$1}?25h`;
|
|
5153
|
+
const CLEAR_SCREEN = "\x1Bc";
|
|
5154
|
+
class Logger {
|
|
5155
|
+
constructor(ctx, outputStream = process.stdout, errorStream = process.stderr) {
|
|
5156
|
+
this.ctx = ctx;
|
|
5157
|
+
this.outputStream = outputStream;
|
|
5158
|
+
this.errorStream = errorStream;
|
|
5159
|
+
this.console = new Console({ stdout: outputStream, stderr: errorStream });
|
|
5160
|
+
this._highlights.clear();
|
|
5161
|
+
this.addCleanupListeners();
|
|
5162
|
+
this.registerUnhandledRejection();
|
|
5163
|
+
this.outputStream.write(HIDE_CURSOR);
|
|
5164
|
+
}
|
|
5165
|
+
_clearScreenPending;
|
|
5166
|
+
_highlights = /* @__PURE__ */ new Map();
|
|
5167
|
+
cleanupListeners = [];
|
|
5168
|
+
console;
|
|
5169
|
+
log(...args) {
|
|
5170
|
+
this._clearScreen();
|
|
5171
|
+
this.console.log(...args);
|
|
5172
|
+
}
|
|
5173
|
+
error(...args) {
|
|
5174
|
+
this._clearScreen();
|
|
5175
|
+
this.console.error(...args);
|
|
5176
|
+
}
|
|
5177
|
+
warn(...args) {
|
|
5178
|
+
this._clearScreen();
|
|
5179
|
+
this.console.warn(...args);
|
|
5180
|
+
}
|
|
5181
|
+
clearFullScreen(message = "") {
|
|
5182
|
+
if (!this.ctx.config.clearScreen) {
|
|
5183
|
+
this.console.log(message);
|
|
5184
|
+
return;
|
|
5185
|
+
}
|
|
5186
|
+
if (message) {
|
|
5187
|
+
this.console.log(`${CLEAR_SCREEN}${ERASE_SCROLLBACK}${message}`);
|
|
5188
|
+
} else {
|
|
5189
|
+
this.outputStream.write(`${CLEAR_SCREEN}${ERASE_SCROLLBACK}`);
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
clearScreen(message, force = false) {
|
|
5193
|
+
if (!this.ctx.config.clearScreen) {
|
|
5194
|
+
this.console.log(message);
|
|
5195
|
+
return;
|
|
5196
|
+
}
|
|
5197
|
+
this._clearScreenPending = message;
|
|
5198
|
+
if (force) {
|
|
5199
|
+
this._clearScreen();
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
_clearScreen() {
|
|
5203
|
+
if (this._clearScreenPending == null) {
|
|
5204
|
+
return;
|
|
5205
|
+
}
|
|
5206
|
+
const log = this._clearScreenPending;
|
|
5207
|
+
this._clearScreenPending = undefined;
|
|
5208
|
+
this.console.log(`${CURSOR_TO_START}${ERASE_DOWN}${log}`);
|
|
5209
|
+
}
|
|
5210
|
+
printError(err, options = {}) {
|
|
5211
|
+
printError(err, this.ctx, this, options);
|
|
5212
|
+
}
|
|
5213
|
+
clearHighlightCache(filename) {
|
|
5214
|
+
if (filename) {
|
|
5215
|
+
this._highlights.delete(filename);
|
|
5216
|
+
} else {
|
|
5217
|
+
this._highlights.clear();
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
highlight(filename, source) {
|
|
5221
|
+
if (this._highlights.has(filename)) {
|
|
5222
|
+
return this._highlights.get(filename);
|
|
5223
|
+
}
|
|
5224
|
+
const code = highlightCode(filename, source);
|
|
5225
|
+
this._highlights.set(filename, code);
|
|
5226
|
+
return code;
|
|
5227
|
+
}
|
|
5228
|
+
printNoTestFound(filters) {
|
|
5229
|
+
const config = this.ctx.config;
|
|
5230
|
+
if (config.watch && (config.changed || config.related?.length)) {
|
|
5231
|
+
this.log(`No affected ${config.mode} files found
|
|
5232
|
+
`);
|
|
5233
|
+
} else if (config.watch) {
|
|
5234
|
+
this.log(
|
|
5235
|
+
c.red(`No ${config.mode} files found. You can change the file name pattern by pressing "p"
|
|
5236
|
+
`)
|
|
5237
|
+
);
|
|
5238
|
+
} else {
|
|
5239
|
+
if (config.passWithNoTests) {
|
|
5240
|
+
this.log(`No ${config.mode} files found, exiting with code 0
|
|
5241
|
+
`);
|
|
5242
|
+
} else {
|
|
5243
|
+
this.error(
|
|
5244
|
+
c.red(`No ${config.mode} files found, exiting with code 1
|
|
5245
|
+
`)
|
|
5246
|
+
);
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5249
|
+
const comma = c.dim(", ");
|
|
5250
|
+
if (filters?.length) {
|
|
5251
|
+
this.console.error(c.dim("filter: ") + c.yellow(filters.join(comma)));
|
|
5252
|
+
}
|
|
5253
|
+
const projectsFilter = toArray(config.project);
|
|
5254
|
+
if (projectsFilter.length) {
|
|
5255
|
+
this.console.error(
|
|
5256
|
+
c.dim("projects: ") + c.yellow(projectsFilter.join(comma))
|
|
5257
|
+
);
|
|
5258
|
+
}
|
|
5259
|
+
this.ctx.projects.forEach((project) => {
|
|
5260
|
+
const config2 = project.config;
|
|
5261
|
+
const printConfig = !project.isRootProject() && project.name;
|
|
5262
|
+
if (printConfig) {
|
|
5263
|
+
this.console.error(`
|
|
5264
|
+
${formatProjectName(project.name)}
|
|
5265
|
+
`);
|
|
5266
|
+
}
|
|
5267
|
+
if (config2.include) {
|
|
5268
|
+
this.console.error(
|
|
5269
|
+
c.dim("include: ") + c.yellow(config2.include.join(comma))
|
|
5270
|
+
);
|
|
5271
|
+
}
|
|
5272
|
+
if (config2.exclude) {
|
|
5273
|
+
this.console.error(
|
|
5274
|
+
c.dim("exclude: ") + c.yellow(config2.exclude.join(comma))
|
|
5275
|
+
);
|
|
5276
|
+
}
|
|
5277
|
+
if (config2.typecheck.enabled) {
|
|
5278
|
+
this.console.error(
|
|
5279
|
+
c.dim("typecheck include: ") + c.yellow(config2.typecheck.include.join(comma))
|
|
5280
|
+
);
|
|
5281
|
+
this.console.error(
|
|
5282
|
+
c.dim("typecheck exclude: ") + c.yellow(config2.typecheck.exclude.join(comma))
|
|
5283
|
+
);
|
|
5284
|
+
}
|
|
5285
|
+
});
|
|
5286
|
+
this.console.error();
|
|
5287
|
+
}
|
|
5288
|
+
printBanner() {
|
|
5289
|
+
this.log();
|
|
5290
|
+
const color = this.ctx.config.watch ? "blue" : "cyan";
|
|
5291
|
+
const mode = this.ctx.config.watch ? "DEV" : "RUN";
|
|
5292
|
+
this.log(withLabel(color, mode, `v${this.ctx.version} `) + c.gray(this.ctx.config.root));
|
|
5293
|
+
if (this.ctx.config.sequence.sequencer === RandomSequencer) {
|
|
5294
|
+
this.log(PAD + c.gray(`Running tests with seed "${this.ctx.config.sequence.seed}"`));
|
|
5295
|
+
}
|
|
5296
|
+
if (this.ctx.config.ui) {
|
|
5297
|
+
const host = this.ctx.config.api?.host || "localhost";
|
|
5298
|
+
const port = this.ctx.server.config.server.port;
|
|
5299
|
+
const base = this.ctx.config.uiBase;
|
|
5300
|
+
this.log(PAD + c.dim(c.green(`UI started at http://${host}:${c.bold(port)}${base}`)));
|
|
5301
|
+
} else if (this.ctx.config.api?.port) {
|
|
5302
|
+
const resolvedUrls = this.ctx.server.resolvedUrls;
|
|
5303
|
+
const fallbackUrl = `http://${this.ctx.config.api.host || "localhost"}:${this.ctx.config.api.port}`;
|
|
5304
|
+
const origin = resolvedUrls?.local[0] ?? resolvedUrls?.network[0] ?? fallbackUrl;
|
|
5305
|
+
this.log(PAD + c.dim(c.green(`API started at ${new URL("/", origin)}`)));
|
|
5306
|
+
}
|
|
5307
|
+
if (this.ctx.coverageProvider) {
|
|
5308
|
+
this.log(PAD + c.dim("Coverage enabled with ") + c.yellow(this.ctx.coverageProvider.name));
|
|
5309
|
+
}
|
|
5310
|
+
if (this.ctx.config.standalone) {
|
|
5311
|
+
this.log(c.yellow(`
|
|
5312
|
+
Vitest is running in standalone mode. Edit a test file to rerun tests.`));
|
|
5313
|
+
} else {
|
|
5314
|
+
this.log();
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
printBrowserBanner(project) {
|
|
5318
|
+
if (!project.browser) {
|
|
5319
|
+
return;
|
|
5320
|
+
}
|
|
5321
|
+
const resolvedUrls = project.browser.vite.resolvedUrls;
|
|
5322
|
+
const origin = resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
|
|
5323
|
+
if (!origin) {
|
|
5324
|
+
return;
|
|
5325
|
+
}
|
|
5326
|
+
const output = project.isRootProject() ? "" : formatProjectName(project.name);
|
|
5327
|
+
const provider = project.browser.provider.name;
|
|
5328
|
+
const providerString = provider === "preview" ? "" : ` by ${c.reset(c.bold(provider))}`;
|
|
5329
|
+
this.log(
|
|
5330
|
+
c.dim(
|
|
5331
|
+
`${output}Browser runner started${providerString} ${c.dim("at")} ${c.blue(new URL("/", origin))}
|
|
5332
|
+
`
|
|
5333
|
+
)
|
|
5334
|
+
);
|
|
5335
|
+
}
|
|
5336
|
+
printUnhandledErrors(errors) {
|
|
5337
|
+
const errorMessage = c.red(
|
|
5338
|
+
c.bold(
|
|
5339
|
+
`
|
|
5340
|
+
Vitest caught ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run.
|
|
5341
|
+
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.`
|
|
5342
|
+
)
|
|
5343
|
+
);
|
|
5344
|
+
this.error(c.red(divider(c.bold(c.inverse(" Unhandled Errors ")))));
|
|
5345
|
+
this.error(errorMessage);
|
|
5346
|
+
errors.forEach((err) => {
|
|
5347
|
+
this.printError(err, {
|
|
5348
|
+
fullStack: true,
|
|
5349
|
+
type: err.type || "Unhandled Error"
|
|
5350
|
+
});
|
|
5351
|
+
});
|
|
5352
|
+
this.error(c.red(divider()));
|
|
5353
|
+
}
|
|
5354
|
+
printSourceTypeErrors(errors) {
|
|
5355
|
+
const errorMessage = c.red(
|
|
5356
|
+
c.bold(
|
|
5357
|
+
`
|
|
5358
|
+
Vitest found ${errors.length} error${errors.length > 1 ? "s" : ""} not related to your test files.`
|
|
5359
|
+
)
|
|
5360
|
+
);
|
|
5361
|
+
this.log(c.red(divider(c.bold(c.inverse(" Source Errors ")))));
|
|
5362
|
+
this.log(errorMessage);
|
|
5363
|
+
errors.forEach((err) => {
|
|
5364
|
+
this.printError(err, { fullStack: true });
|
|
5365
|
+
});
|
|
5366
|
+
this.log(c.red(divider()));
|
|
5367
|
+
}
|
|
5368
|
+
getColumns() {
|
|
5369
|
+
return "columns" in this.outputStream ? this.outputStream.columns : 80;
|
|
5370
|
+
}
|
|
5371
|
+
onTerminalCleanup(listener) {
|
|
5372
|
+
this.cleanupListeners.push(listener);
|
|
5373
|
+
}
|
|
5374
|
+
addCleanupListeners() {
|
|
5375
|
+
const cleanup = () => {
|
|
5376
|
+
this.cleanupListeners.forEach((fn) => fn());
|
|
5377
|
+
this.outputStream.write(SHOW_CURSOR);
|
|
5378
|
+
};
|
|
5379
|
+
const onExit = (signal, exitCode) => {
|
|
5380
|
+
cleanup();
|
|
5381
|
+
if (process.exitCode === undefined) {
|
|
5382
|
+
process.exitCode = exitCode !== undefined ? 128 + exitCode : Number(signal);
|
|
5383
|
+
}
|
|
5384
|
+
process.exit();
|
|
5385
|
+
};
|
|
5386
|
+
process.once("SIGINT", onExit);
|
|
5387
|
+
process.once("SIGTERM", onExit);
|
|
5388
|
+
process.once("exit", onExit);
|
|
5389
|
+
this.ctx.onClose(() => {
|
|
5390
|
+
process.off("SIGINT", onExit);
|
|
5391
|
+
process.off("SIGTERM", onExit);
|
|
5392
|
+
process.off("exit", onExit);
|
|
5393
|
+
cleanup();
|
|
5394
|
+
});
|
|
5395
|
+
}
|
|
5396
|
+
registerUnhandledRejection() {
|
|
5397
|
+
const onUnhandledRejection = (err) => {
|
|
5398
|
+
process.exitCode = 1;
|
|
5399
|
+
this.printError(err, {
|
|
5400
|
+
fullStack: true,
|
|
5401
|
+
type: "Unhandled Rejection"
|
|
5402
|
+
});
|
|
5403
|
+
this.error("\n\n");
|
|
5404
|
+
process.exit();
|
|
5405
|
+
};
|
|
5406
|
+
process.on("unhandledRejection", onUnhandledRejection);
|
|
5407
|
+
this.ctx.onClose(() => {
|
|
5408
|
+
process.off("unhandledRejection", onUnhandledRejection);
|
|
5409
|
+
});
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
|
|
5122
5413
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
5123
5414
|
class VitestPackageInstaller {
|
|
5124
5415
|
isPackageExists(name, options) {
|
|
@@ -5151,7 +5442,7 @@ class VitestPackageInstaller {
|
|
|
5151
5442
|
if (!isTTY) {
|
|
5152
5443
|
return false;
|
|
5153
5444
|
}
|
|
5154
|
-
const prompts = await import('./index.
|
|
5445
|
+
const prompts = await import('./index.Bh7wTRhh.js').then(function (n) { return n.i; });
|
|
5155
5446
|
const { install } = await prompts.default({
|
|
5156
5447
|
type: "confirm",
|
|
5157
5448
|
name: "install",
|
|
@@ -5159,7 +5450,7 @@ class VitestPackageInstaller {
|
|
|
5159
5450
|
});
|
|
5160
5451
|
if (install) {
|
|
5161
5452
|
const packageName = version ? `${dependency}@${version}` : dependency;
|
|
5162
|
-
await (await import('./index.
|
|
5453
|
+
await (await import('./index.DfqWks-F.js')).installPackage(packageName, { dev: true });
|
|
5163
5454
|
process.stderr.write(
|
|
5164
5455
|
c.yellow(
|
|
5165
5456
|
`
|
|
@@ -5186,7 +5477,7 @@ function requireArray () {
|
|
|
5186
5477
|
if (hasRequiredArray) return array;
|
|
5187
5478
|
hasRequiredArray = 1;
|
|
5188
5479
|
Object.defineProperty(array, "__esModule", { value: true });
|
|
5189
|
-
array.splitWhen = array.flatten =
|
|
5480
|
+
array.splitWhen = array.flatten = undefined;
|
|
5190
5481
|
function flatten(items) {
|
|
5191
5482
|
return items.reduce((collection, item) => [].concat(collection, item), []);
|
|
5192
5483
|
}
|
|
@@ -5217,7 +5508,7 @@ function requireErrno () {
|
|
|
5217
5508
|
if (hasRequiredErrno) return errno;
|
|
5218
5509
|
hasRequiredErrno = 1;
|
|
5219
5510
|
Object.defineProperty(errno, "__esModule", { value: true });
|
|
5220
|
-
errno.isEnoentCodeError =
|
|
5511
|
+
errno.isEnoentCodeError = undefined;
|
|
5221
5512
|
function isEnoentCodeError(error) {
|
|
5222
5513
|
return error.code === 'ENOENT';
|
|
5223
5514
|
}
|
|
@@ -5233,7 +5524,7 @@ function requireFs$3 () {
|
|
|
5233
5524
|
if (hasRequiredFs$3) return fs$3;
|
|
5234
5525
|
hasRequiredFs$3 = 1;
|
|
5235
5526
|
Object.defineProperty(fs$3, "__esModule", { value: true });
|
|
5236
|
-
fs$3.createDirentFromStats =
|
|
5527
|
+
fs$3.createDirentFromStats = undefined;
|
|
5237
5528
|
class DirentFromStats {
|
|
5238
5529
|
constructor(name, stats) {
|
|
5239
5530
|
this.name = name;
|
|
@@ -5261,7 +5552,7 @@ function requirePath () {
|
|
|
5261
5552
|
if (hasRequiredPath) return path;
|
|
5262
5553
|
hasRequiredPath = 1;
|
|
5263
5554
|
Object.defineProperty(path, "__esModule", { value: true });
|
|
5264
|
-
path.convertPosixPathToPattern = path.convertWindowsPathToPattern = path.convertPathToPattern = path.escapePosixPath = path.escapeWindowsPath = path.escape = path.removeLeadingDotSegment = path.makeAbsolute = path.unixify =
|
|
5555
|
+
path.convertPosixPathToPattern = path.convertWindowsPathToPattern = path.convertPathToPattern = path.escapePosixPath = path.escapeWindowsPath = path.escape = path.removeLeadingDotSegment = path.makeAbsolute = path.unixify = undefined;
|
|
5265
5556
|
const os = require$$0$4;
|
|
5266
5557
|
const path$1 = require$$0$5;
|
|
5267
5558
|
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
|
@@ -5576,7 +5867,7 @@ function requirePattern () {
|
|
|
5576
5867
|
if (hasRequiredPattern) return pattern;
|
|
5577
5868
|
hasRequiredPattern = 1;
|
|
5578
5869
|
Object.defineProperty(pattern, "__esModule", { value: true });
|
|
5579
|
-
pattern.removeDuplicateSlashes = pattern.matchAny = pattern.convertPatternsToRe = pattern.makeRe = pattern.getPatternParts = pattern.expandBraceExpansion = pattern.expandPatternsWithBraceExpansion = pattern.isAffectDepthOfReadingPattern = pattern.endsWithSlashGlobStar = pattern.hasGlobStar = pattern.getBaseDirectory = pattern.isPatternRelatedToParentDirectory = pattern.getPatternsOutsideCurrentDirectory = pattern.getPatternsInsideCurrentDirectory = pattern.getPositivePatterns = pattern.getNegativePatterns = pattern.isPositivePattern = pattern.isNegativePattern = pattern.convertToNegativePattern = pattern.convertToPositivePattern = pattern.isDynamicPattern = pattern.isStaticPattern =
|
|
5870
|
+
pattern.isAbsolute = pattern.partitionAbsoluteAndRelative = pattern.removeDuplicateSlashes = pattern.matchAny = pattern.convertPatternsToRe = pattern.makeRe = pattern.getPatternParts = pattern.expandBraceExpansion = pattern.expandPatternsWithBraceExpansion = pattern.isAffectDepthOfReadingPattern = pattern.endsWithSlashGlobStar = pattern.hasGlobStar = pattern.getBaseDirectory = pattern.isPatternRelatedToParentDirectory = pattern.getPatternsOutsideCurrentDirectory = pattern.getPatternsInsideCurrentDirectory = pattern.getPositivePatterns = pattern.getNegativePatterns = pattern.isPositivePattern = pattern.isNegativePattern = pattern.convertToNegativePattern = pattern.convertToPositivePattern = pattern.isDynamicPattern = pattern.isStaticPattern = undefined;
|
|
5580
5871
|
const path = require$$0$5;
|
|
5581
5872
|
const globParent = requireGlobParent();
|
|
5582
5873
|
const micromatch = requireMicromatch();
|
|
@@ -5762,6 +6053,24 @@ function requirePattern () {
|
|
|
5762
6053
|
return pattern.replace(DOUBLE_SLASH_RE, '/');
|
|
5763
6054
|
}
|
|
5764
6055
|
pattern.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
6056
|
+
function partitionAbsoluteAndRelative(patterns) {
|
|
6057
|
+
const absolute = [];
|
|
6058
|
+
const relative = [];
|
|
6059
|
+
for (const pattern of patterns) {
|
|
6060
|
+
if (isAbsolute(pattern)) {
|
|
6061
|
+
absolute.push(pattern);
|
|
6062
|
+
}
|
|
6063
|
+
else {
|
|
6064
|
+
relative.push(pattern);
|
|
6065
|
+
}
|
|
6066
|
+
}
|
|
6067
|
+
return [absolute, relative];
|
|
6068
|
+
}
|
|
6069
|
+
pattern.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
6070
|
+
function isAbsolute(pattern) {
|
|
6071
|
+
return path.isAbsolute(pattern);
|
|
6072
|
+
}
|
|
6073
|
+
pattern.isAbsolute = isAbsolute;
|
|
5765
6074
|
return pattern;
|
|
5766
6075
|
}
|
|
5767
6076
|
|
|
@@ -5925,7 +6234,7 @@ function requireStream$3 () {
|
|
|
5925
6234
|
if (hasRequiredStream$3) return stream$3;
|
|
5926
6235
|
hasRequiredStream$3 = 1;
|
|
5927
6236
|
Object.defineProperty(stream$3, "__esModule", { value: true });
|
|
5928
|
-
stream$3.merge =
|
|
6237
|
+
stream$3.merge = undefined;
|
|
5929
6238
|
const merge2 = requireMerge2();
|
|
5930
6239
|
function merge(streams) {
|
|
5931
6240
|
const mergedStream = merge2(streams);
|
|
@@ -5951,7 +6260,7 @@ function requireString () {
|
|
|
5951
6260
|
if (hasRequiredString) return string;
|
|
5952
6261
|
hasRequiredString = 1;
|
|
5953
6262
|
Object.defineProperty(string, "__esModule", { value: true });
|
|
5954
|
-
string.isEmpty = string.isString =
|
|
6263
|
+
string.isEmpty = string.isString = undefined;
|
|
5955
6264
|
function isString(input) {
|
|
5956
6265
|
return typeof input === 'string';
|
|
5957
6266
|
}
|
|
@@ -5969,7 +6278,7 @@ function requireUtils$1 () {
|
|
|
5969
6278
|
if (hasRequiredUtils$1) return utils$1;
|
|
5970
6279
|
hasRequiredUtils$1 = 1;
|
|
5971
6280
|
Object.defineProperty(utils$1, "__esModule", { value: true });
|
|
5972
|
-
utils$1.string = utils$1.stream = utils$1.pattern = utils$1.path = utils$1.fs = utils$1.errno = utils$1.array =
|
|
6281
|
+
utils$1.string = utils$1.stream = utils$1.pattern = utils$1.path = utils$1.fs = utils$1.errno = utils$1.array = undefined;
|
|
5973
6282
|
const array = requireArray();
|
|
5974
6283
|
utils$1.array = array;
|
|
5975
6284
|
const errno = requireErrno();
|
|
@@ -5993,7 +6302,7 @@ function requireTasks () {
|
|
|
5993
6302
|
if (hasRequiredTasks) return tasks;
|
|
5994
6303
|
hasRequiredTasks = 1;
|
|
5995
6304
|
Object.defineProperty(tasks, "__esModule", { value: true });
|
|
5996
|
-
tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate =
|
|
6305
|
+
tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = undefined;
|
|
5997
6306
|
const utils = requireUtils$1();
|
|
5998
6307
|
function generate(input, settings) {
|
|
5999
6308
|
const patterns = processPatterns(input, settings);
|
|
@@ -6128,7 +6437,7 @@ function requireAsync$5 () {
|
|
|
6128
6437
|
if (hasRequiredAsync$5) return async;
|
|
6129
6438
|
hasRequiredAsync$5 = 1;
|
|
6130
6439
|
Object.defineProperty(async, "__esModule", { value: true });
|
|
6131
|
-
async.read =
|
|
6440
|
+
async.read = undefined;
|
|
6132
6441
|
function read(path, settings, callback) {
|
|
6133
6442
|
settings.fs.lstat(path, (lstatError, lstat) => {
|
|
6134
6443
|
if (lstatError !== null) {
|
|
@@ -6173,7 +6482,7 @@ function requireSync$5 () {
|
|
|
6173
6482
|
if (hasRequiredSync$5) return sync$5;
|
|
6174
6483
|
hasRequiredSync$5 = 1;
|
|
6175
6484
|
Object.defineProperty(sync$5, "__esModule", { value: true });
|
|
6176
|
-
sync$5.read =
|
|
6485
|
+
sync$5.read = undefined;
|
|
6177
6486
|
function read(path, settings) {
|
|
6178
6487
|
const lstat = settings.fs.lstatSync(path);
|
|
6179
6488
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
@@ -6208,7 +6517,7 @@ function requireFs$2 () {
|
|
|
6208
6517
|
hasRequiredFs$2 = 1;
|
|
6209
6518
|
(function (exports) {
|
|
6210
6519
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6211
|
-
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER =
|
|
6520
|
+
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = undefined;
|
|
6212
6521
|
const fs = require$$0$6;
|
|
6213
6522
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
6214
6523
|
lstat: fs.lstat,
|
|
@@ -6243,7 +6552,7 @@ function requireSettings$3 () {
|
|
|
6243
6552
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
6244
6553
|
}
|
|
6245
6554
|
_getValue(option, value) {
|
|
6246
|
-
return option !== null && option !==
|
|
6555
|
+
return option !== null && option !== undefined ? option : value;
|
|
6247
6556
|
}
|
|
6248
6557
|
}
|
|
6249
6558
|
settings$3.default = Settings;
|
|
@@ -6256,7 +6565,7 @@ function requireOut$3 () {
|
|
|
6256
6565
|
if (hasRequiredOut$3) return out$1;
|
|
6257
6566
|
hasRequiredOut$3 = 1;
|
|
6258
6567
|
Object.defineProperty(out$1, "__esModule", { value: true });
|
|
6259
|
-
out$1.statSync = out$1.stat = out$1.Settings =
|
|
6568
|
+
out$1.statSync = out$1.stat = out$1.Settings = undefined;
|
|
6260
6569
|
const async = requireAsync$5();
|
|
6261
6570
|
const sync = requireSync$5();
|
|
6262
6571
|
const settings_1 = requireSettings$3();
|
|
@@ -6371,7 +6680,7 @@ function requireConstants () {
|
|
|
6371
6680
|
if (hasRequiredConstants) return constants;
|
|
6372
6681
|
hasRequiredConstants = 1;
|
|
6373
6682
|
Object.defineProperty(constants, "__esModule", { value: true });
|
|
6374
|
-
constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES =
|
|
6683
|
+
constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = undefined;
|
|
6375
6684
|
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
|
|
6376
6685
|
if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
|
|
6377
6686
|
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
|
|
@@ -6399,7 +6708,7 @@ function requireFs$1 () {
|
|
|
6399
6708
|
if (hasRequiredFs$1) return fs$1;
|
|
6400
6709
|
hasRequiredFs$1 = 1;
|
|
6401
6710
|
Object.defineProperty(fs$1, "__esModule", { value: true });
|
|
6402
|
-
fs$1.createDirentFromStats =
|
|
6711
|
+
fs$1.createDirentFromStats = undefined;
|
|
6403
6712
|
class DirentFromStats {
|
|
6404
6713
|
constructor(name, stats) {
|
|
6405
6714
|
this.name = name;
|
|
@@ -6425,7 +6734,7 @@ function requireUtils () {
|
|
|
6425
6734
|
if (hasRequiredUtils) return utils;
|
|
6426
6735
|
hasRequiredUtils = 1;
|
|
6427
6736
|
Object.defineProperty(utils, "__esModule", { value: true });
|
|
6428
|
-
utils.fs =
|
|
6737
|
+
utils.fs = undefined;
|
|
6429
6738
|
const fs = requireFs$1();
|
|
6430
6739
|
utils.fs = fs;
|
|
6431
6740
|
return utils;
|
|
@@ -6439,7 +6748,7 @@ function requireCommon$1 () {
|
|
|
6439
6748
|
if (hasRequiredCommon$1) return common$1;
|
|
6440
6749
|
hasRequiredCommon$1 = 1;
|
|
6441
6750
|
Object.defineProperty(common$1, "__esModule", { value: true });
|
|
6442
|
-
common$1.joinPathSegments =
|
|
6751
|
+
common$1.joinPathSegments = undefined;
|
|
6443
6752
|
function joinPathSegments(a, b, separator) {
|
|
6444
6753
|
/**
|
|
6445
6754
|
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
|
@@ -6459,7 +6768,7 @@ function requireAsync$4 () {
|
|
|
6459
6768
|
if (hasRequiredAsync$4) return async$1;
|
|
6460
6769
|
hasRequiredAsync$4 = 1;
|
|
6461
6770
|
Object.defineProperty(async$1, "__esModule", { value: true });
|
|
6462
|
-
async$1.readdir = async$1.readdirWithFileTypes = async$1.read =
|
|
6771
|
+
async$1.readdir = async$1.readdirWithFileTypes = async$1.read = undefined;
|
|
6463
6772
|
const fsStat = requireOut$3();
|
|
6464
6773
|
const rpl = requireRunParallel();
|
|
6465
6774
|
const constants_1 = requireConstants();
|
|
@@ -6572,7 +6881,7 @@ function requireSync$4 () {
|
|
|
6572
6881
|
if (hasRequiredSync$4) return sync$4;
|
|
6573
6882
|
hasRequiredSync$4 = 1;
|
|
6574
6883
|
Object.defineProperty(sync$4, "__esModule", { value: true });
|
|
6575
|
-
sync$4.readdir = sync$4.readdirWithFileTypes = sync$4.read =
|
|
6884
|
+
sync$4.readdir = sync$4.readdirWithFileTypes = sync$4.read = undefined;
|
|
6576
6885
|
const fsStat = requireOut$3();
|
|
6577
6886
|
const constants_1 = requireConstants();
|
|
6578
6887
|
const utils = requireUtils();
|
|
@@ -6638,7 +6947,7 @@ function requireFs () {
|
|
|
6638
6947
|
hasRequiredFs = 1;
|
|
6639
6948
|
(function (exports) {
|
|
6640
6949
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6641
|
-
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER =
|
|
6950
|
+
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = undefined;
|
|
6642
6951
|
const fs = require$$0$6;
|
|
6643
6952
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
6644
6953
|
lstat: fs.lstat,
|
|
@@ -6683,7 +6992,7 @@ function requireSettings$2 () {
|
|
|
6683
6992
|
});
|
|
6684
6993
|
}
|
|
6685
6994
|
_getValue(option, value) {
|
|
6686
|
-
return option !== null && option !==
|
|
6995
|
+
return option !== null && option !== undefined ? option : value;
|
|
6687
6996
|
}
|
|
6688
6997
|
}
|
|
6689
6998
|
settings$2.default = Settings;
|
|
@@ -6696,7 +7005,7 @@ function requireOut$2 () {
|
|
|
6696
7005
|
if (hasRequiredOut$2) return out$2;
|
|
6697
7006
|
hasRequiredOut$2 = 1;
|
|
6698
7007
|
Object.defineProperty(out$2, "__esModule", { value: true });
|
|
6699
|
-
out$2.Settings = out$2.scandirSync = out$2.scandir =
|
|
7008
|
+
out$2.Settings = out$2.scandirSync = out$2.scandir = undefined;
|
|
6700
7009
|
const async = requireAsync$4();
|
|
6701
7010
|
const sync = requireSync$4();
|
|
6702
7011
|
const settings_1 = requireSettings$2();
|
|
@@ -7092,7 +7401,7 @@ function requireCommon () {
|
|
|
7092
7401
|
if (hasRequiredCommon) return common;
|
|
7093
7402
|
hasRequiredCommon = 1;
|
|
7094
7403
|
Object.defineProperty(common, "__esModule", { value: true });
|
|
7095
|
-
common.joinPathSegments = common.replacePathSegmentSeparator = common.isAppliedFilter = common.isFatalError =
|
|
7404
|
+
common.joinPathSegments = common.replacePathSegmentSeparator = common.isAppliedFilter = common.isFatalError = undefined;
|
|
7096
7405
|
function isFatalError(settings, error) {
|
|
7097
7406
|
if (settings.errorFilter === null) {
|
|
7098
7407
|
return true;
|
|
@@ -7447,7 +7756,7 @@ function requireSettings$1 () {
|
|
|
7447
7756
|
});
|
|
7448
7757
|
}
|
|
7449
7758
|
_getValue(option, value) {
|
|
7450
|
-
return option !== null && option !==
|
|
7759
|
+
return option !== null && option !== undefined ? option : value;
|
|
7451
7760
|
}
|
|
7452
7761
|
}
|
|
7453
7762
|
settings$1.default = Settings;
|
|
@@ -7460,7 +7769,7 @@ function requireOut$1 () {
|
|
|
7460
7769
|
if (hasRequiredOut$1) return out$3;
|
|
7461
7770
|
hasRequiredOut$1 = 1;
|
|
7462
7771
|
Object.defineProperty(out$3, "__esModule", { value: true });
|
|
7463
|
-
out$3.Settings = out$3.walkStream = out$3.walkSync = out$3.walk =
|
|
7772
|
+
out$3.Settings = out$3.walkStream = out$3.walkSync = out$3.walk = undefined;
|
|
7464
7773
|
const async_1 = requireAsync$2();
|
|
7465
7774
|
const stream_1 = requireStream$2();
|
|
7466
7775
|
const sync_1 = requireSync$2();
|
|
@@ -7833,11 +8142,19 @@ function requireEntry$1 () {
|
|
|
7833
8142
|
this.index = new Map();
|
|
7834
8143
|
}
|
|
7835
8144
|
getFilter(positive, negative) {
|
|
7836
|
-
const
|
|
7837
|
-
const
|
|
7838
|
-
|
|
8145
|
+
const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative);
|
|
8146
|
+
const patterns = {
|
|
8147
|
+
positive: {
|
|
8148
|
+
all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions)
|
|
8149
|
+
},
|
|
8150
|
+
negative: {
|
|
8151
|
+
absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })),
|
|
8152
|
+
relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }))
|
|
8153
|
+
}
|
|
8154
|
+
};
|
|
8155
|
+
return (entry) => this._filter(entry, patterns);
|
|
7839
8156
|
}
|
|
7840
|
-
_filter(entry,
|
|
8157
|
+
_filter(entry, patterns) {
|
|
7841
8158
|
const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
|
7842
8159
|
if (this._settings.unique && this._isDuplicateEntry(filepath)) {
|
|
7843
8160
|
return false;
|
|
@@ -7845,11 +8162,7 @@ function requireEntry$1 () {
|
|
|
7845
8162
|
if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
|
|
7846
8163
|
return false;
|
|
7847
8164
|
}
|
|
7848
|
-
|
|
7849
|
-
return false;
|
|
7850
|
-
}
|
|
7851
|
-
const isDirectory = entry.dirent.isDirectory();
|
|
7852
|
-
const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
|
|
8165
|
+
const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory());
|
|
7853
8166
|
if (this._settings.unique && isMatched) {
|
|
7854
8167
|
this._createIndexRecord(filepath);
|
|
7855
8168
|
}
|
|
@@ -7867,14 +8180,32 @@ function requireEntry$1 () {
|
|
|
7867
8180
|
_onlyDirectoryFilter(entry) {
|
|
7868
8181
|
return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
|
7869
8182
|
}
|
|
7870
|
-
|
|
7871
|
-
|
|
8183
|
+
_isMatchToPatternsSet(filepath, patterns, isDirectory) {
|
|
8184
|
+
const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory);
|
|
8185
|
+
if (!isMatched) {
|
|
8186
|
+
return false;
|
|
8187
|
+
}
|
|
8188
|
+
const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory);
|
|
8189
|
+
if (isMatchedByRelativeNegative) {
|
|
7872
8190
|
return false;
|
|
7873
8191
|
}
|
|
7874
|
-
const
|
|
7875
|
-
|
|
8192
|
+
const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory);
|
|
8193
|
+
if (isMatchedByAbsoluteNegative) {
|
|
8194
|
+
return false;
|
|
8195
|
+
}
|
|
8196
|
+
return true;
|
|
8197
|
+
}
|
|
8198
|
+
_isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) {
|
|
8199
|
+
if (patternsRe.length === 0) {
|
|
8200
|
+
return false;
|
|
8201
|
+
}
|
|
8202
|
+
const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
|
8203
|
+
return this._isMatchToPatterns(fullpath, patternsRe, isDirectory);
|
|
7876
8204
|
}
|
|
7877
8205
|
_isMatchToPatterns(filepath, patternsRe, isDirectory) {
|
|
8206
|
+
if (patternsRe.length === 0) {
|
|
8207
|
+
return false;
|
|
8208
|
+
}
|
|
7878
8209
|
// Trying to match files and directories by patterns.
|
|
7879
8210
|
const isMatched = utils.pattern.matchAny(filepath, patternsRe);
|
|
7880
8211
|
// A pattern with a trailling slash can be used for directory matching.
|
|
@@ -8166,7 +8497,7 @@ function requireSettings () {
|
|
|
8166
8497
|
hasRequiredSettings = 1;
|
|
8167
8498
|
(function (exports) {
|
|
8168
8499
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8169
|
-
exports.DEFAULT_FILE_SYSTEM_ADAPTER =
|
|
8500
|
+
exports.DEFAULT_FILE_SYSTEM_ADAPTER = undefined;
|
|
8170
8501
|
const fs = require$$0$6;
|
|
8171
8502
|
const os = require$$0$4;
|
|
8172
8503
|
/**
|
|
@@ -8383,8 +8714,8 @@ function serializeConfig(config, coreConfig, viteConfig) {
|
|
|
8383
8714
|
reportsDirectory: coverage.reportsDirectory,
|
|
8384
8715
|
provider: coverage.provider,
|
|
8385
8716
|
enabled: coverage.enabled,
|
|
8386
|
-
htmlReporter: htmlReporter ? { subdir } :
|
|
8387
|
-
customProviderModule: "customProviderModule" in coverage ? coverage.customProviderModule :
|
|
8717
|
+
htmlReporter: htmlReporter ? { subdir } : undefined,
|
|
8718
|
+
customProviderModule: "customProviderModule" in coverage ? coverage.customProviderModule : undefined
|
|
8388
8719
|
};
|
|
8389
8720
|
})(config.coverage),
|
|
8390
8721
|
fakeTimers: config.fakeTimers,
|
|
@@ -8419,11 +8750,11 @@ function serializeConfig(config, coreConfig, viteConfig) {
|
|
|
8419
8750
|
},
|
|
8420
8751
|
snapshotOptions: {
|
|
8421
8752
|
// TODO: store it differently, not on the config
|
|
8422
|
-
snapshotEnvironment:
|
|
8753
|
+
snapshotEnvironment: undefined,
|
|
8423
8754
|
updateSnapshot: coreConfig.snapshotOptions.updateSnapshot,
|
|
8424
8755
|
snapshotFormat: {
|
|
8425
8756
|
...coreConfig.snapshotOptions.snapshotFormat,
|
|
8426
|
-
compareKeys:
|
|
8757
|
+
compareKeys: undefined
|
|
8427
8758
|
},
|
|
8428
8759
|
expand: config.snapshotOptions.expand ?? coreConfig.snapshotOptions.expand
|
|
8429
8760
|
},
|
|
@@ -8566,7 +8897,7 @@ let lastMsg;
|
|
|
8566
8897
|
let sameCount = 0;
|
|
8567
8898
|
let timeFormatter;
|
|
8568
8899
|
function getTimeFormatter() {
|
|
8569
|
-
timeFormatter ??= new Intl.DateTimeFormat(
|
|
8900
|
+
timeFormatter ??= new Intl.DateTimeFormat(undefined, {
|
|
8570
8901
|
hour: "numeric",
|
|
8571
8902
|
minute: "numeric",
|
|
8572
8903
|
second: "numeric"
|
|
@@ -8805,7 +9136,7 @@ function requireJsTokens () {
|
|
|
8805
9136
|
yield ({
|
|
8806
9137
|
type: "RegularExpressionLiteral",
|
|
8807
9138
|
value: match[0],
|
|
8808
|
-
closed: match[1] !==
|
|
9139
|
+
closed: match[1] !== undefined && match[1] !== "\\"
|
|
8809
9140
|
});
|
|
8810
9141
|
continue;
|
|
8811
9142
|
}
|
|
@@ -8943,7 +9274,7 @@ function requireJsTokens () {
|
|
|
8943
9274
|
yield ({
|
|
8944
9275
|
type: "StringLiteral",
|
|
8945
9276
|
value: match[0],
|
|
8946
|
-
closed: match[2] !==
|
|
9277
|
+
closed: match[2] !== undefined
|
|
8947
9278
|
});
|
|
8948
9279
|
continue;
|
|
8949
9280
|
}
|
|
@@ -9044,7 +9375,7 @@ function requireJsTokens () {
|
|
|
9044
9375
|
yield ({
|
|
9045
9376
|
type: "JSXString",
|
|
9046
9377
|
value: match[0],
|
|
9047
|
-
closed: match[2] !==
|
|
9378
|
+
closed: match[2] !== undefined
|
|
9048
9379
|
});
|
|
9049
9380
|
continue;
|
|
9050
9381
|
}
|
|
@@ -9119,7 +9450,7 @@ function requireJsTokens () {
|
|
|
9119
9450
|
yield ({
|
|
9120
9451
|
type: "MultiLineComment",
|
|
9121
9452
|
value: match[0],
|
|
9122
|
-
closed: match[1] !==
|
|
9453
|
+
closed: match[1] !== undefined
|
|
9123
9454
|
});
|
|
9124
9455
|
continue;
|
|
9125
9456
|
}
|
|
@@ -9142,7 +9473,7 @@ function requireJsTokens () {
|
|
|
9142
9473
|
value: firstCodePoint
|
|
9143
9474
|
});
|
|
9144
9475
|
}
|
|
9145
|
-
return
|
|
9476
|
+
return undefined;
|
|
9146
9477
|
};
|
|
9147
9478
|
return jsTokens_1;
|
|
9148
9479
|
}
|
|
@@ -9267,7 +9598,7 @@ function resolveOptimizerConfig(_testOptions, viteOptions, testConfig, viteCache
|
|
|
9267
9598
|
testOptions.enabled ??= false;
|
|
9268
9599
|
}
|
|
9269
9600
|
if (!allowed || testOptions?.enabled !== true) {
|
|
9270
|
-
newConfig.cacheDir =
|
|
9601
|
+
newConfig.cacheDir = undefined;
|
|
9271
9602
|
newConfig.optimizeDeps = {
|
|
9272
9603
|
// experimental in Vite >2.9.2, entries remains to help with older versions
|
|
9273
9604
|
disabled: true,
|
|
@@ -9428,7 +9759,7 @@ function VitestProjectResolver(ctx) {
|
|
|
9428
9759
|
enforce: "pre",
|
|
9429
9760
|
async resolveId(id, _, { ssr }) {
|
|
9430
9761
|
if (id === "vitest" || id.startsWith("@vitest/") || id.startsWith("vitest/")) {
|
|
9431
|
-
const resolved = await ctx.server.pluginContainer.resolveId(id,
|
|
9762
|
+
const resolved = await ctx.server.pluginContainer.resolveId(id, undefined, {
|
|
9432
9763
|
skip: /* @__PURE__ */ new Set([plugin]),
|
|
9433
9764
|
ssr
|
|
9434
9765
|
});
|
|
@@ -9588,6 +9919,10 @@ class TestSpecification {
|
|
|
9588
9919
|
* @deprecated use `pool` instead
|
|
9589
9920
|
*/
|
|
9590
9921
|
2;
|
|
9922
|
+
/**
|
|
9923
|
+
* The task ID associated with the test module.
|
|
9924
|
+
*/
|
|
9925
|
+
taskId;
|
|
9591
9926
|
/**
|
|
9592
9927
|
* The test project that the module belongs to.
|
|
9593
9928
|
*/
|
|
@@ -9609,11 +9944,27 @@ class TestSpecification {
|
|
|
9609
9944
|
this[0] = project;
|
|
9610
9945
|
this[1] = moduleId;
|
|
9611
9946
|
this[2] = { pool };
|
|
9947
|
+
const name = project.config.name;
|
|
9948
|
+
const hashName = pool !== "typescript" ? name : name ? `${name}:__typecheck__` : "__typecheck__";
|
|
9949
|
+
this.taskId = generateFileHash(
|
|
9950
|
+
relative(project.config.root, moduleId),
|
|
9951
|
+
hashName
|
|
9952
|
+
);
|
|
9612
9953
|
this.project = project;
|
|
9613
9954
|
this.moduleId = moduleId;
|
|
9614
9955
|
this.pool = pool;
|
|
9615
9956
|
this.testLines = testLines;
|
|
9616
9957
|
}
|
|
9958
|
+
/**
|
|
9959
|
+
* Test module associated with the specification.
|
|
9960
|
+
*/
|
|
9961
|
+
get testModule() {
|
|
9962
|
+
const task = this.project.vitest.state.idMap.get(this.taskId);
|
|
9963
|
+
if (!task) {
|
|
9964
|
+
return undefined;
|
|
9965
|
+
}
|
|
9966
|
+
return this.project.vitest.state.getReportedEntity(task);
|
|
9967
|
+
}
|
|
9617
9968
|
toJSON() {
|
|
9618
9969
|
return [
|
|
9619
9970
|
{
|
|
@@ -9681,13 +10032,14 @@ class TestProject {
|
|
|
9681
10032
|
typechecker;
|
|
9682
10033
|
/** @internal */
|
|
9683
10034
|
_config;
|
|
10035
|
+
/** @internal */
|
|
10036
|
+
_vite;
|
|
9684
10037
|
runner;
|
|
9685
10038
|
closingPromise;
|
|
9686
10039
|
testFilesList = null;
|
|
9687
10040
|
typecheckFilesList = null;
|
|
9688
10041
|
_globalSetups;
|
|
9689
10042
|
_provided = {};
|
|
9690
|
-
_vite;
|
|
9691
10043
|
// "provide" is a property, not a method to keep the context when destructed in the global setup,
|
|
9692
10044
|
// making it a method would be a breaking change, and can be done in Vitest 3 at minimum
|
|
9693
10045
|
/**
|
|
@@ -9964,7 +10316,7 @@ class TestProject {
|
|
|
9964
10316
|
}
|
|
9965
10317
|
/** @deprecated use `matchesTestGlob` instead */
|
|
9966
10318
|
async isTargetFile(id, source) {
|
|
9967
|
-
return this.matchesTestGlob(id, source ? () => source :
|
|
10319
|
+
return this.matchesTestGlob(id, source ? () => source : undefined);
|
|
9968
10320
|
}
|
|
9969
10321
|
isInSourceTestCode(code) {
|
|
9970
10322
|
return code.includes("import.meta.vitest");
|
|
@@ -9987,9 +10339,7 @@ class TestProject {
|
|
|
9987
10339
|
}
|
|
9988
10340
|
return testFiles;
|
|
9989
10341
|
}
|
|
9990
|
-
/** @internal */
|
|
9991
10342
|
_parentBrowser;
|
|
9992
|
-
/** @internal */
|
|
9993
10343
|
_parent;
|
|
9994
10344
|
/** @internal */
|
|
9995
10345
|
_initParentBrowser = deduped(async () => {
|
|
@@ -10027,6 +10377,7 @@ class TestProject {
|
|
|
10027
10377
|
await this._parent?._initParentBrowser();
|
|
10028
10378
|
if (!this.browser && this._parent?._parentBrowser) {
|
|
10029
10379
|
this.browser = this._parent._parentBrowser.spawn(this);
|
|
10380
|
+
await this.vitest.report("onBrowserInit", this);
|
|
10030
10381
|
}
|
|
10031
10382
|
});
|
|
10032
10383
|
/**
|
|
@@ -10044,7 +10395,7 @@ class TestProject {
|
|
|
10044
10395
|
].filter(Boolean)
|
|
10045
10396
|
).then(() => {
|
|
10046
10397
|
this._provided = {};
|
|
10047
|
-
this._vite =
|
|
10398
|
+
this._vite = undefined;
|
|
10048
10399
|
});
|
|
10049
10400
|
}
|
|
10050
10401
|
return this.closingPromise;
|
|
@@ -10082,7 +10433,7 @@ class TestProject {
|
|
|
10082
10433
|
this.config.provide[providedKey]
|
|
10083
10434
|
);
|
|
10084
10435
|
}
|
|
10085
|
-
this.closingPromise =
|
|
10436
|
+
this.closingPromise = undefined;
|
|
10086
10437
|
this._vite = server;
|
|
10087
10438
|
this.vitenode = new ViteNodeServer(server, this.config.server);
|
|
10088
10439
|
const node = this.vitenode;
|
|
@@ -10174,7 +10525,7 @@ function deduped(cb) {
|
|
|
10174
10525
|
return (...args) => {
|
|
10175
10526
|
if (!_promise) {
|
|
10176
10527
|
_promise = cb(...args).finally(() => {
|
|
10177
|
-
_promise =
|
|
10528
|
+
_promise = undefined;
|
|
10178
10529
|
});
|
|
10179
10530
|
}
|
|
10180
10531
|
return _promise;
|
|
@@ -10182,7 +10533,7 @@ function deduped(cb) {
|
|
|
10182
10533
|
}
|
|
10183
10534
|
async function initializeProject(workspacePath, ctx, options) {
|
|
10184
10535
|
const project = new TestProject(workspacePath, ctx, options);
|
|
10185
|
-
const {
|
|
10536
|
+
const { configFile, ...restOptions } = options;
|
|
10186
10537
|
const config = {
|
|
10187
10538
|
...restOptions,
|
|
10188
10539
|
configFile,
|
|
@@ -10206,7 +10557,7 @@ async function loadCustomReporterModule(path, runner) {
|
|
|
10206
10557
|
cause: customReporterModuleError
|
|
10207
10558
|
});
|
|
10208
10559
|
}
|
|
10209
|
-
if (customReporterModule.default === null || customReporterModule.default ===
|
|
10560
|
+
if (customReporterModule.default === null || customReporterModule.default === undefined) {
|
|
10210
10561
|
throw new Error(
|
|
10211
10562
|
`Custom reporter loaded from ${path} was not the default export`
|
|
10212
10563
|
);
|
|
@@ -10291,7 +10642,7 @@ function groupFilters(filters) {
|
|
|
10291
10642
|
const testLocations = filters2.map((f) => f.lineNumber);
|
|
10292
10643
|
return [
|
|
10293
10644
|
filename,
|
|
10294
|
-
testLocations.filter((l) => l !==
|
|
10645
|
+
testLocations.filter((l) => l !== undefined)
|
|
10295
10646
|
];
|
|
10296
10647
|
})
|
|
10297
10648
|
);
|
|
@@ -10329,7 +10680,7 @@ class VitestSpecifications {
|
|
|
10329
10680
|
const files = [];
|
|
10330
10681
|
const dir = process.cwd();
|
|
10331
10682
|
const parsedFilters = filters.map((f) => parseFilter(f));
|
|
10332
|
-
if (!this.vitest.config.includeTaskLocation && parsedFilters.some((f) => f.lineNumber !==
|
|
10683
|
+
if (!this.vitest.config.includeTaskLocation && parsedFilters.some((f) => f.lineNumber !== undefined)) {
|
|
10333
10684
|
throw new IncludeTaskLocationDisabledError();
|
|
10334
10685
|
}
|
|
10335
10686
|
const testLines = groupFilters(parsedFilters.map(
|
|
@@ -10449,6 +10800,411 @@ class VitestSpecifications {
|
|
|
10449
10800
|
}
|
|
10450
10801
|
}
|
|
10451
10802
|
|
|
10803
|
+
class ReportedTaskImplementation {
|
|
10804
|
+
/**
|
|
10805
|
+
* Task instance.
|
|
10806
|
+
* @internal
|
|
10807
|
+
*/
|
|
10808
|
+
task;
|
|
10809
|
+
/**
|
|
10810
|
+
* The project associated with the test or suite.
|
|
10811
|
+
*/
|
|
10812
|
+
project;
|
|
10813
|
+
/**
|
|
10814
|
+
* Unique identifier.
|
|
10815
|
+
* This ID is deterministic and will be the same for the same test across multiple runs.
|
|
10816
|
+
* The ID is based on the project name, module url and test order.
|
|
10817
|
+
*/
|
|
10818
|
+
id;
|
|
10819
|
+
/**
|
|
10820
|
+
* Location in the module where the test or suite is defined.
|
|
10821
|
+
*/
|
|
10822
|
+
location;
|
|
10823
|
+
/** @internal */
|
|
10824
|
+
constructor(task, project) {
|
|
10825
|
+
this.task = task;
|
|
10826
|
+
this.project = project;
|
|
10827
|
+
this.id = task.id;
|
|
10828
|
+
this.location = task.location;
|
|
10829
|
+
}
|
|
10830
|
+
/**
|
|
10831
|
+
* Checks if the test did not fail the suite.
|
|
10832
|
+
* If the test is not finished yet or was skipped, it will return `true`.
|
|
10833
|
+
*/
|
|
10834
|
+
ok() {
|
|
10835
|
+
const result = this.task.result;
|
|
10836
|
+
return !result || result.state !== "fail";
|
|
10837
|
+
}
|
|
10838
|
+
/**
|
|
10839
|
+
* Creates a new reported task instance and stores it in the project's state for future use.
|
|
10840
|
+
* @internal
|
|
10841
|
+
*/
|
|
10842
|
+
static register(task, project) {
|
|
10843
|
+
const state = new this(task, project);
|
|
10844
|
+
storeTask(project, task, state);
|
|
10845
|
+
return state;
|
|
10846
|
+
}
|
|
10847
|
+
}
|
|
10848
|
+
class TestCase extends ReportedTaskImplementation {
|
|
10849
|
+
#fullName;
|
|
10850
|
+
type = "test";
|
|
10851
|
+
/**
|
|
10852
|
+
* Direct reference to the test module where the test or suite is defined.
|
|
10853
|
+
*/
|
|
10854
|
+
module;
|
|
10855
|
+
/**
|
|
10856
|
+
* Name of the test.
|
|
10857
|
+
*/
|
|
10858
|
+
name;
|
|
10859
|
+
/**
|
|
10860
|
+
* Options that the test was initiated with.
|
|
10861
|
+
*/
|
|
10862
|
+
options;
|
|
10863
|
+
/**
|
|
10864
|
+
* Parent suite. If the test was called directly inside the module, the parent will be the module itself.
|
|
10865
|
+
*/
|
|
10866
|
+
parent;
|
|
10867
|
+
/** @internal */
|
|
10868
|
+
constructor(task, project) {
|
|
10869
|
+
super(task, project);
|
|
10870
|
+
this.name = task.name;
|
|
10871
|
+
this.module = getReportedTask(project, task.file);
|
|
10872
|
+
const suite = this.task.suite;
|
|
10873
|
+
if (suite) {
|
|
10874
|
+
this.parent = getReportedTask(project, suite);
|
|
10875
|
+
} else {
|
|
10876
|
+
this.parent = this.module;
|
|
10877
|
+
}
|
|
10878
|
+
this.options = buildOptions(task);
|
|
10879
|
+
}
|
|
10880
|
+
/**
|
|
10881
|
+
* Full name of the test including all parent suites separated with `>`.
|
|
10882
|
+
*/
|
|
10883
|
+
get fullName() {
|
|
10884
|
+
if (this.#fullName === undefined) {
|
|
10885
|
+
if (this.parent.type !== "module") {
|
|
10886
|
+
this.#fullName = `${this.parent.fullName} > ${this.name}`;
|
|
10887
|
+
} else {
|
|
10888
|
+
this.#fullName = this.name;
|
|
10889
|
+
}
|
|
10890
|
+
}
|
|
10891
|
+
return this.#fullName;
|
|
10892
|
+
}
|
|
10893
|
+
/**
|
|
10894
|
+
* Test results.
|
|
10895
|
+
* - **pending**: Test was collected, but didn't finish running yet.
|
|
10896
|
+
* - **passed**: Test passed successfully
|
|
10897
|
+
* - **failed**: Test failed to execute
|
|
10898
|
+
* - **skipped**: Test was skipped during collection or dynamically with `ctx.skip()`.
|
|
10899
|
+
*/
|
|
10900
|
+
result() {
|
|
10901
|
+
const result = this.task.result;
|
|
10902
|
+
const mode = result?.state || this.task.mode;
|
|
10903
|
+
if (!result && (mode === "skip" || mode === "todo")) {
|
|
10904
|
+
return {
|
|
10905
|
+
state: "skipped",
|
|
10906
|
+
note: undefined,
|
|
10907
|
+
errors: undefined
|
|
10908
|
+
};
|
|
10909
|
+
}
|
|
10910
|
+
if (!result || result.state === "run" || result.state === "queued") {
|
|
10911
|
+
return {
|
|
10912
|
+
state: "pending",
|
|
10913
|
+
errors: undefined
|
|
10914
|
+
};
|
|
10915
|
+
}
|
|
10916
|
+
const state = result.state === "fail" ? "failed" : result.state === "pass" ? "passed" : "skipped";
|
|
10917
|
+
if (state === "skipped") {
|
|
10918
|
+
return {
|
|
10919
|
+
state,
|
|
10920
|
+
note: result.note,
|
|
10921
|
+
errors: undefined
|
|
10922
|
+
};
|
|
10923
|
+
}
|
|
10924
|
+
if (state === "passed") {
|
|
10925
|
+
return {
|
|
10926
|
+
state,
|
|
10927
|
+
errors: result.errors
|
|
10928
|
+
};
|
|
10929
|
+
}
|
|
10930
|
+
return {
|
|
10931
|
+
state,
|
|
10932
|
+
errors: result.errors || []
|
|
10933
|
+
};
|
|
10934
|
+
}
|
|
10935
|
+
/**
|
|
10936
|
+
* Custom metadata that was attached to the test during its execution.
|
|
10937
|
+
*/
|
|
10938
|
+
meta() {
|
|
10939
|
+
return this.task.meta;
|
|
10940
|
+
}
|
|
10941
|
+
/**
|
|
10942
|
+
* Useful information about the test like duration, memory usage, etc.
|
|
10943
|
+
* Diagnostic is only available after the test has finished.
|
|
10944
|
+
*/
|
|
10945
|
+
diagnostic() {
|
|
10946
|
+
const result = this.task.result;
|
|
10947
|
+
if (!result || !result.startTime) {
|
|
10948
|
+
return undefined;
|
|
10949
|
+
}
|
|
10950
|
+
const duration = result.duration || 0;
|
|
10951
|
+
const slow = duration > this.project.globalConfig.slowTestThreshold;
|
|
10952
|
+
return {
|
|
10953
|
+
slow,
|
|
10954
|
+
heap: result.heap,
|
|
10955
|
+
duration,
|
|
10956
|
+
startTime: result.startTime,
|
|
10957
|
+
retryCount: result.retryCount ?? 0,
|
|
10958
|
+
repeatCount: result.repeatCount ?? 0,
|
|
10959
|
+
flaky: !!result.retryCount && result.state === "pass" && result.retryCount > 0
|
|
10960
|
+
};
|
|
10961
|
+
}
|
|
10962
|
+
}
|
|
10963
|
+
class TestCollection {
|
|
10964
|
+
#task;
|
|
10965
|
+
#project;
|
|
10966
|
+
constructor(task, project) {
|
|
10967
|
+
this.#task = task;
|
|
10968
|
+
this.#project = project;
|
|
10969
|
+
}
|
|
10970
|
+
/**
|
|
10971
|
+
* Returns the test or suite at a specific index.
|
|
10972
|
+
*/
|
|
10973
|
+
at(index) {
|
|
10974
|
+
if (index < 0) {
|
|
10975
|
+
index = this.size + index;
|
|
10976
|
+
}
|
|
10977
|
+
return getReportedTask(this.#project, this.#task.tasks[index]);
|
|
10978
|
+
}
|
|
10979
|
+
/**
|
|
10980
|
+
* The number of tests and suites in the collection.
|
|
10981
|
+
*/
|
|
10982
|
+
get size() {
|
|
10983
|
+
return this.#task.tasks.length;
|
|
10984
|
+
}
|
|
10985
|
+
/**
|
|
10986
|
+
* Returns the collection in array form for easier manipulation.
|
|
10987
|
+
*/
|
|
10988
|
+
array() {
|
|
10989
|
+
return Array.from(this);
|
|
10990
|
+
}
|
|
10991
|
+
/**
|
|
10992
|
+
* Filters all tests that are part of this collection and its children.
|
|
10993
|
+
*/
|
|
10994
|
+
*allTests(state) {
|
|
10995
|
+
for (const child of this) {
|
|
10996
|
+
if (child.type === "suite") {
|
|
10997
|
+
yield* child.children.allTests(state);
|
|
10998
|
+
} else if (state) {
|
|
10999
|
+
const testState = child.result().state;
|
|
11000
|
+
if (state === testState) {
|
|
11001
|
+
yield child;
|
|
11002
|
+
}
|
|
11003
|
+
} else {
|
|
11004
|
+
yield child;
|
|
11005
|
+
}
|
|
11006
|
+
}
|
|
11007
|
+
}
|
|
11008
|
+
/**
|
|
11009
|
+
* Filters only the tests that are part of this collection.
|
|
11010
|
+
*/
|
|
11011
|
+
*tests(state) {
|
|
11012
|
+
for (const child of this) {
|
|
11013
|
+
if (child.type !== "test") {
|
|
11014
|
+
continue;
|
|
11015
|
+
}
|
|
11016
|
+
if (state) {
|
|
11017
|
+
const testState = child.result().state;
|
|
11018
|
+
if (state === testState) {
|
|
11019
|
+
yield child;
|
|
11020
|
+
}
|
|
11021
|
+
} else {
|
|
11022
|
+
yield child;
|
|
11023
|
+
}
|
|
11024
|
+
}
|
|
11025
|
+
}
|
|
11026
|
+
/**
|
|
11027
|
+
* Filters only the suites that are part of this collection.
|
|
11028
|
+
*/
|
|
11029
|
+
*suites() {
|
|
11030
|
+
for (const child of this) {
|
|
11031
|
+
if (child.type === "suite") {
|
|
11032
|
+
yield child;
|
|
11033
|
+
}
|
|
11034
|
+
}
|
|
11035
|
+
}
|
|
11036
|
+
/**
|
|
11037
|
+
* Filters all suites that are part of this collection and its children.
|
|
11038
|
+
*/
|
|
11039
|
+
*allSuites() {
|
|
11040
|
+
for (const child of this) {
|
|
11041
|
+
if (child.type === "suite") {
|
|
11042
|
+
yield child;
|
|
11043
|
+
yield* child.children.allSuites();
|
|
11044
|
+
}
|
|
11045
|
+
}
|
|
11046
|
+
}
|
|
11047
|
+
*[Symbol.iterator]() {
|
|
11048
|
+
for (const task of this.#task.tasks) {
|
|
11049
|
+
yield getReportedTask(this.#project, task);
|
|
11050
|
+
}
|
|
11051
|
+
}
|
|
11052
|
+
}
|
|
11053
|
+
class SuiteImplementation extends ReportedTaskImplementation {
|
|
11054
|
+
/**
|
|
11055
|
+
* Collection of suites and tests that are part of this suite.
|
|
11056
|
+
*/
|
|
11057
|
+
children;
|
|
11058
|
+
/** @internal */
|
|
11059
|
+
constructor(task, project) {
|
|
11060
|
+
super(task, project);
|
|
11061
|
+
this.children = new TestCollection(task, project);
|
|
11062
|
+
}
|
|
11063
|
+
/**
|
|
11064
|
+
* Errors that happened outside of the test run during collection, like syntax errors.
|
|
11065
|
+
*/
|
|
11066
|
+
errors() {
|
|
11067
|
+
return this.task.result?.errors || [];
|
|
11068
|
+
}
|
|
11069
|
+
}
|
|
11070
|
+
class TestSuite extends SuiteImplementation {
|
|
11071
|
+
#fullName;
|
|
11072
|
+
type = "suite";
|
|
11073
|
+
/**
|
|
11074
|
+
* Name of the test or the suite.
|
|
11075
|
+
*/
|
|
11076
|
+
name;
|
|
11077
|
+
/**
|
|
11078
|
+
* Direct reference to the test module where the test or suite is defined.
|
|
11079
|
+
*/
|
|
11080
|
+
module;
|
|
11081
|
+
/**
|
|
11082
|
+
* Parent suite. If suite was called directly inside the module, the parent will be the module itself.
|
|
11083
|
+
*/
|
|
11084
|
+
parent;
|
|
11085
|
+
/**
|
|
11086
|
+
* Options that suite was initiated with.
|
|
11087
|
+
*/
|
|
11088
|
+
options;
|
|
11089
|
+
/** @internal */
|
|
11090
|
+
constructor(task, project) {
|
|
11091
|
+
super(task, project);
|
|
11092
|
+
this.name = task.name;
|
|
11093
|
+
this.module = getReportedTask(project, task.file);
|
|
11094
|
+
const suite = this.task.suite;
|
|
11095
|
+
if (suite) {
|
|
11096
|
+
this.parent = getReportedTask(project, suite);
|
|
11097
|
+
} else {
|
|
11098
|
+
this.parent = this.module;
|
|
11099
|
+
}
|
|
11100
|
+
this.options = buildOptions(task);
|
|
11101
|
+
}
|
|
11102
|
+
/**
|
|
11103
|
+
* Checks the running state of the suite.
|
|
11104
|
+
*/
|
|
11105
|
+
state() {
|
|
11106
|
+
return getSuiteState(this.task);
|
|
11107
|
+
}
|
|
11108
|
+
/**
|
|
11109
|
+
* Full name of the suite including all parent suites separated with `>`.
|
|
11110
|
+
*/
|
|
11111
|
+
get fullName() {
|
|
11112
|
+
if (this.#fullName === undefined) {
|
|
11113
|
+
if (this.parent.type !== "module") {
|
|
11114
|
+
this.#fullName = `${this.parent.fullName} > ${this.name}`;
|
|
11115
|
+
} else {
|
|
11116
|
+
this.#fullName = this.name;
|
|
11117
|
+
}
|
|
11118
|
+
}
|
|
11119
|
+
return this.#fullName;
|
|
11120
|
+
}
|
|
11121
|
+
}
|
|
11122
|
+
class TestModule extends SuiteImplementation {
|
|
11123
|
+
type = "module";
|
|
11124
|
+
/**
|
|
11125
|
+
* This is usually an absolute UNIX file path.
|
|
11126
|
+
* It can be a virtual ID if the file is not on the disk.
|
|
11127
|
+
* This value corresponds to the ID in the Vite's module graph.
|
|
11128
|
+
*/
|
|
11129
|
+
moduleId;
|
|
11130
|
+
/** @internal */
|
|
11131
|
+
constructor(task, project) {
|
|
11132
|
+
super(task, project);
|
|
11133
|
+
this.moduleId = task.filepath;
|
|
11134
|
+
}
|
|
11135
|
+
/**
|
|
11136
|
+
* Checks the running state of the test file.
|
|
11137
|
+
*/
|
|
11138
|
+
state() {
|
|
11139
|
+
const state = this.task.result?.state;
|
|
11140
|
+
if (state === "queued") {
|
|
11141
|
+
return "queued";
|
|
11142
|
+
}
|
|
11143
|
+
return getSuiteState(this.task);
|
|
11144
|
+
}
|
|
11145
|
+
/**
|
|
11146
|
+
* Useful information about the module like duration, memory usage, etc.
|
|
11147
|
+
* If the module was not executed yet, all diagnostic values will return `0`.
|
|
11148
|
+
*/
|
|
11149
|
+
diagnostic() {
|
|
11150
|
+
const setupDuration = this.task.setupDuration || 0;
|
|
11151
|
+
const collectDuration = this.task.collectDuration || 0;
|
|
11152
|
+
const prepareDuration = this.task.prepareDuration || 0;
|
|
11153
|
+
const environmentSetupDuration = this.task.environmentLoad || 0;
|
|
11154
|
+
const duration = this.task.result?.duration || 0;
|
|
11155
|
+
return {
|
|
11156
|
+
environmentSetupDuration,
|
|
11157
|
+
prepareDuration,
|
|
11158
|
+
collectDuration,
|
|
11159
|
+
setupDuration,
|
|
11160
|
+
duration
|
|
11161
|
+
};
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
function buildOptions(task) {
|
|
11165
|
+
return {
|
|
11166
|
+
each: task.each,
|
|
11167
|
+
fails: task.type === "test" && task.fails,
|
|
11168
|
+
concurrent: task.concurrent,
|
|
11169
|
+
shuffle: task.shuffle,
|
|
11170
|
+
retry: task.retry,
|
|
11171
|
+
repeats: task.repeats,
|
|
11172
|
+
// runner types are too broad, but the public API should be more strict
|
|
11173
|
+
// the queued state exists only on Files and this method is called
|
|
11174
|
+
// only for tests and suites
|
|
11175
|
+
mode: task.mode
|
|
11176
|
+
};
|
|
11177
|
+
}
|
|
11178
|
+
function storeTask(project, runnerTask, reportedTask) {
|
|
11179
|
+
project.vitest.state.reportedTasksMap.set(runnerTask, reportedTask);
|
|
11180
|
+
}
|
|
11181
|
+
function getReportedTask(project, runnerTask) {
|
|
11182
|
+
const reportedTask = project.vitest.state.getReportedEntity(runnerTask);
|
|
11183
|
+
if (!reportedTask) {
|
|
11184
|
+
throw new Error(
|
|
11185
|
+
`Task instance was not found for ${runnerTask.type} "${runnerTask.name}"`
|
|
11186
|
+
);
|
|
11187
|
+
}
|
|
11188
|
+
return reportedTask;
|
|
11189
|
+
}
|
|
11190
|
+
function getSuiteState(task) {
|
|
11191
|
+
const mode = task.mode;
|
|
11192
|
+
const state = task.result?.state;
|
|
11193
|
+
if (mode === "skip" || mode === "todo" || state === "skip" || state === "todo") {
|
|
11194
|
+
return "skipped";
|
|
11195
|
+
}
|
|
11196
|
+
if (state == null || state === "run" || state === "only") {
|
|
11197
|
+
return "pending";
|
|
11198
|
+
}
|
|
11199
|
+
if (state === "fail") {
|
|
11200
|
+
return "failed";
|
|
11201
|
+
}
|
|
11202
|
+
if (state === "pass") {
|
|
11203
|
+
return "passed";
|
|
11204
|
+
}
|
|
11205
|
+
throw new Error(`Unknown suite state: ${state}`);
|
|
11206
|
+
}
|
|
11207
|
+
|
|
10452
11208
|
function isAggregateError(err) {
|
|
10453
11209
|
if (typeof AggregateError !== "undefined" && err instanceof AggregateError) {
|
|
10454
11210
|
return true;
|
|
@@ -10630,6 +11386,127 @@ class StateManager {
|
|
|
10630
11386
|
}
|
|
10631
11387
|
}
|
|
10632
11388
|
|
|
11389
|
+
class TestRun {
|
|
11390
|
+
constructor(vitest) {
|
|
11391
|
+
this.vitest = vitest;
|
|
11392
|
+
}
|
|
11393
|
+
async start(specifications) {
|
|
11394
|
+
const filepaths = specifications.map((spec) => spec.moduleId);
|
|
11395
|
+
this.vitest.state.collectPaths(filepaths);
|
|
11396
|
+
await this.vitest.report("onPathsCollected", Array.from(new Set(filepaths)));
|
|
11397
|
+
await this.vitest.report("onSpecsCollected", specifications.map((spec) => spec.toJSON()));
|
|
11398
|
+
await this.vitest.report("onTestRunStart", [...specifications]);
|
|
11399
|
+
}
|
|
11400
|
+
async enqueued(project, file) {
|
|
11401
|
+
this.vitest.state.collectFiles(project, [file]);
|
|
11402
|
+
const testModule = this.vitest.state.getReportedEntity(file);
|
|
11403
|
+
await this.vitest.report("onTestModuleQueued", testModule);
|
|
11404
|
+
}
|
|
11405
|
+
async collected(project, files) {
|
|
11406
|
+
this.vitest.state.collectFiles(project, files);
|
|
11407
|
+
await Promise.all([
|
|
11408
|
+
this.vitest.report("onCollected", files),
|
|
11409
|
+
...files.map((file) => {
|
|
11410
|
+
const testModule = this.vitest.state.getReportedEntity(file);
|
|
11411
|
+
return this.vitest.report("onTestModuleCollected", testModule);
|
|
11412
|
+
})
|
|
11413
|
+
]);
|
|
11414
|
+
}
|
|
11415
|
+
async log(log) {
|
|
11416
|
+
this.vitest.state.updateUserLog(log);
|
|
11417
|
+
await this.vitest.report("onUserConsoleLog", log);
|
|
11418
|
+
}
|
|
11419
|
+
async updated(update, events) {
|
|
11420
|
+
this.vitest.state.updateTasks(update);
|
|
11421
|
+
await this.vitest.report("onTaskUpdate", update);
|
|
11422
|
+
for (const [id, event] of events) {
|
|
11423
|
+
await this.reportEvent(id, event).catch((error) => {
|
|
11424
|
+
this.vitest.state.catchError(serializeError(error), "Unhandled Reporter Error");
|
|
11425
|
+
});
|
|
11426
|
+
}
|
|
11427
|
+
}
|
|
11428
|
+
async end(specifications, errors, coverage) {
|
|
11429
|
+
const modules = specifications.map((spec) => spec.testModule).filter((s) => s != null);
|
|
11430
|
+
const files = modules.map((m) => m.task);
|
|
11431
|
+
const state = this.vitest.isCancelling ? "interrupted" : process.exitCode ? "failed" : "passed";
|
|
11432
|
+
try {
|
|
11433
|
+
await Promise.all([
|
|
11434
|
+
this.vitest.report("onTestRunEnd", modules, [...errors], state),
|
|
11435
|
+
// TODO: in a perfect world, the coverage should be done in parallel to `onFinished`
|
|
11436
|
+
this.vitest.report("onFinished", files, errors, coverage)
|
|
11437
|
+
]);
|
|
11438
|
+
} finally {
|
|
11439
|
+
if (coverage) {
|
|
11440
|
+
await this.vitest.report("onCoverage", coverage);
|
|
11441
|
+
}
|
|
11442
|
+
}
|
|
11443
|
+
}
|
|
11444
|
+
async reportEvent(id, event) {
|
|
11445
|
+
const task = this.vitest.state.idMap.get(id);
|
|
11446
|
+
const entity = task && this.vitest.state.getReportedEntity(task);
|
|
11447
|
+
assert$1(task && entity, `Entity must be found for task ${task?.name || id}`);
|
|
11448
|
+
if (event === "suite-prepare" && entity.type === "suite") {
|
|
11449
|
+
return await this.vitest.report("onTestSuiteReady", entity);
|
|
11450
|
+
}
|
|
11451
|
+
if (event === "suite-prepare" && entity.type === "module") {
|
|
11452
|
+
return await this.vitest.report("onTestModuleStart", entity);
|
|
11453
|
+
}
|
|
11454
|
+
if (event === "suite-finished") {
|
|
11455
|
+
assert$1(entity.type === "suite" || entity.type === "module", "Entity type must be suite or module");
|
|
11456
|
+
if (entity.state() === "skipped") {
|
|
11457
|
+
await this.reportChildren(entity.children);
|
|
11458
|
+
} else {
|
|
11459
|
+
for (const test of entity.children.tests("skipped")) {
|
|
11460
|
+
if (test.task.result?.pending) {
|
|
11461
|
+
continue;
|
|
11462
|
+
}
|
|
11463
|
+
await this.vitest.report("onTestCaseReady", test);
|
|
11464
|
+
await this.vitest.report("onTestCaseResult", test);
|
|
11465
|
+
}
|
|
11466
|
+
}
|
|
11467
|
+
if (entity.type === "module") {
|
|
11468
|
+
await this.vitest.report("onTestModuleEnd", entity);
|
|
11469
|
+
} else {
|
|
11470
|
+
await this.vitest.report("onTestSuiteResult", entity);
|
|
11471
|
+
}
|
|
11472
|
+
return;
|
|
11473
|
+
}
|
|
11474
|
+
if (event === "test-prepare" && entity.type === "test") {
|
|
11475
|
+
return await this.vitest.report("onTestCaseReady", entity);
|
|
11476
|
+
}
|
|
11477
|
+
if (event === "test-finished" && entity.type === "test") {
|
|
11478
|
+
return await this.vitest.report("onTestCaseResult", entity);
|
|
11479
|
+
}
|
|
11480
|
+
if (event.startsWith("before-hook") || event.startsWith("after-hook")) {
|
|
11481
|
+
const isBefore = event.startsWith("before-hook");
|
|
11482
|
+
const hook = entity.type === "test" ? {
|
|
11483
|
+
name: isBefore ? "beforeEach" : "afterEach",
|
|
11484
|
+
entity
|
|
11485
|
+
} : {
|
|
11486
|
+
name: isBefore ? "beforeAll" : "afterAll",
|
|
11487
|
+
entity
|
|
11488
|
+
};
|
|
11489
|
+
if (event.endsWith("-start")) {
|
|
11490
|
+
await this.vitest.report("onHookStart", hook);
|
|
11491
|
+
} else {
|
|
11492
|
+
await this.vitest.report("onHookEnd", hook);
|
|
11493
|
+
}
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
async reportChildren(children) {
|
|
11497
|
+
for (const child of children) {
|
|
11498
|
+
if (child.type === "test") {
|
|
11499
|
+
await this.vitest.report("onTestCaseReady", child);
|
|
11500
|
+
await this.vitest.report("onTestCaseResult", child);
|
|
11501
|
+
} else {
|
|
11502
|
+
await this.vitest.report("onTestSuiteReady", child);
|
|
11503
|
+
await this.reportChildren(child.children);
|
|
11504
|
+
await this.vitest.report("onTestSuiteResult", child);
|
|
11505
|
+
}
|
|
11506
|
+
}
|
|
11507
|
+
}
|
|
11508
|
+
}
|
|
11509
|
+
|
|
10633
11510
|
class VitestWatcher {
|
|
10634
11511
|
constructor(vitest) {
|
|
10635
11512
|
this.vitest = vitest;
|
|
@@ -10839,13 +11716,12 @@ async function resolveWorkspace(vitest, cliOptions, workspaceConfigPath, workspa
|
|
|
10839
11716
|
const concurrent = limitConcurrency(nodeos__default.availableParallelism?.() || nodeos__default.cpus().length || 5);
|
|
10840
11717
|
projectConfigs.forEach((options, index) => {
|
|
10841
11718
|
const configRoot = workspaceConfigPath ? dirname(workspaceConfigPath) : vitest.config.root;
|
|
10842
|
-
const configFile = typeof options.extends === "string" ? resolve(configRoot, options.extends) : false;
|
|
10843
|
-
const rootOptions = options.extends === true ? vitest._options : {};
|
|
11719
|
+
const configFile = typeof options.extends === "string" ? resolve(configRoot, options.extends) : options.extends === true ? vitest.vite.config.configFile || false : false;
|
|
10844
11720
|
const root = options.root ? resolve(configRoot, options.root) : vitest.config.root;
|
|
10845
11721
|
projectPromises.push(concurrent(() => initializeProject(
|
|
10846
11722
|
index,
|
|
10847
11723
|
vitest,
|
|
10848
|
-
|
|
11724
|
+
{ ...options, root, configFile }
|
|
10849
11725
|
)));
|
|
10850
11726
|
});
|
|
10851
11727
|
for (const path of fileProjects) {
|
|
@@ -10966,7 +11842,7 @@ async function resolveBrowserWorkspace(vitest, names, resolvedProjects) {
|
|
|
10966
11842
|
if (!isTTY) {
|
|
10967
11843
|
throw new Error(`${message} Please, filter projects with --browser=name or --project=name flag or run tests with "headless: true" option.`);
|
|
10968
11844
|
}
|
|
10969
|
-
const prompts = await import('./index.
|
|
11845
|
+
const prompts = await import('./index.Bh7wTRhh.js').then(function (n) { return n.i; });
|
|
10970
11846
|
const { projectName } = await prompts.default({
|
|
10971
11847
|
type: "select",
|
|
10972
11848
|
name: "projectName",
|
|
@@ -11012,7 +11888,7 @@ function cloneConfig(project, { browser, ...config }) {
|
|
|
11012
11888
|
headless: project.vitest._options?.browser?.headless ?? headless ?? currentConfig.headless,
|
|
11013
11889
|
name: browser,
|
|
11014
11890
|
providerOptions: config,
|
|
11015
|
-
instances:
|
|
11891
|
+
instances: undefined
|
|
11016
11892
|
// projects cannot spawn more configs
|
|
11017
11893
|
}
|
|
11018
11894
|
// TODO: should resolve, not merge/override
|
|
@@ -11029,7 +11905,7 @@ async function resolveTestProjectConfigs(vitest, workspaceConfigPath, workspaceD
|
|
|
11029
11905
|
if (!isDynamicPattern(stringOption)) {
|
|
11030
11906
|
const file = resolve(vitest.config.root, stringOption);
|
|
11031
11907
|
if (!existsSync(file)) {
|
|
11032
|
-
const relativeWorkSpaceConfigPath = workspaceConfigPath ? relative(vitest.config.root, workspaceConfigPath) :
|
|
11908
|
+
const relativeWorkSpaceConfigPath = workspaceConfigPath ? relative(vitest.config.root, workspaceConfigPath) : undefined;
|
|
11033
11909
|
const note = workspaceConfigPath ? `Workspace config file "${relativeWorkSpaceConfigPath}"` : "Inline workspace";
|
|
11034
11910
|
throw new Error(`${note} references a non-existing file or a directory: ${file}`);
|
|
11035
11911
|
}
|
|
@@ -11173,11 +12049,13 @@ class Vitest {
|
|
|
11173
12049
|
/** @internal */
|
|
11174
12050
|
_options = {};
|
|
11175
12051
|
/** @internal */
|
|
11176
|
-
reporters =
|
|
12052
|
+
reporters = undefined;
|
|
12053
|
+
/** @internal */
|
|
12054
|
+
vitenode = undefined;
|
|
11177
12055
|
/** @internal */
|
|
11178
|
-
|
|
12056
|
+
runner = undefined;
|
|
11179
12057
|
/** @internal */
|
|
11180
|
-
|
|
12058
|
+
_testRun = undefined;
|
|
11181
12059
|
isFirstRun = true;
|
|
11182
12060
|
restartsCount = 0;
|
|
11183
12061
|
specifications;
|
|
@@ -11255,13 +12133,14 @@ class Vitest {
|
|
|
11255
12133
|
this.restartsCount += 1;
|
|
11256
12134
|
this._browserLastPort = defaultBrowserPort;
|
|
11257
12135
|
this.pool?.close?.();
|
|
11258
|
-
this.pool =
|
|
11259
|
-
this.closingPromise =
|
|
12136
|
+
this.pool = undefined;
|
|
12137
|
+
this.closingPromise = undefined;
|
|
11260
12138
|
this.projects = [];
|
|
11261
12139
|
this.resolvedProjects = [];
|
|
11262
|
-
this._workspaceConfigPath =
|
|
11263
|
-
this.coverageProvider =
|
|
11264
|
-
this.runningPromise =
|
|
12140
|
+
this._workspaceConfigPath = undefined;
|
|
12141
|
+
this.coverageProvider = undefined;
|
|
12142
|
+
this.runningPromise = undefined;
|
|
12143
|
+
this.coreWorkspaceProject = undefined;
|
|
11265
12144
|
this.specifications.clearCache();
|
|
11266
12145
|
this._onUserTestsRerun = [];
|
|
11267
12146
|
const resolved = resolveConfig(this.mode, options, server.config, this.logger);
|
|
@@ -11270,6 +12149,7 @@ class Vitest {
|
|
|
11270
12149
|
this._state = new StateManager();
|
|
11271
12150
|
this._cache = new VitestCache(this.version);
|
|
11272
12151
|
this._snapshot = new SnapshotManager({ ...resolved.snapshotOptions });
|
|
12152
|
+
this._testRun = new TestRun(this);
|
|
11273
12153
|
if (this.config.watch) {
|
|
11274
12154
|
this.watcher.registerWatcher();
|
|
11275
12155
|
}
|
|
@@ -11395,7 +12275,7 @@ class Vitest {
|
|
|
11395
12275
|
return rootFiles.includes(configFile);
|
|
11396
12276
|
});
|
|
11397
12277
|
if (!workspaceConfigName) {
|
|
11398
|
-
return
|
|
12278
|
+
return undefined;
|
|
11399
12279
|
}
|
|
11400
12280
|
return join(configDir, workspaceConfigName);
|
|
11401
12281
|
}
|
|
@@ -11404,7 +12284,7 @@ class Vitest {
|
|
|
11404
12284
|
return resolveWorkspace(
|
|
11405
12285
|
this,
|
|
11406
12286
|
cliOptions,
|
|
11407
|
-
|
|
12287
|
+
undefined,
|
|
11408
12288
|
this.config.workspace
|
|
11409
12289
|
);
|
|
11410
12290
|
}
|
|
@@ -11432,7 +12312,7 @@ class Vitest {
|
|
|
11432
12312
|
return this.specifications.globTestSpecifications(filters);
|
|
11433
12313
|
}
|
|
11434
12314
|
async initCoverageProvider() {
|
|
11435
|
-
if (this.coverageProvider !==
|
|
12315
|
+
if (this.coverageProvider !== undefined) {
|
|
11436
12316
|
return;
|
|
11437
12317
|
}
|
|
11438
12318
|
this.coverageProvider = await getCoverageProvider(
|
|
@@ -11455,43 +12335,35 @@ class Vitest {
|
|
|
11455
12335
|
const { files, errors, coverages } = await readBlobs(this.version, directory || this.config.mergeReports, this.projects);
|
|
11456
12336
|
await this.report("onInit", this);
|
|
11457
12337
|
await this.report("onPathsCollected", files.flatMap((f) => f.filepath));
|
|
11458
|
-
const
|
|
12338
|
+
const specifications = [];
|
|
11459
12339
|
for (const file of files) {
|
|
11460
12340
|
const project = this.getProjectByName(file.projectName || "");
|
|
11461
|
-
const
|
|
11462
|
-
|
|
11463
|
-
workspaceSpecs.set(project, specs);
|
|
11464
|
-
}
|
|
11465
|
-
for (const [project, files2] of workspaceSpecs) {
|
|
11466
|
-
const filepaths = files2.map((f) => f.filepath);
|
|
11467
|
-
this.state.clearFiles(project, filepaths);
|
|
11468
|
-
files2.forEach((file) => {
|
|
11469
|
-
file.logs?.forEach((log) => this.state.updateUserLog(log));
|
|
11470
|
-
});
|
|
11471
|
-
this.state.collectFiles(project, files2);
|
|
12341
|
+
const specification = project.createSpecification(file.filepath, undefined, file.pool);
|
|
12342
|
+
specifications.push(specification);
|
|
11472
12343
|
}
|
|
11473
|
-
await this.report("
|
|
12344
|
+
await this.report("onSpecsCollected", specifications.map((spec) => spec.toJSON()));
|
|
12345
|
+
await this._testRun.start(specifications).catch(noop);
|
|
11474
12346
|
for (const file of files) {
|
|
12347
|
+
const project = this.getProjectByName(file.projectName || "");
|
|
12348
|
+
await this._testRun.enqueued(project, file).catch(noop);
|
|
12349
|
+
await this._testRun.collected(project, [file]).catch(noop);
|
|
11475
12350
|
const logs = [];
|
|
11476
|
-
const
|
|
11477
|
-
const tasks = getTasks(file);
|
|
11478
|
-
for (const task of tasks) {
|
|
12351
|
+
const { packs, events } = convertTasksToEvents(file, (task) => {
|
|
11479
12352
|
if (task.logs) {
|
|
11480
12353
|
logs.push(...task.logs);
|
|
11481
12354
|
}
|
|
11482
|
-
|
|
11483
|
-
}
|
|
12355
|
+
});
|
|
11484
12356
|
logs.sort((log1, log2) => log1.time - log2.time);
|
|
11485
12357
|
for (const log of logs) {
|
|
11486
|
-
await this.
|
|
12358
|
+
await this._testRun.log(log).catch(noop);
|
|
11487
12359
|
}
|
|
11488
|
-
await this.
|
|
12360
|
+
await this._testRun.updated(packs, events).catch(noop);
|
|
11489
12361
|
}
|
|
11490
12362
|
if (hasFailed(files)) {
|
|
11491
12363
|
process.exitCode = 1;
|
|
11492
12364
|
}
|
|
11493
12365
|
this._checkUnhandledErrors(errors);
|
|
11494
|
-
await this.
|
|
12366
|
+
await this._testRun.end(specifications, errors).catch(noop);
|
|
11495
12367
|
await this.initCoverageProvider();
|
|
11496
12368
|
await this.coverageProvider?.mergeReports?.(coverages);
|
|
11497
12369
|
return {
|
|
@@ -11534,15 +12406,19 @@ class Vitest {
|
|
|
11534
12406
|
} finally {
|
|
11535
12407
|
await this.report("onInit", this);
|
|
11536
12408
|
}
|
|
11537
|
-
this.filenamePattern = filters && filters?.length > 0 ? filters :
|
|
12409
|
+
this.filenamePattern = filters && filters?.length > 0 ? filters : undefined;
|
|
11538
12410
|
const files = await this.specifications.getRelevantTestSpecifications(filters);
|
|
11539
12411
|
if (!files.length) {
|
|
12412
|
+
const throwAnError = !this.config.watch || !(this.config.changed || this.config.related?.length);
|
|
12413
|
+
await this._testRun.start([]);
|
|
11540
12414
|
const coverage = await this.coverageProvider?.generateCoverage?.({ allTestsRun: true });
|
|
11541
|
-
|
|
11542
|
-
this.logger.printNoTestFound(filters);
|
|
11543
|
-
if (!this.config.watch || !(this.config.changed || this.config.related?.length)) {
|
|
12415
|
+
if (throwAnError) {
|
|
11544
12416
|
const exitCode = this.config.passWithNoTests ? 0 : 1;
|
|
11545
12417
|
process.exitCode = exitCode;
|
|
12418
|
+
}
|
|
12419
|
+
await this._testRun.end([], [], coverage);
|
|
12420
|
+
await this.reportCoverage(coverage, true);
|
|
12421
|
+
if (throwAnError) {
|
|
11546
12422
|
throw new FilesNotFoundError(this.mode);
|
|
11547
12423
|
}
|
|
11548
12424
|
}
|
|
@@ -11616,7 +12492,7 @@ class Vitest {
|
|
|
11616
12492
|
* @param allTestsRun Indicates whether all tests were run. This only matters for coverage.
|
|
11617
12493
|
*/
|
|
11618
12494
|
async rerunTestSpecifications(specifications, allTestsRun = false) {
|
|
11619
|
-
this.configOverride.testNamePattern =
|
|
12495
|
+
this.configOverride.testNamePattern = undefined;
|
|
11620
12496
|
const files = specifications.map((spec) => spec.moduleId);
|
|
11621
12497
|
await Promise.all([
|
|
11622
12498
|
this.report("onWatcherRerun", files, "rerun test"),
|
|
@@ -11627,10 +12503,7 @@ class Vitest {
|
|
|
11627
12503
|
return result;
|
|
11628
12504
|
}
|
|
11629
12505
|
async runFiles(specs, allTestsRun) {
|
|
11630
|
-
|
|
11631
|
-
this.state.collectPaths(filepaths);
|
|
11632
|
-
await this.report("onPathsCollected", filepaths);
|
|
11633
|
-
await this.report("onSpecsCollected", specs.map((spec) => spec.toJSON()));
|
|
12506
|
+
await this._testRun.start(specs);
|
|
11634
12507
|
await this.runningPromise;
|
|
11635
12508
|
this._onCancelListeners = [];
|
|
11636
12509
|
this.isCancelling = false;
|
|
@@ -11663,18 +12536,17 @@ class Vitest {
|
|
|
11663
12536
|
unhandledErrors: this.state.getUnhandledErrors()
|
|
11664
12537
|
};
|
|
11665
12538
|
} finally {
|
|
11666
|
-
const files = Array.from(new Set(specs.map((spec) => spec.moduleId)));
|
|
11667
|
-
const errors = this.state.getUnhandledErrors();
|
|
11668
12539
|
const coverage = await this.coverageProvider?.generateCoverage({ allTestsRun });
|
|
12540
|
+
const errors = this.state.getUnhandledErrors();
|
|
11669
12541
|
this._checkUnhandledErrors(errors);
|
|
11670
|
-
await this.
|
|
12542
|
+
await this._testRun.end(specs, errors, coverage);
|
|
11671
12543
|
await this.reportCoverage(coverage, allTestsRun);
|
|
11672
12544
|
}
|
|
11673
12545
|
})().finally(() => {
|
|
11674
|
-
this.runningPromise =
|
|
12546
|
+
this.runningPromise = undefined;
|
|
11675
12547
|
this.isFirstRun = false;
|
|
11676
12548
|
this.config.changed = false;
|
|
11677
|
-
this.config.related =
|
|
12549
|
+
this.config.related = undefined;
|
|
11678
12550
|
});
|
|
11679
12551
|
return await this.runningPromise;
|
|
11680
12552
|
}
|
|
@@ -11711,9 +12583,9 @@ class Vitest {
|
|
|
11711
12583
|
unhandledErrors: this.state.getUnhandledErrors()
|
|
11712
12584
|
};
|
|
11713
12585
|
})().finally(() => {
|
|
11714
|
-
this.runningPromise =
|
|
12586
|
+
this.runningPromise = undefined;
|
|
11715
12587
|
this.config.changed = false;
|
|
11716
|
-
this.config.related =
|
|
12588
|
+
this.config.related = undefined;
|
|
11717
12589
|
});
|
|
11718
12590
|
return await this.runningPromise;
|
|
11719
12591
|
}
|
|
@@ -11742,7 +12614,7 @@ class Vitest {
|
|
|
11742
12614
|
/** @internal */
|
|
11743
12615
|
async rerunFiles(files = this.state.getFilepaths(), trigger, allTestsRun = true, resetTestNamePattern = false) {
|
|
11744
12616
|
if (resetTestNamePattern) {
|
|
11745
|
-
this.configOverride.testNamePattern =
|
|
12617
|
+
this.configOverride.testNamePattern = undefined;
|
|
11746
12618
|
}
|
|
11747
12619
|
if (this.filenamePattern) {
|
|
11748
12620
|
const filteredFiles = await this.globTestSpecifications(this.filenamePattern);
|
|
@@ -11783,9 +12655,9 @@ class Vitest {
|
|
|
11783
12655
|
/** @internal */
|
|
11784
12656
|
async changeNamePattern(pattern, files = this.state.getFilepaths(), trigger) {
|
|
11785
12657
|
if (pattern === "") {
|
|
11786
|
-
this.filenamePattern =
|
|
12658
|
+
this.filenamePattern = undefined;
|
|
11787
12659
|
}
|
|
11788
|
-
const testNamePattern = pattern ? new RegExp(pattern) :
|
|
12660
|
+
const testNamePattern = pattern ? new RegExp(pattern) : undefined;
|
|
11789
12661
|
this.configOverride.testNamePattern = testNamePattern;
|
|
11790
12662
|
if (testNamePattern) {
|
|
11791
12663
|
files = files.filter((filepath) => {
|
|
@@ -11854,14 +12726,14 @@ class Vitest {
|
|
|
11854
12726
|
if (pattern instanceof RegExp) {
|
|
11855
12727
|
this.configOverride.testNamePattern = pattern;
|
|
11856
12728
|
} else {
|
|
11857
|
-
this.configOverride.testNamePattern = pattern ? new RegExp(pattern) :
|
|
12729
|
+
this.configOverride.testNamePattern = pattern ? new RegExp(pattern) : undefined;
|
|
11858
12730
|
}
|
|
11859
12731
|
}
|
|
11860
12732
|
/**
|
|
11861
12733
|
* Resets the global test name pattern. This method doesn't run any tests.
|
|
11862
12734
|
*/
|
|
11863
12735
|
resetGlobalTestNamePattern() {
|
|
11864
|
-
this.configOverride.testNamePattern =
|
|
12736
|
+
this.configOverride.testNamePattern = undefined;
|
|
11865
12737
|
}
|
|
11866
12738
|
_rerunTimer;
|
|
11867
12739
|
// we can't use a single `triggerId` yet because vscode extension relies on this
|
|
@@ -11963,12 +12835,12 @@ class Vitest {
|
|
|
11963
12835
|
}
|
|
11964
12836
|
const closePromises = this.resolvedProjects.map((w) => w.close());
|
|
11965
12837
|
if (this.coreWorkspaceProject && !this.resolvedProjects.includes(this.coreWorkspaceProject)) {
|
|
11966
|
-
closePromises.push(this.coreWorkspaceProject.close().then(() => this._vite =
|
|
12838
|
+
closePromises.push(this.coreWorkspaceProject.close().then(() => this._vite = undefined));
|
|
11967
12839
|
}
|
|
11968
12840
|
if (this.pool) {
|
|
11969
12841
|
closePromises.push((async () => {
|
|
11970
12842
|
await this.pool?.close?.();
|
|
11971
|
-
this.pool =
|
|
12843
|
+
this.pool = undefined;
|
|
11972
12844
|
})());
|
|
11973
12845
|
}
|
|
11974
12846
|
closePromises.push(...this._onClose.map((fn) => fn()));
|
|
@@ -11993,7 +12865,7 @@ class Vitest {
|
|
|
11993
12865
|
console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
|
|
11994
12866
|
this.state.getProcessTimeoutCauses().forEach((cause) => console.warn(cause));
|
|
11995
12867
|
if (!this.pool) {
|
|
11996
|
-
const runningServers = [this.
|
|
12868
|
+
const runningServers = [this._vite, ...this.resolvedProjects.map((p) => p._vite)].filter(Boolean).length;
|
|
11997
12869
|
if (runningServers === 1) {
|
|
11998
12870
|
console.warn("Tests closed successfully but something prevents Vite server from exiting");
|
|
11999
12871
|
} else if (runningServers > 1) {
|
|
@@ -12001,7 +12873,9 @@ class Vitest {
|
|
|
12001
12873
|
} else {
|
|
12002
12874
|
console.warn("Tests closed successfully but something prevents the main process from exiting");
|
|
12003
12875
|
}
|
|
12004
|
-
|
|
12876
|
+
if (!this.reporters.some((r) => r instanceof HangingProcessReporter)) {
|
|
12877
|
+
console.warn('You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters');
|
|
12878
|
+
}
|
|
12005
12879
|
}
|
|
12006
12880
|
process.exit();
|
|
12007
12881
|
});
|
|
@@ -12141,7 +13015,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
12141
13015
|
...testConfig.api,
|
|
12142
13016
|
open,
|
|
12143
13017
|
hmr: false,
|
|
12144
|
-
ws: testConfig.api?.middlewareMode ? false :
|
|
13018
|
+
ws: testConfig.api?.middlewareMode ? false : undefined,
|
|
12145
13019
|
preTransformRequests: false,
|
|
12146
13020
|
fs: {
|
|
12147
13021
|
allow: resolveFsAllow(options.root || process.cwd(), testConfig.config)
|
|
@@ -12189,18 +13063,13 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
12189
13063
|
}
|
|
12190
13064
|
);
|
|
12191
13065
|
config.customLogger = silenceImportViteIgnoreWarning(config.customLogger);
|
|
12192
|
-
if (userConfig.coverage?.enabled && !userConfig.coverage.exclude && userConfig.include && config.test) {
|
|
12193
|
-
config.test.coverage = {
|
|
12194
|
-
exclude: [...coverageConfigDefaults.exclude, ...userConfig.include]
|
|
12195
|
-
};
|
|
12196
|
-
}
|
|
12197
13066
|
if (viteConfig.ssr?.noExternal !== true) {
|
|
12198
13067
|
const inline = testConfig.server?.deps?.inline;
|
|
12199
13068
|
if (inline === true) {
|
|
12200
13069
|
config.ssr = { noExternal: true };
|
|
12201
13070
|
} else {
|
|
12202
13071
|
const noExternal = viteConfig.ssr?.noExternal;
|
|
12203
|
-
const noExternalArray = typeof noExternal !== "undefined" ? toArray(noExternal) :
|
|
13072
|
+
const noExternalArray = typeof noExternal !== "undefined" ? toArray(noExternal) : undefined;
|
|
12204
13073
|
const uniqueInline = inline && noExternalArray ? inline.filter((dep) => !noExternalArray.includes(dep)) : inline;
|
|
12205
13074
|
config.ssr = {
|
|
12206
13075
|
noExternal: uniqueInline
|
|
@@ -12288,7 +13157,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
12288
13157
|
}
|
|
12289
13158
|
function removeUndefinedValues(obj) {
|
|
12290
13159
|
for (const key in Object.keys(obj)) {
|
|
12291
|
-
if (obj[key] ===
|
|
13160
|
+
if (obj[key] === undefined) {
|
|
12292
13161
|
delete obj[key];
|
|
12293
13162
|
}
|
|
12294
13163
|
}
|
|
@@ -12320,7 +13189,7 @@ const SELECTION_MAX_INDEX = 7;
|
|
|
12320
13189
|
const ESC = "\x1B[";
|
|
12321
13190
|
class WatchFilter {
|
|
12322
13191
|
filterRL;
|
|
12323
|
-
currentKeyword =
|
|
13192
|
+
currentKeyword = undefined;
|
|
12324
13193
|
message;
|
|
12325
13194
|
results = [];
|
|
12326
13195
|
selectionIndex = -1;
|
|
@@ -12360,20 +13229,20 @@ class WatchFilter {
|
|
|
12360
13229
|
if (this.currentKeyword && this.currentKeyword?.length > 1) {
|
|
12361
13230
|
this.currentKeyword = this.currentKeyword?.slice(0, -1);
|
|
12362
13231
|
} else {
|
|
12363
|
-
this.currentKeyword =
|
|
13232
|
+
this.currentKeyword = undefined;
|
|
12364
13233
|
}
|
|
12365
13234
|
break;
|
|
12366
13235
|
case (key?.ctrl && key?.name === "c"):
|
|
12367
13236
|
case key?.name === "escape":
|
|
12368
13237
|
this.write(`${ESC}1G${ESC}0J`);
|
|
12369
|
-
onSubmit(
|
|
13238
|
+
onSubmit(undefined);
|
|
12370
13239
|
return;
|
|
12371
13240
|
case key?.name === "enter":
|
|
12372
13241
|
case key?.name === "return":
|
|
12373
13242
|
onSubmit(
|
|
12374
13243
|
this.results[this.selectionIndex] || this.currentKeyword || ""
|
|
12375
13244
|
);
|
|
12376
|
-
this.currentKeyword =
|
|
13245
|
+
this.currentKeyword = undefined;
|
|
12377
13246
|
break;
|
|
12378
13247
|
case key?.name === "up":
|
|
12379
13248
|
if (this.selectionIndex && this.selectionIndex > 0) {
|
|
@@ -12390,7 +13259,7 @@ class WatchFilter {
|
|
|
12390
13259
|
}
|
|
12391
13260
|
break;
|
|
12392
13261
|
case (!key?.ctrl && !key?.meta):
|
|
12393
|
-
if (this.currentKeyword ===
|
|
13262
|
+
if (this.currentKeyword === undefined) {
|
|
12394
13263
|
this.currentKeyword = str;
|
|
12395
13264
|
} else {
|
|
12396
13265
|
this.currentKeyword += str || "";
|
|
@@ -12588,7 +13457,7 @@ function registerConsoleShortcuts(ctx, stdin = process.stdin, stdout2) {
|
|
|
12588
13457
|
return;
|
|
12589
13458
|
}
|
|
12590
13459
|
const files = ctx.state.getFilepaths();
|
|
12591
|
-
const cliFiles = ctx.config.standalone && !files.length ? await ctx._globTestFilepaths() :
|
|
13460
|
+
const cliFiles = ctx.config.standalone && !files.length ? await ctx._globTestFilepaths() : undefined;
|
|
12592
13461
|
await ctx.changeNamePattern(
|
|
12593
13462
|
filter?.trim() || "",
|
|
12594
13463
|
cliFiles,
|
|
@@ -12627,7 +13496,7 @@ function registerConsoleShortcuts(ctx, stdin = process.stdin, stdout2) {
|
|
|
12627
13496
|
const lastResults = watchFilter.getLastResults();
|
|
12628
13497
|
await ctx.changeFilenamePattern(
|
|
12629
13498
|
latestFilename,
|
|
12630
|
-
filter && lastResults.length ? lastResults.map((i) => resolve(ctx.config.root, i)) :
|
|
13499
|
+
filter && lastResults.length ? lastResults.map((i) => resolve(ctx.config.root, i)) : undefined
|
|
12631
13500
|
);
|
|
12632
13501
|
}
|
|
12633
13502
|
let rl;
|
|
@@ -12642,7 +13511,7 @@ function registerConsoleShortcuts(ctx, stdin = process.stdin, stdout2) {
|
|
|
12642
13511
|
}
|
|
12643
13512
|
function off() {
|
|
12644
13513
|
rl?.close();
|
|
12645
|
-
rl =
|
|
13514
|
+
rl = undefined;
|
|
12646
13515
|
stdin.removeListener("keypress", keypressHandler);
|
|
12647
13516
|
if (stdin.isTTY) {
|
|
12648
13517
|
stdin.setRawMode(false);
|
|
@@ -12809,7 +13678,7 @@ function formatCollectedAsJSON(files) {
|
|
|
12809
13678
|
const results = [];
|
|
12810
13679
|
files.forEach((file) => {
|
|
12811
13680
|
for (const test of file.children.allTests()) {
|
|
12812
|
-
if (test.
|
|
13681
|
+
if (test.result().state === "skipped") {
|
|
12813
13682
|
continue;
|
|
12814
13683
|
}
|
|
12815
13684
|
const result = {
|
|
@@ -12831,7 +13700,7 @@ function formatCollectedAsString(testModules) {
|
|
|
12831
13700
|
const results = [];
|
|
12832
13701
|
testModules.forEach((testModule) => {
|
|
12833
13702
|
for (const test of testModule.children.allTests()) {
|
|
12834
|
-
if (test.
|
|
13703
|
+
if (test.result().state === "skipped") {
|
|
12835
13704
|
continue;
|
|
12836
13705
|
}
|
|
12837
13706
|
const fullName = `${test.module.task.name} > ${test.fullName}`;
|
|
@@ -12870,4 +13739,4 @@ var cliApi = /*#__PURE__*/Object.freeze({
|
|
|
12870
13739
|
startVitest: startVitest
|
|
12871
13740
|
});
|
|
12872
13741
|
|
|
12873
|
-
export { FilesNotFoundError as F, GitNotFoundError as G, Vitest as V, VitestPlugin as a, VitestPackageInstaller as b, createVitest as c, registerConsoleShortcuts as d, createViteLogger as e, cliApi as f, resolveFsAllow as r, startVitest as s };
|
|
13742
|
+
export { FilesNotFoundError as F, GitNotFoundError as G, TestModule as T, Vitest as V, VitestPlugin as a, VitestPackageInstaller as b, createVitest as c, registerConsoleShortcuts as d, createViteLogger as e, cliApi as f, resolveFsAllow as r, startVitest as s };
|