vitest 4.0.0-beta.12 → 4.0.0-beta.14
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/browser/context.d.ts +6 -0
- package/browser/context.js +20 -0
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +7 -0
- package/dist/chunks/{browser.d.D9YV3JvA.d.ts → browser.d.CM1rjKAX.d.ts} +1 -2
- package/dist/chunks/{cac.r1gel_VZ.js → cac.DOq1v3N-.js} +7 -7
- package/dist/chunks/{cli-api.CpywZzJV.js → cli-api.CD_0qYMh.js} +33 -64
- package/dist/chunks/{coverage.CiB0fs_7.js → coverage.3htTSxXZ.js} +227 -39
- package/dist/chunks/{creator.DfXDsUyL.js → creator.Daoa5_gR.js} +2 -28
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/{global.d.BcFPD2LN.d.ts → global.d.YxmikCHu.d.ts} +1 -1
- package/dist/chunks/{index.uLUz1RDt.js → index.01uBqPwR.js} +1 -1
- package/dist/chunks/{index.CHrBLuEH.js → index.DehVUBn4.js} +2 -109
- package/dist/chunks/{moduleRunner.d.CeYc7nZ0.d.ts → moduleRunner.d.CTZUg34g.d.ts} +1 -2
- package/dist/chunks/{plugin.d.XreRXLXS.d.ts → plugin.d.DvkMsuLk.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CJVTaaWb.d.ts → reporters.d.DhY37FSs.d.ts} +73 -38
- package/dist/chunks/{typechecker.BfOQ86_a.js → typechecker.DsKAhua5.js} +108 -1
- package/dist/chunks/{worker.d.buwuBpBt.d.ts → worker.d.B8jq7m7O.d.ts} +38 -2
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +9 -8
- package/dist/coverage.d.ts +6 -5
- package/dist/coverage.js +6 -5
- package/dist/environments.d.ts +3 -2
- package/dist/index.d.ts +8 -8
- package/dist/module-evaluator.d.ts +4 -3
- package/dist/node.d.ts +9 -8
- package/dist/node.js +20 -20
- package/dist/reporters.d.ts +10 -9
- package/dist/reporters.js +4 -4
- package/package.json +26 -12
- package/dist/chunks/environment.d.BsToaxti.d.ts +0 -65
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @ts-ignore -- @vitest/browser-playwright might not be installed
|
|
2
|
+
export * from '@vitest/browser-playwright/context'
|
|
3
|
+
// @ts-ignore -- @vitest/browser-webdriverio might not be installed
|
|
4
|
+
export * from '@vitest/browser-webdriverio/context'
|
|
5
|
+
// @ts-ignore -- @vitest/browser-preview might not be installed
|
|
6
|
+
export * from '@vitest/browser-preview/context'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Vitest resolves "vitest/browser" as a virtual module instead
|
|
2
|
+
|
|
3
|
+
// fake exports for static analysis
|
|
4
|
+
export const page = null
|
|
5
|
+
export const server = null
|
|
6
|
+
export const userEvent = null
|
|
7
|
+
export const cdp = null
|
|
8
|
+
export const commands = null
|
|
9
|
+
export const locators = null
|
|
10
|
+
export const utils = null
|
|
11
|
+
|
|
12
|
+
const pool = globalThis.__vitest_worker__?.ctx?.pool
|
|
13
|
+
|
|
14
|
+
throw new Error(
|
|
15
|
+
// eslint-disable-next-line prefer-template
|
|
16
|
+
'vitest/browser can be imported only inside the Browser Mode. '
|
|
17
|
+
+ (pool
|
|
18
|
+
? `Your test is running in ${pool} pool. Make sure your regular tests are excluded from the "test.include" glob pattern.`
|
|
19
|
+
: 'Instead, it was imported outside of Vitest.'),
|
|
20
|
+
)
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.DGazh2r6.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
|
-
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.
|
|
4
|
+
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.CTZUg34g.js';
|
|
5
5
|
export { collectTests, startTests } from '@vitest/runner';
|
|
6
6
|
import * as _vitest_spy from '@vitest/spy';
|
|
7
7
|
export { _vitest_spy as SpyModule };
|
|
@@ -15,8 +15,8 @@ import '@vitest/pretty-format';
|
|
|
15
15
|
import '@vitest/snapshot';
|
|
16
16
|
import 'node:vm';
|
|
17
17
|
import 'vite/module-runner';
|
|
18
|
-
import './chunks/worker.d.
|
|
19
|
-
import './chunks/environment.d.
|
|
18
|
+
import './chunks/worker.d.B8jq7m7O.js';
|
|
19
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
20
20
|
import '@vitest/mocker';
|
|
21
21
|
import './chunks/mocker.d.BE_2ls6u.js';
|
|
22
22
|
|
package/dist/browser.js
CHANGED
|
@@ -10,3 +10,10 @@ export { getSafeTimers, setSafeTimers } from '@vitest/utils/timers';
|
|
|
10
10
|
import './chunks/coverage.D_JHT54q.js';
|
|
11
11
|
import '@vitest/snapshot';
|
|
12
12
|
import './chunks/utils.CG9h5ccR.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
const __INTERNAL = { _extendedMethods: /* @__PURE__ */ new Set() };
|
|
18
|
+
|
|
19
|
+
export { __INTERNAL };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TestExecutionMethod } from './worker.d.
|
|
1
|
+
import { T as TestExecutionMethod } from './worker.d.B8jq7m7O.js';
|
|
2
2
|
|
|
3
3
|
type SerializedTestSpecification = [project: {
|
|
4
4
|
name: string | undefined;
|
|
@@ -12,7 +12,6 @@ interface BrowserTesterOptions {
|
|
|
12
12
|
method: TestExecutionMethod;
|
|
13
13
|
files: string[];
|
|
14
14
|
providedContext: string;
|
|
15
|
-
startTime: number;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export type { BrowserTesterOptions as B, SerializedTestSpecification as S };
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
5
|
import { a as defaultPort, d as defaultBrowserPort } from './constants.D_Q9UYh-.js';
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
6
|
+
import { R as ReportersMap } from './index.DehVUBn4.js';
|
|
7
7
|
|
|
8
8
|
function toArr(any) {
|
|
9
9
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "4.0.0-beta.
|
|
622
|
+
var version = "4.0.0-beta.14";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -1341,22 +1341,22 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
async function start(mode, cliFilters, options) {
|
|
1343
1343
|
try {
|
|
1344
|
-
const { startVitest } = await import('./cli-api.
|
|
1344
|
+
const { startVitest } = await import('./cli-api.CD_0qYMh.js').then(function (n) { return n.h; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1345
1345
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1346
1346
|
} catch (e) {
|
|
1347
|
-
const { errorBanner } = await import('./index.
|
|
1347
|
+
const { errorBanner } = await import('./index.DehVUBn4.js').then(function (n) { return n.u; });
|
|
1348
1348
|
if (console.error(`\n${errorBanner("Startup Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1349
1349
|
process.exit();
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
1352
|
async function init(project) {
|
|
1353
1353
|
if (project !== "browser") console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project.")), process.exit(1);
|
|
1354
|
-
const { create } = await import('./creator.
|
|
1354
|
+
const { create } = await import('./creator.Daoa5_gR.js');
|
|
1355
1355
|
await create();
|
|
1356
1356
|
}
|
|
1357
1357
|
async function collect(mode, cliFilters, options) {
|
|
1358
1358
|
try {
|
|
1359
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1359
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CD_0qYMh.js').then(function (n) { return n.h; }), ctx = await prepareVitest(mode, {
|
|
1360
1360
|
...normalizeCliOptions(cliFilters, options),
|
|
1361
1361
|
watch: false,
|
|
1362
1362
|
run: true
|
|
@@ -1374,7 +1374,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
await ctx.close();
|
|
1376
1376
|
} catch (e) {
|
|
1377
|
-
const { errorBanner } = await import('./index.
|
|
1377
|
+
const { errorBanner } = await import('./index.DehVUBn4.js').then(function (n) { return n.u; });
|
|
1378
1378
|
if (console.error(`\n${errorBanner("Collect Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1379
1379
|
process.exit();
|
|
1380
1380
|
}
|
|
@@ -10,9 +10,9 @@ import { A as API_PATH, c as configFiles, d as defaultBrowserPort, a as defaultP
|
|
|
10
10
|
import nodeos__default, { tmpdir } from 'node:os';
|
|
11
11
|
import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, hasFailed, getTasks, isTestCase } from '@vitest/runner/utils';
|
|
12
12
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
13
|
-
import { v as version$1 } from './cac.
|
|
13
|
+
import { v as version$1 } from './cac.DOq1v3N-.js';
|
|
14
14
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
15
|
-
import { p as parse,
|
|
15
|
+
import { p as parse, s as stringify, b as TraceMap, o as originalPositionFor, c as ancestor, d as createDefinesScript, e as convertTasksToEvents } from './typechecker.DsKAhua5.js';
|
|
16
16
|
import require$$0$3 from 'events';
|
|
17
17
|
import require$$1$1 from 'https';
|
|
18
18
|
import require$$2 from 'http';
|
|
@@ -26,14 +26,13 @@ import require$$0$1 from 'buffer';
|
|
|
26
26
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
27
27
|
import crypto, { createHash } from 'node:crypto';
|
|
28
28
|
import { distDir, rootDir } from '../path.js';
|
|
29
|
-
import { h as hash,
|
|
30
|
-
import { b as TraceMap, o as originalPositionFor, c as ancestor, d as createDefinesScript, e as convertTasksToEvents } from './typechecker.BfOQ86_a.js';
|
|
31
|
-
import createDebug from 'debug';
|
|
29
|
+
import { d as createDebugger, h as hash, e as createFetchModuleFunction, n as normalizeResolvedIdToUrl, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, f as isBrowserEnabled, r as resolveConfig, j as groupBy, k as getCoverageProvider, l as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.3htTSxXZ.js';
|
|
32
30
|
import { VitestModuleEvaluator } from '#module-evaluator';
|
|
33
31
|
import { ModuleRunner } from 'vite/module-runner';
|
|
34
32
|
import { Console } from 'node:console';
|
|
35
33
|
import c from 'tinyrainbow';
|
|
36
34
|
import { highlight } from '@vitest/utils/highlight';
|
|
35
|
+
import { p as printError, f as formatProjectName, w as withLabel, e as errorBanner, d as divider, h as generateCodeFrame, R as ReportersMap, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.DehVUBn4.js';
|
|
37
36
|
import { createRequire, builtinModules, isBuiltin } from 'node:module';
|
|
38
37
|
import url, { pathToFileURL } from 'node:url';
|
|
39
38
|
import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
|
|
@@ -46,7 +45,7 @@ import { c as configDefaults } from './defaults.CXFFjsi8.js';
|
|
|
46
45
|
import { KNOWN_ASSET_RE } from '@vitest/utils/constants';
|
|
47
46
|
import { findNearestPackageData } from '@vitest/utils/resolver';
|
|
48
47
|
import * as esModuleLexer from 'es-module-lexer';
|
|
49
|
-
import { a as BenchmarkReportsMap } from './index.
|
|
48
|
+
import { a as BenchmarkReportsMap } from './index.01uBqPwR.js';
|
|
50
49
|
import assert$1 from 'node:assert';
|
|
51
50
|
import { serializeValue } from '@vitest/utils/serialize';
|
|
52
51
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
@@ -5022,7 +5021,7 @@ var WebSocketServer = /*@__PURE__*/getDefaultExportFromCjs(websocketServerExport
|
|
|
5022
5021
|
async function getModuleGraph(ctx, projectName, id, browser = false) {
|
|
5023
5022
|
const graph = {}, externalized = /* @__PURE__ */ new Set(), inlined = /* @__PURE__ */ new Set(), project = ctx.getProjectByName(projectName);
|
|
5024
5023
|
async function get(mod, seen = /* @__PURE__ */ new Map()) {
|
|
5025
|
-
if (!mod || !mod.id || mod.id === "\
|
|
5024
|
+
if (!mod || !mod.id || mod.id === "\0vitest/browser") return;
|
|
5026
5025
|
if (seen.has(mod)) return seen.get(mod);
|
|
5027
5026
|
let id = clearId(mod.id);
|
|
5028
5027
|
seen.set(mod, id);
|
|
@@ -5230,11 +5229,6 @@ var setup$1 = /*#__PURE__*/Object.freeze({
|
|
|
5230
5229
|
setup: setup
|
|
5231
5230
|
});
|
|
5232
5231
|
|
|
5233
|
-
function createDebugger(namespace) {
|
|
5234
|
-
const debug = createDebug(namespace);
|
|
5235
|
-
if (debug.enabled) return debug;
|
|
5236
|
-
}
|
|
5237
|
-
|
|
5238
5232
|
const debug = createDebugger("vitest:ast-collect-info"), verbose = createDebugger("vitest:ast-collect-verbose");
|
|
5239
5233
|
function astParseFile(filepath, code) {
|
|
5240
5234
|
const ast = parseAst(code);
|
|
@@ -5782,7 +5776,7 @@ class Logger {
|
|
|
5782
5776
|
if (!project.browser) return;
|
|
5783
5777
|
const resolvedUrls = project.browser.vite.resolvedUrls, origin = resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
|
|
5784
5778
|
if (!origin) return;
|
|
5785
|
-
const output = project.isRootProject() ? "" : formatProjectName(project), provider = project.browser.provider
|
|
5779
|
+
const output = project.isRootProject() ? "" : formatProjectName(project), provider = project.browser.provider?.name, providerString = provider === "preview" ? "" : ` by ${c.reset(c.bold(provider))}`;
|
|
5786
5780
|
this.log(c.dim(`${output}Browser runner started${providerString} ${c.dim("at")} ${c.blue(new URL("/__vitest_test__/", origin))}\n`));
|
|
5787
5781
|
}
|
|
5788
5782
|
printUnhandledErrors(errors) {
|
|
@@ -7359,28 +7353,22 @@ class TestProject {
|
|
|
7359
7353
|
/** @internal */
|
|
7360
7354
|
_parent;
|
|
7361
7355
|
/** @internal */
|
|
7362
|
-
_initParentBrowser = deduped(async () => {
|
|
7356
|
+
_initParentBrowser = deduped(async (childProject) => {
|
|
7363
7357
|
if (!this.isBrowserEnabled() || this._parentBrowser) return;
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
const browser = await
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
},
|
|
7374
|
-
...MocksPlugins({ filter(id) {
|
|
7375
|
-
return !(id.includes(distRoot) || id.includes(cacheDir));
|
|
7376
|
-
} }),
|
|
7377
|
-
MetaEnvReplacerPlugin()
|
|
7378
|
-
], [CoverageTransform(this.vitest)]);
|
|
7358
|
+
const provider = this.config.browser.provider || childProject.config.browser.provider;
|
|
7359
|
+
if (provider == null) throw new Error(`Proider was not specified in the "browser.provider" setting. Please, pass down playwright(), webdriverio() or preview() from "@vitest/browser-playwright", "@vitest/browser-webdriverio" or "@vitest/browser-preview" package respectively.`);
|
|
7360
|
+
if (typeof provider.serverFactory !== "function") throw new TypeError(`The browser provider options do not return a "serverFactory" function. Are you using the latest "@vitest/browser-${provider.name}" package?`);
|
|
7361
|
+
const browser = await provider.serverFactory({
|
|
7362
|
+
project: this,
|
|
7363
|
+
mocksPlugins: (options) => MocksPlugins(options),
|
|
7364
|
+
metaEnvReplacer: () => MetaEnvReplacerPlugin(),
|
|
7365
|
+
coveragePlugin: () => CoverageTransform(this.vitest)
|
|
7366
|
+
});
|
|
7379
7367
|
if (this._parentBrowser = browser, this.config.browser.ui) setup(this.vitest, browser.vite);
|
|
7380
7368
|
});
|
|
7381
7369
|
/** @internal */
|
|
7382
7370
|
_initBrowserServer = deduped(async () => {
|
|
7383
|
-
if (await this._parent?._initParentBrowser(), !this.browser && this._parent?._parentBrowser) this.browser = this._parent._parentBrowser.spawn(this), await this.vitest.report("onBrowserInit", this);
|
|
7371
|
+
if (await this._parent?._initParentBrowser(this), !this.browser && this._parent?._parentBrowser) this.browser = this._parent._parentBrowser.spawn(this), await this.vitest.report("onBrowserInit", this);
|
|
7384
7372
|
});
|
|
7385
7373
|
/**
|
|
7386
7374
|
* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts.
|
|
@@ -7584,19 +7572,13 @@ async function resolveProjects(vitest, cliOptions, workspaceConfigPath, projects
|
|
|
7584
7572
|
}
|
|
7585
7573
|
async function resolveBrowserProjects(vitest, names, resolvedProjects) {
|
|
7586
7574
|
const removeProjects = /* @__PURE__ */ new Set();
|
|
7587
|
-
resolvedProjects.forEach((project) => {
|
|
7575
|
+
return resolvedProjects.forEach((project) => {
|
|
7588
7576
|
if (!project.config.browser.enabled) return;
|
|
7589
|
-
const instances = project.config.browser.instances || []
|
|
7590
|
-
if (instances.length === 0
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
}
|
|
7594
|
-
`No browser "instances" were defined`,
|
|
7595
|
-
project.name ? ` for the "${project.name}" project. ` : ". ",
|
|
7596
|
-
`Running tests in "${project.config.browser.name}" browser. `,
|
|
7597
|
-
"The \"browser.name\" field is deprecated since Vitest 3. ",
|
|
7598
|
-
"Read more: https://vitest.dev/guide/browser/config#browser-instances"
|
|
7599
|
-
].filter(Boolean).join("")));
|
|
7577
|
+
const instances = project.config.browser.instances || [];
|
|
7578
|
+
if (instances.length === 0) {
|
|
7579
|
+
removeProjects.add(project);
|
|
7580
|
+
return;
|
|
7581
|
+
}
|
|
7600
7582
|
const originalName = project.config.name, filteredInstances = vitest.matchesProjectFilter(originalName) ? instances : instances.filter((instance) => {
|
|
7601
7583
|
const newName = instance.name;
|
|
7602
7584
|
return vitest.matchesProjectFilter(newName);
|
|
@@ -7614,6 +7596,7 @@ async function resolveBrowserProjects(vitest, names, resolvedProjects) {
|
|
|
7614
7596
|
}
|
|
7615
7597
|
const name = config.name;
|
|
7616
7598
|
if (name == null) throw new Error(`The browser configuration must have a "name" property. This is a bug in Vitest. Please, open a new issue with reproduction`);
|
|
7599
|
+
if (config.provider?.name != null && project.config.browser.provider?.name != null && config.provider?.name !== project.config.browser.provider?.name) throw new Error(`The instance cannot have a different provider from its parent. The "${name}" instance specifies "${config.provider?.name}" provider, but its parent has a "${project.config.browser.provider?.name}" provider.`);
|
|
7617
7600
|
if (names.has(name)) throw new Error([
|
|
7618
7601
|
`Cannot define a nested project for a ${browser} browser. The project name "${name}" was already defined. `,
|
|
7619
7602
|
"If you have multiple instances for the same browser, make sure to define a custom \"name\". ",
|
|
@@ -7625,26 +7608,7 @@ async function resolveBrowserProjects(vitest, names, resolvedProjects) {
|
|
|
7625
7608
|
const clone = TestProject._cloneBrowserProject(project, clonedConfig);
|
|
7626
7609
|
resolvedProjects.push(clone);
|
|
7627
7610
|
}), removeProjects.add(project);
|
|
7628
|
-
}), resolvedProjects
|
|
7629
|
-
const headedBrowserProjects = resolvedProjects.filter((project) => {
|
|
7630
|
-
return project.config.browser.enabled && !project.config.browser.headless;
|
|
7631
|
-
});
|
|
7632
|
-
if (headedBrowserProjects.length > 1) {
|
|
7633
|
-
const message = [`Found multiple projects that run browser tests in headed mode: "${headedBrowserProjects.map((p) => p.name).join("\", \"")}".`, ` Vitest cannot run multiple headed browsers at the same time.`].join("");
|
|
7634
|
-
if (!isTTY) throw new Error(`${message} Please, filter projects with --browser=name or --project=name flag or run tests with "headless: true" option.`);
|
|
7635
|
-
const { projectName } = await (await import('./index.Dc3xnDvT.js').then(function (n) { return n.i; })).default({
|
|
7636
|
-
type: "select",
|
|
7637
|
-
name: "projectName",
|
|
7638
|
-
choices: headedBrowserProjects.map((project) => ({
|
|
7639
|
-
title: project.name,
|
|
7640
|
-
value: project.name
|
|
7641
|
-
})),
|
|
7642
|
-
message: `${message} Select a single project to run or cancel and run tests with "headless: true" option. Note that you can also start tests with --browser=name or --project=name flag.`
|
|
7643
|
-
});
|
|
7644
|
-
if (!projectName) throw new Error("The test run was aborted.");
|
|
7645
|
-
return resolvedProjects.filter((project) => project.name === projectName);
|
|
7646
|
-
}
|
|
7647
|
-
return resolvedProjects;
|
|
7611
|
+
}), resolvedProjects.filter((project) => !removeProjects.has(project));
|
|
7648
7612
|
}
|
|
7649
7613
|
function cloneConfig(project, { browser,...config }) {
|
|
7650
7614
|
const { locators, viewport, testerHtmlPath, headless, screenshotDirectory, screenshotFailures, browser: _browser, name, provider,...overrideConfig } = config, currentConfig = project.config.browser, clonedConfig = deepClone(project.config);
|
|
@@ -9170,7 +9134,12 @@ class Vitest {
|
|
|
9170
9134
|
}
|
|
9171
9135
|
if (!this.projects.length) {
|
|
9172
9136
|
const filter = toArray(resolved.project).join("\", \"");
|
|
9173
|
-
|
|
9137
|
+
if (filter) throw new Error(`No projects matched the filter "${filter}".`);
|
|
9138
|
+
{
|
|
9139
|
+
let error = `Vitest wasn't able to resolve any project.`;
|
|
9140
|
+
if (this.config.browser.enabled && !this.config.browser.instances?.length) error += ` Please, check that you specified the "browser.instances" option.`;
|
|
9141
|
+
throw new Error(error);
|
|
9142
|
+
}
|
|
9174
9143
|
}
|
|
9175
9144
|
if (!this.coreWorkspaceProject) this.coreWorkspaceProject = TestProject._createBasicProject(this);
|
|
9176
9145
|
if (this.config.testNamePattern) this.configOverride.testNamePattern = this.config.testNamePattern;
|
|
@@ -10277,4 +10246,4 @@ var cliApi = /*#__PURE__*/Object.freeze({
|
|
|
10277
10246
|
startVitest: startVitest
|
|
10278
10247
|
});
|
|
10279
10248
|
|
|
10280
|
-
export { FilesNotFoundError as F, GitNotFoundError as G, Vitest as V, VitestPlugin as a, VitestPackageInstaller as b, createVitest as c, experimental_getRunnerTask as d, escapeTestName as e, registerConsoleShortcuts as f, createViteLogger as g,
|
|
10249
|
+
export { FilesNotFoundError as F, GitNotFoundError as G, Vitest as V, VitestPlugin as a, VitestPackageInstaller as b, createVitest as c, experimental_getRunnerTask as d, escapeTestName as e, registerConsoleShortcuts as f, createViteLogger as g, cliApi as h, isValidApiRequest as i, resolveFsAllow as r, startVitest as s };
|