vitest 4.0.0-beta.2 → 4.0.0-beta.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/dist/browser.d.ts +6 -6
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.Bj3pWTr1.js → base.D5_IXzht.js} +2 -2
- package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
- package/dist/chunks/{browser.d.DP0ACFkh.d.ts → browser.d.BSPEQIuf.d.ts} +5 -5
- package/dist/chunks/{cac.CVVvMokL.js → cac.C30xmylc.js} +11 -16
- package/dist/chunks/{cli-api.BUkNuHvl.js → cli-api.DE98RCgs.js} +37 -65
- package/dist/chunks/{config.d.HJdfX-8k.d.ts → config.d.DZo8c7fw.d.ts} +58 -58
- package/dist/chunks/{console.CtFJOzRO.js → console.DoJHFxmj.js} +3 -3
- package/dist/chunks/{constants.DnKduX2e.js → constants.CXzqaLmq.js} +1 -4
- package/dist/chunks/{coverage.BjMqihzx.js → coverage.OOpN1tMC.js} +52 -26
- package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.CNYjU4GF.d.ts} +4 -4
- package/dist/chunks/{creator.GK6I-cL4.js → creator.CJNzQTzZ.js} +5 -5
- package/dist/chunks/{environment.d.CUq4cUgQ.d.ts → environment.d.Bhm9oc0v.d.ts} +1 -1
- package/dist/chunks/{execute.B7h3T_Hc.js → execute.Dt-pCVcL.js} +1 -1
- package/dist/chunks/{global.d.CVbXEflG.d.ts → global.d.DAhT2emn.d.ts} +2 -2
- package/dist/chunks/{globals.Cxal6MLI.js → globals.Dgo-vS5G.js} +3 -3
- package/dist/chunks/{index.a-yuRg2G.js → index.Bz6b0Ib7.js} +5 -4
- package/dist/chunks/{index.BWf_gE5n.js → index.D1_MsKEt.js} +1 -1
- package/dist/chunks/{index.CJvUWPky.js → index.D3SKT3tv.js} +1 -1
- package/dist/chunks/{index.D-VkfKhf.js → index.Dppt57hu.js} +1 -1
- package/dist/chunks/{plugin.d.NmsBIHuT.d.ts → plugin.d.CKCmge5g.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BbsDWlO9.d.ts → reporters.d.BBuiUFDc.d.ts} +103 -108
- package/dist/chunks/{runBaseTests.BC7ZIH5L.js → runBaseTests.Bbi_gTJQ.js} +5 -5
- package/dist/chunks/{setup-common.D7ZqXFx-.js → setup-common.Ebx5x0eP.js} +1 -1
- package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
- package/dist/chunks/{typechecker.CVytUJuF.js → typechecker.CMNPqJOo.js} +3 -3
- package/dist/chunks/{utils.CAioKnHs.js → utils.CcGm2cd1.js} +1 -1
- package/dist/chunks/{vi.bdSIJ99Y.js → vi.CA0EPI9Y.js} +11 -11
- package/dist/chunks/{vm.BThCzidc.js → vm.BUnLJt_P.js} +11 -3
- package/dist/chunks/{worker.d.CVn8WGlF.d.ts → worker.d.DyXSTmRq.d.ts} +1 -1
- package/dist/chunks/{worker.d.COAQvn4k.d.ts → worker.d.xTcinSQw.d.ts} +9 -9
- package/dist/cli.js +4 -4
- package/dist/config.d.ts +44 -44
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +20 -18
- package/dist/coverage.js +3 -3
- package/dist/environments.d.ts +9 -9
- package/dist/execute.d.ts +7 -7
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +28 -23
- package/dist/index.js +2 -2
- package/dist/node.d.ts +22 -20
- package/dist/node.js +9 -9
- package/dist/reporters.d.ts +7 -7
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/suite.d.ts +2 -2
- package/dist/worker.js +1 -1
- package/dist/workers/forks.js +3 -3
- package/dist/workers/runVmTests.js +4 -4
- package/dist/workers/threads.js +3 -3
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +4 -4
- package/dist/workers.js +5 -5
- package/package.json +16 -16
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Task, CancelReason, TaskMeta, Suite, File, TestAnnotation, ImportDuration, TaskResultPack, TaskEventPack, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
|
|
2
|
-
import { P as ProvidedContext, U as UserConsoleLog, b as Awaitable$1, c as Arrayable$1, A as AfterSuiteRunMeta, L as LabelColor } from './environment.d.
|
|
2
|
+
import { P as ProvidedContext, U as UserConsoleLog, b as Awaitable$1, c as Arrayable$1, A as AfterSuiteRunMeta, L as LabelColor } from './environment.d.Bhm9oc0v.js';
|
|
3
3
|
import { ParsedStack, Awaitable, TestError, SerializedError, Arrayable } from '@vitest/utils';
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
|
-
import { ViteDevServer, ModuleNode, TransformResult as TransformResult$1, UserConfig as UserConfig$1,
|
|
5
|
+
import { ViteDevServer, ModuleNode, TransformResult as TransformResult$1, DepOptimizationConfig, ServerOptions, UserConfig as UserConfig$1, ConfigEnv, AliasOptions } from 'vite';
|
|
6
6
|
import { Console } from 'node:console';
|
|
7
|
-
import { B as BrowserTesterOptions, S as SerializedTestSpecification } from './browser.d.
|
|
7
|
+
import { B as BrowserTesterOptions, S as SerializedTestSpecification } from './browser.d.BSPEQIuf.js';
|
|
8
8
|
import { MockedModule } from '@vitest/mocker';
|
|
9
9
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
10
|
-
import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.
|
|
10
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.DZo8c7fw.js';
|
|
11
11
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
12
12
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
13
13
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
14
14
|
import { ViteNodeServerOptions } from 'vite-node';
|
|
15
15
|
import * as chai from 'chai';
|
|
16
16
|
import { happyDomTypes, jsdomTypes } from 'vitest/optional-types.js';
|
|
17
|
-
import { B as BenchmarkResult } from './benchmark.d.
|
|
18
|
-
import { a as RuntimeCoverageProviderModule } from './coverage.d.
|
|
17
|
+
import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
|
|
18
|
+
import { a as RuntimeCoverageProviderModule } from './coverage.d.CNYjU4GF.js';
|
|
19
19
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
20
20
|
import { Stats } from 'node:fs';
|
|
21
21
|
|
|
@@ -233,12 +233,12 @@ interface BrowserConfigOptions {
|
|
|
233
233
|
* Width of the viewport
|
|
234
234
|
* @default 414
|
|
235
235
|
*/
|
|
236
|
-
width: number
|
|
236
|
+
width: number;
|
|
237
237
|
/**
|
|
238
238
|
* Height of the viewport
|
|
239
239
|
* @default 896
|
|
240
240
|
*/
|
|
241
|
-
height: number
|
|
241
|
+
height: number;
|
|
242
242
|
};
|
|
243
243
|
/**
|
|
244
244
|
* Locator options
|
|
@@ -248,7 +248,7 @@ interface BrowserConfigOptions {
|
|
|
248
248
|
* Attribute used to locate elements by test id
|
|
249
249
|
* @default 'data-testid'
|
|
250
250
|
*/
|
|
251
|
-
testIdAttribute?: string
|
|
251
|
+
testIdAttribute?: string;
|
|
252
252
|
};
|
|
253
253
|
/**
|
|
254
254
|
* Directory where screenshots will be saved when page.screenshot() is called
|
|
@@ -360,12 +360,12 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
360
360
|
api: ApiConfig;
|
|
361
361
|
ui: boolean;
|
|
362
362
|
viewport: {
|
|
363
|
-
width: number
|
|
364
|
-
height: number
|
|
363
|
+
width: number;
|
|
364
|
+
height: number;
|
|
365
365
|
};
|
|
366
366
|
screenshotFailures: boolean;
|
|
367
367
|
locators: {
|
|
368
|
-
testIdAttribute: string
|
|
368
|
+
testIdAttribute: string;
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
371
|
|
|
@@ -384,8 +384,8 @@ declare class ReportedTaskImplementation {
|
|
|
384
384
|
* Location in the module where the test or suite is defined.
|
|
385
385
|
*/
|
|
386
386
|
readonly location: {
|
|
387
|
-
line: number
|
|
388
|
-
column: number
|
|
387
|
+
line: number;
|
|
388
|
+
column: number;
|
|
389
389
|
} | undefined;
|
|
390
390
|
/**
|
|
391
391
|
* Checks if the test did not fail the suite.
|
|
@@ -473,11 +473,11 @@ declare class TestCollection {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
type ReportedHookContext = {
|
|
476
|
-
readonly name: "beforeAll" | "afterAll"
|
|
477
|
-
readonly entity: TestSuite | TestModule
|
|
476
|
+
readonly name: "beforeAll" | "afterAll";
|
|
477
|
+
readonly entity: TestSuite | TestModule;
|
|
478
478
|
} | {
|
|
479
|
-
readonly name: "beforeEach" | "afterEach"
|
|
480
|
-
readonly entity: TestCase
|
|
479
|
+
readonly name: "beforeEach" | "afterEach";
|
|
480
|
+
readonly entity: TestCase;
|
|
481
481
|
};
|
|
482
482
|
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
483
483
|
/**
|
|
@@ -813,7 +813,7 @@ declare class TestSpecification {
|
|
|
813
813
|
* @deprecated use `pool` instead
|
|
814
814
|
*/
|
|
815
815
|
readonly 2: {
|
|
816
|
-
pool: Pool
|
|
816
|
+
pool: Pool;
|
|
817
817
|
};
|
|
818
818
|
/**
|
|
819
819
|
* The task ID associated with the test module.
|
|
@@ -852,7 +852,7 @@ declare class TestSpecification {
|
|
|
852
852
|
declare class TestProject {
|
|
853
853
|
/** @deprecated */
|
|
854
854
|
path: string | number;
|
|
855
|
-
options?:
|
|
855
|
+
options?: Vitest;
|
|
856
856
|
/**
|
|
857
857
|
* The global Vitest instance.
|
|
858
858
|
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
@@ -955,11 +955,11 @@ declare class TestProject {
|
|
|
955
955
|
/**
|
|
956
956
|
* Test files that match the filters.
|
|
957
957
|
*/
|
|
958
|
-
testFiles: string[]
|
|
958
|
+
testFiles: string[];
|
|
959
959
|
/**
|
|
960
960
|
* Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
|
|
961
961
|
*/
|
|
962
|
-
typecheckTestFiles: string[]
|
|
962
|
+
typecheckTestFiles: string[];
|
|
963
963
|
}>;
|
|
964
964
|
private globAllTestFiles;
|
|
965
965
|
isBrowserEnabled(): boolean;
|
|
@@ -1009,7 +1009,7 @@ interface InitializeProjectOptions extends TestProjectInlineConfiguration {
|
|
|
1009
1009
|
* @deprecated use TestSpecification instead
|
|
1010
1010
|
*/
|
|
1011
1011
|
type WorkspaceSpec = TestSpecification & [project: TestProject, file: string, options: {
|
|
1012
|
-
pool: Pool
|
|
1012
|
+
pool: Pool;
|
|
1013
1013
|
}];
|
|
1014
1014
|
type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) => Awaitable<void>;
|
|
1015
1015
|
interface ProcessPool {
|
|
@@ -1060,14 +1060,14 @@ declare class VitestCache {
|
|
|
1060
1060
|
constructor(version: string);
|
|
1061
1061
|
getFileTestResults(key: string): SuiteResultCache | undefined;
|
|
1062
1062
|
getFileStats(key: string): {
|
|
1063
|
-
size: number
|
|
1063
|
+
size: number;
|
|
1064
1064
|
} | undefined;
|
|
1065
1065
|
static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
declare class VitestPackageInstaller {
|
|
1069
1069
|
isPackageExists(name: string, options?: {
|
|
1070
|
-
paths?: string[]
|
|
1070
|
+
paths?: string[];
|
|
1071
1071
|
}): boolean;
|
|
1072
1072
|
ensureInstalled(dependency: string, root: string, version?: string): Promise<boolean>;
|
|
1073
1073
|
}
|
|
@@ -1101,7 +1101,7 @@ declare class StateManager {
|
|
|
1101
1101
|
blobs?: MergedBlobs;
|
|
1102
1102
|
onUnhandledError?: OnUnhandledErrorCallback;
|
|
1103
1103
|
constructor(options: {
|
|
1104
|
-
onUnhandledError?: OnUnhandledErrorCallback
|
|
1104
|
+
onUnhandledError?: OnUnhandledErrorCallback;
|
|
1105
1105
|
});
|
|
1106
1106
|
catchError(error: unknown, type: string): void;
|
|
1107
1107
|
clearErrors(): void;
|
|
@@ -1175,7 +1175,6 @@ declare class Vitest {
|
|
|
1175
1175
|
private _state?;
|
|
1176
1176
|
private _cache?;
|
|
1177
1177
|
private _snapshot?;
|
|
1178
|
-
private _workspaceConfigPath?;
|
|
1179
1178
|
constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
|
|
1180
1179
|
private _onRestartListeners;
|
|
1181
1180
|
private _onClose;
|
|
@@ -1242,7 +1241,6 @@ declare class Vitest {
|
|
|
1242
1241
|
* @param moduleId The ID of the module in Vite module graph
|
|
1243
1242
|
*/
|
|
1244
1243
|
import<T>(moduleId: string): Promise<T>;
|
|
1245
|
-
private resolveWorkspaceConfigPath;
|
|
1246
1244
|
private resolveProjects;
|
|
1247
1245
|
/**
|
|
1248
1246
|
* Glob test files in every project and create a TestSpecification for each file and pool.
|
|
@@ -1837,17 +1835,17 @@ declare class VerboseReporter extends DefaultReporter {
|
|
|
1837
1835
|
}
|
|
1838
1836
|
|
|
1839
1837
|
type FormattedBenchmarkResult = BenchmarkResult & {
|
|
1840
|
-
id: string
|
|
1838
|
+
id: string;
|
|
1841
1839
|
};
|
|
1842
1840
|
|
|
1843
1841
|
declare function renderTable(options: {
|
|
1844
|
-
tasks: Task[]
|
|
1845
|
-
level: number
|
|
1846
|
-
shallow?: boolean
|
|
1847
|
-
showHeap: boolean
|
|
1848
|
-
columns: number
|
|
1849
|
-
slowTestThreshold: number
|
|
1850
|
-
compare?: Record<Task["id"], FormattedBenchmarkResult
|
|
1842
|
+
tasks: Task[];
|
|
1843
|
+
level: number;
|
|
1844
|
+
shallow?: boolean;
|
|
1845
|
+
showHeap: boolean;
|
|
1846
|
+
columns: number;
|
|
1847
|
+
slowTestThreshold: number;
|
|
1848
|
+
compare?: Record<Task["id"], FormattedBenchmarkResult>;
|
|
1851
1849
|
}): string;
|
|
1852
1850
|
|
|
1853
1851
|
declare class BenchmarkReporter extends DefaultReporter {
|
|
@@ -1865,22 +1863,22 @@ declare class VerboseBenchmarkReporter extends BenchmarkReporter {
|
|
|
1865
1863
|
}
|
|
1866
1864
|
|
|
1867
1865
|
declare const BenchmarkReportsMap: {
|
|
1868
|
-
default: typeof BenchmarkReporter
|
|
1869
|
-
verbose: typeof VerboseBenchmarkReporter
|
|
1866
|
+
default: typeof BenchmarkReporter;
|
|
1867
|
+
verbose: typeof VerboseBenchmarkReporter;
|
|
1870
1868
|
};
|
|
1871
1869
|
type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
1872
1870
|
|
|
1873
1871
|
declare const ReportersMap: {
|
|
1874
|
-
default: typeof DefaultReporter
|
|
1875
|
-
blob: typeof BlobReporter
|
|
1876
|
-
verbose: typeof VerboseReporter
|
|
1877
|
-
dot: typeof DotReporter
|
|
1878
|
-
json: typeof JsonReporter
|
|
1879
|
-
tap: typeof TapReporter
|
|
1880
|
-
"tap-flat": typeof TapFlatReporter
|
|
1881
|
-
junit: typeof JUnitReporter
|
|
1882
|
-
"hanging-process": typeof HangingProcessReporter
|
|
1883
|
-
"github-actions": typeof GithubActionsReporter
|
|
1872
|
+
default: typeof DefaultReporter;
|
|
1873
|
+
blob: typeof BlobReporter;
|
|
1874
|
+
verbose: typeof VerboseReporter;
|
|
1875
|
+
dot: typeof DotReporter;
|
|
1876
|
+
json: typeof JsonReporter;
|
|
1877
|
+
tap: typeof TapReporter;
|
|
1878
|
+
"tap-flat": typeof TapFlatReporter;
|
|
1879
|
+
junit: typeof JUnitReporter;
|
|
1880
|
+
"hanging-process": typeof HangingProcessReporter;
|
|
1881
|
+
"github-actions": typeof GithubActionsReporter;
|
|
1884
1882
|
};
|
|
1885
1883
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
1886
1884
|
interface BuiltinReporterOptions {
|
|
@@ -2070,23 +2068,23 @@ type CoverageReporter = keyof ReportOptions | (string & {});
|
|
|
2070
2068
|
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, object] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
|
|
2071
2069
|
type CoverageProviderName = "v8" | "istanbul" | "custom" | undefined;
|
|
2072
2070
|
type CoverageOptions<T extends CoverageProviderName = CoverageProviderName> = T extends "istanbul" ? {
|
|
2073
|
-
provider: T
|
|
2071
|
+
provider: T;
|
|
2074
2072
|
} & CoverageIstanbulOptions : T extends "v8" ? {
|
|
2075
2073
|
/**
|
|
2076
2074
|
* Provider to use for coverage collection.
|
|
2077
2075
|
*
|
|
2078
2076
|
* @default 'v8'
|
|
2079
2077
|
*/
|
|
2080
|
-
provider: T
|
|
2078
|
+
provider: T;
|
|
2081
2079
|
} & CoverageV8Options : T extends "custom" ? {
|
|
2082
|
-
provider: T
|
|
2080
|
+
provider: T;
|
|
2083
2081
|
} & CustomProviderOptions : {
|
|
2084
|
-
provider?: T
|
|
2082
|
+
provider?: T;
|
|
2085
2083
|
} & CoverageV8Options;
|
|
2086
2084
|
/** Fields that have default values. Internally these will always be defined. */
|
|
2087
2085
|
type FieldsWithDefaultValues = "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "exclude" | "reportOnFailure" | "allowExternal" | "processingConcurrency";
|
|
2088
2086
|
type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
2089
|
-
reporter: CoverageReporterWithOptions[]
|
|
2087
|
+
reporter: CoverageReporterWithOptions[];
|
|
2090
2088
|
};
|
|
2091
2089
|
interface BaseCoverageOptions {
|
|
2092
2090
|
/**
|
|
@@ -2162,7 +2160,7 @@ interface BaseCoverageOptions {
|
|
|
2162
2160
|
* ```
|
|
2163
2161
|
*/
|
|
2164
2162
|
thresholds?: Thresholds | ({
|
|
2165
|
-
[glob: string]: Pick<Thresholds, 100 | "statements" | "functions" | "branches" | "lines"
|
|
2163
|
+
[glob: string]: Pick<Thresholds, 100 | "statements" | "functions" | "branches" | "lines">;
|
|
2166
2164
|
} & Thresholds);
|
|
2167
2165
|
/**
|
|
2168
2166
|
* Watermarks for statements, lines, branches and functions.
|
|
@@ -2170,10 +2168,10 @@ interface BaseCoverageOptions {
|
|
|
2170
2168
|
* Default value is `[50,80]` for each property.
|
|
2171
2169
|
*/
|
|
2172
2170
|
watermarks?: {
|
|
2173
|
-
statements?: [number, number]
|
|
2174
|
-
functions?: [number, number]
|
|
2175
|
-
branches?: [number, number]
|
|
2176
|
-
lines?: [number, number]
|
|
2171
|
+
statements?: [number, number];
|
|
2172
|
+
functions?: [number, number];
|
|
2173
|
+
branches?: [number, number];
|
|
2174
|
+
lines?: [number, number];
|
|
2177
2175
|
};
|
|
2178
2176
|
/**
|
|
2179
2177
|
* Generate coverage report even when tests fail.
|
|
@@ -2284,12 +2282,12 @@ interface SequenceOptions {
|
|
|
2284
2282
|
* earlier if you enable this option.
|
|
2285
2283
|
* @default false
|
|
2286
2284
|
*/
|
|
2287
|
-
files?: boolean
|
|
2285
|
+
files?: boolean;
|
|
2288
2286
|
/**
|
|
2289
2287
|
* Should tests run in random order.
|
|
2290
2288
|
* @default false
|
|
2291
2289
|
*/
|
|
2292
|
-
tests?: boolean
|
|
2290
|
+
tests?: boolean;
|
|
2293
2291
|
};
|
|
2294
2292
|
/**
|
|
2295
2293
|
* Should tests run in parallel.
|
|
@@ -2318,7 +2316,7 @@ interface SequenceOptions {
|
|
|
2318
2316
|
hooks?: SequenceHooks;
|
|
2319
2317
|
}
|
|
2320
2318
|
type DepsOptimizationOptions = Omit<DepOptimizationConfig, "disabled" | "noDiscovery"> & {
|
|
2321
|
-
enabled?: boolean
|
|
2319
|
+
enabled?: boolean;
|
|
2322
2320
|
};
|
|
2323
2321
|
interface TransformModePatterns {
|
|
2324
2322
|
/**
|
|
@@ -2342,8 +2340,8 @@ interface DepsOptions {
|
|
|
2342
2340
|
* Enable dependency optimization. This can improve the performance of your tests.
|
|
2343
2341
|
*/
|
|
2344
2342
|
optimizer?: {
|
|
2345
|
-
web?: DepsOptimizationOptions
|
|
2346
|
-
ssr?: DepsOptimizationOptions
|
|
2343
|
+
web?: DepsOptimizationOptions;
|
|
2344
|
+
ssr?: DepsOptimizationOptions;
|
|
2347
2345
|
};
|
|
2348
2346
|
web?: {
|
|
2349
2347
|
/**
|
|
@@ -2355,7 +2353,7 @@ interface DepsOptions {
|
|
|
2355
2353
|
*
|
|
2356
2354
|
* @default true
|
|
2357
2355
|
*/
|
|
2358
|
-
transformAssets?: boolean
|
|
2356
|
+
transformAssets?: boolean;
|
|
2359
2357
|
/**
|
|
2360
2358
|
* Should Vitest process CSS (.css, .scss, .sass, etc) files and resolve them like Vite does in the browser.
|
|
2361
2359
|
*
|
|
@@ -2365,7 +2363,7 @@ interface DepsOptions {
|
|
|
2365
2363
|
*
|
|
2366
2364
|
* @default true
|
|
2367
2365
|
*/
|
|
2368
|
-
transformCss?: boolean
|
|
2366
|
+
transformCss?: boolean;
|
|
2369
2367
|
/**
|
|
2370
2368
|
* Regexp pattern to match external files that should be transformed.
|
|
2371
2369
|
*
|
|
@@ -2375,7 +2373,7 @@ interface DepsOptions {
|
|
|
2375
2373
|
*
|
|
2376
2374
|
* @default []
|
|
2377
2375
|
*/
|
|
2378
|
-
transformGlobPattern?: RegExp | RegExp[]
|
|
2376
|
+
transformGlobPattern?: RegExp | RegExp[];
|
|
2379
2377
|
};
|
|
2380
2378
|
/**
|
|
2381
2379
|
* Externalize means that Vite will bypass the package to native Node.
|
|
@@ -2531,11 +2529,6 @@ interface InlineConfig {
|
|
|
2531
2529
|
*/
|
|
2532
2530
|
projects?: TestProjectConfiguration[];
|
|
2533
2531
|
/**
|
|
2534
|
-
* Path to a workspace configuration file
|
|
2535
|
-
* @deprecated use `projects` instead
|
|
2536
|
-
*/
|
|
2537
|
-
workspace?: string | TestProjectConfiguration[];
|
|
2538
|
-
/**
|
|
2539
2532
|
* Update snapshot
|
|
2540
2533
|
*
|
|
2541
2534
|
* @default false
|
|
@@ -2691,7 +2684,9 @@ interface InlineConfig {
|
|
|
2691
2684
|
/**
|
|
2692
2685
|
* Format options for snapshot testing.
|
|
2693
2686
|
*/
|
|
2694
|
-
snapshotFormat?: Omit<PrettyFormatOptions, "plugins"
|
|
2687
|
+
snapshotFormat?: Omit<PrettyFormatOptions, "plugins" | "compareKeys"> & {
|
|
2688
|
+
compareKeys?: null | undefined;
|
|
2689
|
+
};
|
|
2695
2690
|
/**
|
|
2696
2691
|
* Path to a module which has a default export of diff config.
|
|
2697
2692
|
*/
|
|
@@ -2755,11 +2750,11 @@ interface InlineConfig {
|
|
|
2755
2750
|
* @default { include: [], modules: { classNameStrategy: false } }
|
|
2756
2751
|
*/
|
|
2757
2752
|
css?: boolean | {
|
|
2758
|
-
include?: RegExp | RegExp[]
|
|
2759
|
-
exclude?: RegExp | RegExp[]
|
|
2753
|
+
include?: RegExp | RegExp[];
|
|
2754
|
+
exclude?: RegExp | RegExp[];
|
|
2760
2755
|
modules?: {
|
|
2761
|
-
classNameStrategy?: CSSModuleScopeStrategy
|
|
2762
|
-
}
|
|
2756
|
+
classNameStrategy?: CSSModuleScopeStrategy;
|
|
2757
|
+
};
|
|
2763
2758
|
};
|
|
2764
2759
|
/**
|
|
2765
2760
|
* A number of tests that are allowed to run at the same time marked with `test.concurrent`.
|
|
@@ -2774,7 +2769,7 @@ interface InlineConfig {
|
|
|
2774
2769
|
/**
|
|
2775
2770
|
* @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
|
|
2776
2771
|
*/
|
|
2777
|
-
dir: string
|
|
2772
|
+
dir: string;
|
|
2778
2773
|
};
|
|
2779
2774
|
/**
|
|
2780
2775
|
* Options for configuring the order of running tests.
|
|
@@ -2827,19 +2822,19 @@ interface InlineConfig {
|
|
|
2827
2822
|
/**
|
|
2828
2823
|
* Enable inspector
|
|
2829
2824
|
*/
|
|
2830
|
-
enabled?: boolean
|
|
2825
|
+
enabled?: boolean;
|
|
2831
2826
|
/**
|
|
2832
2827
|
* Port to run inspector on
|
|
2833
2828
|
*/
|
|
2834
|
-
port?: number
|
|
2829
|
+
port?: number;
|
|
2835
2830
|
/**
|
|
2836
2831
|
* Host to run inspector on
|
|
2837
2832
|
*/
|
|
2838
|
-
host?: string
|
|
2833
|
+
host?: string;
|
|
2839
2834
|
/**
|
|
2840
2835
|
* Wait for debugger to connect before running tests
|
|
2841
2836
|
*/
|
|
2842
|
-
waitForDebugger?: boolean
|
|
2837
|
+
waitForDebugger?: boolean;
|
|
2843
2838
|
};
|
|
2844
2839
|
/**
|
|
2845
2840
|
* Define variables that will be returned from `inject` in the test environment.
|
|
@@ -2868,7 +2863,7 @@ interface InlineConfig {
|
|
|
2868
2863
|
/**
|
|
2869
2864
|
* Throw an error if tests don't have any expect() assertions.
|
|
2870
2865
|
*/
|
|
2871
|
-
requireAssertions?: boolean
|
|
2866
|
+
requireAssertions?: boolean;
|
|
2872
2867
|
/**
|
|
2873
2868
|
* Default options for expect.poll()
|
|
2874
2869
|
*/
|
|
@@ -2877,13 +2872,13 @@ interface InlineConfig {
|
|
|
2877
2872
|
* Timeout in milliseconds
|
|
2878
2873
|
* @default 1000
|
|
2879
2874
|
*/
|
|
2880
|
-
timeout?: number
|
|
2875
|
+
timeout?: number;
|
|
2881
2876
|
/**
|
|
2882
2877
|
* Polling interval in milliseconds
|
|
2883
2878
|
* @default 50
|
|
2884
2879
|
*/
|
|
2885
|
-
interval?: number
|
|
2886
|
-
}
|
|
2880
|
+
interval?: number;
|
|
2881
|
+
};
|
|
2887
2882
|
};
|
|
2888
2883
|
/**
|
|
2889
2884
|
* Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
|
|
@@ -2993,7 +2988,7 @@ interface UserConfig extends InlineConfig {
|
|
|
2993
2988
|
*
|
|
2994
2989
|
* Vitest will only run tests if it's called programmatically or the test file changes.
|
|
2995
2990
|
*
|
|
2996
|
-
* CLI file filters
|
|
2991
|
+
* If CLI file filters are passed, standalone mode is ignored.
|
|
2997
2992
|
*/
|
|
2998
2993
|
standalone?: boolean;
|
|
2999
2994
|
/**
|
|
@@ -3049,7 +3044,7 @@ interface UserConfig extends InlineConfig {
|
|
|
3049
3044
|
mergeReports?: string;
|
|
3050
3045
|
}
|
|
3051
3046
|
type OnUnhandledErrorCallback = (error: (TestError | Error) & {
|
|
3052
|
-
type: string
|
|
3047
|
+
type: string;
|
|
3053
3048
|
}) => boolean | void;
|
|
3054
3049
|
interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "poolOptions" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name"> {
|
|
3055
3050
|
mode: VitestRunMode;
|
|
@@ -3072,47 +3067,47 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
3072
3067
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
3073
3068
|
defines: Record<string, any>;
|
|
3074
3069
|
api: ApiConfig & {
|
|
3075
|
-
token: string
|
|
3070
|
+
token: string;
|
|
3076
3071
|
};
|
|
3077
3072
|
cliExclude?: string[];
|
|
3078
3073
|
project: string[];
|
|
3079
3074
|
benchmark?: Required<Omit<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">> & Pick<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">;
|
|
3080
3075
|
shard?: {
|
|
3081
|
-
index: number
|
|
3082
|
-
count: number
|
|
3076
|
+
index: number;
|
|
3077
|
+
count: number;
|
|
3083
3078
|
};
|
|
3084
3079
|
cache: {
|
|
3085
3080
|
/**
|
|
3086
3081
|
* @deprecated
|
|
3087
3082
|
*/
|
|
3088
|
-
dir: string
|
|
3083
|
+
dir: string;
|
|
3089
3084
|
} | false;
|
|
3090
3085
|
sequence: {
|
|
3091
|
-
sequencer: TestSequencerConstructor
|
|
3092
|
-
hooks: SequenceHooks
|
|
3093
|
-
setupFiles: SequenceSetupFiles
|
|
3094
|
-
shuffle?: boolean
|
|
3095
|
-
concurrent?: boolean
|
|
3096
|
-
seed: number
|
|
3097
|
-
groupOrder: number
|
|
3086
|
+
sequencer: TestSequencerConstructor;
|
|
3087
|
+
hooks: SequenceHooks;
|
|
3088
|
+
setupFiles: SequenceSetupFiles;
|
|
3089
|
+
shuffle?: boolean;
|
|
3090
|
+
concurrent?: boolean;
|
|
3091
|
+
seed: number;
|
|
3092
|
+
groupOrder: number;
|
|
3098
3093
|
};
|
|
3099
3094
|
typecheck: Omit<TypecheckConfig, "enabled"> & {
|
|
3100
|
-
enabled: boolean
|
|
3095
|
+
enabled: boolean;
|
|
3101
3096
|
};
|
|
3102
3097
|
runner?: string;
|
|
3103
3098
|
maxWorkers: number;
|
|
3104
3099
|
minWorkers: number;
|
|
3105
3100
|
}
|
|
3106
|
-
type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "maxWorkers" | "minWorkers" | "fileParallelism" | "
|
|
3101
|
+
type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "maxWorkers" | "minWorkers" | "fileParallelism" | "watchTriggerPatterns";
|
|
3107
3102
|
type ProjectConfig = Omit<InlineConfig, NonProjectOptions | "sequencer" | "deps" | "poolOptions"> & {
|
|
3108
|
-
mode?: string
|
|
3109
|
-
sequencer?: Omit<SequenceOptions, "sequencer" | "seed"
|
|
3110
|
-
deps?: Omit<DepsOptions, "moduleDirectories"
|
|
3103
|
+
mode?: string;
|
|
3104
|
+
sequencer?: Omit<SequenceOptions, "sequencer" | "seed">;
|
|
3105
|
+
deps?: Omit<DepsOptions, "moduleDirectories">;
|
|
3111
3106
|
poolOptions?: {
|
|
3112
|
-
threads?: Pick<NonNullable<PoolOptions["threads"]>, "singleThread" | "isolate"
|
|
3113
|
-
vmThreads?: Pick<NonNullable<PoolOptions["vmThreads"]>, "singleThread"
|
|
3114
|
-
forks?: Pick<NonNullable<PoolOptions["forks"]>, "singleFork" | "isolate"
|
|
3115
|
-
}
|
|
3107
|
+
threads?: Pick<NonNullable<PoolOptions["threads"]>, "singleThread" | "isolate">;
|
|
3108
|
+
vmThreads?: Pick<NonNullable<PoolOptions["vmThreads"]>, "singleThread">;
|
|
3109
|
+
forks?: Pick<NonNullable<PoolOptions["forks"]>, "singleFork" | "isolate">;
|
|
3110
|
+
};
|
|
3116
3111
|
};
|
|
3117
3112
|
type ResolvedProjectConfig = Omit<ResolvedConfig, Exclude<NonProjectOptions, "coverage" | "watch">>;
|
|
3118
3113
|
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
@@ -3127,7 +3122,7 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
|
|
|
3127
3122
|
* If `true`, the project will inherit all options from the root config.
|
|
3128
3123
|
* @example '../vite.config.ts'
|
|
3129
3124
|
*/
|
|
3130
|
-
extends?: string | true
|
|
3125
|
+
extends?: string | true;
|
|
3131
3126
|
});
|
|
3132
3127
|
type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
3133
3128
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
4
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.
|
|
5
|
-
import { a as globalExpect, v as vi } from './vi.
|
|
3
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.Dppt57hu.js';
|
|
4
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.Ebx5x0eP.js';
|
|
5
|
+
import { a as globalExpect, v as vi } from './vi.CA0EPI9Y.js';
|
|
6
6
|
import { c as closeInspector } from './inspector.C914Efll.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import timers from 'node:timers';
|
|
@@ -11,7 +11,7 @@ import util from 'node:util';
|
|
|
11
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
12
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
13
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
14
|
-
import { V as VitestIndex } from './index.
|
|
14
|
+
import { V as VitestIndex } from './index.D1_MsKEt.js';
|
|
15
15
|
import { g as getWorkerState, r as resetModules } from './utils.XdZDrNZV.js';
|
|
16
16
|
import 'chai';
|
|
17
17
|
import 'node:path';
|
|
@@ -72,7 +72,7 @@ function resolveAsset(mod, url) {
|
|
|
72
72
|
mod.exports = url;
|
|
73
73
|
}
|
|
74
74
|
async function setupConsoleLogSpy() {
|
|
75
|
-
const { createCustomConsole } = await import('./console.
|
|
75
|
+
const { createCustomConsole } = await import('./console.DoJHFxmj.js');
|
|
76
76
|
globalThis.console = createCustomConsole();
|
|
77
77
|
}
|
|
78
78
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -25,7 +25,7 @@ async function setupCommonEnv(config) {
|
|
|
25
25
|
if (globalSetup) return;
|
|
26
26
|
globalSetup = true;
|
|
27
27
|
setSafeTimers();
|
|
28
|
-
if (config.globals) (await import('./globals.
|
|
28
|
+
if (config.globals) (await import('./globals.Dgo-vS5G.js')).registerApiGlobally();
|
|
29
29
|
}
|
|
30
30
|
function setupDefines(defines) {
|
|
31
31
|
for (const key in defines) globalThis[key] = defines[key];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Test } from '@vitest/runner';
|
|
2
|
-
import { c as BenchmarkAPI, a as BenchFunction } from './benchmark.d.
|
|
2
|
+
import { c as BenchmarkAPI, a as BenchFunction } from './benchmark.d.DAaHLpsq.js';
|
|
3
3
|
import { Options } from 'tinybench';
|
|
4
4
|
import '@vitest/runner/utils';
|
|
5
5
|
|
|
@@ -768,7 +768,7 @@ class Typechecker {
|
|
|
768
768
|
let dataReceived = false;
|
|
769
769
|
return new Promise((resolve, reject) => {
|
|
770
770
|
if (!child.process || !child.process.stdout) {
|
|
771
|
-
reject(new Error(`Failed to initialize ${typecheck.checker}. This is a bug in Vitest - please, open an issue with reproduction.`));
|
|
771
|
+
reject(/* @__PURE__ */ new Error(`Failed to initialize ${typecheck.checker}. This is a bug in Vitest - please, open an issue with reproduction.`));
|
|
772
772
|
return;
|
|
773
773
|
}
|
|
774
774
|
child.process.stdout.on("data", (chunk) => {
|
|
@@ -792,7 +792,7 @@ class Typechecker {
|
|
|
792
792
|
this._output = "";
|
|
793
793
|
}
|
|
794
794
|
});
|
|
795
|
-
const timeout = setTimeout(() => reject(new Error(`${typecheck.checker} spawn timed out`)), this.project.config.typecheck.spawnTimeout);
|
|
795
|
+
const timeout = setTimeout(() => reject(/* @__PURE__ */ new Error(`${typecheck.checker} spawn timed out`)), this.project.config.typecheck.spawnTimeout);
|
|
796
796
|
function onError(cause) {
|
|
797
797
|
clearTimeout(timeout);
|
|
798
798
|
reject(new Error("Spawning typechecker failed - is typescript installed?", { cause }));
|
|
@@ -811,7 +811,7 @@ class Typechecker {
|
|
|
811
811
|
else resolve({ result: child });
|
|
812
812
|
});
|
|
813
813
|
if (process.platform === "win32") child.process.once("close", (code) => {
|
|
814
|
-
if (code != null && code !== 0 && !dataReceived) onError(new Error(`The ${typecheck.checker} command exited with code ${code}.`));
|
|
814
|
+
if (code != null && code !== 0 && !dataReceived) onError(/* @__PURE__ */ new Error(`The ${typecheck.checker} command exited with code ${code}.`));
|
|
815
815
|
});
|
|
816
816
|
child.process.once("error", onError);
|
|
817
817
|
});
|
|
@@ -46,7 +46,7 @@ function createForksRpcOptions(nodeV8) {
|
|
|
46
46
|
function unwrapSerializableConfig(config) {
|
|
47
47
|
if (config.testNamePattern && typeof config.testNamePattern === "string") {
|
|
48
48
|
const testNamePattern = config.testNamePattern;
|
|
49
|
-
if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) config.testNamePattern = parseRegexp(testNamePattern.slice(
|
|
49
|
+
if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) config.testNamePattern = parseRegexp(testNamePattern.slice(9));
|
|
50
50
|
}
|
|
51
51
|
if (config.defines && Array.isArray(config.defines.keys) && config.defines.original) {
|
|
52
52
|
const { keys, original } = config.defines;
|