vitest 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +320 -30
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.tiemDJX6.js → base.BO5Jx7vw.js} +1 -1
- package/dist/chunks/{cac.B9PaPYY1.js → cac.BSMVokHR.js} +4 -4
- package/dist/chunks/{cli-api.CHxC4-U8.js → cli-api.btGgw3PC.js} +2843 -2778
- package/dist/chunks/{console.DI3gHgtH.js → console.CfT1Wjed.js} +1 -1
- package/dist/chunks/{creator.Cf-MKt9i.js → creator.CBPphXqR.js} +1 -1
- package/dist/chunks/{globals.HsM2o-0O.js → globals.Bdzt04Qm.js} +2 -2
- package/dist/chunks/{index.mAqbj9F9.js → index.-d_XpZEA.js} +1 -1
- package/dist/chunks/{index.Ckn0Cw1h.js → index.4GFF2h22.js} +1 -1
- package/dist/chunks/{index.FcPVJkIQ.js → index.Dz2opmmU.js} +21 -4
- package/dist/chunks/{index.BpojBOif.js → index.X0nbfr6-.js} +3 -3
- package/dist/chunks/{reporters.DAfKSDh5.d.ts → reporters.C4ZHgdxQ.d.ts} +9 -9
- package/dist/chunks/{resolveConfig.D1DENLPF.js → resolveConfig.Dha6ilPI.js} +58 -40
- package/dist/chunks/{runBaseTests.D-Gcin7G.js → runBaseTests.Cx4wXyTR.js} +5 -5
- package/dist/chunks/{setup-common.DF96bIYE.js → setup-common.BKyF15v_.js} +1 -1
- package/dist/chunks/{vi.DUs2eKik.js → vi.BskyZC5g.js} +2 -0
- package/dist/chunks/{vite.8fk186v-.d.ts → vite.YH7MrecS.d.ts} +1 -1
- package/dist/chunks/{vm.CPXwWp4C.js → vm.DB_hLchi.js} +1 -1
- package/dist/chunks/{worker.Chrs-_NL.d.ts → worker.B6RjTtbk.d.ts} +40 -26
- package/dist/chunks/{worker.Qtv8v5nL.d.ts → worker.CcJLfX8w.d.ts} +1 -1
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +16 -11
- package/dist/coverage.d.ts +65 -28
- package/dist/coverage.js +249 -108
- package/dist/execute.d.ts +1 -1
- package/dist/index.d.ts +29 -12
- package/dist/index.js +3 -3
- package/dist/node.d.ts +4 -4
- package/dist/node.js +7 -6
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +1 -1
- package/dist/runners.js +1 -1
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +4 -4
- package/dist/workers/threads.js +1 -1
- package/dist/workers/vmForks.js +2 -2
- package/dist/workers/vmThreads.js +2 -2
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +3 -3
- package/package.json +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve, dirname, relative } from 'node:path';
|
|
2
2
|
import { existsSync, writeFileSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { p as prompt, f as findUp } from './index.
|
|
4
|
+
import { p as prompt, f as findUp } from './index.X0nbfr6-.js';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
6
|
import { detectPackageManager, installPackage } from './index.CPD77dLA.js';
|
|
7
7
|
import { x } from 'tinyexec';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.fzPh7AOq.js';
|
|
2
|
-
import { V as VitestIndex } from './index.
|
|
2
|
+
import { V as VitestIndex } from './index.-d_XpZEA.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import './benchmark.C8CRJYG4.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
@@ -10,7 +10,7 @@ import './utils.Ck2hJTRs.js';
|
|
|
10
10
|
import './env.CmHVDJnw.js';
|
|
11
11
|
import 'std-env';
|
|
12
12
|
import './run-once.Sxe67Wng.js';
|
|
13
|
-
import './vi.
|
|
13
|
+
import './vi.BskyZC5g.js';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
16
16
|
import '@vitest/expect';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
2
2
|
import { b as bench } from './benchmark.C8CRJYG4.js';
|
|
3
3
|
import { i as isFirstRun, a as runOnce } from './run-once.Sxe67Wng.js';
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.BskyZC5g.js';
|
|
5
5
|
import { g as getWorkerState } from './utils.Ck2hJTRs.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
@@ -4,7 +4,7 @@ import { distDir } from '../path.js';
|
|
|
4
4
|
import { g as getWorkerState } from './utils.Ck2hJTRs.js';
|
|
5
5
|
import { r as rpc } from './rpc.B7Mfb-Yf.js';
|
|
6
6
|
import { t as takeCoverageInsideWorker } from './coverage.zlNdAMHK.js';
|
|
7
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.
|
|
7
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.BKyF15v_.js';
|
|
8
8
|
|
|
9
9
|
function setupChaiConfig(config) {
|
|
10
10
|
Object.assign(chai.config, config);
|
|
@@ -20,7 +20,7 @@ import { Console } from 'node:console';
|
|
|
20
20
|
import process$1 from 'node:process';
|
|
21
21
|
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers.BFTU3MAI.js';
|
|
22
22
|
import require$$0 from 'assert';
|
|
23
|
-
import require$$
|
|
23
|
+
import require$$0$1 from 'events';
|
|
24
24
|
import { createRequire } from 'node:module';
|
|
25
25
|
import { mkdir, writeFile, readdir, stat, readFile } from 'node:fs/promises';
|
|
26
26
|
|
|
@@ -152,7 +152,11 @@ class TestCase extends ReportedTaskImplementation {
|
|
|
152
152
|
*/
|
|
153
153
|
get fullName() {
|
|
154
154
|
if (this.#fullName === void 0) {
|
|
155
|
-
|
|
155
|
+
if (this.parent.type !== "module") {
|
|
156
|
+
this.#fullName = `${this.parent.fullName} > ${this.name}`;
|
|
157
|
+
} else {
|
|
158
|
+
this.#fullName = this.name;
|
|
159
|
+
}
|
|
156
160
|
}
|
|
157
161
|
return this.#fullName;
|
|
158
162
|
}
|
|
@@ -339,7 +343,11 @@ class TestSuite extends SuiteImplementation {
|
|
|
339
343
|
*/
|
|
340
344
|
get fullName() {
|
|
341
345
|
if (this.#fullName === void 0) {
|
|
342
|
-
|
|
346
|
+
if (this.parent.type !== "module") {
|
|
347
|
+
this.#fullName = `${this.parent.fullName} > ${this.name}`;
|
|
348
|
+
} else {
|
|
349
|
+
this.#fullName = this.name;
|
|
350
|
+
}
|
|
343
351
|
}
|
|
344
352
|
return this.#fullName;
|
|
345
353
|
}
|
|
@@ -2950,7 +2958,7 @@ function requireSignalExit () {
|
|
|
2950
2958
|
var signals = requireSignals();
|
|
2951
2959
|
var isWin = /^win/i.test(process.platform);
|
|
2952
2960
|
|
|
2953
|
-
var EE = require$$
|
|
2961
|
+
var EE = require$$0$1;
|
|
2954
2962
|
/* istanbul ignore if */
|
|
2955
2963
|
if (typeof EE !== 'function') {
|
|
2956
2964
|
EE = EE.EventEmitter;
|
|
@@ -4175,6 +4183,15 @@ Failure screenshot${length > 1 ? "s" : ""}:`);
|
|
|
4175
4183
|
logger.error(`${e.codeFrame}
|
|
4176
4184
|
`);
|
|
4177
4185
|
}
|
|
4186
|
+
if ("__vitest_rollup_error__" in e) {
|
|
4187
|
+
const err = e.__vitest_rollup_error__;
|
|
4188
|
+
logger.error([
|
|
4189
|
+
err.plugin && ` Plugin: ${c.magenta(err.plugin)}`,
|
|
4190
|
+
err.id && ` File: ${c.cyan(err.id)}${err.loc ? `:${err.loc.line}:${err.loc.column}` : ""}`,
|
|
4191
|
+
err.frame && c.yellow(err.frame.split(/\r?\n/g).map((l) => ` `.repeat(2) + l).join(`
|
|
4192
|
+
`))
|
|
4193
|
+
].filter(Boolean).join("\n"));
|
|
4194
|
+
}
|
|
4178
4195
|
if (e.diff) {
|
|
4179
4196
|
displayDiff(e.diff, logger.console);
|
|
4180
4197
|
}
|
|
@@ -4,7 +4,7 @@ import process$1 from 'node:process';
|
|
|
4
4
|
import { promises } from 'node:fs';
|
|
5
5
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
6
6
|
import require$$0 from 'readline';
|
|
7
|
-
import require$$
|
|
7
|
+
import require$$0$1 from 'events';
|
|
8
8
|
|
|
9
9
|
function _mergeNamespaces(n, m) {
|
|
10
10
|
m.forEach(function (e) {
|
|
@@ -795,7 +795,7 @@ function requirePrompt$1 () {
|
|
|
795
795
|
const _require = requireUtil$1(),
|
|
796
796
|
action = _require.action;
|
|
797
797
|
|
|
798
|
-
const EventEmitter = require$$
|
|
798
|
+
const EventEmitter = require$$0$1;
|
|
799
799
|
|
|
800
800
|
const _require2 = requireSrc(),
|
|
801
801
|
beep = _require2.beep,
|
|
@@ -3957,7 +3957,7 @@ function requirePrompt () {
|
|
|
3957
3957
|
|
|
3958
3958
|
const readline = require$$0;
|
|
3959
3959
|
const { action } = requireUtil();
|
|
3960
|
-
const EventEmitter = require$$
|
|
3960
|
+
const EventEmitter = require$$0$1;
|
|
3961
3961
|
const { beep, cursor } = requireSrc();
|
|
3962
3962
|
const color = requireKleur();
|
|
3963
3963
|
|
|
@@ -774,7 +774,7 @@ declare class ReportedTaskImplementation {
|
|
|
774
774
|
/**
|
|
775
775
|
* Creates a new reported task instance and stores it in the project's state for future use.
|
|
776
776
|
*/
|
|
777
|
-
static register(task: Task, project: WorkspaceProject):
|
|
777
|
+
static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestModule;
|
|
778
778
|
}
|
|
779
779
|
declare class TestCase extends ReportedTaskImplementation {
|
|
780
780
|
#private;
|
|
@@ -838,20 +838,20 @@ declare class TestCollection {
|
|
|
838
838
|
/**
|
|
839
839
|
* Filters all tests that are part of this collection and its children.
|
|
840
840
|
*/
|
|
841
|
-
allTests(state?: TestResult['state'] | 'running'):
|
|
841
|
+
allTests(state?: TestResult['state'] | 'running'): Generator<TestCase, undefined, void>;
|
|
842
842
|
/**
|
|
843
843
|
* Filters only the tests that are part of this collection.
|
|
844
844
|
*/
|
|
845
|
-
tests(state?: TestResult['state'] | 'running'):
|
|
845
|
+
tests(state?: TestResult['state'] | 'running'): Generator<TestCase, undefined, void>;
|
|
846
846
|
/**
|
|
847
847
|
* Filters only the suites that are part of this collection.
|
|
848
848
|
*/
|
|
849
|
-
suites():
|
|
849
|
+
suites(): Generator<TestSuite, undefined, void>;
|
|
850
850
|
/**
|
|
851
851
|
* Filters all suites that are part of this collection and its children.
|
|
852
852
|
*/
|
|
853
|
-
allSuites():
|
|
854
|
-
[Symbol.iterator]():
|
|
853
|
+
allSuites(): Generator<TestSuite, undefined, void>;
|
|
854
|
+
[Symbol.iterator](): Generator<TestSuite | TestCase, undefined, void>;
|
|
855
855
|
}
|
|
856
856
|
|
|
857
857
|
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
@@ -1006,7 +1006,7 @@ declare class StateManager {
|
|
|
1006
1006
|
taskFileMap: WeakMap<Task, File>;
|
|
1007
1007
|
errorsSet: Set<unknown>;
|
|
1008
1008
|
processTimeoutCauses: Set<string>;
|
|
1009
|
-
reportedTasksMap: WeakMap<Task,
|
|
1009
|
+
reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestModule>;
|
|
1010
1010
|
catchError(err: unknown, type: string): void;
|
|
1011
1011
|
clearErrors(): void;
|
|
1012
1012
|
getUnhandledErrors(): unknown[];
|
|
@@ -1023,7 +1023,7 @@ declare class StateManager {
|
|
|
1023
1023
|
collectFiles(project: WorkspaceProject, files?: File[]): void;
|
|
1024
1024
|
clearFiles(project: WorkspaceProject, paths?: string[]): void;
|
|
1025
1025
|
updateId(task: Task, project: WorkspaceProject): void;
|
|
1026
|
-
getReportedEntity(task: Task):
|
|
1026
|
+
getReportedEntity(task: Task): TestCase | TestSuite | TestModule | undefined;
|
|
1027
1027
|
updateTasks(packs: TaskResultPack[]): void;
|
|
1028
1028
|
updateUserLog(log: UserConsoleLog): void;
|
|
1029
1029
|
getCountOfFailedTests(): number;
|
|
@@ -2744,4 +2744,4 @@ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
|
|
|
2744
2744
|
extends?: string;
|
|
2745
2745
|
});
|
|
2746
2746
|
|
|
2747
|
-
export { type BrowserProviderInitializationOptions as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type ResolvedConfig as E, type ProjectConfig as F, type BenchmarkUserOptions as G, type VitestOptions as H, type InlineConfig as I, WorkspaceProject as J, type TestSequencer as K, Logger as L, type WorkspaceSpec as M, TestModule as N, type ModuleDiagnostic as O, type Pool as P, type ProcessPool as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, getFilePoolName as X, VitestPackageInstaller as Y, TestSpecification as Z, type TestSequencerConstructor as _, type
|
|
2747
|
+
export { type BrowserProviderInitializationOptions as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type ResolvedConfig as E, type ProjectConfig as F, type BenchmarkUserOptions as G, type VitestOptions as H, type InlineConfig as I, WorkspaceProject as J, type TestSequencer as K, Logger as L, type WorkspaceSpec as M, TestModule as N, type ModuleDiagnostic as O, type Pool as P, type ProcessPool as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, getFilePoolName as X, VitestPackageInstaller as Y, TestSpecification as Z, type TestSequencerConstructor as _, type ReportContext as a, type BrowserProvider as a0, type CDPSession as a1, type BrowserProviderModule as a2, type ResolvedBrowserOptions as a3, type BrowserProviderOptions as a4, type BrowserBuiltinProvider as a5, type BrowserCommand as a6, type BrowserCommandContext as a7, type BrowserServer as a8, type BrowserServerState as a9, BaseReporter as aA, TestFile as aB, type FileDiagnostic as aC, ReportersMap as aD, type BuiltinReporters as aE, type BuiltinReporterOptions as aF, type JsonAssertionResult as aG, type JsonTestResult as aH, type JsonTestResults as aI, BenchmarkReportsMap as aJ, type BenchmarkBuiltinReporters as aK, type BrowserServerStateContext as aa, type BrowserOrchestrator as ab, type JsonOptions as ac, type JUnitOptions as ad, type HTMLOptions as ae, TestCase as af, TestSuite as ag, TestProject as ah, TestCollection as ai, type TaskOptions as aj, type TestDiagnostic as ak, type TestResult as al, type TestResultPassed as am, type TestResultFailed as an, type TestResultSkipped as ao, type ResolvedProjectConfig as ap, DefaultReporter as aq, BasicReporter as ar, DotReporter as as, JsonReporter as at, VerboseReporter as au, TapReporter as av, JUnitReporter as aw, TapFlatReporter as ax, HangingProcessReporter as ay, GithubActionsReporter as az, type CoverageProviderModule as b, type CoverageV8Options as c, type UserProjectConfigFn as d, type UserProjectConfigExport as e, type VitestEnvironment as f, type RawErrsMap as g, type CollectLineNumbers as h, type CollectLines as i, type RootAndTarget as j, type Context as k, type CoverageReporter as l, type CoverageProviderName as m, type CoverageOptions as n, type CoverageIstanbulOptions as o, type CustomProviderOptions as p, type Reporter as q, type BrowserScript as r, type BrowserConfigOptions as s, type BuiltinEnvironment as t, type PoolOptions as u, type CSSModuleScopeStrategy as v, type VitestRunMode as w, type TransformModePatterns as x, type TypecheckConfig as y, type UserConfig as z };
|
|
@@ -3681,7 +3681,12 @@ function requireMicromatch () {
|
|
|
3681
3681
|
const braces = requireBraces();
|
|
3682
3682
|
const picomatch = requirePicomatch();
|
|
3683
3683
|
const utils = requireUtils();
|
|
3684
|
-
|
|
3684
|
+
|
|
3685
|
+
const isEmptyString = v => v === '' || v === './';
|
|
3686
|
+
const hasBraces = v => {
|
|
3687
|
+
const index = v.indexOf('{');
|
|
3688
|
+
return index > -1 && v.indexOf('}', index) > -1;
|
|
3689
|
+
};
|
|
3685
3690
|
|
|
3686
3691
|
/**
|
|
3687
3692
|
* Returns an array of strings that match one or more glob patterns.
|
|
@@ -4122,7 +4127,7 @@ function requireMicromatch () {
|
|
|
4122
4127
|
|
|
4123
4128
|
micromatch.braces = (pattern, options) => {
|
|
4124
4129
|
if (typeof pattern !== 'string') throw new TypeError('Expected a string');
|
|
4125
|
-
if ((options && options.nobrace === true) ||
|
|
4130
|
+
if ((options && options.nobrace === true) || !hasBraces(pattern)) {
|
|
4126
4131
|
return [pattern];
|
|
4127
4132
|
}
|
|
4128
4133
|
return braces(pattern, options);
|
|
@@ -4141,6 +4146,8 @@ function requireMicromatch () {
|
|
|
4141
4146
|
* Expose micromatch
|
|
4142
4147
|
*/
|
|
4143
4148
|
|
|
4149
|
+
// exposed for tests
|
|
4150
|
+
micromatch.hasBraces = hasBraces;
|
|
4144
4151
|
micromatch_1 = micromatch;
|
|
4145
4152
|
return micromatch_1;
|
|
4146
4153
|
}
|
|
@@ -4222,7 +4229,7 @@ function createMethodsRPC(project, options = {}) {
|
|
|
4222
4229
|
return r?.map;
|
|
4223
4230
|
},
|
|
4224
4231
|
async fetch(id, transformMode) {
|
|
4225
|
-
const result = await project.vitenode.fetchResult(id, transformMode);
|
|
4232
|
+
const result = await project.vitenode.fetchResult(id, transformMode).catch(handleRollupError);
|
|
4226
4233
|
const code = result.code;
|
|
4227
4234
|
if (!cacheFs || result.externalize) {
|
|
4228
4235
|
return result;
|
|
@@ -4253,10 +4260,10 @@ function createMethodsRPC(project, options = {}) {
|
|
|
4253
4260
|
return { id: tmp };
|
|
4254
4261
|
},
|
|
4255
4262
|
resolveId(id, importer, transformMode) {
|
|
4256
|
-
return project.vitenode.resolveId(id, importer, transformMode);
|
|
4263
|
+
return project.vitenode.resolveId(id, importer, transformMode).catch(handleRollupError);
|
|
4257
4264
|
},
|
|
4258
4265
|
transform(id, environment) {
|
|
4259
|
-
return project.vitenode.transformModule(id, environment);
|
|
4266
|
+
return project.vitenode.transformModule(id, environment).catch(handleRollupError);
|
|
4260
4267
|
},
|
|
4261
4268
|
onPathsCollected(paths) {
|
|
4262
4269
|
ctx.state.collectPaths(paths);
|
|
@@ -4291,6 +4298,23 @@ function createMethodsRPC(project, options = {}) {
|
|
|
4291
4298
|
}
|
|
4292
4299
|
};
|
|
4293
4300
|
}
|
|
4301
|
+
function handleRollupError(e) {
|
|
4302
|
+
if (e instanceof Error && "plugin" in e) {
|
|
4303
|
+
throw {
|
|
4304
|
+
name: e.name,
|
|
4305
|
+
message: e.message,
|
|
4306
|
+
stack: e.stack,
|
|
4307
|
+
cause: e.cause,
|
|
4308
|
+
__vitest_rollup_error__: {
|
|
4309
|
+
plugin: e.plugin,
|
|
4310
|
+
id: e.id,
|
|
4311
|
+
loc: e.loc,
|
|
4312
|
+
frame: e.frame
|
|
4313
|
+
}
|
|
4314
|
+
};
|
|
4315
|
+
}
|
|
4316
|
+
throw e;
|
|
4317
|
+
}
|
|
4294
4318
|
|
|
4295
4319
|
function createChildProcessChannel$1(project) {
|
|
4296
4320
|
const emitter = new EventEmitter();
|
|
@@ -4378,7 +4402,7 @@ function createForksPool(ctx, { execArgv, env }) {
|
|
|
4378
4402
|
}
|
|
4379
4403
|
return async (specs, invalidates) => {
|
|
4380
4404
|
ctx.onCancel(() => pool.cancelPendingTasks());
|
|
4381
|
-
const configs = /* @__PURE__ */ new
|
|
4405
|
+
const configs = /* @__PURE__ */ new WeakMap();
|
|
4382
4406
|
const getConfig = (project) => {
|
|
4383
4407
|
if (configs.has(project)) {
|
|
4384
4408
|
return configs.get(project);
|
|
@@ -4388,14 +4412,6 @@ function createForksPool(ctx, { execArgv, env }) {
|
|
|
4388
4412
|
configs.set(project, config);
|
|
4389
4413
|
return config;
|
|
4390
4414
|
};
|
|
4391
|
-
const workspaceMap = /* @__PURE__ */ new Map();
|
|
4392
|
-
for (const spec of specs) {
|
|
4393
|
-
const file = spec.moduleId;
|
|
4394
|
-
const project = spec.project.workspaceProject;
|
|
4395
|
-
const workspaceFiles = workspaceMap.get(file) ?? [];
|
|
4396
|
-
workspaceFiles.push(project);
|
|
4397
|
-
workspaceMap.set(file, workspaceFiles);
|
|
4398
|
-
}
|
|
4399
4415
|
const singleFork = specs.filter(
|
|
4400
4416
|
(spec) => spec.project.config.poolOptions?.forks?.singleFork
|
|
4401
4417
|
);
|
|
@@ -4577,7 +4593,7 @@ See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for t
|
|
|
4577
4593
|
}
|
|
4578
4594
|
return async (specs, invalidates) => {
|
|
4579
4595
|
ctx.onCancel(() => pool.cancelPendingTasks());
|
|
4580
|
-
const configs = /* @__PURE__ */ new
|
|
4596
|
+
const configs = /* @__PURE__ */ new WeakMap();
|
|
4581
4597
|
const getConfig = (project) => {
|
|
4582
4598
|
if (configs.has(project)) {
|
|
4583
4599
|
return configs.get(project);
|
|
@@ -4586,12 +4602,6 @@ See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for t
|
|
|
4586
4602
|
configs.set(project, config);
|
|
4587
4603
|
return config;
|
|
4588
4604
|
};
|
|
4589
|
-
const workspaceMap = /* @__PURE__ */ new Map();
|
|
4590
|
-
for (const [project, file] of specs) {
|
|
4591
|
-
const workspaceFiles = workspaceMap.get(file) ?? [];
|
|
4592
|
-
workspaceFiles.push(project);
|
|
4593
|
-
workspaceMap.set(file, workspaceFiles);
|
|
4594
|
-
}
|
|
4595
4605
|
const singleThreads = specs.filter(
|
|
4596
4606
|
(spec) => spec.project.config.poolOptions?.threads?.singleThread
|
|
4597
4607
|
);
|
|
@@ -7809,6 +7819,12 @@ function resolveConfig(mode, options, viteConfig, logger) {
|
|
|
7809
7819
|
resolved.maxWorkers = 1;
|
|
7810
7820
|
resolved.minWorkers = 1;
|
|
7811
7821
|
}
|
|
7822
|
+
if (resolved.maxConcurrency === 0) {
|
|
7823
|
+
logger.console.warn(
|
|
7824
|
+
c.yellow(`The option "maxConcurrency" cannot be set to 0. Using default value ${configDefaults.maxConcurrency} instead.`)
|
|
7825
|
+
);
|
|
7826
|
+
resolved.maxConcurrency = configDefaults.maxConcurrency;
|
|
7827
|
+
}
|
|
7812
7828
|
if (resolved.inspect || resolved.inspectBrk) {
|
|
7813
7829
|
const isSingleThread = resolved.pool === "threads" && resolved.poolOptions?.threads?.singleThread;
|
|
7814
7830
|
const isSingleFork = resolved.pool === "forks" && resolved.poolOptions?.forks?.singleFork;
|
|
@@ -7892,6 +7908,24 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
7892
7908
|
resolved.deps.web.transformAssets ??= true;
|
|
7893
7909
|
resolved.deps.web.transformCss ??= true;
|
|
7894
7910
|
resolved.deps.web.transformGlobPattern ??= [];
|
|
7911
|
+
resolved.setupFiles = toArray(resolved.setupFiles || []).map(
|
|
7912
|
+
(file) => resolvePath(file, resolved.root)
|
|
7913
|
+
);
|
|
7914
|
+
resolved.globalSetup = toArray(resolved.globalSetup || []).map(
|
|
7915
|
+
(file) => resolvePath(file, resolved.root)
|
|
7916
|
+
);
|
|
7917
|
+
resolved.coverage.exclude.push(
|
|
7918
|
+
...resolved.setupFiles.map(
|
|
7919
|
+
(file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(
|
|
7920
|
+
resolved.root,
|
|
7921
|
+
file
|
|
7922
|
+
)}`
|
|
7923
|
+
)
|
|
7924
|
+
);
|
|
7925
|
+
resolved.forceRerunTriggers = [
|
|
7926
|
+
...resolved.forceRerunTriggers,
|
|
7927
|
+
...resolved.setupFiles
|
|
7928
|
+
];
|
|
7895
7929
|
resolved.server ??= {};
|
|
7896
7930
|
resolved.server.deps ??= {};
|
|
7897
7931
|
const deprecatedDepsOptions = ["inline", "external", "fallbackCJS"];
|
|
@@ -7933,6 +7967,8 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
7933
7967
|
resolved.server.deps.inline.push(...extraInlineDeps);
|
|
7934
7968
|
}
|
|
7935
7969
|
}
|
|
7970
|
+
resolved.server.deps.inlineFiles ??= [];
|
|
7971
|
+
resolved.server.deps.inlineFiles.push(...resolved.setupFiles);
|
|
7936
7972
|
resolved.server.deps.moduleDirectories ??= [];
|
|
7937
7973
|
resolved.server.deps.moduleDirectories.push(
|
|
7938
7974
|
...resolved.deps.moduleDirectories
|
|
@@ -8087,24 +8123,6 @@ ${JSON.stringify({ browser: { provider: "playwright", name: "chromium" } }, null
|
|
|
8087
8123
|
resolved.benchmark.outputJson = options.outputJson;
|
|
8088
8124
|
}
|
|
8089
8125
|
}
|
|
8090
|
-
resolved.setupFiles = toArray(resolved.setupFiles || []).map(
|
|
8091
|
-
(file) => resolvePath(file, resolved.root)
|
|
8092
|
-
);
|
|
8093
|
-
resolved.globalSetup = toArray(resolved.globalSetup || []).map(
|
|
8094
|
-
(file) => resolvePath(file, resolved.root)
|
|
8095
|
-
);
|
|
8096
|
-
resolved.coverage.exclude.push(
|
|
8097
|
-
...resolved.setupFiles.map(
|
|
8098
|
-
(file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(
|
|
8099
|
-
resolved.root,
|
|
8100
|
-
file
|
|
8101
|
-
)}`
|
|
8102
|
-
)
|
|
8103
|
-
);
|
|
8104
|
-
resolved.forceRerunTriggers = [
|
|
8105
|
-
...resolved.forceRerunTriggers,
|
|
8106
|
-
...resolved.setupFiles
|
|
8107
|
-
];
|
|
8108
8126
|
if (resolved.diff) {
|
|
8109
8127
|
resolved.diff = resolvePath(resolved.diff, resolved.root);
|
|
8110
8128
|
resolved.forceRerunTriggers.push(resolved.diff);
|
|
@@ -8292,4 +8310,4 @@ function resolveCoverageReporters(configReporters) {
|
|
|
8292
8310
|
return resolvedReporters;
|
|
8293
8311
|
}
|
|
8294
8312
|
|
|
8295
|
-
export { VitestCache as V,
|
|
8313
|
+
export { VitestCache as V, createMethodsRPC as a, resolveApiServerConfig as b, coverageConfigDefaults as c, resolveConfig as d, requireMicromatch as e, configDefaults as f, getFilePoolName as g, isPackageExists as h, isBrowserEnabled as i, createPool as j, mm as m, resolveCoverageReporters as r };
|
|
@@ -5,16 +5,16 @@ import '@vitest/runner/utils';
|
|
|
5
5
|
import { getSafeTimers } from '@vitest/utils';
|
|
6
6
|
import { g as getWorkerState } from './utils.Ck2hJTRs.js';
|
|
7
7
|
import './env.CmHVDJnw.js';
|
|
8
|
-
import { a as globalExpect, r as resetModules, v as vi } from './vi.
|
|
8
|
+
import { a as globalExpect, r as resetModules, v as vi } from './vi.BskyZC5g.js';
|
|
9
9
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from './coverage.zlNdAMHK.js';
|
|
10
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
10
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.4GFF2h22.js';
|
|
11
11
|
import { createRequire } from 'node:module';
|
|
12
12
|
import util from 'node:util';
|
|
13
13
|
import timers from 'node:timers';
|
|
14
14
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
15
15
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
16
|
-
import { V as VitestIndex } from './index.
|
|
17
|
-
import { s as setupCommonEnv } from './setup-common.
|
|
16
|
+
import { V as VitestIndex } from './index.-d_XpZEA.js';
|
|
17
|
+
import { s as setupCommonEnv } from './setup-common.BKyF15v_.js';
|
|
18
18
|
import { c as closeInspector } from './inspector.70d6emsh.js';
|
|
19
19
|
import 'std-env';
|
|
20
20
|
import 'chai';
|
|
@@ -81,7 +81,7 @@ function resolveAsset(mod, url) {
|
|
|
81
81
|
mod.exports = url;
|
|
82
82
|
}
|
|
83
83
|
async function setupConsoleLogSpy() {
|
|
84
|
-
const { createCustomConsole } = await import('./console.
|
|
84
|
+
const { createCustomConsole } = await import('./console.CfT1Wjed.js');
|
|
85
85
|
globalThis.console = createCustomConsole();
|
|
86
86
|
}
|
|
87
87
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals) {
|
|
16
|
-
(await import('./globals.
|
|
16
|
+
(await import('./globals.Bdzt04Qm.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function setupDefines(defines) {
|
|
@@ -397,6 +397,7 @@ function createExpectPoll(expect) {
|
|
|
397
397
|
const assertion = expect(null, message).withContext({
|
|
398
398
|
poll: true
|
|
399
399
|
});
|
|
400
|
+
fn = fn.bind(assertion);
|
|
400
401
|
const proxy = new Proxy(assertion, {
|
|
401
402
|
get(target, key, receiver) {
|
|
402
403
|
const assertionFunction = Reflect.get(target, key, receiver);
|
|
@@ -430,6 +431,7 @@ function createExpectPoll(expect) {
|
|
|
430
431
|
}, timeout);
|
|
431
432
|
const check = async () => {
|
|
432
433
|
try {
|
|
434
|
+
chai$1.util.flag(assertion, "_name", key);
|
|
433
435
|
const obj = await fn();
|
|
434
436
|
chai$1.util.flag(assertion, "object", obj);
|
|
435
437
|
resolve(await assertionFunction.call(assertion, ...args));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import vm, { isContext } from 'node:vm';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
|
|
4
|
-
import { createCustomConsole } from './console.
|
|
4
|
+
import { createCustomConsole } from './console.CfT1Wjed.js';
|
|
5
5
|
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute._eQQfgI8.js';
|
|
6
6
|
import { distDir } from '../path.js';
|
|
7
7
|
import { dirname as dirname$1 } from 'node:path';
|
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ViteNodeResolveId, ModuleCacheMap } from 'vite-node';
|
|
2
2
|
import { File, TaskResultPack, CancelReason, Task } from '@vitest/runner';
|
|
3
3
|
import { S as SerializedConfig } from './config.Crbj2GAb.js';
|
|
4
4
|
import { SnapshotResult } from '@vitest/snapshot';
|
|
5
5
|
import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.CzISCQ7o.js';
|
|
6
6
|
|
|
7
|
-
interface RuntimeRPC {
|
|
8
|
-
fetch: (id: string, transformMode: TransformMode) => Promise<{
|
|
9
|
-
externalize?: string;
|
|
10
|
-
id?: string;
|
|
11
|
-
}>;
|
|
12
|
-
transform: (id: string, transformMode: TransformMode) => Promise<FetchResult>;
|
|
13
|
-
resolveId: (id: string, importer: string | undefined, transformMode: TransformMode) => Promise<ViteNodeResolveId | null>;
|
|
14
|
-
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
15
|
-
onFinished: (files: File[], errors?: unknown[]) => void;
|
|
16
|
-
onPathsCollected: (paths: string[]) => void;
|
|
17
|
-
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
18
|
-
onUnhandledError: (err: unknown, type: string) => void;
|
|
19
|
-
onCollected: (files: File[]) => Promise<void>;
|
|
20
|
-
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
21
|
-
onTaskUpdate: (pack: TaskResultPack[]) => Promise<void>;
|
|
22
|
-
onCancel: (reason: CancelReason) => void;
|
|
23
|
-
getCountOfFailedTests: () => number;
|
|
24
|
-
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
25
|
-
resolveSnapshotPath: (testPath: string) => string;
|
|
26
|
-
}
|
|
27
|
-
interface RunnerRPC {
|
|
28
|
-
onCancel: (reason: CancelReason) => void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
7
|
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
32
8
|
type ReturnType<T> = T extends (...args: any) => infer R ? R : never;
|
|
33
9
|
type PromisifyFn<T> = ReturnType<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
@@ -93,6 +69,44 @@ type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
|
93
69
|
$functions: LocalFunctions;
|
|
94
70
|
};
|
|
95
71
|
|
|
72
|
+
interface RuntimeRPC {
|
|
73
|
+
fetch: (id: string, transformMode: TransformMode) => Promise<{
|
|
74
|
+
externalize?: string;
|
|
75
|
+
id?: string;
|
|
76
|
+
}>;
|
|
77
|
+
transform: (id: string, transformMode: TransformMode) => Promise<{
|
|
78
|
+
code?: string;
|
|
79
|
+
}>;
|
|
80
|
+
resolveId: (id: string, importer: string | undefined, transformMode: TransformMode) => Promise<{
|
|
81
|
+
external?: boolean | 'absolute' | 'relative';
|
|
82
|
+
id: string;
|
|
83
|
+
/** @deprecated */
|
|
84
|
+
meta?: Record<string, any> | null;
|
|
85
|
+
/** @deprecated */
|
|
86
|
+
moduleSideEffects?: boolean | 'no-treeshake' | null;
|
|
87
|
+
/** @deprecated */
|
|
88
|
+
syntheticNamedExports?: boolean | string | null;
|
|
89
|
+
} | null>;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated unused
|
|
92
|
+
*/
|
|
93
|
+
getSourceMap: (id: string, force?: boolean) => Promise<any>;
|
|
94
|
+
onFinished: (files: File[], errors?: unknown[]) => void;
|
|
95
|
+
onPathsCollected: (paths: string[]) => void;
|
|
96
|
+
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
97
|
+
onUnhandledError: (err: unknown, type: string) => void;
|
|
98
|
+
onCollected: (files: File[]) => Promise<void>;
|
|
99
|
+
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
100
|
+
onTaskUpdate: (pack: TaskResultPack[]) => Promise<void>;
|
|
101
|
+
onCancel: (reason: CancelReason) => void;
|
|
102
|
+
getCountOfFailedTests: () => number;
|
|
103
|
+
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
104
|
+
resolveSnapshotPath: (testPath: string) => string;
|
|
105
|
+
}
|
|
106
|
+
interface RunnerRPC {
|
|
107
|
+
onCancel: (reason: CancelReason) => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
96
110
|
/** @deprecated unused */
|
|
97
111
|
type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
98
112
|
type WorkerRPC = BirpcReturn<RuntimeRPC, RunnerRPC>;
|
|
@@ -129,4 +143,4 @@ interface WorkerGlobalState {
|
|
|
129
143
|
};
|
|
130
144
|
}
|
|
131
145
|
|
|
132
|
-
export type { BirpcOptions as B, ContextRPC as C, RuntimeRPC as R, WorkerGlobalState as W, BirpcReturn as a,
|
|
146
|
+
export type { BirpcOptions as B, ContextRPC as C, RuntimeRPC as R, WorkerGlobalState as W, BirpcReturn as a, WorkerRPC as b, RunnerRPC as c, ResolveIdFunction as d, ContextTestEnvironment as e };
|
package/dist/cli.js
CHANGED
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import './chunks/vite.
|
|
2
|
-
import {
|
|
3
|
-
export { ConfigEnv, Plugin, UserConfig, mergeConfig } from 'vite';
|
|
4
|
-
import { R as ResolvedCoverageOptions,
|
|
1
|
+
import './chunks/vite.YH7MrecS.js';
|
|
2
|
+
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
3
|
+
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
4
|
+
import { R as ResolvedCoverageOptions, c as CoverageV8Options, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, W as WorkspaceProjectConfiguration } from './chunks/reporters.C4ZHgdxQ.js';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/pretty-format';
|
|
7
7
|
import './chunks/config.Crbj2GAb.js';
|
|
@@ -71,12 +71,17 @@ declare const configDefaults: Readonly<{
|
|
|
71
71
|
disableConsoleIntercept: false;
|
|
72
72
|
}>;
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
type
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use `ViteUserConfig` instead
|
|
76
|
+
*/
|
|
77
|
+
type UserConfig = UserConfig$1;
|
|
78
|
+
|
|
79
|
+
type UserConfigFnObject = (env: ConfigEnv) => UserConfig$1;
|
|
80
|
+
type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig$1>;
|
|
81
|
+
type UserConfigFn = (env: ConfigEnv) => UserConfig$1 | Promise<UserConfig$1>;
|
|
82
|
+
type UserConfigExport = UserConfig$1 | Promise<UserConfig$1> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
83
|
+
declare function defineConfig(config: UserConfig$1): UserConfig$1;
|
|
84
|
+
declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
|
|
80
85
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
81
86
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
82
87
|
declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
|
|
@@ -85,4 +90,4 @@ declare function defineProject(config: UserProjectConfigFn): UserProjectConfigFn
|
|
|
85
90
|
declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
|
|
86
91
|
declare function defineWorkspace(config: WorkspaceProjectConfiguration[]): WorkspaceProjectConfiguration[];
|
|
87
92
|
|
|
88
|
-
export { type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, WorkspaceProjectConfiguration, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace, extraInlineDeps };
|
|
93
|
+
export { type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, WorkspaceProjectConfiguration, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace, extraInlineDeps };
|