vitest 4.1.0-beta.1 → 4.1.0-beta.2
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 +36 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/acorn.B2iPLyUM.js +5958 -0
- package/dist/chunks/{base.CBRNZa3k.js → base.DiopZV8F.js} +48 -14
- package/dist/chunks/{benchmark.B3N2zMcH.js → benchmark.BoqSLF53.js} +1 -1
- package/dist/chunks/{browser.d.8hOapKZr.d.ts → browser.d.BE4kbYok.d.ts} +2 -1
- package/dist/chunks/{cac.B1v3xxoC.js → cac.C4jjt2RX.js} +797 -13
- package/dist/chunks/{cli-api.B4CqEpI6.js → cli-api.ChbI1JU9.js} +322 -124
- package/dist/chunks/{config.d.idH22YSr.d.ts → config.d.Cr1Ep39N.d.ts} +6 -1
- package/dist/chunks/{console.uGgdMhyZ.js → console.CNlG1KsP.js} +2 -2
- package/dist/chunks/{constants.D_Q9UYh-.js → constants.B63TT-Bl.js} +1 -1
- package/dist/chunks/coverage.tyqbzn4W.js +1001 -0
- package/dist/chunks/{creator.C7WwjkuR.js → creator.yyCHuw5R.js} +1 -1
- package/dist/chunks/{global.d.B15mdLcR.d.ts → global.d.JeWMqlOm.d.ts} +1 -1
- package/dist/chunks/{globals.DjuGMoMc.js → globals.C6Ecf1TO.js} +6 -6
- package/dist/chunks/{index.Dm4xqZ0s.js → index.B-iBE_Gx.js} +20 -4
- package/dist/chunks/{coverage.BMlOMIWl.js → index.BCY_7LL2.js} +5 -969
- package/dist/chunks/{index.BiOAd_ki.js → index.CAN630q3.js} +7 -7
- package/dist/chunks/{index.DyBZXrH3.js → index.CFulQRmC.js} +1 -1
- package/dist/chunks/{index.BEFi2-_3.js → index.CouFDptX.js} +2 -2
- package/dist/chunks/{init-forks.CHeQ9Moq.js → init-forks.BnCXPazU.js} +1 -1
- package/dist/chunks/{init-threads.uZiNAuPk.js → init-threads.Cyh2PqXi.js} +1 -1
- package/dist/chunks/{init.DVtKdFty.js → init.B95Mm0Iz.js} +47 -9
- package/dist/chunks/native.mV0-490A.js +148 -0
- package/dist/chunks/nativeModuleMocker.D_q5sFv6.js +206 -0
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +36 -0
- package/dist/chunks/{node.Ce0vMQM7.js → node.CrSEwhm4.js} +1 -1
- package/dist/chunks/{plugin.d.D8KU2PY_.d.ts → plugin.d.C9o5bttz.d.ts} +1 -1
- package/dist/chunks/{reporters.d.Db3MiIWX.d.ts → reporters.d.7faYdkxy.d.ts} +120 -51
- package/dist/chunks/{rpc.HLmECnw_.js → rpc.DcRWTy5G.js} +1 -1
- package/dist/chunks/{rpc.d.RH3apGEf.d.ts → rpc.d.CM7x9-sm.d.ts} +1 -0
- package/dist/chunks/{setup-common.BcqLPsn5.js → setup-common.cvFp-ao9.js} +2 -2
- package/dist/chunks/{startModuleRunner.C5CcWyXW.js → startVitestModuleRunner.BK-u7y4N.js} +163 -372
- package/dist/chunks/{test.prxIahgM.js → test.G82XYNFk.js} +9 -4
- package/dist/chunks/{utils.DvEY5TfP.js → utils.DT4VyRyl.js} +5 -1
- package/dist/chunks/{vm.CrifS09m.js → vm.BdLtzhnj.js} +13 -6
- package/dist/chunks/{worker.d.Bji1eq5g.d.ts → worker.d.CPzI2ZzJ.d.ts} +2 -2
- package/dist/cli.js +4 -3
- package/dist/config.d.ts +8 -8
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +7 -5
- package/dist/coverage.js +5 -4
- package/dist/index.d.ts +18 -23
- package/dist/index.js +5 -5
- package/dist/module-evaluator.d.ts +10 -1
- package/dist/node.d.ts +9 -9
- package/dist/node.js +18 -16
- package/dist/nodejs-worker-loader.js +41 -0
- package/dist/reporters.d.ts +5 -5
- package/dist/reporters.js +2 -2
- package/dist/runners.d.ts +2 -1
- package/dist/runners.js +4 -4
- package/dist/runtime.js +4 -5
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.d.ts +6 -6
- package/dist/worker.js +25 -18
- package/dist/workers/forks.js +21 -14
- package/dist/workers/runVmTests.js +7 -7
- package/dist/workers/threads.js +21 -14
- package/dist/workers/vmForks.js +14 -10
- package/dist/workers/vmThreads.js +14 -10
- package/package.json +17 -14
- package/suppress-warnings.cjs +1 -0
|
@@ -7,6 +7,10 @@ function getWorkerState() {
|
|
|
7
7
|
if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n");
|
|
8
8
|
return workerState;
|
|
9
9
|
}
|
|
10
|
+
function getSafeWorkerState() {
|
|
11
|
+
// @ts-expect-error untyped global
|
|
12
|
+
return globalThis[NAME_WORKER_STATE];
|
|
13
|
+
}
|
|
10
14
|
function provideWorkerState(context, state) {
|
|
11
15
|
Object.defineProperty(context, NAME_WORKER_STATE, {
|
|
12
16
|
value: state,
|
|
@@ -49,4 +53,4 @@ async function waitForImportsToResolve() {
|
|
|
49
53
|
await waitForImportsToResolve();
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
export { getWorkerState as g, isChildProcess as i, provideWorkerState as p, resetModules as r, waitForImportsToResolve as w };
|
|
56
|
+
export { getSafeWorkerState as a, getWorkerState as g, isChildProcess as i, provideWorkerState as p, resetModules as r, waitForImportsToResolve as w };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
2
2
|
import vm, { isContext, runInContext } from 'node:vm';
|
|
3
3
|
import { dirname, basename, extname, normalize, resolve } from 'pathe';
|
|
4
|
-
import { l as loadEnvironment, e as emitModuleRunner } from './init.
|
|
4
|
+
import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.B95Mm0Iz.js';
|
|
5
5
|
import { distDir } from '../path.js';
|
|
6
|
-
import { createCustomConsole } from './console.
|
|
6
|
+
import { createCustomConsole } from './console.CNlG1KsP.js';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { createRequire, Module, isBuiltin } from 'node:module';
|
|
9
9
|
import { toArray, isBareImport } from '@vitest/utils/helpers';
|
|
@@ -11,8 +11,8 @@ import { findNearestPackageData } from '@vitest/utils/resolver';
|
|
|
11
11
|
import { dirname as dirname$1 } from 'node:path';
|
|
12
12
|
import { CSS_LANGS_RE, KNOWN_ASSET_RE } from '@vitest/utils/constants';
|
|
13
13
|
import { getDefaultRequestStubs } from '../module-evaluator.js';
|
|
14
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta, V as VITEST_VM_CONTEXT_SYMBOL } from './
|
|
15
|
-
import { p as provideWorkerState } from './utils.
|
|
14
|
+
import { s as startVitestModuleRunner, c as createNodeImportMeta, V as VITEST_VM_CONTEXT_SYMBOL } from './startVitestModuleRunner.BK-u7y4N.js';
|
|
15
|
+
import { p as provideWorkerState } from './utils.DT4VyRyl.js';
|
|
16
16
|
|
|
17
17
|
function interopCommonJsModule(interopDefault, mod) {
|
|
18
18
|
if (isPrimitive(mod) || Array.isArray(mod) || mod instanceof Promise) return {
|
|
@@ -674,7 +674,7 @@ const packageCache = /* @__PURE__ */ new Map();
|
|
|
674
674
|
async function runVmTests(method, state, traces) {
|
|
675
675
|
const { ctx, rpc } = state;
|
|
676
676
|
const beforeEnvironmentTime = performance.now();
|
|
677
|
-
const { environment } = await loadEnvironment(ctx.environment.name, ctx.config.root, rpc, traces);
|
|
677
|
+
const { environment } = await loadEnvironment(ctx.environment.name, ctx.config.root, rpc, traces, true);
|
|
678
678
|
state.environment = environment;
|
|
679
679
|
if (!environment.setupVM) {
|
|
680
680
|
const envName = ctx.environment.name;
|
|
@@ -708,6 +708,10 @@ async function runVmTests(method, state, traces) {
|
|
|
708
708
|
transform: rpc.transform,
|
|
709
709
|
viteClientModule: stubs["/@vite/client"]
|
|
710
710
|
});
|
|
711
|
+
process.exit = (code = process.exitCode || 0) => {
|
|
712
|
+
throw new Error(`process.exit unexpectedly called with "${code}"`);
|
|
713
|
+
};
|
|
714
|
+
listenForErrors(() => state);
|
|
711
715
|
const moduleRunner = startVitestModuleRunner({
|
|
712
716
|
context,
|
|
713
717
|
evaluatedModules: state.evaluatedModules,
|
|
@@ -740,5 +744,8 @@ async function runVmTests(method, state, traces) {
|
|
|
740
744
|
await traces.$("vitest.runtime.environment.teardown", () => vm.teardown?.());
|
|
741
745
|
}
|
|
742
746
|
}
|
|
747
|
+
function setupVmWorker(context) {
|
|
748
|
+
if (context.config.experimental.viteModuleRunner === false) throw new Error(`Pool "${context.pool}" cannot run with "experimental.viteModuleRunner: false". Please, use "threads" or "forks" instead.`);
|
|
749
|
+
}
|
|
743
750
|
|
|
744
|
-
export { runVmTests as r };
|
|
751
|
+
export { runVmTests as r, setupVmWorker as s };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FileSpecification, Task, CancelReason } from '@vitest/runner';
|
|
2
2
|
import { EvaluatedModules } from 'vite/module-runner';
|
|
3
|
-
import { S as SerializedConfig } from './config.d.
|
|
3
|
+
import { S as SerializedConfig } from './config.d.Cr1Ep39N.js';
|
|
4
4
|
import { E as Environment } from './environment.d.CrsxCzP1.js';
|
|
5
|
-
import { R as RuntimeRPC, a as RunnerRPC } from './rpc.d.
|
|
5
|
+
import { R as RuntimeRPC, a as RunnerRPC } from './rpc.d.CM7x9-sm.js';
|
|
6
6
|
|
|
7
7
|
//#region src/messages.d.ts
|
|
8
8
|
declare const TYPE_REQUEST: "q";
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as createCLI } from './chunks/cac.
|
|
1
|
+
import { c as createCLI } from './chunks/cac.C4jjt2RX.js';
|
|
2
2
|
import '@vitest/utils/helpers';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
|
-
import './chunks/constants.
|
|
7
|
-
import './chunks/index.
|
|
6
|
+
import './chunks/constants.B63TT-Bl.js';
|
|
7
|
+
import './chunks/index.B-iBE_Gx.js';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import 'node:fs/promises';
|
|
10
10
|
import 'node:perf_hooks';
|
|
@@ -24,5 +24,6 @@ import 'node:url';
|
|
|
24
24
|
import 'vite';
|
|
25
25
|
import '@vitest/utils/offset';
|
|
26
26
|
import 'node:module';
|
|
27
|
+
import 'node:assert';
|
|
27
28
|
|
|
28
29
|
createCLI().parse();
|
package/dist/config.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { HookHandler, ConfigEnv, UserConfig } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { I as InlineConfig, C as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, b as UserProjectConfigFn, c as UserProjectConfigExport } from './chunks/reporters.d.
|
|
4
|
-
export { a as TestProjectConfiguration, e as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.
|
|
5
|
-
import { V as VitestPluginContext } from './chunks/plugin.d.
|
|
6
|
-
import { F as FakeTimerInstallOpts } from './chunks/config.d.
|
|
7
|
-
|
|
3
|
+
import { I as InlineConfig, C as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, b as UserProjectConfigFn, c as UserProjectConfigExport } from './chunks/reporters.d.7faYdkxy.js';
|
|
4
|
+
export { a as TestProjectConfiguration, e as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.7faYdkxy.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.C9o5bttz.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.Cr1Ep39N.js';
|
|
7
|
+
export { TestTagDefinition } from '@vitest/runner';
|
|
8
8
|
import '@vitest/utils';
|
|
9
|
-
import './chunks/rpc.d.
|
|
9
|
+
import './chunks/rpc.d.CM7x9-sm.js';
|
|
10
10
|
import '@vitest/snapshot';
|
|
11
11
|
import 'vite/module-runner';
|
|
12
12
|
import './chunks/traces.d.402V_yFI.js';
|
|
13
13
|
import 'node:stream';
|
|
14
|
-
import './chunks/browser.d.
|
|
15
|
-
import './chunks/worker.d.
|
|
14
|
+
import './chunks/browser.d.BE4kbYok.js';
|
|
15
|
+
import './chunks/worker.d.CPzI2ZzJ.js';
|
|
16
16
|
import './chunks/environment.d.CrsxCzP1.js';
|
|
17
17
|
import '@vitest/pretty-format';
|
|
18
18
|
import '@vitest/utils/diff';
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.BOqNVLsY.js';
|
|
2
2
|
export { mergeConfig } from 'vite';
|
|
3
|
-
export { d as defaultBrowserPort } from './chunks/constants.
|
|
3
|
+
export { d as defaultBrowserPort } from './chunks/constants.B63TT-Bl.js';
|
|
4
4
|
import 'node:os';
|
|
5
5
|
import './chunks/env.D4Lgay0q.js';
|
|
6
6
|
import 'std-env';
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, aY as CoverageMap, aW as ReportContext } from './chunks/reporters.d.
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, aY as CoverageMap, aW as ReportContext, T as TestProject } from './chunks/reporters.d.7faYdkxy.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
|
-
import { A as AfterSuiteRunMeta } from './chunks/rpc.d.
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/rpc.d.CM7x9-sm.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
7
|
-
import './chunks/browser.d.
|
|
7
|
+
import './chunks/browser.d.BE4kbYok.js';
|
|
8
8
|
import './chunks/traces.d.402V_yFI.js';
|
|
9
|
-
import './chunks/worker.d.
|
|
9
|
+
import './chunks/worker.d.CPzI2ZzJ.js';
|
|
10
10
|
import 'vite/module-runner';
|
|
11
|
-
import './chunks/config.d.
|
|
11
|
+
import './chunks/config.d.Cr1Ep39N.js';
|
|
12
12
|
import '@vitest/pretty-format';
|
|
13
13
|
import '@vitest/snapshot';
|
|
14
14
|
import '@vitest/utils/diff';
|
|
@@ -57,6 +57,7 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
|
|
|
57
57
|
version: string;
|
|
58
58
|
options: Options;
|
|
59
59
|
globCache: Map<string, boolean>;
|
|
60
|
+
autoUpdateMarker: string;
|
|
60
61
|
coverageFiles: CoverageFiles;
|
|
61
62
|
pendingPromises: Promise<void>[];
|
|
62
63
|
coverageFilesDirectory: string;
|
|
@@ -112,6 +113,7 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
|
|
|
112
113
|
mergeReports(coverageMaps: unknown[]): Promise<void>;
|
|
113
114
|
hasTerminalReporter(reporters: ResolvedCoverageOptions["reporter"]): boolean;
|
|
114
115
|
toSlices<T>(array: T[], size: number): T[][];
|
|
116
|
+
transformFile(url: string, project: TestProject, viteEnvironment: string): Promise<TransformResult | null | undefined>;
|
|
115
117
|
createUncoveredFileTransformer(ctx: Vitest): (filename: string) => Promise<TransformResult | null | undefined>;
|
|
116
118
|
}
|
|
117
119
|
|
package/dist/coverage.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.tyqbzn4W.js';
|
|
2
2
|
import 'node:fs';
|
|
3
|
+
import 'node:module';
|
|
3
4
|
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
4
6
|
import '@vitest/utils/helpers';
|
|
5
7
|
import 'pathe';
|
|
6
8
|
import 'picomatch';
|
|
@@ -11,15 +13,14 @@ import 'node:os';
|
|
|
11
13
|
import './chunks/env.D4Lgay0q.js';
|
|
12
14
|
import 'std-env';
|
|
13
15
|
import 'node:crypto';
|
|
14
|
-
import '
|
|
15
|
-
import 'node:module';
|
|
16
|
+
import './chunks/index.BCY_7LL2.js';
|
|
16
17
|
import 'node:process';
|
|
17
18
|
import 'node:fs/promises';
|
|
18
19
|
import 'node:assert';
|
|
19
20
|
import 'node:v8';
|
|
20
21
|
import 'node:util';
|
|
21
22
|
import 'vite';
|
|
22
|
-
import './chunks/constants.
|
|
23
|
+
import './chunks/constants.B63TT-Bl.js';
|
|
23
24
|
import './chunks/coverage.D_JHT54q.js';
|
|
24
25
|
|
|
25
26
|
console.warn("Importing from \"vitest/coverage\" is deprecated since Vitest 4.1. Please use \"vitest/node\" instead.");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.
|
|
2
|
-
export { B as BrowserTesterOptions } from './chunks/browser.d.
|
|
3
|
-
import './chunks/global.d.
|
|
1
|
+
import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.BE4kbYok.js';
|
|
2
|
+
export { B as BrowserTesterOptions } from './chunks/browser.d.BE4kbYok.js';
|
|
3
|
+
import './chunks/global.d.JeWMqlOm.js';
|
|
4
4
|
import { File, TestAnnotation, TestArtifact, TaskResultPack, TaskEventPack, Test, TaskPopulated } from '@vitest/runner';
|
|
5
|
-
export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, 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, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestAnnotationArtifact, TestArtifact, TestArtifactBase, TestArtifactLocation, TestArtifactRegistry, TestAttachment, TestContext, TestFunction, TestOptions, VitestRunnerConfig as TestRunnerConfig, VitestRunner as VitestTestRunner, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from '@vitest/runner';
|
|
5
|
+
export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, 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, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestAnnotationArtifact, TestArtifact, TestArtifactBase, TestArtifactLocation, TestArtifactRegistry, TestAttachment, TestContext, TestFunction, TestOptions, VitestRunnerConfig as TestRunnerConfig, TestTags, VitestRunner as VitestTestRunner, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from '@vitest/runner';
|
|
6
6
|
import { Awaitable } from '@vitest/utils';
|
|
7
7
|
export { ParsedStack, SerializedError, TestError } from '@vitest/utils';
|
|
8
|
-
import { b as BirpcReturn } from './chunks/worker.d.
|
|
9
|
-
export { C as ContextRPC, c as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
10
|
-
import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.
|
|
11
|
-
export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.d.
|
|
12
|
-
import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/rpc.d.
|
|
13
|
-
export { A as AfterSuiteRunMeta, a as RunnerRPC, R as RuntimeRPC } from './chunks/rpc.d.
|
|
8
|
+
import { b as BirpcReturn } from './chunks/worker.d.CPzI2ZzJ.js';
|
|
9
|
+
export { C as ContextRPC, c as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.CPzI2ZzJ.js';
|
|
10
|
+
import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.Cr1Ep39N.js';
|
|
11
|
+
export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.d.Cr1Ep39N.js';
|
|
12
|
+
import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/rpc.d.CM7x9-sm.js';
|
|
13
|
+
export { A as AfterSuiteRunMeta, a as RunnerRPC, R as RuntimeRPC } from './chunks/rpc.d.CM7x9-sm.js';
|
|
14
14
|
import { ExpectStatic } from '@vitest/expect';
|
|
15
|
-
export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers, chai } from '@vitest/expect';
|
|
15
|
+
export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, RawMatcherFn as Matcher, ExpectationResult as MatcherResult, MatcherState, Matchers, chai } from '@vitest/expect';
|
|
16
16
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
17
17
|
export { Mock, MockContext, MockInstance, MockResult, MockResultIncomplete, MockResultReturn, MockResultThrow, MockSettledResult, MockSettledResultFulfilled, MockSettledResultIncomplete, MockSettledResultRejected, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
|
|
18
|
+
import { ModuleMockFactoryWithHelper, ModuleMockOptions } from '@vitest/mocker';
|
|
18
19
|
export { b as bench } from './chunks/suite.d.BJWk38HB.js';
|
|
19
20
|
export { V as EvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
|
|
20
21
|
export { NodeBenchmarkRunner as BenchmarkRunner, VitestTestRunner as TestRunner } from './runners.js';
|
|
@@ -99,12 +100,6 @@ declare const should: () => Chai.Should;
|
|
|
99
100
|
*/
|
|
100
101
|
declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];
|
|
101
102
|
|
|
102
|
-
type Promisable<T> = T | Promise<T>;
|
|
103
|
-
type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M = M>() => Promise<T>) => Promisable<Partial<M>>;
|
|
104
|
-
interface MockOptions {
|
|
105
|
-
spy?: boolean;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
103
|
type WaitForCallback<T> = () => T | Promise<T>;
|
|
109
104
|
interface WaitForOptions {
|
|
110
105
|
/**
|
|
@@ -306,8 +301,8 @@ interface VitestUtils {
|
|
|
306
301
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
307
302
|
* @param factory Mocked module factory. The result of this function will be an exports object
|
|
308
303
|
*/
|
|
309
|
-
mock(path: string, factory?:
|
|
310
|
-
mock<T>(module: Promise<T>, factory?:
|
|
304
|
+
mock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): void;
|
|
305
|
+
mock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): void;
|
|
311
306
|
/**
|
|
312
307
|
* Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
|
|
313
308
|
*
|
|
@@ -327,8 +322,8 @@ interface VitestUtils {
|
|
|
327
322
|
*
|
|
328
323
|
* @returns A disposable object that calls {@link doUnmock()} when disposed
|
|
329
324
|
*/
|
|
330
|
-
doMock(path: string, factory?:
|
|
331
|
-
doMock<T>(module: Promise<T>, factory?:
|
|
325
|
+
doMock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): Disposable;
|
|
326
|
+
doMock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): Disposable;
|
|
332
327
|
/**
|
|
333
328
|
* Removes module from mocked registry. All subsequent calls to import will return original module.
|
|
334
329
|
*
|
|
@@ -399,12 +394,12 @@ interface VitestUtils {
|
|
|
399
394
|
* @param value - The object to be mocked
|
|
400
395
|
* @returns A deeply mocked version of the input object
|
|
401
396
|
*/
|
|
402
|
-
mockObject: <T>(value: T, options?:
|
|
397
|
+
mockObject: <T>(value: T, options?: ModuleMockOptions) => MaybeMockedDeep<T>;
|
|
403
398
|
/**
|
|
404
399
|
* Type helper for TypeScript. Just returns the object that was passed.
|
|
405
400
|
*
|
|
406
401
|
* When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
|
|
407
|
-
* the first level values are mocked. You can pass down `{ deep: true }`
|
|
402
|
+
* the first level values are mocked. You can pass down `{ partial: true, deep: true }` to make nested objects also partial recursively.
|
|
408
403
|
* @example
|
|
409
404
|
* ```ts
|
|
410
405
|
* import example from './example.js'
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { N as BenchmarkRunner, T as TestRunner, a as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, b as vitest } from './chunks/test.
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
1
|
+
export { N as BenchmarkRunner, T as TestRunner, a as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, b as vitest } from './chunks/test.G82XYNFk.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.BoqSLF53.js';
|
|
3
3
|
export { V as EvaluatedModules } from './chunks/evaluatedModules.Dg1zASAC.js';
|
|
4
|
-
export { a as assertType } from './chunks/index.
|
|
4
|
+
export { a as assertType } from './chunks/index.CouFDptX.js';
|
|
5
5
|
export { expectTypeOf } from 'expect-type';
|
|
6
6
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from '@vitest/runner';
|
|
7
7
|
export { chai } from '@vitest/expect';
|
|
8
8
|
import '@vitest/utils/helpers';
|
|
9
9
|
import '@vitest/utils/timers';
|
|
10
|
-
import './chunks/utils.
|
|
10
|
+
import './chunks/utils.DT4VyRyl.js';
|
|
11
11
|
import '@vitest/runner/utils';
|
|
12
12
|
import '@vitest/utils/error';
|
|
13
13
|
import 'pathe';
|
|
@@ -16,6 +16,6 @@ import '@vitest/spy';
|
|
|
16
16
|
import '@vitest/utils/offset';
|
|
17
17
|
import '@vitest/utils/source-map';
|
|
18
18
|
import './chunks/_commonjsHelpers.D26ty3Ew.js';
|
|
19
|
-
import './chunks/rpc.
|
|
19
|
+
import './chunks/rpc.DcRWTy5G.js';
|
|
20
20
|
import './chunks/index.Chj8NDwU.js';
|
|
21
21
|
import 'vite/module-runner';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode } from 'vite/module-runner';
|
|
2
2
|
import { V as VitestEvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
|
|
3
3
|
import vm from 'node:vm';
|
|
4
|
-
import { R as RuntimeRPC } from './chunks/rpc.d.
|
|
4
|
+
import { R as RuntimeRPC } from './chunks/rpc.d.CM7x9-sm.js';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/snapshot';
|
|
7
7
|
import './chunks/traces.d.402V_yFI.js';
|
|
@@ -82,6 +82,15 @@ declare module "vite/module-runner" {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare module "vite/module-runner" {
|
|
86
|
+
interface EvaluatedModuleNode {
|
|
87
|
+
/**
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
mockedExports?: Record<string, any>;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
interface VitestVmOptions {
|
|
86
95
|
context: vm.Context;
|
|
87
96
|
externalModulesExecutor: ExternalModulesExecutor;
|
package/dist/node.d.ts
CHANGED
|
@@ -3,22 +3,22 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
|
|
|
3
3
|
export { vite as Vite };
|
|
4
4
|
export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
5
5
|
import { IncomingMessage } from 'node:http';
|
|
6
|
-
import { f as ResolvedConfig, d as UserConfig, g as VitestRunMode, h as VitestOptions, V as Vitest, A as ApiConfig, i as TestSpecification, T as TestProject, P as PoolWorker, j as PoolOptions, k as WorkerRequest, l as TestSequencer, L as Logger } from './chunks/reporters.d.
|
|
7
|
-
export { aP as BaseCoverageOptions, z as BaseReporter, E as BenchmarkBuiltinReporters, B as BenchmarkReporter, r as BenchmarkReportsMap, ai as BenchmarkUserOptions, ak as BrowserBuiltinProvider, al as BrowserCommand, am as BrowserCommandContext, an as BrowserConfigOptions, ao as BrowserInstanceOption, ap as BrowserModuleMocker, aq as BrowserOrchestrator, ar as BrowserProvider, as as BrowserProviderOption, at as BrowserScript, au as BrowserServerFactory, av as BrowserServerOptions, aw as BrowserServerState, ax as BrowserServerStateSession, aE as BuiltinEnvironment, F as BuiltinReporterOptions, K as BuiltinReporters, ay as CDPSession, aF as CSSModuleScopeStrategy, aQ as CoverageIstanbulOptions, aR as CoverageOptions, aS as CoverageProvider, aT as CoverageProviderModule, aU as CoverageReporter, C as CoverageV8Options, aV as CustomProviderOptions, D as DefaultReporter, aG as DepsOptimizationOptions, s as DotReporter, aH as EnvironmentOptions, G as GithubActionsReporter, _ as HTMLOptions, H as HangingProcessReporter, I as InlineConfig, a0 as JUnitOptions, t as JUnitReporter, M as JsonAssertionResult, $ as JsonOptions, J as JsonReporter, N as JsonTestResult, Q as JsonTestResults, a1 as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, az as ParentProjectBrowser, aI as Pool, o as PoolRunnerInitializer, p as PoolTask, aA as ProjectBrowser, aJ as ProjectConfig, aW as ReportContext, X as ReportedHookContext, Y as Reporter, u as ReportersMap, aL as ResolveSnapshotPathHandler, aM as ResolveSnapshotPathHandlerContext, aB as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aK as ResolvedProjectConfig, S as SerializedTestProject, v as TapFlatReporter, w as TapReporter, a2 as TaskOptions, a3 as TestCase, a4 as TestCollection, a5 as TestDiagnostic, a6 as TestModule, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, Z as TestRunEndReason, aX as TestRunResult, ag as TestSequencerConstructor, ah as TestSpecificationOptions, ac as TestState, ad as TestSuite, ae as TestSuiteState, aC as ToMatchScreenshotComparators, aD as ToMatchScreenshotOptions, aN as TypecheckConfig, U as UserWorkspaceConfig, x as VerboseBenchmarkReporter, y as VerboseReporter, aO as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, q as WorkerResponse, aj as _BrowserNames, af as experimental_getRunnerTask } from './chunks/reporters.d.
|
|
8
|
-
export { C as CacheKeyIdGenerator, a as CacheKeyIdGeneratorContext, V as VitestPluginContext } from './chunks/plugin.d.
|
|
6
|
+
import { f as ResolvedConfig, d as UserConfig, g as VitestRunMode, h as VitestOptions, V as Vitest, A as ApiConfig, i as TestSpecification, T as TestProject, P as PoolWorker, j as PoolOptions, k as WorkerRequest, l as TestSequencer, L as Logger } from './chunks/reporters.d.7faYdkxy.js';
|
|
7
|
+
export { aP as BaseCoverageOptions, z as BaseReporter, E as BenchmarkBuiltinReporters, B as BenchmarkReporter, r as BenchmarkReportsMap, ai as BenchmarkUserOptions, ak as BrowserBuiltinProvider, al as BrowserCommand, am as BrowserCommandContext, an as BrowserConfigOptions, ao as BrowserInstanceOption, ap as BrowserModuleMocker, aq as BrowserOrchestrator, ar as BrowserProvider, as as BrowserProviderOption, at as BrowserScript, au as BrowserServerFactory, av as BrowserServerOptions, aw as BrowserServerState, ax as BrowserServerStateSession, aE as BuiltinEnvironment, F as BuiltinReporterOptions, K as BuiltinReporters, ay as CDPSession, aF as CSSModuleScopeStrategy, aQ as CoverageIstanbulOptions, aR as CoverageOptions, aS as CoverageProvider, aT as CoverageProviderModule, aU as CoverageReporter, C as CoverageV8Options, aV as CustomProviderOptions, D as DefaultReporter, aG as DepsOptimizationOptions, s as DotReporter, aH as EnvironmentOptions, G as GithubActionsReporter, _ as HTMLOptions, H as HangingProcessReporter, I as InlineConfig, a0 as JUnitOptions, t as JUnitReporter, M as JsonAssertionResult, $ as JsonOptions, J as JsonReporter, N as JsonTestResult, Q as JsonTestResults, a1 as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, az as ParentProjectBrowser, aI as Pool, o as PoolRunnerInitializer, p as PoolTask, aA as ProjectBrowser, aJ as ProjectConfig, aW as ReportContext, X as ReportedHookContext, Y as Reporter, u as ReportersMap, aL as ResolveSnapshotPathHandler, aM as ResolveSnapshotPathHandlerContext, aB as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aK as ResolvedProjectConfig, S as SerializedTestProject, v as TapFlatReporter, w as TapReporter, a2 as TaskOptions, a3 as TestCase, a4 as TestCollection, a5 as TestDiagnostic, a6 as TestModule, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, Z as TestRunEndReason, aX as TestRunResult, ag as TestSequencerConstructor, ah as TestSpecificationOptions, ac as TestState, ad as TestSuite, ae as TestSuiteState, aC as ToMatchScreenshotComparators, aD as ToMatchScreenshotOptions, aN as TypecheckConfig, U as UserWorkspaceConfig, x as VerboseBenchmarkReporter, y as VerboseReporter, aO as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, q as WorkerResponse, aj as _BrowserNames, af as experimental_getRunnerTask } from './chunks/reporters.d.7faYdkxy.js';
|
|
8
|
+
export { C as CacheKeyIdGenerator, a as CacheKeyIdGeneratorContext, V as VitestPluginContext } from './chunks/plugin.d.C9o5bttz.js';
|
|
9
9
|
export { BaseCoverageProvider } from './coverage.js';
|
|
10
10
|
import { Awaitable } from '@vitest/utils';
|
|
11
11
|
export { SerializedError } from '@vitest/utils';
|
|
12
|
-
import { R as RuntimeRPC } from './chunks/rpc.d.
|
|
12
|
+
import { R as RuntimeRPC } from './chunks/rpc.d.CM7x9-sm.js';
|
|
13
13
|
import { Writable } from 'node:stream';
|
|
14
|
-
import { C as ContextRPC } from './chunks/worker.d.
|
|
15
|
-
export { T as TestExecutionType } from './chunks/worker.d.
|
|
14
|
+
import { C as ContextRPC } from './chunks/worker.d.CPzI2ZzJ.js';
|
|
15
|
+
export { T as TestExecutionType } from './chunks/worker.d.CPzI2ZzJ.js';
|
|
16
16
|
import { Debugger } from 'obug';
|
|
17
|
-
import './chunks/global.d.
|
|
17
|
+
import './chunks/global.d.JeWMqlOm.js';
|
|
18
18
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
19
|
-
export { b as RuntimeConfig } from './chunks/config.d.
|
|
19
|
+
export { b as RuntimeConfig } from './chunks/config.d.Cr1Ep39N.js';
|
|
20
20
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
21
|
-
import './chunks/browser.d.
|
|
21
|
+
import './chunks/browser.d.BE4kbYok.js';
|
|
22
22
|
import './chunks/traces.d.402V_yFI.js';
|
|
23
23
|
import '@vitest/pretty-format';
|
|
24
24
|
import '@vitest/snapshot';
|
package/dist/node.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
|
|
3
3
|
export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
4
|
-
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.
|
|
5
|
-
export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, p as createDebugger, d as createMethodsRPC, o as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, n as isFileServingAllowed, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { B as BaseCoverageProvider, b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.ChbI1JU9.js';
|
|
5
|
+
export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, p as createDebugger, d as createMethodsRPC, o as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, n as isFileServingAllowed, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.ChbI1JU9.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.C4jjt2RX.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.tyqbzn4W.js';
|
|
8
|
+
export { B as BaseCoverageProvider, b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.tyqbzn4W.js';
|
|
9
9
|
import { slash, deepClone } from '@vitest/utils/helpers';
|
|
10
10
|
import { a as any } from './chunks/index.D4KonVSU.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
|
12
|
-
import { c as configFiles } from './chunks/constants.
|
|
13
|
-
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.
|
|
12
|
+
import { c as configFiles } from './chunks/constants.B63TT-Bl.js';
|
|
13
|
+
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.B-iBE_Gx.js';
|
|
14
14
|
export { distDir, rootDir } from './path.js';
|
|
15
15
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
16
|
-
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.
|
|
16
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CFulQRmC.js';
|
|
17
17
|
import 'node:fs';
|
|
18
18
|
import './chunks/coverage.D_JHT54q.js';
|
|
19
19
|
import 'node:path';
|
|
20
|
+
import './chunks/index.BCY_7LL2.js';
|
|
21
|
+
import 'node:module';
|
|
22
|
+
import 'node:process';
|
|
23
|
+
import 'node:fs/promises';
|
|
24
|
+
import 'node:url';
|
|
25
|
+
import 'node:assert';
|
|
26
|
+
import 'node:v8';
|
|
27
|
+
import 'node:util';
|
|
20
28
|
import 'node:os';
|
|
21
29
|
import '@vitest/snapshot/manager';
|
|
22
30
|
import 'node:perf_hooks';
|
|
@@ -33,16 +41,14 @@ import 'zlib';
|
|
|
33
41
|
import 'buffer';
|
|
34
42
|
import './chunks/_commonjsHelpers.D26ty3Ew.js';
|
|
35
43
|
import 'node:crypto';
|
|
44
|
+
import './chunks/nativeModuleRunner.BIakptoF.js';
|
|
45
|
+
import 'vite/module-runner';
|
|
36
46
|
import './chunks/traces.CCmnQaNT.js';
|
|
37
47
|
import 'obug';
|
|
38
|
-
import 'node:fs/promises';
|
|
39
48
|
import 'tinyrainbow';
|
|
40
49
|
import '#module-evaluator';
|
|
41
|
-
import 'vite/module-runner';
|
|
42
50
|
import 'node:console';
|
|
43
51
|
import '@vitest/utils/highlight';
|
|
44
|
-
import 'node:module';
|
|
45
|
-
import 'node:url';
|
|
46
52
|
import './chunks/env.D4Lgay0q.js';
|
|
47
53
|
import 'std-env';
|
|
48
54
|
import 'node:tty';
|
|
@@ -58,13 +64,9 @@ import './chunks/defaults.BOqNVLsY.js';
|
|
|
58
64
|
import '@vitest/utils/constants';
|
|
59
65
|
import '@vitest/utils/resolver';
|
|
60
66
|
import 'es-module-lexer';
|
|
61
|
-
import 'node:assert';
|
|
62
67
|
import '@vitest/utils/serialize';
|
|
63
68
|
import '@vitest/utils/source-map';
|
|
64
69
|
import 'node:readline';
|
|
65
|
-
import 'node:util';
|
|
66
|
-
import 'node:process';
|
|
67
|
-
import 'node:v8';
|
|
68
70
|
import 'readline';
|
|
69
71
|
import 'node:stream';
|
|
70
72
|
import '@vitest/utils/display';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isBuiltin } from 'node:module';
|
|
2
|
+
|
|
3
|
+
let port;
|
|
4
|
+
const initialize = async ({ port: _port, time: _time }) => {
|
|
5
|
+
port = _port;
|
|
6
|
+
};
|
|
7
|
+
const NOW_LENGTH = Date.now().toString().length;
|
|
8
|
+
const REGEXP_VITEST = /* @__PURE__ */ new RegExp(`%3Fvitest=\\d{${NOW_LENGTH}}`);
|
|
9
|
+
const REGEXP_MOCK_ACTUAL = /\?mock=actual/;
|
|
10
|
+
const resolve = (specifier, context, defaultResolve) => {
|
|
11
|
+
if (specifier.includes("mock=actual")) {
|
|
12
|
+
// url is already resolved by `importActual`
|
|
13
|
+
const moduleId = specifier.replace(REGEXP_MOCK_ACTUAL, "");
|
|
14
|
+
return {
|
|
15
|
+
url: moduleId,
|
|
16
|
+
format: isBuiltin(moduleId) ? "builtin" : void 0,
|
|
17
|
+
shortCircuit: true
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const isVitest = specifier.includes("%3Fvitest=");
|
|
21
|
+
const result = defaultResolve(isVitest ? specifier.replace(REGEXP_VITEST, "") : specifier, context);
|
|
22
|
+
if (!port || !context?.parentURL) return result;
|
|
23
|
+
if (typeof result === "object" && "then" in result) return result.then((resolved) => {
|
|
24
|
+
ensureModuleGraphEntry(resolved.url, context.parentURL);
|
|
25
|
+
if (isVitest) resolved.url = `${resolved.url}?vitest=${Date.now()}`;
|
|
26
|
+
return resolved;
|
|
27
|
+
});
|
|
28
|
+
if (isVitest) result.url = `${result.url}?vitest=${Date.now()}`;
|
|
29
|
+
ensureModuleGraphEntry(result.url, context.parentURL);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
function ensureModuleGraphEntry(url, parentURL) {
|
|
33
|
+
if (url.includes("/node_modules/")) return;
|
|
34
|
+
port.postMessage({
|
|
35
|
+
event: "register-module-graph-entry",
|
|
36
|
+
url,
|
|
37
|
+
parentURL
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { initialize, resolve };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { z as BaseReporter, E as BenchmarkBuiltinReporters, B as BenchmarkReporter, r as BenchmarkReportsMap, F as BuiltinReporterOptions, K as BuiltinReporters, D as DefaultReporter, s as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, t as JUnitReporter, M as JsonAssertionResult, J as JsonReporter, N as JsonTestResult, Q as JsonTestResults, X as ReportedHookContext, Y as Reporter, u as ReportersMap, v as TapFlatReporter, w as TapReporter, Z as TestRunEndReason, x as VerboseBenchmarkReporter, y as VerboseReporter } from './chunks/reporters.d.
|
|
1
|
+
export { z as BaseReporter, E as BenchmarkBuiltinReporters, B as BenchmarkReporter, r as BenchmarkReportsMap, F as BuiltinReporterOptions, K as BuiltinReporters, D as DefaultReporter, s as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, t as JUnitReporter, M as JsonAssertionResult, J as JsonReporter, N as JsonTestResult, Q as JsonTestResults, X as ReportedHookContext, Y as Reporter, u as ReportersMap, v as TapFlatReporter, w as TapReporter, Z as TestRunEndReason, x as VerboseBenchmarkReporter, y as VerboseReporter } from './chunks/reporters.d.7faYdkxy.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils';
|
|
4
|
-
import './chunks/rpc.d.
|
|
4
|
+
import './chunks/rpc.d.CM7x9-sm.js';
|
|
5
5
|
import '@vitest/snapshot';
|
|
6
6
|
import 'vite/module-runner';
|
|
7
7
|
import './chunks/traces.d.402V_yFI.js';
|
|
8
8
|
import 'node:stream';
|
|
9
9
|
import 'vite';
|
|
10
|
-
import './chunks/browser.d.
|
|
11
|
-
import './chunks/worker.d.
|
|
12
|
-
import './chunks/config.d.
|
|
10
|
+
import './chunks/browser.d.BE4kbYok.js';
|
|
11
|
+
import './chunks/worker.d.CPzI2ZzJ.js';
|
|
12
|
+
import './chunks/config.d.Cr1Ep39N.js';
|
|
13
13
|
import '@vitest/pretty-format';
|
|
14
14
|
import '@vitest/utils/diff';
|
|
15
15
|
import './chunks/environment.d.CrsxCzP1.js';
|
package/dist/reporters.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.B-iBE_Gx.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CFulQRmC.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'pathe';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tinybench from 'tinybench';
|
|
2
2
|
import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, Test, TestContext, ImportDuration, createTaskCollector, getCurrentSuite, getCurrentTest, getHooks, getFn } from '@vitest/runner';
|
|
3
3
|
export { VitestRunner } from '@vitest/runner';
|
|
4
|
-
import { S as SerializedConfig } from './chunks/config.d.
|
|
4
|
+
import { S as SerializedConfig } from './chunks/config.d.Cr1Ep39N.js';
|
|
5
5
|
import { T as Traces } from './chunks/traces.d.402V_yFI.js';
|
|
6
6
|
import { createChainable } from '@vitest/runner/utils';
|
|
7
7
|
import { g as getBenchFn, a as getBenchOptions } from './chunks/suite.d.BJWk38HB.js';
|
|
@@ -30,6 +30,7 @@ declare class TestRunner implements VitestRunner {
|
|
|
30
30
|
pool: string;
|
|
31
31
|
private _otel;
|
|
32
32
|
viteEnvironment: string;
|
|
33
|
+
private viteModuleRunner;
|
|
33
34
|
constructor(config: SerializedConfig);
|
|
34
35
|
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
|
|
35
36
|
onCollectStart(file: File): void;
|
package/dist/runners.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { N as NodeBenchmarkRunner, T as VitestTestRunner } from './chunks/test.
|
|
1
|
+
export { N as NodeBenchmarkRunner, T as VitestTestRunner } from './chunks/test.G82XYNFk.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils/helpers';
|
|
4
4
|
import '@vitest/utils/timers';
|
|
5
|
-
import './chunks/benchmark.
|
|
5
|
+
import './chunks/benchmark.BoqSLF53.js';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
|
-
import './chunks/utils.
|
|
7
|
+
import './chunks/utils.DT4VyRyl.js';
|
|
8
8
|
import '@vitest/expect';
|
|
9
9
|
import '@vitest/utils/error';
|
|
10
10
|
import 'pathe';
|
|
@@ -13,7 +13,7 @@ import '@vitest/spy';
|
|
|
13
13
|
import '@vitest/utils/offset';
|
|
14
14
|
import '@vitest/utils/source-map';
|
|
15
15
|
import './chunks/_commonjsHelpers.D26ty3Ew.js';
|
|
16
|
-
import './chunks/rpc.
|
|
16
|
+
import './chunks/rpc.DcRWTy5G.js';
|
|
17
17
|
import './chunks/index.Chj8NDwU.js';
|
|
18
18
|
|
|
19
19
|
console.warn("Importing from \"vitest/runners\" is deprecated since Vitest 4.1. Please use \"vitest\" instead.");
|
package/dist/runtime.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VitestModuleEvaluator } from './module-evaluator.js';
|
|
2
|
-
import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, a as VitestModuleRunner } from './chunks/
|
|
3
|
-
import { g as getWorkerState } from './chunks/utils.
|
|
2
|
+
import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, a as VitestModuleRunner } from './chunks/startVitestModuleRunner.BK-u7y4N.js';
|
|
3
|
+
import { g as getWorkerState } from './chunks/utils.DT4VyRyl.js';
|
|
4
4
|
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.CyBMJtT7.js';
|
|
5
|
-
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.
|
|
5
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.CrSEwhm4.js';
|
|
6
6
|
import 'node:module';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:vm';
|
|
@@ -14,13 +14,12 @@ import './chunks/modules.BJuCwlRJ.js';
|
|
|
14
14
|
import 'pathe';
|
|
15
15
|
import './path.js';
|
|
16
16
|
import 'node:path';
|
|
17
|
-
import '@vitest/utils/serialize';
|
|
18
17
|
import '@vitest/mocker';
|
|
18
|
+
import '@vitest/mocker/redirect';
|
|
19
19
|
import '@vitest/utils/timers';
|
|
20
20
|
import 'node:console';
|
|
21
21
|
import '@vitest/snapshot/environment';
|
|
22
22
|
|
|
23
|
-
// #region internal
|
|
24
23
|
/**
|
|
25
24
|
* @internal
|
|
26
25
|
*/
|
package/dist/snapshot.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.
|
|
1
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.CrSEwhm4.js';
|
|
2
2
|
import '@vitest/snapshot/environment';
|
|
3
|
-
import './chunks/utils.
|
|
3
|
+
import './chunks/utils.DT4VyRyl.js';
|
|
4
4
|
import '@vitest/utils/timers';
|
|
5
5
|
|
|
6
6
|
console.warn("Importing from \"vitest/snapshot\" is deprecated since Vitest 4.1. Please use \"vitest/runtime\" instead.");
|