vitest 4.0.0-beta.1 → 4.0.0-beta.11
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 +83 -2
- package/dist/browser.d.ts +19 -16
- package/dist/browser.js +11 -7
- package/dist/chunks/{benchmark.CYdenmiT.js → benchmark.LXhJ0F0X.js} +7 -9
- package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
- package/dist/chunks/{browser.d.q8Z0P0q1.d.ts → browser.d.Dx7DO_Ce.d.ts} +5 -5
- package/dist/chunks/{cac.D3EzDDZd.js → cac.elvK37c9.js} +71 -153
- package/dist/chunks/{cli-api.Dn5gKePv.js → cli-api.C7plPyhs.js} +1376 -1693
- package/dist/chunks/{config.d.HJdfX-8k.d.ts → config.d.B_LthbQq.d.ts} +58 -63
- package/dist/chunks/{console.CtFJOzRO.js → console.CiTi59Jy.js} +35 -71
- package/dist/chunks/{constants.DnKduX2e.js → constants.D_Q9UYh-.js} +1 -9
- package/dist/chunks/{coverage.Cwa-XhJt.js → coverage.CG6Uhorw.js} +522 -792
- package/dist/chunks/{coverage.DVF1vEu8.js → coverage.D_JHT54q.js} +2 -2
- package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.BZtK59WP.d.ts} +10 -8
- package/dist/chunks/{creator.GK6I-cL4.js → creator.08Gi-vCA.js} +93 -77
- package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
- package/dist/chunks/{environment.d.CUq4cUgQ.d.ts → environment.d.BsToaxti.d.ts} +27 -6
- package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
- package/dist/chunks/{global.d.CVbXEflG.d.ts → global.d.BK3X7FW1.d.ts} +2 -5
- package/dist/chunks/{globals.Cxal6MLI.js → globals.BjvYA-AD.js} +11 -9
- package/dist/chunks/{index.BWf_gE5n.js → index.AZOjjqWP.js} +7 -6
- package/dist/chunks/{index.B521nVV-.js → index.Bgo3tNWt.js} +23 -4
- package/dist/chunks/{index.TfbsX-3I.js → index.BhY64fF0.js} +16 -26
- package/dist/chunks/{index.CZI_8rVt.js → index.BwBttQPf.js} +340 -663
- package/dist/chunks/{index.CmSc2RE5.js → index.DIWhzsUh.js} +72 -118
- package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
- package/dist/chunks/moduleRunner.d.BNa-CL9e.d.ts +201 -0
- package/dist/chunks/{node.fjCdwEIl.js → node.BsdMi6DV.js} +2 -2
- package/dist/chunks/{plugin.d.C2EcJUjo.d.ts → plugin.d.C5phQR6o.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DxZg19fy.d.ts → reporters.d.CVzhsTvK.d.ts} +1233 -1293
- package/dist/chunks/resolveSnapshotEnvironment.DQVamkje.js +81 -0
- package/dist/chunks/rpc.jKGRSXIH.js +65 -0
- package/dist/chunks/{setup-common.D7ZqXFx-.js → setup-common.NAWRuMRP.js} +18 -30
- package/dist/chunks/startModuleRunner.oAuCu1yL.js +682 -0
- package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
- package/dist/chunks/test.KC5tH8hC.js +214 -0
- package/dist/chunks/typechecker.gXq-5P3n.js +1438 -0
- package/dist/chunks/{utils.XdZDrNZV.js → utils.DGKhod2J.js} +9 -28
- package/dist/chunks/{vi.bdSIJ99Y.js → vi.CiJ0Laa6.js} +159 -306
- package/dist/chunks/worker.d.B_Fd9M_w.d.ts +100 -0
- package/dist/chunks/worker.rPGLlbkW.js +200 -0
- package/dist/cli.js +8 -6
- package/dist/config.cjs +3 -9
- package/dist/config.d.ts +49 -54
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +27 -26
- package/dist/coverage.js +6 -8
- package/dist/environments.d.ts +9 -13
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +38 -45
- package/dist/index.js +10 -10
- package/dist/module-evaluator.d.ts +13 -0
- package/dist/module-evaluator.js +276 -0
- package/dist/module-runner.js +15 -0
- package/dist/node.d.ts +44 -42
- package/dist/node.js +30 -36
- package/dist/reporters.d.ts +12 -13
- package/dist/reporters.js +7 -5
- package/dist/runners.d.ts +3 -3
- package/dist/runners.js +15 -232
- package/dist/snapshot.js +3 -3
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +4 -3
- package/dist/worker-base.js +203 -0
- package/dist/{chunks/vm.BThCzidc.js → worker-vm.js} +179 -228
- package/dist/workers/runVmTests.js +39 -56
- package/globals.d.ts +17 -17
- package/package.json +40 -38
- package/browser.d.ts +0 -1
- package/dist/chunks/base.Bj3pWTr1.js +0 -38
- package/dist/chunks/execute.B7h3T_Hc.js +0 -708
- package/dist/chunks/index.D-VkfKhf.js +0 -105
- package/dist/chunks/rpc.CsFtxqeq.js +0 -83
- package/dist/chunks/runBaseTests.BC7ZIH5L.js +0 -129
- package/dist/chunks/typechecker.CVytUJuF.js +0 -874
- package/dist/chunks/utils.CAioKnHs.js +0 -61
- package/dist/chunks/worker.d.CmvJfRGs.d.ts +0 -8
- package/dist/chunks/worker.d.DoNjFAiv.d.ts +0 -169
- package/dist/execute.d.ts +0 -148
- package/dist/execute.js +0 -13
- package/dist/worker.js +0 -124
- package/dist/workers/forks.js +0 -43
- package/dist/workers/threads.js +0 -31
- package/dist/workers/vmForks.js +0 -47
- package/dist/workers/vmThreads.js +0 -37
- package/dist/workers.d.ts +0 -37
- package/dist/workers.js +0 -30
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
package/dist/node.d.ts
CHANGED
|
@@ -3,38 +3,36 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
|
|
|
3
3
|
export { vite as Vite };
|
|
4
4
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
5
5
|
import { IncomingMessage } from 'node:http';
|
|
6
|
-
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject,
|
|
7
|
-
export {
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
6
|
+
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as Pool, l as TestSequencer, L as Logger } from './chunks/reporters.d.CVzhsTvK.js';
|
|
7
|
+
export { al as BaseCoverageOptions, G as BenchmarkUserOptions, K as BrowserBuiltinProvider, N as BrowserCommand, Q as BrowserCommandContext, X as BrowserConfigOptions, Y as BrowserInstanceOption, Z as BrowserModuleMocker, _ as BrowserOrchestrator, $ as BrowserProvider, a0 as BrowserProviderOption, a1 as BrowserScript, a2 as BrowserServerState, a3 as BrowserServerStateSession, aa as BuiltinEnvironment, a4 as CDPSession, ab as CSSModuleScopeStrategy, am as CoverageIstanbulOptions, an as CoverageOptions, ao as CoverageProvider, ap as CoverageProviderModule, aq as CoverageReporter, c as CoverageV8Options, ar as CustomProviderOptions, ac as DepsOptimizationOptions, ad as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, o as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a5 as ParentProjectBrowser, ae as PoolOptions, a6 as ProjectBrowser, af as ProjectConfig, b as ReportContext, at as ReportedHookContext, au as Reporter, ah as ResolveSnapshotPathHandler, ai as ResolveSnapshotPathHandlerContext, a7 as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ag as ResolvedProjectConfig, S as SerializedTestProject, p as TaskOptions, q as TestCase, r as TestCollection, s as TestDiagnostic, t as TestModule, u as TestModuleState, v as TestResult, w as TestResultFailed, x as TestResultPassed, y as TestResultSkipped, av as TestRunEndReason, as as TestRunResult, F as TestSequencerConstructor, z as TestState, B as TestSuite, D as TestSuiteState, a8 as ToMatchScreenshotComparators, a9 as ToMatchScreenshotOptions, aj as TypecheckConfig, U as UserWorkspaceConfig, ak as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, E as experimental_getRunnerTask } from './chunks/reporters.d.CVzhsTvK.js';
|
|
8
|
+
import { Awaitable } from '@vitest/utils';
|
|
9
|
+
export { SerializedError } from '@vitest/utils';
|
|
10
|
+
import { a as RuntimeRPC, C as ContextRPC } from './chunks/worker.d.B_Fd9M_w.js';
|
|
11
|
+
export { T as TestExecutionType } from './chunks/worker.d.B_Fd9M_w.js';
|
|
10
12
|
import { Writable } from 'node:stream';
|
|
11
|
-
export { V as VitestPluginContext } from './chunks/plugin.d.
|
|
12
|
-
|
|
13
|
+
export { V as VitestPluginContext } from './chunks/plugin.d.C5phQR6o.js';
|
|
14
|
+
import { MessagePort } from 'node:worker_threads';
|
|
13
15
|
import { Debugger } from 'debug';
|
|
14
|
-
import './chunks/global.d.
|
|
16
|
+
import './chunks/global.d.BK3X7FW1.js';
|
|
15
17
|
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 { b as RuntimeConfig } from './chunks/config.d.
|
|
17
|
-
export { SerializedError } from '@vitest/utils';
|
|
18
|
+
export { b as RuntimeConfig } from './chunks/config.d.B_LthbQq.js';
|
|
18
19
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
19
|
-
import './chunks/environment.d.
|
|
20
|
-
import 'node:console';
|
|
21
|
-
import './chunks/browser.d.q8Z0P0q1.js';
|
|
20
|
+
import './chunks/environment.d.BsToaxti.js';
|
|
22
21
|
import '@vitest/mocker';
|
|
23
22
|
import '@vitest/utils/source-map';
|
|
23
|
+
import './chunks/browser.d.Dx7DO_Ce.js';
|
|
24
24
|
import '@vitest/pretty-format';
|
|
25
25
|
import '@vitest/snapshot';
|
|
26
26
|
import '@vitest/utils/diff';
|
|
27
|
-
import '
|
|
28
|
-
import 'chai';
|
|
27
|
+
import '@vitest/expect';
|
|
29
28
|
import 'vitest/optional-types.js';
|
|
30
|
-
import './chunks/benchmark.d.
|
|
29
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
31
30
|
import 'tinybench';
|
|
32
|
-
import './chunks/coverage.d.
|
|
33
|
-
import 'vite-node/client';
|
|
31
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
34
32
|
import '@vitest/snapshot/manager';
|
|
35
33
|
import 'node:fs';
|
|
36
|
-
import 'node:
|
|
37
|
-
import '
|
|
34
|
+
import 'node:console';
|
|
35
|
+
import 'vite/module-runner';
|
|
38
36
|
|
|
39
37
|
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
40
38
|
interface TscErrorInfo {
|
|
@@ -55,13 +53,15 @@ interface RootAndTarget {
|
|
|
55
53
|
targetAbsPath: string;
|
|
56
54
|
}
|
|
57
55
|
type Context = RootAndTarget & {
|
|
58
|
-
rawErrsMap: RawErrsMap
|
|
59
|
-
openedDirs: Set<string
|
|
60
|
-
lastActivePath?: string
|
|
56
|
+
rawErrsMap: RawErrsMap;
|
|
57
|
+
openedDirs: Set<string>;
|
|
58
|
+
lastActivePath?: string;
|
|
61
59
|
};
|
|
62
60
|
|
|
63
61
|
declare function isValidApiRequest(config: ResolvedConfig, req: IncomingMessage): boolean;
|
|
64
62
|
|
|
63
|
+
declare function escapeTestName(label: string, dynamic: boolean): string;
|
|
64
|
+
|
|
65
65
|
interface CliOptions extends UserConfig {
|
|
66
66
|
/**
|
|
67
67
|
* Override the watch mode
|
|
@@ -86,7 +86,7 @@ interface CliOptions extends UserConfig {
|
|
|
86
86
|
* @experimental
|
|
87
87
|
*/
|
|
88
88
|
configLoader?: InlineConfig extends {
|
|
89
|
-
configLoader?: infer T
|
|
89
|
+
configLoader?: infer T;
|
|
90
90
|
} ? T : never;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
@@ -100,11 +100,11 @@ interface CliParseOptions {
|
|
|
100
100
|
allowUnknownOptions?: boolean;
|
|
101
101
|
}
|
|
102
102
|
declare function parseCLI(argv: string | string[], config?: CliParseOptions): {
|
|
103
|
-
filter: string[]
|
|
104
|
-
options: CliOptions
|
|
103
|
+
filter: string[];
|
|
104
|
+
options: CliOptions;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
declare function resolveApiServerConfig<Options extends ApiConfig & UserConfig
|
|
107
|
+
declare function resolveApiServerConfig<Options extends ApiConfig & Omit<UserConfig, "expect">>(options: Options, defaultPort: number): ApiConfig | undefined;
|
|
108
108
|
|
|
109
109
|
declare function createVitest(mode: VitestRunMode, options: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest>;
|
|
110
110
|
|
|
@@ -117,22 +117,26 @@ declare class GitNotFoundError extends Error {
|
|
|
117
117
|
constructor();
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/** @deprecated use `TestProject` instead */
|
|
121
|
-
type GlobalSetupContext = TestProject;
|
|
122
|
-
|
|
123
120
|
declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
|
|
124
121
|
|
|
125
|
-
// this is only exported as a public function and not used inside vitest
|
|
126
122
|
declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
|
|
127
|
-
vitestConfig: ResolvedConfig
|
|
128
|
-
viteConfig: ResolvedConfig$1
|
|
123
|
+
vitestConfig: ResolvedConfig;
|
|
124
|
+
viteConfig: ResolvedConfig$1;
|
|
129
125
|
}>;
|
|
130
126
|
|
|
131
127
|
declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
|
|
132
128
|
|
|
129
|
+
type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) => Awaitable<void>;
|
|
130
|
+
interface ProcessPool {
|
|
131
|
+
name: string;
|
|
132
|
+
runTests: RunWithFiles;
|
|
133
|
+
collectTests: RunWithFiles;
|
|
134
|
+
close?: () => Awaitable<void>;
|
|
135
|
+
}
|
|
136
|
+
declare function getFilePoolName(project: TestProject): Pool;
|
|
137
|
+
|
|
133
138
|
interface MethodsOptions {
|
|
134
139
|
cacheFs?: boolean;
|
|
135
|
-
// do not report files
|
|
136
140
|
collect?: boolean;
|
|
137
141
|
}
|
|
138
142
|
declare function createMethodsRPC(project: TestProject, options?: MethodsOptions): RuntimeRPC;
|
|
@@ -140,18 +144,17 @@ declare function createMethodsRPC(project: TestProject, options?: MethodsOptions
|
|
|
140
144
|
declare class BaseSequencer implements TestSequencer {
|
|
141
145
|
protected ctx: Vitest;
|
|
142
146
|
constructor(ctx: Vitest);
|
|
143
|
-
// async so it can be extended by other sequelizers
|
|
144
147
|
shard(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
145
|
-
// async so it can be extended by other sequelizers
|
|
146
148
|
sort(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
149
|
+
private calculateShardRange;
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
interface WorkerContext extends ContextRPC {
|
|
155
|
+
port: MessagePort;
|
|
156
|
+
}
|
|
157
|
+
|
|
155
158
|
declare function createViteLogger(console: Logger, level?: LogLevel, options?: LoggerOptions): Logger$1;
|
|
156
159
|
|
|
157
160
|
declare const rootDir: string;
|
|
@@ -163,8 +166,7 @@ declare const version: string;
|
|
|
163
166
|
|
|
164
167
|
declare const createViteServer: typeof vite.createServer;
|
|
165
168
|
|
|
166
|
-
// rolldownVersion is exported only by rolldown-vite
|
|
167
169
|
declare const rolldownVersion: string | undefined;
|
|
168
170
|
|
|
169
|
-
export { ApiConfig, BaseSequencer, GitNotFoundError, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, Vitest, VitestOptions, VitestPlugin, VitestRunMode,
|
|
170
|
-
export type { CliParseOptions,
|
|
171
|
+
export { ApiConfig, BaseSequencer, GitNotFoundError, Pool, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, Vitest, VitestOptions, VitestPlugin, VitestRunMode, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, escapeTestName, getFilePoolName, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
|
|
172
|
+
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget, WorkerContext };
|
package/dist/node.js
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
|
|
3
3
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
4
|
-
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.
|
|
5
|
-
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller,
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.
|
|
9
|
-
import { slash, deepClone } from '@vitest/utils';
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.C7plPyhs.js';
|
|
5
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, h as createDebugger, g as createViteLogger, c as createVitest, e as escapeTestName, d as experimental_getRunnerTask, i as isValidApiRequest, f as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.C7plPyhs.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.elvK37c9.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.CG6Uhorw.js';
|
|
8
|
+
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.CG6Uhorw.js';
|
|
9
|
+
import { slash, deepClone } from '@vitest/utils/helpers';
|
|
10
10
|
import { f as findUp } from './chunks/index.X0nbfr6-.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
|
12
|
-
import { c as configFiles } from './chunks/constants.
|
|
12
|
+
import { c as configFiles } from './chunks/constants.D_Q9UYh-.js';
|
|
13
13
|
export { distDir, rootDir } from './path.js';
|
|
14
|
-
import createDebug from 'debug';
|
|
15
14
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
16
15
|
import 'node:fs';
|
|
17
|
-
import './chunks/coverage.
|
|
16
|
+
import './chunks/coverage.D_JHT54q.js';
|
|
18
17
|
import 'node:path';
|
|
18
|
+
import 'node:os';
|
|
19
19
|
import '@vitest/snapshot/manager';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import './chunks/index.B521nVV-.js';
|
|
23
|
-
import './chunks/index.CZI_8rVt.js';
|
|
20
|
+
import './chunks/index.Bgo3tNWt.js';
|
|
21
|
+
import './chunks/index.BwBttQPf.js';
|
|
24
22
|
import 'node:fs/promises';
|
|
25
|
-
import './chunks/typechecker.
|
|
26
|
-
import 'node:os';
|
|
23
|
+
import './chunks/typechecker.gXq-5P3n.js';
|
|
27
24
|
import 'node:perf_hooks';
|
|
28
|
-
import '@vitest/utils/source-map';
|
|
29
25
|
import 'tinyexec';
|
|
26
|
+
import '@vitest/utils/source-map';
|
|
30
27
|
import 'tinyrainbow';
|
|
31
28
|
import './chunks/env.D4Lgay0q.js';
|
|
32
29
|
import 'std-env';
|
|
33
30
|
import 'node:util';
|
|
34
31
|
import 'node:console';
|
|
35
32
|
import 'node:stream';
|
|
33
|
+
import '@vitest/utils/display';
|
|
34
|
+
import '@vitest/utils/offset';
|
|
36
35
|
import 'node:module';
|
|
37
36
|
import 'events';
|
|
38
37
|
import 'https';
|
|
@@ -46,16 +45,22 @@ import 'zlib';
|
|
|
46
45
|
import 'buffer';
|
|
47
46
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
48
47
|
import 'node:crypto';
|
|
48
|
+
import 'debug';
|
|
49
|
+
import '#module-evaluator';
|
|
50
|
+
import 'vite/module-runner';
|
|
51
|
+
import '@vitest/utils/highlight';
|
|
49
52
|
import 'node:url';
|
|
50
53
|
import 'picomatch';
|
|
51
54
|
import 'tinyglobby';
|
|
52
|
-
import '
|
|
55
|
+
import 'magic-string';
|
|
53
56
|
import '@vitest/mocker/node';
|
|
54
57
|
import './chunks/defaults.CXFFjsi8.js';
|
|
55
|
-
import '
|
|
56
|
-
import '
|
|
58
|
+
import '@vitest/utils/constants';
|
|
59
|
+
import '@vitest/utils/resolver';
|
|
60
|
+
import 'es-module-lexer';
|
|
61
|
+
import './chunks/index.BhY64fF0.js';
|
|
57
62
|
import 'node:assert';
|
|
58
|
-
import '@vitest/utils/
|
|
63
|
+
import '@vitest/utils/serialize';
|
|
59
64
|
import 'node:readline';
|
|
60
65
|
import 'node:process';
|
|
61
66
|
import 'node:v8';
|
|
@@ -67,33 +72,22 @@ import 'readline';
|
|
|
67
72
|
|
|
68
73
|
// this is only exported as a public function and not used inside vitest
|
|
69
74
|
async function resolveConfig(options = {}, viteOverrides = {}) {
|
|
70
|
-
const root = slash(resolve(options.root || process.cwd()));
|
|
71
|
-
const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
|
|
75
|
+
const root = slash(resolve(options.root || process.cwd())), configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
|
|
72
76
|
options.config = configPath;
|
|
73
|
-
const vitest = new Vitest("test", deepClone(options))
|
|
74
|
-
const config = await resolveConfig$1(mergeConfig({
|
|
77
|
+
const vitest = new Vitest("test", deepClone(options)), config = await resolveConfig$1(mergeConfig({
|
|
75
78
|
configFile: configPath,
|
|
76
79
|
mode: options.mode || "test",
|
|
77
80
|
plugins: [await VitestPlugin(options, vitest)]
|
|
78
|
-
}, mergeConfig(viteOverrides, { root: options.root })), "serve");
|
|
79
|
-
|
|
80
|
-
const updatedOptions = Reflect.get(config, "_vitest");
|
|
81
|
-
const vitestConfig = resolveConfig$2(vitest, updatedOptions, config);
|
|
82
|
-
await vitest.close();
|
|
83
|
-
return {
|
|
81
|
+
}, mergeConfig(viteOverrides, { root: options.root })), "serve"), updatedOptions = Reflect.get(config, "_vitest"), vitestConfig = resolveConfig$2(vitest, updatedOptions, config);
|
|
82
|
+
return await vitest.close(), {
|
|
84
83
|
viteConfig: config,
|
|
85
84
|
vitestConfig
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
function createDebugger(namespace) {
|
|
90
|
-
const debug = createDebug(namespace);
|
|
91
|
-
if (debug.enabled) return debug;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
88
|
const version = Vitest.version;
|
|
95
89
|
const createViteServer = vite.createServer;
|
|
96
90
|
// rolldownVersion is exported only by rolldown-vite
|
|
97
91
|
const rolldownVersion = vite.rolldownVersion;
|
|
98
92
|
|
|
99
|
-
export { VitestPlugin,
|
|
93
|
+
export { VitestPlugin, createViteServer, resolveConfig, rolldownVersion, version };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aJ as BaseReporter, aK as BenchmarkBuiltinReporters, aw as BenchmarkReporter, ax as BenchmarkReportsMap, aL as BuiltinReporterOptions, aM as BuiltinReporters, ay as DefaultReporter, az as DotReporter, aA as GithubActionsReporter, aB as HangingProcessReporter, aD as JUnitReporter, aN as JsonAssertionResult, aC as JsonReporter, aO as JsonTestResult, aP as JsonTestResults, at as ReportedHookContext, au as Reporter, aE as ReportersMap, aF as TapFlatReporter, aG as TapReporter, av as TestRunEndReason, aH as VerboseBenchmarkReporter, aI as VerboseReporter } from './chunks/reporters.d.CVzhsTvK.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
|
-
import './chunks/environment.d.CUq4cUgQ.js';
|
|
4
3
|
import '@vitest/utils';
|
|
4
|
+
import './chunks/environment.d.BsToaxti.js';
|
|
5
5
|
import 'node:stream';
|
|
6
6
|
import 'vite';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import './chunks/
|
|
10
|
-
import './chunks/
|
|
7
|
+
import '@vitest/mocker';
|
|
8
|
+
import '@vitest/utils/source-map';
|
|
9
|
+
import './chunks/browser.d.Dx7DO_Ce.js';
|
|
10
|
+
import './chunks/worker.d.B_Fd9M_w.js';
|
|
11
|
+
import 'vite/module-runner';
|
|
12
|
+
import './chunks/config.d.B_LthbQq.js';
|
|
11
13
|
import '@vitest/pretty-format';
|
|
12
14
|
import '@vitest/snapshot';
|
|
13
15
|
import '@vitest/utils/diff';
|
|
14
|
-
import '@vitest/
|
|
15
|
-
import '@vitest/utils/source-map';
|
|
16
|
-
import 'vite-node';
|
|
17
|
-
import 'chai';
|
|
16
|
+
import '@vitest/expect';
|
|
18
17
|
import 'vitest/optional-types.js';
|
|
19
|
-
import './chunks/benchmark.d.
|
|
18
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
20
19
|
import '@vitest/runner/utils';
|
|
21
20
|
import 'tinybench';
|
|
22
|
-
import './chunks/coverage.d.
|
|
23
|
-
import 'vite-node/client';
|
|
21
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
24
22
|
import '@vitest/snapshot/manager';
|
|
25
23
|
import 'node:fs';
|
|
24
|
+
import 'node:console';
|
package/dist/reporters.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
export { 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 { 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.BwBttQPf.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.BhY64fF0.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'pathe';
|
|
6
|
-
import './chunks/typechecker.
|
|
6
|
+
import './chunks/typechecker.gXq-5P3n.js';
|
|
7
7
|
import 'node:os';
|
|
8
8
|
import 'node:perf_hooks';
|
|
9
|
-
import '@vitest/utils/source-map';
|
|
10
9
|
import 'tinyexec';
|
|
11
10
|
import './path.js';
|
|
12
11
|
import 'node:path';
|
|
13
12
|
import 'node:url';
|
|
14
13
|
import '@vitest/runner/utils';
|
|
15
|
-
import '@vitest/utils';
|
|
14
|
+
import '@vitest/utils/helpers';
|
|
16
15
|
import 'vite';
|
|
16
|
+
import '@vitest/utils/source-map';
|
|
17
17
|
import 'tinyrainbow';
|
|
18
18
|
import './chunks/env.D4Lgay0q.js';
|
|
19
19
|
import 'std-env';
|
|
20
20
|
import 'node:util';
|
|
21
21
|
import 'node:console';
|
|
22
22
|
import 'node:stream';
|
|
23
|
+
import '@vitest/utils/display';
|
|
24
|
+
import '@vitest/utils/offset';
|
|
23
25
|
import 'node:module';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as tinybench from 'tinybench';
|
|
2
2
|
import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, Test, TestContext, ImportDuration } from '@vitest/runner';
|
|
3
3
|
export { VitestRunner } from '@vitest/runner';
|
|
4
|
-
import { a as SerializedConfig } from './chunks/config.d.
|
|
4
|
+
import { a as SerializedConfig } from './chunks/config.d.B_LthbQq.js';
|
|
5
5
|
import '@vitest/pretty-format';
|
|
6
6
|
import '@vitest/snapshot';
|
|
7
7
|
import '@vitest/utils/diff';
|
|
8
8
|
|
|
9
9
|
declare class NodeBenchmarkRunner implements VitestRunner {
|
|
10
10
|
config: SerializedConfig;
|
|
11
|
-
private
|
|
11
|
+
private moduleRunner;
|
|
12
12
|
constructor(config: SerializedConfig);
|
|
13
13
|
importTinybench(): Promise<typeof tinybench>;
|
|
14
14
|
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
|
|
@@ -20,7 +20,7 @@ declare class VitestTestRunner implements VitestRunner {
|
|
|
20
20
|
config: SerializedConfig;
|
|
21
21
|
private snapshotClient;
|
|
22
22
|
private workerState;
|
|
23
|
-
private
|
|
23
|
+
private moduleRunner;
|
|
24
24
|
private cancelRun;
|
|
25
25
|
private assertionsErrors;
|
|
26
26
|
pool: string;
|
package/dist/runners.js
CHANGED
|
@@ -1,236 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import '
|
|
1
|
+
export { N as NodeBenchmarkRunner, V as VitestTestRunner } from './chunks/test.KC5tH8hC.js';
|
|
2
|
+
import '@vitest/runner';
|
|
3
|
+
import '@vitest/utils/helpers';
|
|
4
|
+
import '@vitest/utils/timers';
|
|
5
|
+
import './chunks/benchmark.LXhJ0F0X.js';
|
|
6
|
+
import '@vitest/runner/utils';
|
|
7
|
+
import './chunks/utils.DGKhod2J.js';
|
|
8
|
+
import '@vitest/expect';
|
|
9
|
+
import '@vitest/utils/error';
|
|
10
|
+
import 'pathe';
|
|
11
|
+
import './chunks/vi.CiJ0Laa6.js';
|
|
11
12
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
12
13
|
import '@vitest/snapshot';
|
|
13
|
-
import '@vitest/utils/error';
|
|
14
14
|
import '@vitest/spy';
|
|
15
|
+
import '@vitest/utils/offset';
|
|
15
16
|
import '@vitest/utils/source-map';
|
|
16
|
-
import './chunks/date.
|
|
17
|
-
import './chunks/
|
|
18
|
-
|
|
19
|
-
function createBenchmarkResult(name) {
|
|
20
|
-
return {
|
|
21
|
-
name,
|
|
22
|
-
rank: 0,
|
|
23
|
-
rme: 0,
|
|
24
|
-
samples: []
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const benchmarkTasks = /* @__PURE__ */ new WeakMap();
|
|
28
|
-
async function runBenchmarkSuite(suite, runner) {
|
|
29
|
-
const { Task, Bench } = await runner.importTinybench();
|
|
30
|
-
const start = performance.now();
|
|
31
|
-
const benchmarkGroup = [];
|
|
32
|
-
const benchmarkSuiteGroup = [];
|
|
33
|
-
for (const task of suite.tasks) {
|
|
34
|
-
if (task.mode !== "run" && task.mode !== "queued") continue;
|
|
35
|
-
if (task.meta?.benchmark) benchmarkGroup.push(task);
|
|
36
|
-
else if (task.type === "suite") benchmarkSuiteGroup.push(task);
|
|
37
|
-
}
|
|
38
|
-
// run sub suites sequentially
|
|
39
|
-
for (const subSuite of benchmarkSuiteGroup) await runBenchmarkSuite(subSuite, runner);
|
|
40
|
-
if (benchmarkGroup.length) {
|
|
41
|
-
const defer = createDefer();
|
|
42
|
-
suite.result = {
|
|
43
|
-
state: "run",
|
|
44
|
-
startTime: start,
|
|
45
|
-
benchmark: createBenchmarkResult(suite.name)
|
|
46
|
-
};
|
|
47
|
-
updateTask$1("suite-prepare", suite);
|
|
48
|
-
const addBenchTaskListener = (task, benchmark) => {
|
|
49
|
-
task.addEventListener("complete", (e) => {
|
|
50
|
-
const task = e.task;
|
|
51
|
-
const taskRes = task.result;
|
|
52
|
-
const result = benchmark.result.benchmark;
|
|
53
|
-
benchmark.result.state = "pass";
|
|
54
|
-
Object.assign(result, taskRes);
|
|
55
|
-
// compute extra stats and free raw samples as early as possible
|
|
56
|
-
const samples = result.samples;
|
|
57
|
-
result.sampleCount = samples.length;
|
|
58
|
-
result.median = samples.length % 2 ? samples[Math.floor(samples.length / 2)] : (samples[samples.length / 2] + samples[samples.length / 2 - 1]) / 2;
|
|
59
|
-
if (!runner.config.benchmark?.includeSamples) result.samples.length = 0;
|
|
60
|
-
updateTask$1("test-finished", benchmark);
|
|
61
|
-
}, { once: true });
|
|
62
|
-
task.addEventListener("error", (e) => {
|
|
63
|
-
const task = e.task;
|
|
64
|
-
defer.reject(benchmark ? task.result.error : e);
|
|
65
|
-
}, { once: true });
|
|
66
|
-
};
|
|
67
|
-
benchmarkGroup.forEach((benchmark) => {
|
|
68
|
-
const options = getBenchOptions(benchmark);
|
|
69
|
-
const benchmarkInstance = new Bench(options);
|
|
70
|
-
const benchmarkFn = getBenchFn(benchmark);
|
|
71
|
-
benchmark.result = {
|
|
72
|
-
state: "run",
|
|
73
|
-
startTime: start,
|
|
74
|
-
benchmark: createBenchmarkResult(benchmark.name)
|
|
75
|
-
};
|
|
76
|
-
const task = new Task(benchmarkInstance, benchmark.name, benchmarkFn);
|
|
77
|
-
benchmarkTasks.set(benchmark, task);
|
|
78
|
-
addBenchTaskListener(task, benchmark);
|
|
79
|
-
});
|
|
80
|
-
const { setTimeout } = getSafeTimers();
|
|
81
|
-
const tasks = [];
|
|
82
|
-
for (const benchmark of benchmarkGroup) {
|
|
83
|
-
const task = benchmarkTasks.get(benchmark);
|
|
84
|
-
updateTask$1("test-prepare", benchmark);
|
|
85
|
-
await task.warmup();
|
|
86
|
-
tasks.push([await new Promise((resolve) => setTimeout(async () => {
|
|
87
|
-
resolve(await task.run());
|
|
88
|
-
})), benchmark]);
|
|
89
|
-
}
|
|
90
|
-
suite.result.duration = performance.now() - start;
|
|
91
|
-
suite.result.state = "pass";
|
|
92
|
-
updateTask$1("suite-finished", suite);
|
|
93
|
-
defer.resolve(null);
|
|
94
|
-
await defer;
|
|
95
|
-
}
|
|
96
|
-
function updateTask$1(event, task) {
|
|
97
|
-
updateTask(event, task, runner);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
class NodeBenchmarkRunner {
|
|
101
|
-
__vitest_executor;
|
|
102
|
-
constructor(config) {
|
|
103
|
-
this.config = config;
|
|
104
|
-
}
|
|
105
|
-
async importTinybench() {
|
|
106
|
-
return await import('tinybench');
|
|
107
|
-
}
|
|
108
|
-
importFile(filepath, source) {
|
|
109
|
-
if (source === "setup") getWorkerState().moduleCache.delete(filepath);
|
|
110
|
-
return this.__vitest_executor.executeId(filepath);
|
|
111
|
-
}
|
|
112
|
-
async runSuite(suite) {
|
|
113
|
-
await runBenchmarkSuite(suite, this);
|
|
114
|
-
}
|
|
115
|
-
async runTask() {
|
|
116
|
-
throw new Error("`test()` and `it()` is only available in test mode.");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// import type { VitestExecutor } from '../execute'
|
|
121
|
-
// worker context is shared between all tests
|
|
122
|
-
const workerContext = Object.create(null);
|
|
123
|
-
class VitestTestRunner {
|
|
124
|
-
snapshotClient = getSnapshotClient();
|
|
125
|
-
workerState = getWorkerState();
|
|
126
|
-
__vitest_executor;
|
|
127
|
-
cancelRun = false;
|
|
128
|
-
assertionsErrors = /* @__PURE__ */ new WeakMap();
|
|
129
|
-
pool = this.workerState.ctx.pool;
|
|
130
|
-
constructor(config) {
|
|
131
|
-
this.config = config;
|
|
132
|
-
}
|
|
133
|
-
importFile(filepath, source) {
|
|
134
|
-
if (source === "setup") this.workerState.moduleCache.delete(filepath);
|
|
135
|
-
return this.__vitest_executor.executeId(filepath);
|
|
136
|
-
}
|
|
137
|
-
onCollectStart(file) {
|
|
138
|
-
this.workerState.current = file;
|
|
139
|
-
}
|
|
140
|
-
onCleanupWorkerContext(listener) {
|
|
141
|
-
this.workerState.onCleanup(listener);
|
|
142
|
-
}
|
|
143
|
-
onAfterRunFiles() {
|
|
144
|
-
this.snapshotClient.clear();
|
|
145
|
-
this.workerState.current = void 0;
|
|
146
|
-
}
|
|
147
|
-
getWorkerContext() {
|
|
148
|
-
return workerContext;
|
|
149
|
-
}
|
|
150
|
-
async onAfterRunSuite(suite) {
|
|
151
|
-
if (this.config.logHeapUsage && typeof process !== "undefined") suite.result.heap = process.memoryUsage().heapUsed;
|
|
152
|
-
if (suite.mode !== "skip" && "filepath" in suite) {
|
|
153
|
-
// mark snapshots in skipped tests as not obsolete
|
|
154
|
-
for (const test of getTests(suite)) if (test.mode === "skip") {
|
|
155
|
-
const name = getNames(test).slice(1).join(" > ");
|
|
156
|
-
this.snapshotClient.skipTest(suite.file.filepath, name);
|
|
157
|
-
}
|
|
158
|
-
const result = await this.snapshotClient.finish(suite.file.filepath);
|
|
159
|
-
await rpc().snapshotSaved(result);
|
|
160
|
-
}
|
|
161
|
-
this.workerState.current = suite.suite || suite.file;
|
|
162
|
-
}
|
|
163
|
-
onAfterRunTask(test) {
|
|
164
|
-
if (this.config.logHeapUsage && typeof process !== "undefined") test.result.heap = process.memoryUsage().heapUsed;
|
|
165
|
-
this.workerState.current = test.suite || test.file;
|
|
166
|
-
}
|
|
167
|
-
cancel(_reason) {
|
|
168
|
-
this.cancelRun = true;
|
|
169
|
-
}
|
|
170
|
-
injectValue(key) {
|
|
171
|
-
// inject has a very limiting type controlled by ProvidedContext
|
|
172
|
-
// some tests override it which causes the build to fail
|
|
173
|
-
return inject(key);
|
|
174
|
-
}
|
|
175
|
-
async onBeforeRunTask(test) {
|
|
176
|
-
if (this.cancelRun) test.mode = "skip";
|
|
177
|
-
if (test.mode !== "run" && test.mode !== "queued") return;
|
|
178
|
-
this.workerState.current = test;
|
|
179
|
-
}
|
|
180
|
-
async onBeforeRunSuite(suite) {
|
|
181
|
-
if (this.cancelRun) suite.mode = "skip";
|
|
182
|
-
// initialize snapshot state before running file suite
|
|
183
|
-
if (suite.mode !== "skip" && "filepath" in suite) await this.snapshotClient.setup(suite.file.filepath, this.workerState.config.snapshotOptions);
|
|
184
|
-
this.workerState.current = suite;
|
|
185
|
-
}
|
|
186
|
-
onBeforeTryTask(test) {
|
|
187
|
-
clearModuleMocks(this.config);
|
|
188
|
-
this.snapshotClient.clearTest(test.file.filepath, test.id);
|
|
189
|
-
setState({
|
|
190
|
-
assertionCalls: 0,
|
|
191
|
-
isExpectingAssertions: false,
|
|
192
|
-
isExpectingAssertionsError: null,
|
|
193
|
-
expectedAssertionsNumber: null,
|
|
194
|
-
expectedAssertionsNumberErrorGen: null,
|
|
195
|
-
currentTestName: getTestName(test),
|
|
196
|
-
snapshotState: this.snapshotClient.getSnapshotState(test.file.filepath)
|
|
197
|
-
}, globalThis[GLOBAL_EXPECT]);
|
|
198
|
-
}
|
|
199
|
-
onAfterTryTask(test) {
|
|
200
|
-
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
201
|
-
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber) throw expectedAssertionsNumberErrorGen();
|
|
202
|
-
if (isExpectingAssertions === true && assertionCalls === 0) throw isExpectingAssertionsError;
|
|
203
|
-
if (this.config.expect.requireAssertions && assertionCalls === 0) throw this.assertionsErrors.get(test);
|
|
204
|
-
}
|
|
205
|
-
extendTaskContext(context) {
|
|
206
|
-
// create error during the test initialization so we have a nice stack trace
|
|
207
|
-
if (this.config.expect.requireAssertions) this.assertionsErrors.set(context.task, new Error("expected any number of assertion, but got none"));
|
|
208
|
-
let _expect;
|
|
209
|
-
Object.defineProperty(context, "expect", { get() {
|
|
210
|
-
if (!_expect) _expect = createExpect(context.task);
|
|
211
|
-
return _expect;
|
|
212
|
-
} });
|
|
213
|
-
Object.defineProperty(context, "_local", { get() {
|
|
214
|
-
return _expect != null;
|
|
215
|
-
} });
|
|
216
|
-
return context;
|
|
217
|
-
}
|
|
218
|
-
getImportDurations() {
|
|
219
|
-
const entries = [...this.workerState.moduleExecutionInfo?.entries() ?? []];
|
|
220
|
-
return Object.fromEntries(entries.map(([filepath, { duration, selfTime }]) => [normalize(filepath), {
|
|
221
|
-
selfTime,
|
|
222
|
-
totalTime: duration
|
|
223
|
-
}]));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function clearModuleMocks(config) {
|
|
227
|
-
const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
|
|
228
|
-
// since each function calls another, we can just call one
|
|
229
|
-
if (restoreMocks) vi.restoreAllMocks();
|
|
230
|
-
else if (mockReset) vi.resetAllMocks();
|
|
231
|
-
else if (clearMocks) vi.clearAllMocks();
|
|
232
|
-
if (unstubEnvs) vi.unstubAllEnvs();
|
|
233
|
-
if (unstubGlobals) vi.unstubAllGlobals();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export { NodeBenchmarkRunner, VitestTestRunner };
|
|
17
|
+
import './chunks/date.-jtEtIeV.js';
|
|
18
|
+
import './chunks/rpc.jKGRSXIH.js';
|
|
19
|
+
import './chunks/index.Bgo3tNWt.js';
|
package/dist/snapshot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.
|
|
1
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.BsdMi6DV.js';
|
|
2
2
|
import '@vitest/snapshot/environment';
|
|
3
|
-
import './chunks/utils.
|
|
4
|
-
import '@vitest/utils';
|
|
3
|
+
import './chunks/utils.DGKhod2J.js';
|
|
4
|
+
import '@vitest/utils/timers';
|