vitest 4.0.0-beta.9 → 4.0.1
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 +86 -102
- package/browser/context.d.ts +7 -0
- package/browser/context.js +20 -0
- package/dist/browser.d.ts +24 -7
- package/dist/browser.js +15 -5
- package/dist/chunks/{base.CA5N8Af0.js → base.BYPMk0VN.js} +36 -36
- package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.DHKMYAts.js} +2 -2
- package/dist/chunks/{browser.d.DtfyY9yS.d.ts → browser.d.B9iJzZyn.d.ts} +3 -3
- package/dist/chunks/{cac.Dt7e1TIu.js → cac.DrF4Gm0S.js} +47 -73
- package/dist/chunks/{cli-api.eAzsLIxz.js → cli-api.W2Q-JQoO.js} +1524 -296
- package/dist/chunks/{config.d.DacWrqWe.d.ts → config.d.u2CUDWwS.d.ts} +5 -19
- package/dist/chunks/{console.7h5kHUIf.js → console.CTJL2nuH.js} +4 -6
- package/dist/chunks/{coverage.CDRAMTt7.js → coverage.FU3w4IrQ.js} +125 -1108
- package/dist/chunks/{creator.KEg6n5IC.js → creator.DucAaYBz.js} +10 -37
- package/dist/chunks/{defaults.CXFFjsi8.js → defaults.BOqNVLsY.js} +0 -1
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/{global.d.K6uBQHzY.d.ts → global.d.BgJSTpgQ.d.ts} +2 -17
- package/dist/chunks/{globals.CJrTTbxC.js → globals.BGT_RUsD.js} +11 -7
- package/dist/chunks/{index.BjKEiSn0.js → index.BdSLhLDZ.js} +3 -3
- package/dist/chunks/{index.DfviD7lX.js → index.CbWINfS7.js} +49 -21
- package/dist/chunks/{index.BIP7prJq.js → index.CcRZ6fUh.js} +1493 -114
- package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
- package/dist/chunks/{index.C832ioot.js → index.RwjEGCQ0.js} +4 -4
- package/dist/chunks/init-forks.WglB-sfY.js +54 -0
- package/dist/chunks/init-threads.Czek6eA5.js +17 -0
- package/dist/chunks/init.94FWN9pW.js +213 -0
- package/dist/chunks/{inspector.CvQD-Nie.js → inspector.DLZxSeU3.js} +2 -6
- package/dist/chunks/{moduleRunner.d.DxTLreRD.d.ts → moduleRunner.d.YtNsMIoJ.d.ts} +9 -14
- package/dist/chunks/{node.CyipiPvJ.js → node.BwAWWjHZ.js} +3 -4
- package/dist/chunks/{plugin.d.CIk0YiKb.d.ts → plugin.d.DQU1R5px.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DmP-iHLr.d.ts → reporters.d.BMKt7f6I.d.ts} +1064 -1021
- package/dist/chunks/{resolveSnapshotEnvironment.Bvv2zr69.js → resolveSnapshotEnvironment.DJJKMKxb.js} +7 -8
- package/dist/chunks/{rpc.BKr6mtxz.js → rpc.cD77ENhU.js} +13 -14
- package/dist/chunks/{setup-common.B7I37Tji.js → setup-common.DR1sucx6.js} +6 -6
- package/dist/chunks/{startModuleRunner.BDRvKSdz.js → startModuleRunner.iF1E9Bt4.js} +126 -110
- package/dist/chunks/{test.BAlBebnP.js → test.C3RPt8JR.js} +7 -7
- package/dist/chunks/{utils.D2R2NiOH.js → utils.CG9h5ccR.js} +2 -5
- package/dist/chunks/{vi.BB37KeLx.js → vi.BZvkKVkM.js} +61 -164
- package/dist/chunks/{vm.CjLTDaST.js → vm.CuMWYx_F.js} +20 -29
- package/dist/chunks/{worker.d.B2r4Ln6p.d.ts → worker.d.BFk-vvBU.d.ts} +42 -6
- package/dist/cli.js +12 -11
- package/dist/config.cjs +0 -1
- package/dist/config.d.ts +11 -13
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +7 -6
- package/dist/coverage.js +3 -14
- package/dist/environments.d.ts +3 -6
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +20 -25
- package/dist/index.js +11 -7
- package/dist/module-evaluator.d.ts +5 -4
- package/dist/module-evaluator.js +11 -13
- package/dist/module-runner.js +5 -5
- package/dist/node.d.ts +82 -25
- package/dist/node.js +23 -20
- package/dist/reporters.d.ts +10 -9
- package/dist/reporters.js +12 -11
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +9 -7
- package/dist/snapshot.js +3 -3
- package/dist/suite.js +4 -3
- package/dist/worker.d.ts +26 -0
- package/dist/worker.js +45 -165
- package/dist/workers/forks.js +26 -43
- package/dist/workers/runVmTests.js +16 -12
- package/dist/workers/threads.js +26 -31
- package/dist/workers/vmForks.js +26 -39
- package/dist/workers/vmThreads.js +26 -29
- package/package.json +48 -32
- package/worker.d.ts +1 -0
- package/browser.d.ts +0 -1
- package/dist/chunks/environment.d.2fYMoz3o.d.ts +0 -66
- package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
- package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
- package/dist/chunks/typechecker.DB-fIMaH.js +0 -805
- package/dist/chunks/utils.C2YI6McM.js +0 -52
- package/dist/chunks/worker.d.DJ6qxO2w.d.ts +0 -8
- package/dist/workers.d.ts +0 -38
- package/dist/workers.js +0 -49
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
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, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.
|
|
4
|
-
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f 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.
|
|
3
|
+
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.BMKt7f6I.js';
|
|
4
|
+
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.BMKt7f6I.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.DQU1R5px.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.u2CUDWwS.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
8
|
import '@vitest/utils';
|
|
9
|
-
import './chunks/
|
|
9
|
+
import './chunks/worker.d.BFk-vvBU.js';
|
|
10
|
+
import 'vite/module-runner';
|
|
11
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
12
|
+
import '@vitest/snapshot';
|
|
10
13
|
import 'node:stream';
|
|
11
14
|
import '@vitest/mocker';
|
|
12
15
|
import '@vitest/utils/source-map';
|
|
13
|
-
import '
|
|
14
|
-
import './chunks/
|
|
15
|
-
import 'vite/module-runner';
|
|
16
|
-
import '@vitest/snapshot';
|
|
16
|
+
import 'vitest/browser';
|
|
17
|
+
import './chunks/browser.d.B9iJzZyn.js';
|
|
17
18
|
import '@vitest/pretty-format';
|
|
18
19
|
import '@vitest/utils/diff';
|
|
19
20
|
import '@vitest/expect';
|
|
@@ -26,8 +27,6 @@ import '@vitest/snapshot/manager';
|
|
|
26
27
|
import 'node:fs';
|
|
27
28
|
import 'node:console';
|
|
28
29
|
|
|
29
|
-
/* eslint-disable unused-imports/no-unused-vars */
|
|
30
|
-
|
|
31
30
|
type VitestInlineConfig = InlineConfig;
|
|
32
31
|
declare module "vite" {
|
|
33
32
|
interface UserConfig {
|
|
@@ -45,7 +44,6 @@ declare const defaultBrowserPort = 63315;
|
|
|
45
44
|
|
|
46
45
|
declare const defaultInclude: string[];
|
|
47
46
|
declare const defaultExclude: string[];
|
|
48
|
-
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
49
47
|
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
50
48
|
declare const configDefaults: Readonly<{
|
|
51
49
|
allowOnly: boolean;
|
|
@@ -53,7 +51,6 @@ declare const configDefaults: Readonly<{
|
|
|
53
51
|
watch: boolean;
|
|
54
52
|
globals: boolean;
|
|
55
53
|
environment: "node";
|
|
56
|
-
pool: "forks";
|
|
57
54
|
clearMocks: boolean;
|
|
58
55
|
restoreMocks: boolean;
|
|
59
56
|
mockReset: boolean;
|
|
@@ -94,6 +91,7 @@ type ViteUserConfigExport = UserConfig | Promise<UserConfig> | ViteUserConfigFnO
|
|
|
94
91
|
declare function defineConfig(config: UserConfig): UserConfig;
|
|
95
92
|
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
96
93
|
declare function defineConfig(config: ViteUserConfigFnObject): ViteUserConfigFnObject;
|
|
94
|
+
declare function defineConfig(config: ViteUserConfigFnPromise): ViteUserConfigFnPromise;
|
|
97
95
|
declare function defineConfig(config: ViteUserConfigExport): ViteUserConfigExport;
|
|
98
96
|
declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
|
|
99
97
|
declare function defineProject(config: Promise<UserWorkspaceConfig>): Promise<UserWorkspaceConfig>;
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.
|
|
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
3
|
export { d as defaultBrowserPort } from './chunks/constants.D_Q9UYh-.js';
|
|
4
4
|
import 'node:os';
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.BMKt7f6I.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
|
-
import { A as AfterSuiteRunMeta } from './chunks/
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/worker.d.BFk-vvBU.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
7
7
|
import '@vitest/mocker';
|
|
8
8
|
import '@vitest/utils/source-map';
|
|
9
|
-
import '
|
|
10
|
-
import './chunks/
|
|
11
|
-
import 'vite/module-runner';
|
|
12
|
-
import './chunks/config.d.DacWrqWe.js';
|
|
9
|
+
import 'vitest/browser';
|
|
10
|
+
import './chunks/config.d.u2CUDWwS.js';
|
|
13
11
|
import '@vitest/pretty-format';
|
|
14
12
|
import '@vitest/snapshot';
|
|
15
13
|
import '@vitest/utils/diff';
|
|
14
|
+
import './chunks/browser.d.B9iJzZyn.js';
|
|
16
15
|
import '@vitest/expect';
|
|
17
16
|
import 'vitest/optional-types.js';
|
|
18
17
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
@@ -22,6 +21,8 @@ import './chunks/coverage.d.BZtK59WP.js';
|
|
|
22
21
|
import '@vitest/snapshot/manager';
|
|
23
22
|
import 'node:fs';
|
|
24
23
|
import 'node:console';
|
|
24
|
+
import 'vite/module-runner';
|
|
25
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
25
26
|
|
|
26
27
|
type Threshold = "lines" | "functions" | "statements" | "branches";
|
|
27
28
|
interface ResolvedThreshold {
|
package/dist/coverage.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.FU3w4IrQ.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:path';
|
|
4
|
-
import '@vitest/utils';
|
|
4
|
+
import '@vitest/utils/helpers';
|
|
5
5
|
import 'pathe';
|
|
6
6
|
import 'picomatch';
|
|
7
7
|
import 'tinyglobby';
|
|
8
8
|
import 'tinyrainbow';
|
|
9
|
-
import './chunks/defaults.
|
|
9
|
+
import './chunks/defaults.BOqNVLsY.js';
|
|
10
10
|
import 'node:os';
|
|
11
11
|
import './chunks/env.D4Lgay0q.js';
|
|
12
12
|
import 'std-env';
|
|
@@ -20,15 +20,4 @@ import 'node:v8';
|
|
|
20
20
|
import 'node:util';
|
|
21
21
|
import 'vite';
|
|
22
22
|
import './chunks/constants.D_Q9UYh-.js';
|
|
23
|
-
import 'node:tty';
|
|
24
|
-
import 'node:events';
|
|
25
|
-
import './chunks/index.Bgo3tNWt.js';
|
|
26
|
-
import 'tinypool';
|
|
27
|
-
import './chunks/typechecker.DB-fIMaH.js';
|
|
28
|
-
import 'node:perf_hooks';
|
|
29
|
-
import '@vitest/utils/source-map';
|
|
30
|
-
import 'tinyexec';
|
|
31
|
-
import './path.js';
|
|
32
|
-
import '@vitest/runner/utils';
|
|
33
|
-
import 'node:worker_threads';
|
|
34
23
|
import './chunks/coverage.D_JHT54q.js';
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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.CrsxCzP1.js';
|
|
2
|
+
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.CrsxCzP1.js';
|
|
3
|
+
import '@vitest/utils';
|
|
3
4
|
|
|
4
5
|
declare const environments: {
|
|
5
6
|
"node": Environment;
|
|
@@ -9,10 +10,6 @@ declare const environments: {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
interface PopulateOptions {
|
|
12
|
-
// we bind functions such as addEventListener and others
|
|
13
|
-
// because they rely on `this` in happy-dom, and in jsdom it
|
|
14
|
-
// has a priority for getting implementation from symbols
|
|
15
|
-
// (global doesn't have these symbols, but window - does)
|
|
16
13
|
bindFunctions?: boolean;
|
|
17
14
|
additionalKeys?: string[];
|
|
18
15
|
}
|
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.CbWINfS7.js';
|
|
2
2
|
import 'node:console';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { S as SerializedTestSpecification } from './chunks/browser.d.
|
|
2
|
-
export { B as BrowserTesterOptions } from './chunks/browser.d.
|
|
3
|
-
import './chunks/global.d.
|
|
1
|
+
import { S as SerializedTestSpecification } from './chunks/browser.d.B9iJzZyn.js';
|
|
2
|
+
export { B as BrowserTesterOptions } from './chunks/browser.d.B9iJzZyn.js';
|
|
3
|
+
import './chunks/global.d.BgJSTpgQ.js';
|
|
4
4
|
import { File, TestAnnotation, TaskResultPack, TaskEventPack, TaskPopulated } from '@vitest/runner';
|
|
5
|
-
export { CancelReason,
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
import {
|
|
9
|
-
export { b as
|
|
10
|
-
import {
|
|
11
|
-
export {
|
|
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, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
|
+
import { Awaitable } from '@vitest/utils';
|
|
7
|
+
export { ParsedStack, SerializedError, TestError } from '@vitest/utils';
|
|
8
|
+
import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, a as BirpcReturn, P as ProvidedContext } from './chunks/worker.d.BFk-vvBU.js';
|
|
9
|
+
export { A as AfterSuiteRunMeta, C as ContextRPC, c as ContextTestEnvironment, b as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.BFk-vvBU.js';
|
|
10
|
+
import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.u2CUDWwS.js';
|
|
11
|
+
export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.d.u2CUDWwS.js';
|
|
12
12
|
import { ExpectStatic } from '@vitest/expect';
|
|
13
13
|
export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers, chai } from '@vitest/expect';
|
|
14
14
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
15
15
|
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
|
|
16
16
|
import { M as MockFactoryWithHelper, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
|
|
17
17
|
export { b as bench } from './chunks/suite.d.BJWk38HB.js';
|
|
18
|
+
import { EvaluatedModules } from 'vite/module-runner';
|
|
18
19
|
export { a as BenchFunction, b as Benchmark, c as BenchmarkAPI, B as BenchmarkResult } from './chunks/benchmark.d.DAaHLpsq.js';
|
|
19
20
|
export { ExpectTypeOf, expectTypeOf } from 'expect-type';
|
|
20
21
|
export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
|
|
21
|
-
export { ParsedStack, SerializedError, TestError } from '@vitest/utils';
|
|
22
22
|
export { DiffOptions } from '@vitest/utils/diff';
|
|
23
|
-
export { EvaluatedModules } from 'vite/module-runner';
|
|
24
23
|
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
|
|
25
24
|
import '@vitest/pretty-format';
|
|
25
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
26
26
|
import '@vitest/mocker';
|
|
27
27
|
import '@vitest/runner/utils';
|
|
28
28
|
|
|
@@ -88,7 +88,6 @@ declare const should: () => Chai.Should;
|
|
|
88
88
|
*/
|
|
89
89
|
declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];
|
|
90
90
|
|
|
91
|
-
// The waitFor function was inspired by https://github.com/testing-library/web-testing-library/pull/2
|
|
92
91
|
type WaitForCallback<T> = () => T | Promise<T>;
|
|
93
92
|
interface WaitForOptions {
|
|
94
93
|
/**
|
|
@@ -277,13 +276,11 @@ interface VitestUtils {
|
|
|
277
276
|
* The call to `vi.mock` is hoisted to the top of the file, so you don't have access to variables declared in the global file scope
|
|
278
277
|
* unless they are defined with [`vi.hoisted`](https://vitest.dev/api/vi#vi-hoisted) before this call.
|
|
279
278
|
*
|
|
280
|
-
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking
|
|
279
|
+
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
|
|
281
280
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
282
281
|
* @param factory Mocked module factory. The result of this function will be an exports object
|
|
283
282
|
*/
|
|
284
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
285
283
|
mock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
|
|
286
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
287
284
|
mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
|
|
288
285
|
/**
|
|
289
286
|
* Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
|
|
@@ -291,22 +288,18 @@ interface VitestUtils {
|
|
|
291
288
|
* This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
|
|
292
289
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
293
290
|
*/
|
|
294
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
295
291
|
unmock(path: string): void;
|
|
296
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
297
292
|
unmock(module: Promise<unknown>): void;
|
|
298
293
|
/**
|
|
299
294
|
* Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
|
|
300
295
|
*
|
|
301
296
|
* Unlike [`vi.mock`](https://vitest.dev/api/vi#vi-mock), this method will not mock statically imported modules because it is not hoisted to the top of the file.
|
|
302
297
|
*
|
|
303
|
-
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking
|
|
298
|
+
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
|
|
304
299
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
305
300
|
* @param factory Mocked module factory. The result of this function will be an exports object
|
|
306
301
|
*/
|
|
307
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
308
302
|
doMock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
|
|
309
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
310
303
|
doMock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
|
|
311
304
|
/**
|
|
312
305
|
* Removes module from mocked registry. All subsequent calls to import will return original module.
|
|
@@ -314,9 +307,7 @@ interface VitestUtils {
|
|
|
314
307
|
* Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
|
|
315
308
|
* @param path Path to the module. Can be aliased, if your Vitest config supports it
|
|
316
309
|
*/
|
|
317
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
318
310
|
doUnmock(path: string): void;
|
|
319
|
-
// eslint-disable-next-line ts/method-signature-style
|
|
320
311
|
doUnmock(module: Promise<unknown>): void;
|
|
321
312
|
/**
|
|
322
313
|
* Imports module, bypassing all checks if it should be mocked.
|
|
@@ -335,7 +326,7 @@ interface VitestUtils {
|
|
|
335
326
|
/**
|
|
336
327
|
* Imports a module with all of its properties and nested properties mocked.
|
|
337
328
|
*
|
|
338
|
-
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking
|
|
329
|
+
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
|
|
339
330
|
* @example
|
|
340
331
|
* ```ts
|
|
341
332
|
* const example = await vi.importMock<typeof import('./example.js')>('./example.js')
|
|
@@ -485,6 +476,10 @@ interface VitestUtils {
|
|
|
485
476
|
declare const vitest: VitestUtils;
|
|
486
477
|
declare const vi: VitestUtils;
|
|
487
478
|
|
|
479
|
+
declare class VitestEvaluatedModules extends EvaluatedModules {
|
|
480
|
+
getModuleSourceMapById(id: string): any;
|
|
481
|
+
}
|
|
482
|
+
|
|
488
483
|
interface AssertType {
|
|
489
484
|
<T>(value: T): void;
|
|
490
485
|
}
|
|
@@ -495,5 +490,5 @@ interface BrowserUI {
|
|
|
495
490
|
setIframeViewport: (width: number, height: number) => Promise<void>;
|
|
496
491
|
}
|
|
497
492
|
|
|
498
|
-
export { LabelColor, ModuleGraphData, ProvidedContext, SerializedConfig, SerializedTestSpecification, UserConsoleLog, assert, assertType, createExpect, globalExpect as expect, inject, should, vi, vitest };
|
|
493
|
+
export { VitestEvaluatedModules as EvaluatedModules, LabelColor, ModuleGraphData, ProvidedContext, SerializedConfig, SerializedTestSpecification, UserConsoleLog, assert, assertType, createExpect, globalExpect as expect, inject, should, vi, vitest };
|
|
499
494
|
export type { AssertType, BrowserUI, TransformResultWithSource, VitestUtils, WebSocketEvents, WebSocketHandlers, WebSocketRPC };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
3
|
-
export {
|
|
1
|
+
export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.BZvkKVkM.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.DHKMYAts.js';
|
|
3
|
+
export { V as EvaluatedModules } from './chunks/evaluatedModules.Dg1zASAC.js';
|
|
4
|
+
export { a as assertType } from './chunks/index.RwjEGCQ0.js';
|
|
4
5
|
export { expectTypeOf } from 'expect-type';
|
|
5
6
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
|
-
export { EvaluatedModules } from 'vite/module-runner';
|
|
7
7
|
export { chai } from '@vitest/expect';
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
|
-
import './chunks/utils.
|
|
10
|
-
import '@vitest/utils';
|
|
11
|
-
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
9
|
+
import './chunks/utils.CG9h5ccR.js';
|
|
10
|
+
import '@vitest/utils/timers';
|
|
12
11
|
import '@vitest/snapshot';
|
|
13
12
|
import '@vitest/utils/error';
|
|
13
|
+
import '@vitest/utils/helpers';
|
|
14
14
|
import '@vitest/spy';
|
|
15
|
+
import '@vitest/utils/offset';
|
|
15
16
|
import '@vitest/utils/source-map';
|
|
17
|
+
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
16
18
|
import './chunks/date.-jtEtIeV.js';
|
|
19
|
+
import 'pathe';
|
|
20
|
+
import 'vite/module-runner';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import 'vite/module-runner';
|
|
2
|
-
export { b as VitestModuleEvaluator, a as VitestModuleEvaluatorOptions, c as createImportMetaEnvProxy, g as getDefaultRequestStubs, i as isPrimitive, u as unwrapId, w as wrapId } from './chunks/moduleRunner.d.
|
|
2
|
+
export { b as VitestModuleEvaluator, a as VitestModuleEvaluatorOptions, c as createImportMetaEnvProxy, g as getDefaultRequestStubs, i as isPrimitive, u as unwrapId, w as wrapId } from './chunks/moduleRunner.d.YtNsMIoJ.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
|
-
import './chunks/worker.d.
|
|
5
|
+
import './chunks/worker.d.BFk-vvBU.js';
|
|
6
6
|
import '@vitest/runner';
|
|
7
|
-
import './chunks/config.d.
|
|
7
|
+
import './chunks/config.d.u2CUDWwS.js';
|
|
8
8
|
import '@vitest/pretty-format';
|
|
9
9
|
import '@vitest/snapshot';
|
|
10
10
|
import '@vitest/utils/diff';
|
|
11
|
-
import './chunks/environment.d.
|
|
11
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
12
|
+
import '@vitest/utils';
|
|
12
13
|
import '@vitest/mocker';
|
|
13
14
|
import './chunks/mocker.d.BE_2ls6u.js';
|
package/dist/module-evaluator.js
CHANGED
|
@@ -58,7 +58,8 @@ class VitestModuleEvaluator {
|
|
|
58
58
|
if (id in this.stubs) return this.stubs[id];
|
|
59
59
|
const file = this.convertIdToImportUrl(id), namespace = this.vm ? await this.vm.externalModulesExecutor.import(file) : await import(file);
|
|
60
60
|
if (!this.shouldInterop(file, namespace)) return namespace;
|
|
61
|
-
const { mod, defaultExport } = interopModule(namespace), { Proxy, Reflect } = this.primitives
|
|
61
|
+
const { mod, defaultExport } = interopModule(namespace), { Proxy, Reflect } = this.primitives;
|
|
62
|
+
return new Proxy(mod, {
|
|
62
63
|
get(mod, prop) {
|
|
63
64
|
return prop === "default" ? defaultExport : mod[prop] ?? defaultExport?.[prop];
|
|
64
65
|
},
|
|
@@ -75,7 +76,6 @@ class VitestModuleEvaluator {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
|
-
return proxy;
|
|
79
79
|
}
|
|
80
80
|
async runInlinedModule(context, code, module) {
|
|
81
81
|
context.__vite_ssr_import_meta__.env = this.env;
|
|
@@ -107,8 +107,8 @@ class VitestModuleEvaluator {
|
|
|
107
107
|
get exports() {
|
|
108
108
|
return cjsExports;
|
|
109
109
|
}
|
|
110
|
-
}, meta = context[ssrImportMetaKey]
|
|
111
|
-
if (
|
|
110
|
+
}, meta = context[ssrImportMetaKey];
|
|
111
|
+
if (this.options.getCurrentTestFilepath?.() === module.file) {
|
|
112
112
|
const globalNamespace = this.vm?.context || globalThis;
|
|
113
113
|
Object.defineProperty(meta, "vitest", { get: () => globalNamespace.__vitest_index__ });
|
|
114
114
|
}
|
|
@@ -133,14 +133,13 @@ class VitestModuleEvaluator {
|
|
|
133
133
|
columnOffset: -codeDefinition.length
|
|
134
134
|
}, finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
135
135
|
try {
|
|
136
|
-
|
|
137
|
-
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
138
|
-
};
|
|
139
|
-
await initModule(
|
|
136
|
+
await (this.vm ? vm.runInContext(wrappedCode, this.vm.context, options) : vm.runInThisContext(wrappedCode, options))(
|
|
140
137
|
context[ssrModuleExportsKey],
|
|
141
138
|
context[ssrImportMetaKey],
|
|
142
139
|
context[ssrImportKey],
|
|
143
|
-
|
|
140
|
+
async (dep, options) => {
|
|
141
|
+
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
142
|
+
},
|
|
144
143
|
context[ssrExportAllKey],
|
|
145
144
|
// vite 7 support, remove when vite 7+ is supported
|
|
146
145
|
context.__vite_ssr_exportName__ || ((name, getter) => Object.defineProperty(exportsObject, name, {
|
|
@@ -162,7 +161,7 @@ class VitestModuleEvaluator {
|
|
|
162
161
|
}
|
|
163
162
|
}
|
|
164
163
|
createRequire(filename) {
|
|
165
|
-
return filename
|
|
164
|
+
return filename[0] === "\0" || !isAbsolute(filename) ? () => ({}) : this.vm ? this.vm.externalModulesExecutor.createRequire(filename) : createRequire(filename);
|
|
166
165
|
}
|
|
167
166
|
shouldInterop(path, mod) {
|
|
168
167
|
// never interop ESM modules
|
|
@@ -179,7 +178,7 @@ function createImportMetaEnvProxy() {
|
|
|
179
178
|
];
|
|
180
179
|
return new Proxy(process.env, {
|
|
181
180
|
get(_, key) {
|
|
182
|
-
|
|
181
|
+
if (typeof key === "string") return booleanKeys.includes(key) ? !!process.env[key] : process.env[key];
|
|
183
182
|
},
|
|
184
183
|
set(_, key, value) {
|
|
185
184
|
if (typeof key !== "string") return true;
|
|
@@ -248,8 +247,7 @@ function defineExport(exports, key, value) {
|
|
|
248
247
|
});
|
|
249
248
|
}
|
|
250
249
|
function isPrimitive(v) {
|
|
251
|
-
|
|
252
|
-
return !isObject || v == null;
|
|
250
|
+
return !(typeof v === "object" || typeof v === "function") || v == null;
|
|
253
251
|
}
|
|
254
252
|
function interopModule(mod) {
|
|
255
253
|
if (isPrimitive(mod)) return {
|
package/dist/module-runner.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { VitestModuleEvaluator } from './module-evaluator.js';
|
|
2
|
-
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.
|
|
3
|
-
export { g as getWorkerState } from './chunks/utils.
|
|
2
|
+
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.iF1E9Bt4.js';
|
|
3
|
+
export { g as getWorkerState } from './chunks/utils.CG9h5ccR.js';
|
|
4
4
|
import 'node:module';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'pathe';
|
|
8
8
|
import 'vite/module-runner';
|
|
9
9
|
import 'node:fs';
|
|
10
|
-
import '@vitest/utils';
|
|
10
|
+
import '@vitest/utils/helpers';
|
|
11
11
|
import './path.js';
|
|
12
12
|
import 'node:path';
|
|
13
|
-
import '@vitest/utils/
|
|
13
|
+
import '@vitest/utils/serialize';
|
|
14
14
|
import '@vitest/mocker';
|
|
15
|
-
import '
|
|
15
|
+
import '@vitest/utils/timers';
|
package/dist/node.d.ts
CHANGED
|
@@ -3,24 +3,23 @@ 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, k as TestSpecification, T as TestProject, P as
|
|
7
|
-
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 PoolWorker, l as PoolOptions, m as WorkerRequest, n as TestSequencer, L as Logger } from './chunks/reporters.d.BMKt7f6I.js';
|
|
7
|
+
export { at as BaseCoverageOptions, Y as BenchmarkUserOptions, Z as BrowserBuiltinProvider, $ as BrowserCommand, a0 as BrowserCommandContext, a1 as BrowserConfigOptions, a2 as BrowserInstanceOption, a3 as BrowserModuleMocker, a4 as BrowserOrchestrator, a5 as BrowserProvider, a6 as BrowserProviderOption, a7 as BrowserScript, a8 as BrowserServerFactory, a9 as BrowserServerOptions, aa as BrowserServerState, ab as BrowserServerStateSession, ai as BuiltinEnvironment, ac as CDPSession, aj as CSSModuleScopeStrategy, au as CoverageIstanbulOptions, av as CoverageOptions, aw as CoverageProvider, ax as CoverageProviderModule, ay as CoverageReporter, c as CoverageV8Options, az as CustomProviderOptions, ak as DepsOptimizationOptions, al as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, t as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, o as OnTestsRerunHandler, ad as ParentProjectBrowser, am as Pool, q as PoolRunnerInitializer, r as PoolTask, ae as ProjectBrowser, an as ProjectConfig, b as ReportContext, aB as ReportedHookContext, aC as Reporter, ap as ResolveSnapshotPathHandler, aq as ResolveSnapshotPathHandlerContext, af as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ao as ResolvedProjectConfig, S as SerializedTestProject, u as TaskOptions, v as TestCase, w as TestCollection, x as TestDiagnostic, y as TestModule, z as TestModuleState, B as TestResult, D as TestResultFailed, E as TestResultPassed, F as TestResultSkipped, aD as TestRunEndReason, aA as TestRunResult, X as TestSequencerConstructor, G as TestState, K as TestSuite, N as TestSuiteState, ag as ToMatchScreenshotComparators, ah as ToMatchScreenshotOptions, ar as TypecheckConfig, U as UserWorkspaceConfig, as as VitestEnvironment, p as VitestPackageInstaller, W as WatcherTriggerPattern, s as WorkerResponse, _ as _BrowserNames, Q as experimental_getRunnerTask } from './chunks/reporters.d.BMKt7f6I.js';
|
|
8
8
|
import { Awaitable } from '@vitest/utils';
|
|
9
9
|
export { SerializedError } from '@vitest/utils';
|
|
10
|
-
import { R as RuntimeRPC } from './chunks/worker.d.
|
|
11
|
-
export { T as TestExecutionType } from './chunks/worker.d.
|
|
10
|
+
import { R as RuntimeRPC, C as ContextRPC } from './chunks/worker.d.BFk-vvBU.js';
|
|
11
|
+
export { T as TestExecutionType } from './chunks/worker.d.BFk-vvBU.js';
|
|
12
12
|
import { Writable } from 'node:stream';
|
|
13
|
-
export { V as VitestPluginContext } from './chunks/plugin.d.
|
|
14
|
-
export { W as WorkerContext } from './chunks/worker.d.DJ6qxO2w.js';
|
|
13
|
+
export { V as VitestPluginContext } from './chunks/plugin.d.DQU1R5px.js';
|
|
15
14
|
import { Debugger } from 'debug';
|
|
16
|
-
import './chunks/global.d.
|
|
15
|
+
import './chunks/global.d.BgJSTpgQ.js';
|
|
17
16
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
18
|
-
export { b as RuntimeConfig } from './chunks/config.d.
|
|
17
|
+
export { b as RuntimeConfig } from './chunks/config.d.u2CUDWwS.js';
|
|
19
18
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
20
|
-
import './chunks/environment.d.2fYMoz3o.js';
|
|
21
19
|
import '@vitest/mocker';
|
|
22
20
|
import '@vitest/utils/source-map';
|
|
23
|
-
import '
|
|
21
|
+
import 'vitest/browser';
|
|
22
|
+
import './chunks/browser.d.B9iJzZyn.js';
|
|
24
23
|
import '@vitest/pretty-format';
|
|
25
24
|
import '@vitest/snapshot';
|
|
26
25
|
import '@vitest/utils/diff';
|
|
@@ -33,7 +32,7 @@ import '@vitest/snapshot/manager';
|
|
|
33
32
|
import 'node:fs';
|
|
34
33
|
import 'node:console';
|
|
35
34
|
import 'vite/module-runner';
|
|
36
|
-
import '
|
|
35
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
37
36
|
|
|
38
37
|
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
39
38
|
interface TscErrorInfo {
|
|
@@ -120,7 +119,6 @@ declare class GitNotFoundError extends Error {
|
|
|
120
119
|
|
|
121
120
|
declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
|
|
122
121
|
|
|
123
|
-
// this is only exported as a public function and not used inside vitest
|
|
124
122
|
declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
|
|
125
123
|
vitestConfig: ResolvedConfig;
|
|
126
124
|
viteConfig: ResolvedConfig$1;
|
|
@@ -128,39 +126,99 @@ declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$
|
|
|
128
126
|
|
|
129
127
|
declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
|
|
130
128
|
|
|
131
|
-
type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) =>
|
|
129
|
+
type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) => Promise<void>;
|
|
132
130
|
interface ProcessPool {
|
|
133
131
|
name: string;
|
|
134
132
|
runTests: RunWithFiles;
|
|
135
133
|
collectTests: RunWithFiles;
|
|
136
134
|
close?: () => Awaitable<void>;
|
|
137
135
|
}
|
|
138
|
-
declare function getFilePoolName(project: TestProject):
|
|
136
|
+
declare function getFilePoolName(project: TestProject): ResolvedConfig["pool"];
|
|
139
137
|
|
|
140
138
|
interface MethodsOptions {
|
|
141
139
|
cacheFs?: boolean;
|
|
142
|
-
// do not report files
|
|
143
140
|
collect?: boolean;
|
|
144
141
|
}
|
|
145
142
|
declare function createMethodsRPC(project: TestProject, options?: MethodsOptions): RuntimeRPC;
|
|
146
143
|
|
|
144
|
+
/** @experimental */
|
|
145
|
+
declare class ForksPoolWorker implements PoolWorker {
|
|
146
|
+
readonly name: string;
|
|
147
|
+
readonly cacheFs: boolean;
|
|
148
|
+
protected readonly entrypoint: string;
|
|
149
|
+
protected execArgv: string[];
|
|
150
|
+
protected env: Partial<NodeJS.ProcessEnv>;
|
|
151
|
+
private _fork?;
|
|
152
|
+
constructor(options: PoolOptions);
|
|
153
|
+
on(event: string, callback: (arg: any) => void): void;
|
|
154
|
+
off(event: string, callback: (arg: any) => void): void;
|
|
155
|
+
send(message: WorkerRequest): void;
|
|
156
|
+
start(): Promise<void>;
|
|
157
|
+
stop(): Promise<void>;
|
|
158
|
+
deserialize(data: unknown): unknown;
|
|
159
|
+
private get fork();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** @experimental */
|
|
163
|
+
declare class ThreadsPoolWorker implements PoolWorker {
|
|
164
|
+
readonly name: string;
|
|
165
|
+
protected readonly entrypoint: string;
|
|
166
|
+
protected execArgv: string[];
|
|
167
|
+
protected env: Partial<NodeJS.ProcessEnv>;
|
|
168
|
+
private _thread?;
|
|
169
|
+
constructor(options: PoolOptions);
|
|
170
|
+
on(event: string, callback: (arg: any) => void): void;
|
|
171
|
+
off(event: string, callback: (arg: any) => void): void;
|
|
172
|
+
send(message: WorkerRequest): void;
|
|
173
|
+
start(): Promise<void>;
|
|
174
|
+
stop(): Promise<void>;
|
|
175
|
+
deserialize(data: unknown): unknown;
|
|
176
|
+
private get thread();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** @experimental */
|
|
180
|
+
declare class TypecheckPoolWorker implements PoolWorker {
|
|
181
|
+
readonly name: string;
|
|
182
|
+
private readonly project;
|
|
183
|
+
private _eventEmitter;
|
|
184
|
+
constructor(options: PoolOptions);
|
|
185
|
+
start(): Promise<void>;
|
|
186
|
+
stop(): Promise<void>;
|
|
187
|
+
canReuse(): boolean;
|
|
188
|
+
send(message: WorkerRequest): void;
|
|
189
|
+
on(event: string, callback: (arg: any) => any): void;
|
|
190
|
+
off(event: string, callback: (arg: any) => any): void;
|
|
191
|
+
deserialize(data: unknown): unknown;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** @experimental */
|
|
195
|
+
declare class VmForksPoolWorker extends ForksPoolWorker {
|
|
196
|
+
readonly name = "vmForks";
|
|
197
|
+
readonly reportMemory: true;
|
|
198
|
+
protected readonly entrypoint: string;
|
|
199
|
+
constructor(options: PoolOptions);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** @experimental */
|
|
203
|
+
declare class VmThreadsPoolWorker extends ThreadsPoolWorker {
|
|
204
|
+
readonly name = "vmThreads";
|
|
205
|
+
readonly reportMemory: true;
|
|
206
|
+
protected readonly entrypoint: string;
|
|
207
|
+
constructor(options: PoolOptions);
|
|
208
|
+
}
|
|
209
|
+
|
|
147
210
|
declare class BaseSequencer implements TestSequencer {
|
|
148
211
|
protected ctx: Vitest;
|
|
149
212
|
constructor(ctx: Vitest);
|
|
150
|
-
// async so it can be extended by other sequelizers
|
|
151
213
|
shard(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
152
|
-
// async so it can be extended by other sequelizers
|
|
153
214
|
sort(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
154
|
-
// Calculate distributed shard range [start, end] distributed equally
|
|
155
215
|
private calculateShardRange;
|
|
156
216
|
}
|
|
157
217
|
|
|
158
218
|
declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
|
|
159
219
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// When Vitest supports only Vite 6 and above, we can use Vite's `createLogger({ console })`
|
|
163
|
-
// https://github.com/vitejs/vite/pull/18379
|
|
220
|
+
interface WorkerContext extends ContextRPC {}
|
|
221
|
+
|
|
164
222
|
declare function createViteLogger(console: Logger, level?: LogLevel, options?: LoggerOptions): Logger$1;
|
|
165
223
|
|
|
166
224
|
declare const rootDir: string;
|
|
@@ -172,8 +230,7 @@ declare const version: string;
|
|
|
172
230
|
|
|
173
231
|
declare const createViteServer: typeof vite.createServer;
|
|
174
232
|
|
|
175
|
-
// rolldownVersion is exported only by rolldown-vite
|
|
176
233
|
declare const rolldownVersion: string | undefined;
|
|
177
234
|
|
|
178
|
-
export { ApiConfig, BaseSequencer, GitNotFoundError,
|
|
179
|
-
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget };
|
|
235
|
+
export { ApiConfig, BaseSequencer, ForksPoolWorker, GitNotFoundError, PoolOptions, PoolWorker, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, ThreadsPoolWorker, TypecheckPoolWorker, Vitest, VitestOptions, VitestPlugin, VitestRunMode, VmForksPoolWorker, VmThreadsPoolWorker, WorkerRequest, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, escapeTestName, getFilePoolName, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
|
|
236
|
+
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget, WorkerContext };
|