vitest 2.1.1 → 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 +5 -5
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.CsQmmYBA.js → base.BO5Jx7vw.js} +1 -1
- package/dist/chunks/{base.BlXpj3e_.js → base.DwXGwWst.js} +1 -10
- package/dist/chunks/{benchmark.puBFxyfE.d.ts → benchmark.JVlTzojj.d.ts} +2 -0
- package/dist/chunks/{cac.BVmpoFAv.js → cac.BSMVokHR.js} +7 -7
- package/dist/chunks/cli-api.btGgw3PC.js +11819 -0
- package/dist/chunks/{config.CHuotKvS.d.ts → config.Crbj2GAb.d.ts} +3 -0
- package/dist/chunks/{console.DI3gHgtH.js → console.CfT1Wjed.js} +1 -1
- package/dist/chunks/{creator.BteLTfY8.js → creator.CBPphXqR.js} +4 -7
- package/dist/chunks/{environment.C5eAp3K6.d.ts → environment.CzISCQ7o.d.ts} +1 -0
- package/dist/chunks/{globals.C03P0O1a.js → globals.Bdzt04Qm.js} +3 -3
- package/dist/chunks/index.-d_XpZEA.js +140 -0
- package/dist/chunks/{index.DkN6V87F.js → index.4GFF2h22.js} +2 -1
- package/dist/chunks/{index.zPibhCkV.js → index.Dz2opmmU.js} +653 -585
- package/dist/chunks/{index.Bn75ITYg.js → index.X0nbfr6-.js} +37 -28
- package/dist/chunks/{reporters.WnPwkmgA.d.ts → reporters.C4ZHgdxQ.d.ts} +20 -15
- package/dist/chunks/{resolveConfig.-K5hHm0S.js → resolveConfig.Dha6ilPI.js} +3544 -3374
- package/dist/chunks/{runBaseTests.9YDrdSI4.js → runBaseTests.Cx4wXyTR.js} +6 -6
- package/dist/chunks/{setup-common.DV1PI68g.js → setup-common.BKyF15v_.js} +1 -1
- package/dist/chunks/{suite.CcK46U-P.d.ts → suite.BMWOKiTe.d.ts} +1 -1
- package/dist/chunks/{utils.Dbnmsfq1.js → utils.CY6Spixo.js} +26 -47
- package/dist/chunks/vi.BskyZC5g.js +3945 -0
- package/dist/chunks/{vite.D2yAwzwa.d.ts → vite.YH7MrecS.d.ts} +1 -1
- package/dist/chunks/{vm.CPXwWp4C.js → vm.DB_hLchi.js} +1 -1
- package/dist/chunks/{worker.CmPmTxgH.d.ts → worker.B6RjTtbk.d.ts} +42 -28
- package/dist/chunks/{worker.Bws9Zuxu.d.ts → worker.CcJLfX8w.d.ts} +1 -1
- package/dist/cli.js +2 -2
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +19 -14
- package/dist/config.js +2 -1
- package/dist/coverage.d.ts +67 -30
- package/dist/coverage.js +250 -109
- package/dist/environments.d.ts +2 -2
- package/dist/execute.d.ts +3 -3
- package/dist/index.d.ts +36 -19
- package/dist/index.js +5 -5
- package/dist/node.d.ts +8 -8
- package/dist/node.js +10 -9
- package/dist/reporters.d.ts +4 -4
- package/dist/reporters.js +4 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +8 -2
- package/dist/suite.d.ts +2 -2
- package/dist/worker.js +11 -3
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +8 -5
- 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 +4 -4
- package/dist/workers.js +4 -4
- package/package.json +12 -13
- package/dist/chunks/cli-api.BKkmK21J.js +0 -11404
- package/dist/chunks/index.iyKRMe3s.js +0 -131
- package/dist/chunks/vi.D6IHiKAI.js +0 -3746
|
@@ -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,
|
|
@@ -3261,11 +3261,11 @@ function requireElements$1 () {
|
|
|
3261
3261
|
return elements$1;
|
|
3262
3262
|
}
|
|
3263
3263
|
|
|
3264
|
-
var hasRequiredPrompts$
|
|
3264
|
+
var hasRequiredPrompts$2;
|
|
3265
3265
|
|
|
3266
|
-
function requirePrompts$
|
|
3267
|
-
if (hasRequiredPrompts$
|
|
3268
|
-
hasRequiredPrompts$
|
|
3266
|
+
function requirePrompts$2 () {
|
|
3267
|
+
if (hasRequiredPrompts$2) return prompts$2;
|
|
3268
|
+
hasRequiredPrompts$2 = 1;
|
|
3269
3269
|
(function (exports) {
|
|
3270
3270
|
|
|
3271
3271
|
const $ = exports;
|
|
@@ -3515,7 +3515,7 @@ function requireDist () {
|
|
|
3515
3515
|
|
|
3516
3516
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3517
3517
|
|
|
3518
|
-
const prompts = requirePrompts$
|
|
3518
|
+
const prompts = requirePrompts$2();
|
|
3519
3519
|
|
|
3520
3520
|
const passOn = ['suggest', 'format', 'onState', 'validate', 'onRender', 'type'];
|
|
3521
3521
|
|
|
@@ -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
|
|
|
@@ -6229,11 +6229,11 @@ function requireElements () {
|
|
|
6229
6229
|
return elements;
|
|
6230
6230
|
}
|
|
6231
6231
|
|
|
6232
|
-
var hasRequiredPrompts;
|
|
6232
|
+
var hasRequiredPrompts$1;
|
|
6233
6233
|
|
|
6234
|
-
function requirePrompts () {
|
|
6235
|
-
if (hasRequiredPrompts) return prompts$1;
|
|
6236
|
-
hasRequiredPrompts = 1;
|
|
6234
|
+
function requirePrompts$1 () {
|
|
6235
|
+
if (hasRequiredPrompts$1) return prompts$1;
|
|
6236
|
+
hasRequiredPrompts$1 = 1;
|
|
6237
6237
|
(function (exports) {
|
|
6238
6238
|
const $ = exports;
|
|
6239
6239
|
const el = requireElements();
|
|
@@ -6451,7 +6451,7 @@ function requireLib () {
|
|
|
6451
6451
|
if (hasRequiredLib) return lib;
|
|
6452
6452
|
hasRequiredLib = 1;
|
|
6453
6453
|
|
|
6454
|
-
const prompts = requirePrompts();
|
|
6454
|
+
const prompts = requirePrompts$1();
|
|
6455
6455
|
|
|
6456
6456
|
const passOn = ['suggest', 'format', 'onState', 'validate', 'onRender', 'type'];
|
|
6457
6457
|
const noop = () => {};
|
|
@@ -6550,26 +6550,35 @@ function requireLib () {
|
|
|
6550
6550
|
return lib;
|
|
6551
6551
|
}
|
|
6552
6552
|
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6553
|
+
var prompts;
|
|
6554
|
+
var hasRequiredPrompts;
|
|
6555
|
+
|
|
6556
|
+
function requirePrompts () {
|
|
6557
|
+
if (hasRequiredPrompts) return prompts;
|
|
6558
|
+
hasRequiredPrompts = 1;
|
|
6559
|
+
function isNodeLT(tar) {
|
|
6560
|
+
tar = (Array.isArray(tar) ? tar : tar.split('.')).map(Number);
|
|
6561
|
+
let i=0, src=process.versions.node.split('.').map(Number);
|
|
6562
|
+
for (; i < tar.length; i++) {
|
|
6563
|
+
if (src[i] > tar[i]) return false;
|
|
6564
|
+
if (tar[i] > src[i]) return true;
|
|
6565
|
+
}
|
|
6566
|
+
return false;
|
|
6567
|
+
}
|
|
6562
6568
|
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6569
|
+
prompts =
|
|
6570
|
+
isNodeLT('8.6.0')
|
|
6571
|
+
? requireDist()
|
|
6572
|
+
: requireLib();
|
|
6573
|
+
return prompts;
|
|
6574
|
+
}
|
|
6567
6575
|
|
|
6568
|
-
var
|
|
6576
|
+
var promptsExports = requirePrompts();
|
|
6577
|
+
var prompt = /*@__PURE__*/getDefaultExportFromCjs(promptsExports);
|
|
6569
6578
|
|
|
6570
6579
|
var index = /*#__PURE__*/_mergeNamespaces({
|
|
6571
6580
|
__proto__: null,
|
|
6572
6581
|
default: prompt
|
|
6573
|
-
}, [
|
|
6582
|
+
}, [promptsExports]);
|
|
6574
6583
|
|
|
6575
6584
|
export { findUp as f, index as i, prompt as p };
|
|
@@ -3,10 +3,10 @@ import { File, Test, Suite, TaskResultPack, Task, CancelReason, Custom, TaskMeta
|
|
|
3
3
|
import * as vite from 'vite';
|
|
4
4
|
import { ViteDevServer, TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
5
5
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
6
|
-
import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.
|
|
6
|
+
import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.Crbj2GAb.js';
|
|
7
7
|
import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
|
|
8
8
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
9
|
-
import { b as Awaitable, P as ProvidedContext, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable, d as ArgumentsType, O as OnServerRestartHandler, f as EnvironmentOptions } from './environment.
|
|
9
|
+
import { b as Awaitable, P as ProvidedContext, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable, d as ArgumentsType, O as OnServerRestartHandler, f as EnvironmentOptions } from './environment.CzISCQ7o.js';
|
|
10
10
|
import { Writable } from 'node:stream';
|
|
11
11
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
12
12
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
@@ -15,7 +15,7 @@ import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, TestError, Arraya
|
|
|
15
15
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
16
16
|
import { Stats } from 'node:fs';
|
|
17
17
|
import * as chai from 'chai';
|
|
18
|
-
import { B as BenchmarkResult } from './benchmark.
|
|
18
|
+
import { B as BenchmarkResult } from './benchmark.JVlTzojj.js';
|
|
19
19
|
|
|
20
20
|
type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
|
|
21
21
|
type Pool = BuiltinPool | (string & {});
|
|
@@ -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 {
|
|
@@ -1071,7 +1071,7 @@ declare class VitestCache {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
1073
|
declare class VitestPackageInstaller {
|
|
1074
|
-
ensureInstalled(dependency: string, root: string): Promise<boolean>;
|
|
1074
|
+
ensureInstalled(dependency: string, root: string, version?: string): Promise<boolean>;
|
|
1075
1075
|
}
|
|
1076
1076
|
|
|
1077
1077
|
interface Node {
|
|
@@ -1161,6 +1161,8 @@ interface CoverageProvider {
|
|
|
1161
1161
|
clean: (clean?: boolean) => void | Promise<void>;
|
|
1162
1162
|
/** Called with coverage results after a single test file has been run */
|
|
1163
1163
|
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise<void>;
|
|
1164
|
+
/** Callback called when test run fails */
|
|
1165
|
+
onTestFailure?: () => void | Promise<void>;
|
|
1164
1166
|
/** Callback to generate final coverage results */
|
|
1165
1167
|
generateCoverage: (reportContext: ReportContext) => CoverageResults | Promise<CoverageResults>;
|
|
1166
1168
|
/** Callback to convert coverage results to coverage reports. Called with results returned from `generateCoverage` */
|
|
@@ -1777,10 +1779,8 @@ declare class TableReporter extends BaseReporter {
|
|
|
1777
1779
|
interface FlatBenchmarkReport {
|
|
1778
1780
|
[id: string]: FormattedBenchmarkResult;
|
|
1779
1781
|
}
|
|
1780
|
-
type FormattedBenchmarkResult =
|
|
1782
|
+
type FormattedBenchmarkResult = BenchmarkResult & {
|
|
1781
1783
|
id: string;
|
|
1782
|
-
sampleCount: number;
|
|
1783
|
-
median: number;
|
|
1784
1784
|
};
|
|
1785
1785
|
|
|
1786
1786
|
declare const BenchmarkReportsMap: {
|
|
@@ -1867,8 +1867,7 @@ interface BenchmarkUserOptions {
|
|
|
1867
1867
|
*/
|
|
1868
1868
|
reporters?: Arrayable$1<BenchmarkBuiltinReporters | Reporter>;
|
|
1869
1869
|
/**
|
|
1870
|
-
*
|
|
1871
|
-
* Also definable individually per reporter by using an object instead.
|
|
1870
|
+
* @deprecated Use `benchmark.outputJson` instead
|
|
1872
1871
|
*/
|
|
1873
1872
|
outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
|
|
1874
1873
|
/**
|
|
@@ -1879,6 +1878,12 @@ interface BenchmarkUserOptions {
|
|
|
1879
1878
|
* benchmark output file
|
|
1880
1879
|
*/
|
|
1881
1880
|
outputJson?: string;
|
|
1881
|
+
/**
|
|
1882
|
+
* Include `samples` array of benchmark results for API or custom reporter usages.
|
|
1883
|
+
* This is disabled by default to reduce memory usage.
|
|
1884
|
+
* @default false
|
|
1885
|
+
*/
|
|
1886
|
+
includeSamples?: boolean;
|
|
1882
1887
|
}
|
|
1883
1888
|
|
|
1884
1889
|
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
@@ -2739,4 +2744,4 @@ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
|
|
|
2739
2744
|
extends?: string;
|
|
2740
2745
|
});
|
|
2741
2746
|
|
|
2742
|
-
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 };
|