vitest 3.2.0-beta.2 → 3.2.0
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 +29 -0
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +2 -2
- package/dist/chunks/{base.DwtwORaC.js → base.Cg0miDlQ.js} +11 -14
- package/dist/chunks/{benchmark.BoF7jW0Q.js → benchmark.CYdenmiT.js} +4 -6
- package/dist/chunks/{cac.I9MLYfT-.js → cac.6rXCxFY1.js} +76 -143
- package/dist/chunks/{cli-api.d6IK1pnk.js → cli-api.Cej3MBjA.js} +1460 -1344
- package/dist/chunks/{config.d.UqE-KR0o.d.ts → config.d.D2ROskhv.d.ts} +2 -0
- package/dist/chunks/{console.K1NMVOSc.js → console.CtFJOzRO.js} +25 -45
- package/dist/chunks/{constants.BZZyIeIE.js → constants.DnKduX2e.js} +1 -0
- package/dist/chunks/{coverage.0iPg4Wrz.js → coverage.DVF1vEu8.js} +4 -12
- package/dist/chunks/{coverage.OGU09Jbh.js → coverage.EIiagJJP.js} +578 -993
- package/dist/chunks/{creator.DGAdZ4Hj.js → creator.GK6I-cL4.js} +39 -83
- package/dist/chunks/date.Bq6ZW5rf.js +73 -0
- package/dist/chunks/{defaults.DSxsTG0h.js → defaults.B7q_naMc.js} +2 -1
- package/dist/chunks/{env.Dq0hM4Xv.js → env.D4Lgay0q.js} +1 -1
- package/dist/chunks/{environment.d.D8YDy2v5.d.ts → environment.d.cL3nLXbE.d.ts} +1 -0
- package/dist/chunks/{execute.JlGHLJZT.js → execute.B7h3T_Hc.js} +126 -217
- package/dist/chunks/{git.DXfdBEfR.js → git.BVQ8w_Sw.js} +1 -3
- package/dist/chunks/{global.d.BPa1eL3O.d.ts → global.d.MAmajcmJ.d.ts} +5 -1
- package/dist/chunks/{globals.CpxW8ccg.js → globals.DEHgCU4V.js} +7 -6
- package/dist/chunks/{index.CV36oG_L.js → index.BZ0g1JD2.js} +430 -625
- package/dist/chunks/{index.DswW_LEs.js → index.BbB8_kAK.js} +25 -24
- package/dist/chunks/{index.CmC5OK9L.js → index.CIyJn3t1.js} +38 -82
- package/dist/chunks/{index.CfXMNXHg.js → index.CdQS2e2Q.js} +4 -2
- package/dist/chunks/{index.DFXFpH3w.js → index.CmSc2RE5.js} +85 -105
- package/dist/chunks/index.D3XRDfWc.js +213 -0
- package/dist/chunks/{inspector.DbDkSkFn.js → inspector.C914Efll.js} +4 -1
- package/dist/chunks/{node.3xsWotC9.js → node.fjCdwEIl.js} +1 -1
- package/dist/chunks/{reporters.d.CLC9rhKy.d.ts → reporters.d.C1ogPriE.d.ts} +47 -9
- package/dist/chunks/{rpc.D9_013TY.js → rpc.Iovn4oWe.js} +10 -19
- package/dist/chunks/{runBaseTests.Dn2vyej_.js → runBaseTests.Dd85QTll.js} +27 -31
- package/dist/chunks/{setup-common.CYo3Y0dD.js → setup-common.Dd054P77.js} +16 -42
- package/dist/chunks/{typechecker.DnTrplSJ.js → typechecker.DRKU1-1g.js} +163 -186
- package/dist/chunks/{utils.BfxieIyZ.js → utils.CAioKnHs.js} +9 -14
- package/dist/chunks/{utils.CgTj3MsC.js → utils.XdZDrNZV.js} +6 -13
- package/dist/chunks/{vi.BFR5YIgu.js → vi.bdSIJ99Y.js} +137 -263
- package/dist/chunks/{vite.d.CBZ3M_ru.d.ts → vite.d.DqE4-hhK.d.ts} +3 -1
- package/dist/chunks/{vm.C1HHjtNS.js → vm.BThCzidc.js} +164 -212
- package/dist/chunks/{worker.d.D5Xdi-Zr.d.ts → worker.d.DvqK5Vmu.d.ts} +1 -1
- package/dist/chunks/{worker.d.CoCI7hzP.d.ts → worker.d.tQu2eJQy.d.ts} +5 -3
- package/dist/cli.js +5 -5
- package/dist/config.cjs +3 -1
- package/dist/config.d.ts +7 -6
- package/dist/config.js +3 -3
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +7 -7
- package/dist/environments.d.ts +6 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +9 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +28 -15
- package/dist/index.js +5 -5
- package/dist/node.d.ts +18 -10
- package/dist/node.js +17 -17
- package/dist/reporters.d.ts +4 -4
- package/dist/reporters.js +4 -4
- package/dist/runners.d.ts +6 -3
- package/dist/runners.js +59 -80
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +39 -41
- package/dist/workers/forks.js +6 -4
- package/dist/workers/runVmTests.js +20 -21
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +6 -6
- package/dist/workers.d.ts +4 -4
- package/dist/workers.js +10 -10
- package/package.json +21 -19
- package/dist/chunks/date.CDOsz-HY.js +0 -53
- package/dist/chunks/index.CK1YOQaa.js +0 -143
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { File, TaskResultPack, TaskEventPack, CancelReason, FileSpecification, Task } from '@vitest/runner';
|
|
1
|
+
import { File, TestAnnotation, TaskResultPack, TaskEventPack, CancelReason, FileSpecification, Task } from '@vitest/runner';
|
|
2
2
|
import { ViteNodeResolveId, ModuleCacheMap, ModuleExecutionInfo } from 'vite-node';
|
|
3
|
-
import { a as SerializedConfig } from './config.d.
|
|
4
|
-
import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d.
|
|
3
|
+
import { a as SerializedConfig } from './config.d.D2ROskhv.js';
|
|
4
|
+
import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d.cL3nLXbE.js';
|
|
5
5
|
import { SnapshotResult } from '@vitest/snapshot';
|
|
6
6
|
|
|
7
7
|
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
@@ -121,6 +121,7 @@ interface RuntimeRPC {
|
|
|
121
121
|
onQueued: (file: File) => void;
|
|
122
122
|
onCollected: (files: File[]) => Promise<void>;
|
|
123
123
|
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
124
|
+
onTaskAnnotate: (testId: string, annotation: TestAnnotation) => Promise<TestAnnotation>;
|
|
124
125
|
onTaskUpdate: (pack: TaskResultPack[], events: TaskEventPack[]) => Promise<void>;
|
|
125
126
|
onCancel: (reason: CancelReason) => void;
|
|
126
127
|
getCountOfFailedTests: () => number;
|
|
@@ -162,6 +163,7 @@ interface WorkerGlobalState {
|
|
|
162
163
|
onCancel: Promise<CancelReason>;
|
|
163
164
|
moduleCache: ModuleCacheMap;
|
|
164
165
|
moduleExecutionInfo?: ModuleExecutionInfo;
|
|
166
|
+
onCleanup: (listener: () => unknown) => void;
|
|
165
167
|
providedContext: Record<string, any>;
|
|
166
168
|
durations: {
|
|
167
169
|
environment: number
|
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { c as createCLI } from './chunks/cac.
|
|
1
|
+
import { c as createCLI } from './chunks/cac.6rXCxFY1.js';
|
|
2
2
|
import '@vitest/utils';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
|
-
import './chunks/constants.
|
|
7
|
-
import './chunks/index.
|
|
6
|
+
import './chunks/constants.DnKduX2e.js';
|
|
7
|
+
import './chunks/index.BZ0g1JD2.js';
|
|
8
8
|
import 'node:perf_hooks';
|
|
9
9
|
import '@vitest/runner/utils';
|
|
10
10
|
import '@vitest/utils/source-map';
|
|
11
|
-
import './chunks/env.
|
|
11
|
+
import './chunks/env.D4Lgay0q.js';
|
|
12
12
|
import 'std-env';
|
|
13
|
-
import './chunks/typechecker.
|
|
13
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
14
14
|
import 'node:os';
|
|
15
15
|
import 'tinyexec';
|
|
16
16
|
import './path.js';
|
package/dist/config.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var os = require('node:os');
|
|
|
4
4
|
var stdEnv = require('std-env');
|
|
5
5
|
var vite = require('vite');
|
|
6
6
|
|
|
7
|
+
// if changed, update also jsdocs and docs
|
|
7
8
|
const defaultBrowserPort = 63315;
|
|
8
9
|
const extraInlineDeps = [
|
|
9
10
|
/^(?!.*node_modules).*\.mjs$/,
|
|
@@ -12,7 +13,7 @@ const extraInlineDeps = [
|
|
|
12
13
|
];
|
|
13
14
|
|
|
14
15
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
|
|
15
|
-
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !==
|
|
16
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
|
|
16
17
|
(isNode || isDeno) && process.platform === "win32";
|
|
17
18
|
(isNode || isDeno) && process.stdout?.isTTY && !stdEnv.isCI;
|
|
18
19
|
|
|
@@ -43,6 +44,7 @@ const defaultCoverageExcludes = [
|
|
|
43
44
|
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
44
45
|
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
45
46
|
];
|
|
47
|
+
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
46
48
|
const coverageConfigDefaults = {
|
|
47
49
|
provider: "v8",
|
|
48
50
|
enabled: false,
|
package/dist/config.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.
|
|
4
|
-
export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.
|
|
5
|
-
import './chunks/vite.d.
|
|
6
|
-
import { F as FakeTimerInstallOpts } from './chunks/config.d.
|
|
3
|
+
import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.C1ogPriE.js';
|
|
4
|
+
export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.C1ogPriE.js';
|
|
5
|
+
import './chunks/vite.d.DqE4-hhK.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.D2ROskhv.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
|
-
import './chunks/environment.d.
|
|
8
|
+
import './chunks/environment.d.cL3nLXbE.js';
|
|
9
9
|
import 'vitest/optional-types.js';
|
|
10
10
|
import '@vitest/utils';
|
|
11
11
|
import 'node:stream';
|
|
12
12
|
import 'node:console';
|
|
13
13
|
import '@vitest/mocker';
|
|
14
14
|
import '@vitest/utils/source-map';
|
|
15
|
-
import './chunks/worker.d.
|
|
15
|
+
import './chunks/worker.d.tQu2eJQy.js';
|
|
16
16
|
import 'vite-node';
|
|
17
17
|
import '@vitest/snapshot';
|
|
18
18
|
import '@vitest/pretty-format';
|
|
@@ -32,6 +32,7 @@ declare const extraInlineDeps: RegExp[];
|
|
|
32
32
|
|
|
33
33
|
declare const defaultInclude: string[];
|
|
34
34
|
declare const defaultExclude: string[];
|
|
35
|
+
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
35
36
|
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
36
37
|
declare const configDefaults: Readonly<{
|
|
37
38
|
allowOnly: boolean
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.
|
|
2
|
-
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.
|
|
1
|
+
export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.DnKduX2e.js';
|
|
2
|
+
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.B7q_naMc.js';
|
|
3
3
|
export { mergeConfig } from 'vite';
|
|
4
4
|
import 'node:os';
|
|
5
|
-
import './chunks/env.
|
|
5
|
+
import './chunks/env.D4Lgay0q.js';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
|
|
8
8
|
function defineConfig(config) {
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.C1ogPriE.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
|
-
import { A as AfterSuiteRunMeta } from './chunks/environment.d.
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/environment.d.cL3nLXbE.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
7
7
|
import 'node:console';
|
|
8
8
|
import '@vitest/mocker';
|
|
9
9
|
import '@vitest/utils/source-map';
|
|
10
|
-
import './chunks/worker.d.
|
|
10
|
+
import './chunks/worker.d.tQu2eJQy.js';
|
|
11
11
|
import 'vite-node';
|
|
12
|
-
import './chunks/config.d.
|
|
12
|
+
import './chunks/config.d.D2ROskhv.js';
|
|
13
13
|
import '@vitest/pretty-format';
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
15
|
import '@vitest/snapshot/environment';
|
package/dist/coverage.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.EIiagJJP.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import 'picomatch';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
|
-
import './chunks/defaults.
|
|
6
|
+
import './chunks/defaults.B7q_naMc.js';
|
|
7
7
|
import 'node:os';
|
|
8
|
-
import './chunks/env.
|
|
8
|
+
import './chunks/env.D4Lgay0q.js';
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import 'node:crypto';
|
|
11
11
|
import '@vitest/utils';
|
|
@@ -17,13 +17,13 @@ import 'node:url';
|
|
|
17
17
|
import 'node:assert';
|
|
18
18
|
import 'node:v8';
|
|
19
19
|
import 'node:util';
|
|
20
|
-
import './chunks/constants.BZZyIeIE.js';
|
|
21
|
-
import 'node:tty';
|
|
22
20
|
import 'vite';
|
|
21
|
+
import './chunks/constants.DnKduX2e.js';
|
|
22
|
+
import 'node:tty';
|
|
23
23
|
import 'node:events';
|
|
24
24
|
import './chunks/index.CJ0plNrh.js';
|
|
25
25
|
import 'tinypool';
|
|
26
|
-
import './chunks/typechecker.
|
|
26
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
27
27
|
import 'node:perf_hooks';
|
|
28
28
|
import '@vitest/utils/source-map';
|
|
29
29
|
import 'tinyexec';
|
|
@@ -31,4 +31,4 @@ import './path.js';
|
|
|
31
31
|
import '@vitest/runner/utils';
|
|
32
32
|
import 'node:worker_threads';
|
|
33
33
|
import 'vite-node/utils';
|
|
34
|
-
import './chunks/coverage.
|
|
34
|
+
import './chunks/coverage.DVF1vEu8.js';
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Environment } from './chunks/environment.d.
|
|
2
|
-
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.
|
|
1
|
+
import { E as Environment } from './chunks/environment.d.cL3nLXbE.js';
|
|
2
|
+
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.cL3nLXbE.js';
|
|
3
3
|
import 'vitest/optional-types.js';
|
|
4
4
|
|
|
5
5
|
declare const environments: {
|
|
@@ -10,6 +10,10 @@ declare const environments: {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
interface PopulateOptions {
|
|
13
|
+
// we bind functions such as addEventListener and others
|
|
14
|
+
// because they rely on `this` in happy-dom, and in jsdom it
|
|
15
|
+
// has a priority for getting implementation from symbols
|
|
16
|
+
// (global doesn't have these symbols, but window - does)
|
|
13
17
|
bindFunctions?: boolean;
|
|
14
18
|
additionalKeys?: string[];
|
|
15
19
|
}
|
package/dist/environments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.CmSc2RE5.js';
|
|
2
2
|
import 'node:console';
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
2
2
|
import { ViteNodeRunner, ModuleExecutionInfo } from 'vite-node/client';
|
|
3
|
-
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.
|
|
3
|
+
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.tQu2eJQy.js';
|
|
4
4
|
import vm from 'node:vm';
|
|
5
5
|
import { MockedModule, MockedModuleType } from '@vitest/mocker';
|
|
6
6
|
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
|
-
import './chunks/config.d.
|
|
8
|
+
import './chunks/config.d.D2ROskhv.js';
|
|
9
9
|
import '@vitest/pretty-format';
|
|
10
10
|
import '@vitest/snapshot';
|
|
11
11
|
import '@vitest/snapshot/environment';
|
|
12
12
|
import '@vitest/utils/diff';
|
|
13
|
-
import './chunks/environment.d.
|
|
13
|
+
import './chunks/environment.d.cL3nLXbE.js';
|
|
14
14
|
import 'vitest/optional-types.js';
|
|
15
15
|
|
|
16
16
|
declare class FileMap {
|
|
@@ -21,6 +21,8 @@ declare class FileMap {
|
|
|
21
21
|
readBuffer(path: string): Buffer;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// need to copy paste types for vm
|
|
25
|
+
// because they require latest @types/node which we don't bundle
|
|
24
26
|
interface ModuleEvaluateOptions {
|
|
25
27
|
timeout?: vm.RunningScriptOptions["timeout"] | undefined;
|
|
26
28
|
breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
|
|
@@ -48,6 +50,7 @@ interface ExternalModulesExecutorOptions {
|
|
|
48
50
|
interopDefault?: boolean;
|
|
49
51
|
viteClientModule: Record<string, unknown>;
|
|
50
52
|
}
|
|
53
|
+
// TODO: improve Node.js strict mode support in #2854
|
|
51
54
|
declare class ExternalModulesExecutor {
|
|
52
55
|
#private;
|
|
53
56
|
private options;
|
|
@@ -61,6 +64,7 @@ declare class ExternalModulesExecutor {
|
|
|
61
64
|
import(identifier: string): Promise<object>;
|
|
62
65
|
require(identifier: string): any;
|
|
63
66
|
createRequire(identifier: string): NodeJS.Require;
|
|
67
|
+
// dynamic import can be used in both ESM and CJS, so we have it in the executor
|
|
64
68
|
importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
|
|
65
69
|
resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
|
|
66
70
|
resolve(specifier: string, parent: string): string;
|
|
@@ -98,7 +102,9 @@ declare class VitestMocker {
|
|
|
98
102
|
private resolvePath;
|
|
99
103
|
resolveMocks(): Promise<void>;
|
|
100
104
|
private callFunctionMock;
|
|
105
|
+
// public method to avoid circular dependency
|
|
101
106
|
getMockContext(): MockContext;
|
|
107
|
+
// path used to store mocked dependencies
|
|
102
108
|
getMockPath(dep: string): string;
|
|
103
109
|
getDependencyMock(id: string): MockedModule | undefined;
|
|
104
110
|
normalizePath(path: string): string;
|
package/dist/execute.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { File as File$1, TaskResultPack as TaskResultPack$1, TaskEventPack, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
|
|
2
|
-
export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
3
|
-
import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.
|
|
4
|
-
export { G as BrowserTesterOptions } from './chunks/reporters.d.
|
|
5
|
-
import { W as WorkerContext$1 } from './chunks/worker.d.
|
|
6
|
-
import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/global.d.
|
|
7
|
-
import { b as Awaitable$1, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.d.
|
|
8
|
-
export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.
|
|
9
|
-
import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.
|
|
10
|
-
export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
11
|
-
import './chunks/vite.d.
|
|
12
|
-
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.
|
|
13
|
-
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.
|
|
1
|
+
import { File as File$1, TestAnnotation, TaskResultPack as TaskResultPack$1, TaskEventPack, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
|
|
2
|
+
export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
3
|
+
import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.C1ogPriE.js';
|
|
4
|
+
export { G as BrowserTesterOptions } from './chunks/reporters.d.C1ogPriE.js';
|
|
5
|
+
import { W as WorkerContext$1 } from './chunks/worker.d.DvqK5Vmu.js';
|
|
6
|
+
import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/global.d.MAmajcmJ.js';
|
|
7
|
+
import { b as Awaitable$1, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.d.cL3nLXbE.js';
|
|
8
|
+
export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.cL3nLXbE.js';
|
|
9
|
+
import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.tQu2eJQy.js';
|
|
10
|
+
export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.tQu2eJQy.js';
|
|
11
|
+
import './chunks/vite.d.DqE4-hhK.js';
|
|
12
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.D2ROskhv.js';
|
|
13
|
+
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.D2ROskhv.js';
|
|
14
14
|
import { ExpectStatic } from '@vitest/expect';
|
|
15
|
-
export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStatic, JestAssertion } from '@vitest/expect';
|
|
15
|
+
export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers } from '@vitest/expect';
|
|
16
16
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
17
17
|
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
|
|
18
18
|
import { M as MockFactoryWithHelper, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
|
|
@@ -68,6 +68,7 @@ interface WebSocketHandlers {
|
|
|
68
68
|
getTestFiles: () => Promise<SerializedTestSpecification[]>;
|
|
69
69
|
getPaths: () => string[];
|
|
70
70
|
getConfig: () => SerializedConfig;
|
|
71
|
+
// TODO: Remove in v4
|
|
71
72
|
/** @deprecated -- Use `getResolvedProjectLabels` instead */
|
|
72
73
|
getResolvedProjectNames: () => string[];
|
|
73
74
|
getResolvedProjectLabels: () => {
|
|
@@ -86,7 +87,8 @@ interface WebSocketHandlers {
|
|
|
86
87
|
interface WebSocketEvents {
|
|
87
88
|
onCollected?: (files?: File$1[]) => Awaitable$1<void>;
|
|
88
89
|
onFinished?: (files: File$1[], errors: unknown[], coverage?: unknown) => Awaitable$1<void>;
|
|
89
|
-
|
|
90
|
+
onTestAnnotate?: (testId: string, annotation: TestAnnotation) => Awaitable$1<void>;
|
|
91
|
+
onTaskUpdate?: (packs: TaskResultPack$1[], events: TaskEventPack[]) => Awaitable$1<void>;
|
|
90
92
|
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable$1<void>;
|
|
91
93
|
onPathsCollected?: (paths?: string[]) => Awaitable$1<void>;
|
|
92
94
|
onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable$1<void>;
|
|
@@ -94,6 +96,8 @@ interface WebSocketEvents {
|
|
|
94
96
|
}
|
|
95
97
|
type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
|
|
96
98
|
|
|
99
|
+
// CI fails only for this file, but it works locally
|
|
100
|
+
|
|
97
101
|
declare function createExpect(test?: TaskPopulated): ExpectStatic;
|
|
98
102
|
declare const globalExpect: ExpectStatic;
|
|
99
103
|
|
|
@@ -103,6 +107,7 @@ declare const globalExpect: ExpectStatic;
|
|
|
103
107
|
*/
|
|
104
108
|
declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];
|
|
105
109
|
|
|
110
|
+
// The waitFor function was inspired by https://github.com/testing-library/web-testing-library/pull/2
|
|
106
111
|
type WaitForCallback<T> = () => T | Promise<T>;
|
|
107
112
|
interface WaitForOptions {
|
|
108
113
|
/**
|
|
@@ -295,7 +300,9 @@ interface VitestUtils {
|
|
|
295
300
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
296
301
|
* @param factory Mocked module factory. The result of this function will be an exports object
|
|
297
302
|
*/
|
|
303
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
298
304
|
mock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
|
|
305
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
299
306
|
mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
|
|
300
307
|
/**
|
|
301
308
|
* Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
|
|
@@ -303,7 +310,9 @@ interface VitestUtils {
|
|
|
303
310
|
* This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
|
|
304
311
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
305
312
|
*/
|
|
313
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
306
314
|
unmock(path: string): void;
|
|
315
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
307
316
|
unmock(module: Promise<unknown>): void;
|
|
308
317
|
/**
|
|
309
318
|
* Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
|
|
@@ -314,7 +323,9 @@ interface VitestUtils {
|
|
|
314
323
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
315
324
|
* @param factory Mocked module factory. The result of this function will be an exports object
|
|
316
325
|
*/
|
|
326
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
317
327
|
doMock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
|
|
328
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
318
329
|
doMock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
|
|
319
330
|
/**
|
|
320
331
|
* Removes module from mocked registry. All subsequent calls to import will return original module.
|
|
@@ -322,7 +333,9 @@ interface VitestUtils {
|
|
|
322
333
|
* Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
|
|
323
334
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
324
335
|
*/
|
|
336
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
325
337
|
doUnmock(path: string): void;
|
|
338
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
326
339
|
doUnmock(module: Promise<unknown>): void;
|
|
327
340
|
/**
|
|
328
341
|
* Imports module, bypassing all checks if it should be mocked.
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
3
|
-
export { a as assertType } from './chunks/index.
|
|
1
|
+
export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.bdSIJ99Y.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.CYdenmiT.js';
|
|
3
|
+
export { a as assertType } from './chunks/index.CdQS2e2Q.js';
|
|
4
4
|
export { expectTypeOf } from 'expect-type';
|
|
5
5
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
6
|
import * as chai from 'chai';
|
|
@@ -8,11 +8,11 @@ export { chai };
|
|
|
8
8
|
export { assert, should } from 'chai';
|
|
9
9
|
import '@vitest/expect';
|
|
10
10
|
import '@vitest/runner/utils';
|
|
11
|
-
import './chunks/utils.
|
|
11
|
+
import './chunks/utils.XdZDrNZV.js';
|
|
12
12
|
import '@vitest/utils';
|
|
13
13
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
15
|
import '@vitest/utils/error';
|
|
16
16
|
import '@vitest/spy';
|
|
17
17
|
import '@vitest/utils/source-map';
|
|
18
|
-
import './chunks/date.
|
|
18
|
+
import './chunks/date.Bq6ZW5rf.js';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.
|
|
2
|
-
export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.
|
|
1
|
+
import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.C1ogPriE.js';
|
|
2
|
+
export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.C1ogPriE.js';
|
|
3
3
|
import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1, createServer as createServer$1 } from 'vite';
|
|
4
4
|
import * as vite from 'vite';
|
|
5
5
|
export { vite as Vite };
|
|
6
6
|
export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
7
7
|
import { IncomingMessage } from 'node:http';
|
|
8
|
-
import { R as RuntimeRPC } from './chunks/worker.d.
|
|
9
|
-
export { T as TestExecutionType } from './chunks/worker.d.
|
|
8
|
+
import { R as RuntimeRPC } from './chunks/worker.d.tQu2eJQy.js';
|
|
9
|
+
export { T as TestExecutionType } from './chunks/worker.d.tQu2eJQy.js';
|
|
10
10
|
import { Writable } from 'node:stream';
|
|
11
|
-
export { V as VitestPluginContext } from './chunks/vite.d.
|
|
12
|
-
export { W as WorkerContext } from './chunks/worker.d.
|
|
13
|
-
export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.
|
|
11
|
+
export { V as VitestPluginContext } from './chunks/vite.d.DqE4-hhK.js';
|
|
12
|
+
export { W as WorkerContext } from './chunks/worker.d.DvqK5Vmu.js';
|
|
13
|
+
export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.MAmajcmJ.js';
|
|
14
14
|
import { Debugger } from 'debug';
|
|
15
15
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
16
|
-
export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions } from './chunks/environment.d.
|
|
16
|
+
export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions } from './chunks/environment.d.cL3nLXbE.js';
|
|
17
17
|
export { SerializedError } from '@vitest/utils';
|
|
18
|
-
export { b as RuntimeConfig } from './chunks/config.d.
|
|
18
|
+
export { b as RuntimeConfig } from './chunks/config.d.D2ROskhv.js';
|
|
19
19
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
20
20
|
import 'node:console';
|
|
21
21
|
import '@vitest/mocker';
|
|
@@ -96,8 +96,9 @@ declare class GitNotFoundError extends Error {
|
|
|
96
96
|
/** @deprecated use `TestProject` instead */
|
|
97
97
|
type GlobalSetupContext = TestProject;
|
|
98
98
|
|
|
99
|
-
declare function VitestPlugin(options?: UserConfig,
|
|
99
|
+
declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
|
|
100
100
|
|
|
101
|
+
// this is only exported as a public function and not used inside vitest
|
|
101
102
|
declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
|
|
102
103
|
vitestConfig: ResolvedConfig
|
|
103
104
|
viteConfig: ResolvedConfig$1
|
|
@@ -107,6 +108,7 @@ declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | fa
|
|
|
107
108
|
|
|
108
109
|
interface MethodsOptions {
|
|
109
110
|
cacheFs?: boolean;
|
|
111
|
+
// do not report files
|
|
110
112
|
collect?: boolean;
|
|
111
113
|
}
|
|
112
114
|
declare function createMethodsRPC(project: TestProject, options?: MethodsOptions): RuntimeRPC;
|
|
@@ -114,12 +116,18 @@ declare function createMethodsRPC(project: TestProject, options?: MethodsOptions
|
|
|
114
116
|
declare class BaseSequencer implements TestSequencer {
|
|
115
117
|
protected ctx: Vitest;
|
|
116
118
|
constructor(ctx: Vitest);
|
|
119
|
+
// async so it can be extended by other sequelizers
|
|
117
120
|
shard(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
121
|
+
// async so it can be extended by other sequelizers
|
|
118
122
|
sort(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
|
|
122
126
|
|
|
127
|
+
// This is copy-pasted and needs to be synced from time to time. Ideally, Vite's `createLogger` should accept a custom `console`
|
|
128
|
+
// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/logger.ts?rgh-link-date=2024-10-16T23%3A29%3A19Z
|
|
129
|
+
// When Vitest supports only Vite 6 and above, we can use Vite's `createLogger({ console })`
|
|
130
|
+
// https://github.com/vitejs/vite/pull/18379
|
|
123
131
|
declare function createViteLogger(console: Logger, level?: LogLevel, options?: LoggerOptions): Logger$1;
|
|
124
132
|
|
|
125
133
|
declare const rootDir: string;
|
package/dist/node.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { resolveConfig as resolveConfig$1, mergeConfig, createServer as createServer$1 } from 'vite';
|
|
2
2
|
export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
3
|
-
import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.
|
|
4
|
-
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
5
|
-
export { p as parseCLI } from './chunks/cac.
|
|
6
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
7
|
-
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.
|
|
8
|
-
import { slash } from '@vitest/utils';
|
|
3
|
+
import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.Cej3MBjA.js';
|
|
4
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.Cej3MBjA.js';
|
|
5
|
+
export { p as parseCLI } from './chunks/cac.6rXCxFY1.js';
|
|
6
|
+
import { r as resolveConfig$2 } from './chunks/coverage.EIiagJJP.js';
|
|
7
|
+
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.EIiagJJP.js';
|
|
8
|
+
import { slash, deepClone } from '@vitest/utils';
|
|
9
9
|
import { f as findUp } from './chunks/index.X0nbfr6-.js';
|
|
10
10
|
import { resolve } from 'pathe';
|
|
11
|
-
import { c as configFiles } from './chunks/constants.
|
|
11
|
+
import { c as configFiles } from './chunks/constants.DnKduX2e.js';
|
|
12
12
|
export { distDir, rootDir } from './path.js';
|
|
13
13
|
import createDebug from 'debug';
|
|
14
14
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
15
15
|
import 'node:fs';
|
|
16
|
-
import './chunks/coverage.
|
|
16
|
+
import './chunks/coverage.DVF1vEu8.js';
|
|
17
17
|
import 'node:path';
|
|
18
18
|
import '@vitest/snapshot/manager';
|
|
19
19
|
import 'vite-node/client';
|
|
20
20
|
import 'vite-node/server';
|
|
21
21
|
import './chunks/index.CJ0plNrh.js';
|
|
22
|
-
import './chunks/index.
|
|
22
|
+
import './chunks/index.BZ0g1JD2.js';
|
|
23
23
|
import 'node:perf_hooks';
|
|
24
24
|
import '@vitest/utils/source-map';
|
|
25
25
|
import 'tinyrainbow';
|
|
26
|
-
import './chunks/env.
|
|
26
|
+
import './chunks/env.D4Lgay0q.js';
|
|
27
27
|
import 'std-env';
|
|
28
|
-
import './chunks/typechecker.
|
|
28
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
29
29
|
import 'node:os';
|
|
30
30
|
import 'tinyexec';
|
|
31
31
|
import 'node:util';
|
|
@@ -50,9 +50,9 @@ import 'picomatch';
|
|
|
50
50
|
import 'tinyglobby';
|
|
51
51
|
import 'vite-node/utils';
|
|
52
52
|
import '@vitest/mocker/node';
|
|
53
|
-
import './chunks/defaults.
|
|
53
|
+
import './chunks/defaults.B7q_naMc.js';
|
|
54
54
|
import 'magic-string';
|
|
55
|
-
import './chunks/index.
|
|
55
|
+
import './chunks/index.CIyJn3t1.js';
|
|
56
56
|
import 'node:assert';
|
|
57
57
|
import '@vitest/utils/error';
|
|
58
58
|
import 'node:readline';
|
|
@@ -64,16 +64,18 @@ import 'tinypool';
|
|
|
64
64
|
import 'node:worker_threads';
|
|
65
65
|
import 'readline';
|
|
66
66
|
|
|
67
|
+
// this is only exported as a public function and not used inside vitest
|
|
67
68
|
async function resolveConfig(options = {}, viteOverrides = {}) {
|
|
68
69
|
const root = slash(resolve(options.root || process.cwd()));
|
|
69
70
|
const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
|
|
70
71
|
options.config = configPath;
|
|
71
|
-
const vitest = new Vitest("test");
|
|
72
|
+
const vitest = new Vitest("test", deepClone(options));
|
|
72
73
|
const config = await resolveConfig$1(mergeConfig({
|
|
73
74
|
configFile: configPath,
|
|
74
75
|
mode: options.mode || "test",
|
|
75
76
|
plugins: [await VitestPlugin(options, vitest)]
|
|
76
77
|
}, mergeConfig(viteOverrides, { root: options.root })), "serve");
|
|
78
|
+
// Reflect just to avoid type error
|
|
77
79
|
const updatedOptions = Reflect.get(config, "_vitest");
|
|
78
80
|
const vitestConfig = resolveConfig$2(vitest, updatedOptions, config);
|
|
79
81
|
await vitest.close();
|
|
@@ -85,9 +87,7 @@ async function resolveConfig(options = {}, viteOverrides = {}) {
|
|
|
85
87
|
|
|
86
88
|
function createDebugger(namespace) {
|
|
87
89
|
const debug = createDebug(namespace);
|
|
88
|
-
if (debug.enabled)
|
|
89
|
-
return debug;
|
|
90
|
-
}
|
|
90
|
+
if (debug.enabled) return debug;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const version = Vitest.version;
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.
|
|
1
|
+
export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.C1ogPriE.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
|
-
import './chunks/environment.d.
|
|
3
|
+
import './chunks/environment.d.cL3nLXbE.js';
|
|
4
4
|
import 'vitest/optional-types.js';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
@@ -8,9 +8,9 @@ import 'vite';
|
|
|
8
8
|
import 'node:console';
|
|
9
9
|
import '@vitest/mocker';
|
|
10
10
|
import '@vitest/utils/source-map';
|
|
11
|
-
import './chunks/worker.d.
|
|
11
|
+
import './chunks/worker.d.tQu2eJQy.js';
|
|
12
12
|
import 'vite-node';
|
|
13
|
-
import './chunks/config.d.
|
|
13
|
+
import './chunks/config.d.D2ROskhv.js';
|
|
14
14
|
import '@vitest/pretty-format';
|
|
15
15
|
import '@vitest/snapshot';
|
|
16
16
|
import '@vitest/snapshot/environment';
|
package/dist/reporters.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.
|
|
2
|
-
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.
|
|
1
|
+
export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.BZ0g1JD2.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CIyJn3t1.js';
|
|
3
3
|
import 'node:perf_hooks';
|
|
4
4
|
import '@vitest/runner/utils';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import '@vitest/utils/source-map';
|
|
7
7
|
import 'pathe';
|
|
8
8
|
import 'tinyrainbow';
|
|
9
|
-
import './chunks/env.
|
|
9
|
+
import './chunks/env.D4Lgay0q.js';
|
|
10
10
|
import 'std-env';
|
|
11
|
-
import './chunks/typechecker.
|
|
11
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
12
12
|
import 'node:os';
|
|
13
13
|
import 'tinyexec';
|
|
14
14
|
import './path.js';
|