vitest 3.2.0-beta.3 → 3.2.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 +29 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/{base.D4119yLM.js → base.Cg0miDlQ.js} +10 -14
- package/dist/chunks/{benchmark.Cf_PACH1.js → benchmark.CYdenmiT.js} +4 -6
- package/dist/chunks/{cac.DWaWHIIE.js → cac.C8BzMmTW.js} +66 -136
- package/dist/chunks/{cli-api.CnmEXkxs.js → cli-api.DmupRhea.js} +1251 -1336
- package/dist/chunks/{console.Cwr-MFPV.js → console.CtFJOzRO.js} +24 -45
- package/dist/chunks/{coverage.0iPg4Wrz.js → coverage.DVF1vEu8.js} +4 -12
- package/dist/chunks/{coverage.C73DaDgS.js → coverage.EIiagJJP.js} +484 -1003
- package/dist/chunks/{creator.C8WKy2eW.js → creator.GK6I-cL4.js} +29 -76
- package/dist/chunks/{date.ByMsSlOr.js → date.Bq6ZW5rf.js} +3 -8
- package/dist/chunks/{defaults.DpVH7vbg.js → defaults.B7q_naMc.js} +1 -1
- package/dist/chunks/{env.Dq0hM4Xv.js → env.D4Lgay0q.js} +1 -1
- package/dist/chunks/{execute.B3q-2LPV.js → execute.B7h3T_Hc.js} +104 -220
- package/dist/chunks/{git.DXfdBEfR.js → git.BVQ8w_Sw.js} +1 -3
- package/dist/chunks/{global.d.BNLIi6yo.d.ts → global.d.MAmajcmJ.d.ts} +2 -0
- package/dist/chunks/{globals.CI21aWXF.js → globals.DEHgCU4V.js} +5 -5
- package/dist/chunks/{index.Bter3jj9.js → index.BZ0g1JD2.js} +366 -628
- package/dist/chunks/{index.CbT4iuwc.js → index.BbB8_kAK.js} +22 -24
- package/dist/chunks/{index.JOzufsrU.js → index.CIyJn3t1.js} +37 -82
- package/dist/chunks/{index.DNgLEKsQ.js → index.CdQS2e2Q.js} +2 -2
- package/dist/chunks/{index.2jgTs_Q5.js → index.CmSc2RE5.js} +69 -107
- package/dist/chunks/{inspector.BFsh5KO0.js → inspector.C914Efll.js} +1 -1
- package/dist/chunks/{node.Be-ntJnD.js → node.fjCdwEIl.js} +1 -1
- package/dist/chunks/{reporters.d.Bt4IGtsa.d.ts → reporters.d.C1ogPriE.d.ts} +24 -4
- package/dist/chunks/{rpc.BKExFSRG.js → rpc.Iovn4oWe.js} +9 -19
- package/dist/chunks/{runBaseTests.B_M1TTsK.js → runBaseTests.Dd85QTll.js} +18 -31
- package/dist/chunks/{setup-common.CF-O-dZX.js → setup-common.Dd054P77.js} +15 -42
- package/dist/chunks/{typechecker.BgzF-6iO.js → typechecker.DRKU1-1g.js} +106 -186
- package/dist/chunks/{utils.DPCq3gzW.js → utils.CAioKnHs.js} +6 -14
- package/dist/chunks/{utils.BlI4TC7Y.js → utils.XdZDrNZV.js} +5 -13
- package/dist/chunks/{vi.pkoYCV6A.js → vi.bdSIJ99Y.js} +118 -267
- package/dist/chunks/{vite.d.B-Kx3KCF.d.ts → vite.d.DqE4-hhK.d.ts} +1 -1
- package/dist/chunks/{vm.DPYem2so.js → vm.BThCzidc.js} +98 -214
- package/dist/chunks/{worker.d.Bl1O4kuf.d.ts → worker.d.DvqK5Vmu.d.ts} +1 -1
- package/dist/chunks/{worker.d.BKbBp2ga.d.ts → worker.d.tQu2eJQy.d.ts} +3 -1
- package/dist/cli.js +4 -4
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.js +2 -2
- package/dist/coverage.d.ts +2 -2
- package/dist/coverage.js +5 -5
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.js +5 -5
- package/dist/node.d.ts +7 -7
- package/dist/node.js +12 -14
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +4 -4
- package/dist/runners.d.ts +5 -2
- package/dist/runners.js +51 -80
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +36 -42
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +15 -21
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +6 -6
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +10 -10
- package/package.json +16 -14
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.
|
|
4
|
-
export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.
|
|
5
|
-
import './chunks/vite.d.
|
|
3
|
+
import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.C1ogPriE.js';
|
|
4
|
+
export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.C1ogPriE.js';
|
|
5
|
+
import './chunks/vite.d.DqE4-hhK.js';
|
|
6
6
|
import { F as FakeTimerInstallOpts } from './chunks/config.d.D2ROskhv.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
8
|
import './chunks/environment.d.cL3nLXbE.js';
|
|
@@ -12,7 +12,7 @@ import 'node:stream';
|
|
|
12
12
|
import 'node:console';
|
|
13
13
|
import '@vitest/mocker';
|
|
14
14
|
import '@vitest/utils/source-map';
|
|
15
|
-
import './chunks/worker.d.
|
|
15
|
+
import './chunks/worker.d.tQu2eJQy.js';
|
|
16
16
|
import 'vite-node';
|
|
17
17
|
import '@vitest/snapshot';
|
|
18
18
|
import '@vitest/pretty-format';
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.DnKduX2e.js';
|
|
2
|
-
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.
|
|
2
|
+
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.B7q_naMc.js';
|
|
3
3
|
export { mergeConfig } from 'vite';
|
|
4
4
|
import 'node:os';
|
|
5
|
-
import './chunks/env.
|
|
5
|
+
import './chunks/env.D4Lgay0q.js';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
|
|
8
8
|
function defineConfig(config) {
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.C1ogPriE.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
3
|
import { A as AfterSuiteRunMeta } from './chunks/environment.d.cL3nLXbE.js';
|
|
4
4
|
import '@vitest/runner';
|
|
@@ -7,7 +7,7 @@ import 'node:stream';
|
|
|
7
7
|
import 'node:console';
|
|
8
8
|
import '@vitest/mocker';
|
|
9
9
|
import '@vitest/utils/source-map';
|
|
10
|
-
import './chunks/worker.d.
|
|
10
|
+
import './chunks/worker.d.tQu2eJQy.js';
|
|
11
11
|
import 'vite-node';
|
|
12
12
|
import './chunks/config.d.D2ROskhv.js';
|
|
13
13
|
import '@vitest/pretty-format';
|
package/dist/coverage.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.EIiagJJP.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import 'picomatch';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
|
-
import './chunks/defaults.
|
|
6
|
+
import './chunks/defaults.B7q_naMc.js';
|
|
7
7
|
import 'node:os';
|
|
8
|
-
import './chunks/env.
|
|
8
|
+
import './chunks/env.D4Lgay0q.js';
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import 'node:crypto';
|
|
11
11
|
import '@vitest/utils';
|
|
@@ -23,7 +23,7 @@ import 'node:tty';
|
|
|
23
23
|
import 'node:events';
|
|
24
24
|
import './chunks/index.CJ0plNrh.js';
|
|
25
25
|
import 'tinypool';
|
|
26
|
-
import './chunks/typechecker.
|
|
26
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
27
27
|
import 'node:perf_hooks';
|
|
28
28
|
import '@vitest/utils/source-map';
|
|
29
29
|
import 'tinyexec';
|
|
@@ -31,4 +31,4 @@ import './path.js';
|
|
|
31
31
|
import '@vitest/runner/utils';
|
|
32
32
|
import 'node:worker_threads';
|
|
33
33
|
import 'vite-node/utils';
|
|
34
|
-
import './chunks/coverage.
|
|
34
|
+
import './chunks/coverage.DVF1vEu8.js';
|
package/dist/environments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.CmSc2RE5.js';
|
|
2
2
|
import 'node:console';
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
2
2
|
import { ViteNodeRunner, ModuleExecutionInfo } from 'vite-node/client';
|
|
3
|
-
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.
|
|
3
|
+
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.tQu2eJQy.js';
|
|
4
4
|
import vm from 'node:vm';
|
|
5
5
|
import { MockedModule, MockedModuleType } from '@vitest/mocker';
|
|
6
6
|
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
|
package/dist/execute.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { File as File$1, TaskResultPack as TaskResultPack$1, TaskEventPack, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
|
|
2
|
-
export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
3
|
-
import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.
|
|
4
|
-
export { G as BrowserTesterOptions } from './chunks/reporters.d.
|
|
5
|
-
import { W as WorkerContext$1 } from './chunks/worker.d.
|
|
6
|
-
import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/global.d.
|
|
1
|
+
import { File as File$1, TestAnnotation, TaskResultPack as TaskResultPack$1, TaskEventPack, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
|
|
2
|
+
export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
3
|
+
import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.C1ogPriE.js';
|
|
4
|
+
export { G as BrowserTesterOptions } from './chunks/reporters.d.C1ogPriE.js';
|
|
5
|
+
import { W as WorkerContext$1 } from './chunks/worker.d.DvqK5Vmu.js';
|
|
6
|
+
import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/global.d.MAmajcmJ.js';
|
|
7
7
|
import { b as Awaitable$1, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.d.cL3nLXbE.js';
|
|
8
8
|
export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.cL3nLXbE.js';
|
|
9
|
-
import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.
|
|
10
|
-
export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
11
|
-
import './chunks/vite.d.
|
|
9
|
+
import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.tQu2eJQy.js';
|
|
10
|
+
export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.tQu2eJQy.js';
|
|
11
|
+
import './chunks/vite.d.DqE4-hhK.js';
|
|
12
12
|
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.D2ROskhv.js';
|
|
13
13
|
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.D2ROskhv.js';
|
|
14
14
|
import { ExpectStatic } from '@vitest/expect';
|
|
15
|
-
export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers } from '@vitest/expect';
|
|
15
|
+
export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers } from '@vitest/expect';
|
|
16
16
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
17
17
|
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
|
|
18
18
|
import { M as MockFactoryWithHelper, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
|
|
@@ -87,7 +87,8 @@ interface WebSocketHandlers {
|
|
|
87
87
|
interface WebSocketEvents {
|
|
88
88
|
onCollected?: (files?: File$1[]) => Awaitable$1<void>;
|
|
89
89
|
onFinished?: (files: File$1[], errors: unknown[], coverage?: unknown) => Awaitable$1<void>;
|
|
90
|
-
|
|
90
|
+
onTestAnnotate?: (testId: string, annotation: TestAnnotation) => Awaitable$1<void>;
|
|
91
|
+
onTaskUpdate?: (packs: TaskResultPack$1[], events: TaskEventPack[]) => Awaitable$1<void>;
|
|
91
92
|
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable$1<void>;
|
|
92
93
|
onPathsCollected?: (paths?: string[]) => Awaitable$1<void>;
|
|
93
94
|
onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable$1<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
3
|
-
export { a as assertType } from './chunks/index.
|
|
1
|
+
export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.bdSIJ99Y.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.CYdenmiT.js';
|
|
3
|
+
export { a as assertType } from './chunks/index.CdQS2e2Q.js';
|
|
4
4
|
export { expectTypeOf } from 'expect-type';
|
|
5
5
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
6
|
import * as chai from 'chai';
|
|
@@ -8,11 +8,11 @@ export { chai };
|
|
|
8
8
|
export { assert, should } from 'chai';
|
|
9
9
|
import '@vitest/expect';
|
|
10
10
|
import '@vitest/runner/utils';
|
|
11
|
-
import './chunks/utils.
|
|
11
|
+
import './chunks/utils.XdZDrNZV.js';
|
|
12
12
|
import '@vitest/utils';
|
|
13
13
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
15
|
import '@vitest/utils/error';
|
|
16
16
|
import '@vitest/spy';
|
|
17
17
|
import '@vitest/utils/source-map';
|
|
18
|
-
import './chunks/date.
|
|
18
|
+
import './chunks/date.Bq6ZW5rf.js';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.
|
|
2
|
-
export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.
|
|
1
|
+
import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.C1ogPriE.js';
|
|
2
|
+
export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.C1ogPriE.js';
|
|
3
3
|
import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1, createServer as createServer$1 } from 'vite';
|
|
4
4
|
import * as vite from 'vite';
|
|
5
5
|
export { vite as Vite };
|
|
6
6
|
export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
7
7
|
import { IncomingMessage } from 'node:http';
|
|
8
|
-
import { R as RuntimeRPC } from './chunks/worker.d.
|
|
9
|
-
export { T as TestExecutionType } from './chunks/worker.d.
|
|
8
|
+
import { R as RuntimeRPC } from './chunks/worker.d.tQu2eJQy.js';
|
|
9
|
+
export { T as TestExecutionType } from './chunks/worker.d.tQu2eJQy.js';
|
|
10
10
|
import { Writable } from 'node:stream';
|
|
11
|
-
export { V as VitestPluginContext } from './chunks/vite.d.
|
|
12
|
-
export { W as WorkerContext } from './chunks/worker.d.
|
|
13
|
-
export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.
|
|
11
|
+
export { V as VitestPluginContext } from './chunks/vite.d.DqE4-hhK.js';
|
|
12
|
+
export { W as WorkerContext } from './chunks/worker.d.DvqK5Vmu.js';
|
|
13
|
+
export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.MAmajcmJ.js';
|
|
14
14
|
import { Debugger } from 'debug';
|
|
15
15
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
16
16
|
export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions } from './chunks/environment.d.cL3nLXbE.js';
|
package/dist/node.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { resolveConfig as resolveConfig$1, mergeConfig, createServer as createServer$1 } from 'vite';
|
|
2
2
|
export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
3
|
-
import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.
|
|
4
|
-
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
5
|
-
export { p as parseCLI } from './chunks/cac.
|
|
6
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
7
|
-
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.
|
|
3
|
+
import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.DmupRhea.js';
|
|
4
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.DmupRhea.js';
|
|
5
|
+
export { p as parseCLI } from './chunks/cac.C8BzMmTW.js';
|
|
6
|
+
import { r as resolveConfig$2 } from './chunks/coverage.EIiagJJP.js';
|
|
7
|
+
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.EIiagJJP.js';
|
|
8
8
|
import { slash, deepClone } from '@vitest/utils';
|
|
9
9
|
import { f as findUp } from './chunks/index.X0nbfr6-.js';
|
|
10
10
|
import { resolve } from 'pathe';
|
|
@@ -13,19 +13,19 @@ export { distDir, rootDir } from './path.js';
|
|
|
13
13
|
import createDebug from 'debug';
|
|
14
14
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
15
15
|
import 'node:fs';
|
|
16
|
-
import './chunks/coverage.
|
|
16
|
+
import './chunks/coverage.DVF1vEu8.js';
|
|
17
17
|
import 'node:path';
|
|
18
18
|
import '@vitest/snapshot/manager';
|
|
19
19
|
import 'vite-node/client';
|
|
20
20
|
import 'vite-node/server';
|
|
21
21
|
import './chunks/index.CJ0plNrh.js';
|
|
22
|
-
import './chunks/index.
|
|
22
|
+
import './chunks/index.BZ0g1JD2.js';
|
|
23
23
|
import 'node:perf_hooks';
|
|
24
24
|
import '@vitest/utils/source-map';
|
|
25
25
|
import 'tinyrainbow';
|
|
26
|
-
import './chunks/env.
|
|
26
|
+
import './chunks/env.D4Lgay0q.js';
|
|
27
27
|
import 'std-env';
|
|
28
|
-
import './chunks/typechecker.
|
|
28
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
29
29
|
import 'node:os';
|
|
30
30
|
import 'tinyexec';
|
|
31
31
|
import 'node:util';
|
|
@@ -50,9 +50,9 @@ import 'picomatch';
|
|
|
50
50
|
import 'tinyglobby';
|
|
51
51
|
import 'vite-node/utils';
|
|
52
52
|
import '@vitest/mocker/node';
|
|
53
|
-
import './chunks/defaults.
|
|
53
|
+
import './chunks/defaults.B7q_naMc.js';
|
|
54
54
|
import 'magic-string';
|
|
55
|
-
import './chunks/index.
|
|
55
|
+
import './chunks/index.CIyJn3t1.js';
|
|
56
56
|
import 'node:assert';
|
|
57
57
|
import '@vitest/utils/error';
|
|
58
58
|
import 'node:readline';
|
|
@@ -87,9 +87,7 @@ async function resolveConfig(options = {}, viteOverrides = {}) {
|
|
|
87
87
|
|
|
88
88
|
function createDebugger(namespace) {
|
|
89
89
|
const debug = createDebug(namespace);
|
|
90
|
-
if (debug.enabled)
|
|
91
|
-
return debug;
|
|
92
|
-
}
|
|
90
|
+
if (debug.enabled) return debug;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
const version = Vitest.version;
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.
|
|
1
|
+
export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.C1ogPriE.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import './chunks/environment.d.cL3nLXbE.js';
|
|
4
4
|
import 'vitest/optional-types.js';
|
|
@@ -8,7 +8,7 @@ import 'vite';
|
|
|
8
8
|
import 'node:console';
|
|
9
9
|
import '@vitest/mocker';
|
|
10
10
|
import '@vitest/utils/source-map';
|
|
11
|
-
import './chunks/worker.d.
|
|
11
|
+
import './chunks/worker.d.tQu2eJQy.js';
|
|
12
12
|
import 'vite-node';
|
|
13
13
|
import './chunks/config.d.D2ROskhv.js';
|
|
14
14
|
import '@vitest/pretty-format';
|
package/dist/reporters.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.
|
|
2
|
-
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.
|
|
1
|
+
export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.BZ0g1JD2.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CIyJn3t1.js';
|
|
3
3
|
import 'node:perf_hooks';
|
|
4
4
|
import '@vitest/runner/utils';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import '@vitest/utils/source-map';
|
|
7
7
|
import 'pathe';
|
|
8
8
|
import 'tinyrainbow';
|
|
9
|
-
import './chunks/env.
|
|
9
|
+
import './chunks/env.D4Lgay0q.js';
|
|
10
10
|
import 'std-env';
|
|
11
|
-
import './chunks/typechecker.
|
|
11
|
+
import './chunks/typechecker.DRKU1-1g.js';
|
|
12
12
|
import 'node:os';
|
|
13
13
|
import 'tinyexec';
|
|
14
14
|
import './path.js';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as tinybench from 'tinybench';
|
|
2
|
-
import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, TestContext } from '@vitest/runner';
|
|
2
|
+
import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, Test, TestContext, ImportDuration } from '@vitest/runner';
|
|
3
3
|
export { VitestRunner } from '@vitest/runner';
|
|
4
4
|
import { a as SerializedConfig } from './chunks/config.d.D2ROskhv.js';
|
|
5
5
|
import '@vitest/pretty-format';
|
|
@@ -28,7 +28,9 @@ declare class VitestTestRunner implements VitestRunner {
|
|
|
28
28
|
constructor(config: SerializedConfig);
|
|
29
29
|
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
|
|
30
30
|
onCollectStart(file: File): void;
|
|
31
|
+
onCleanupWorkerContext(listener: () => unknown): void;
|
|
31
32
|
onAfterRunFiles(): void;
|
|
33
|
+
getWorkerContext(): Record<string, unknown>;
|
|
32
34
|
onAfterRunSuite(suite: Suite): Promise<void>;
|
|
33
35
|
onAfterRunTask(test: Task): void;
|
|
34
36
|
cancel(_reason: CancelReason): void;
|
|
@@ -36,8 +38,9 @@ declare class VitestTestRunner implements VitestRunner {
|
|
|
36
38
|
onBeforeRunTask(test: Task): Promise<void>;
|
|
37
39
|
onBeforeRunSuite(suite: Suite): Promise<void>;
|
|
38
40
|
onBeforeTryTask(test: Task): void;
|
|
39
|
-
onAfterTryTask(test:
|
|
41
|
+
onAfterTryTask(test: Test): void;
|
|
40
42
|
extendTaskContext(context: TestContext): TestContext;
|
|
43
|
+
getImportDurations(): Record<string, ImportDuration>;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
export { NodeBenchmarkRunner, VitestTestRunner };
|
package/dist/runners.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { updateTask } from '@vitest/runner';
|
|
2
2
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
3
|
-
import { a as getBenchOptions, g as getBenchFn } from './chunks/benchmark.
|
|
4
|
-
import { g as getWorkerState } from './chunks/utils.
|
|
3
|
+
import { a as getBenchOptions, g as getBenchFn } from './chunks/benchmark.CYdenmiT.js';
|
|
4
|
+
import { g as getWorkerState } from './chunks/utils.XdZDrNZV.js';
|
|
5
5
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
6
6
|
import { getTests, getNames, getTestName } from '@vitest/runner/utils';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { normalize } from 'pathe';
|
|
8
|
+
import { g as getSnapshotClient, i as inject, c as createExpect, v as vi } from './chunks/vi.bdSIJ99Y.js';
|
|
9
|
+
import { r as rpc } from './chunks/rpc.Iovn4oWe.js';
|
|
9
10
|
import 'chai';
|
|
10
11
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
11
12
|
import '@vitest/snapshot';
|
|
12
13
|
import '@vitest/utils/error';
|
|
13
14
|
import '@vitest/spy';
|
|
14
15
|
import '@vitest/utils/source-map';
|
|
15
|
-
import './chunks/date.
|
|
16
|
+
import './chunks/date.Bq6ZW5rf.js';
|
|
16
17
|
import './chunks/index.CJ0plNrh.js';
|
|
17
18
|
|
|
18
19
|
function createBenchmarkResult(name) {
|
|
@@ -23,26 +24,19 @@ function createBenchmarkResult(name) {
|
|
|
23
24
|
samples: []
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
const benchmarkTasks = new WeakMap();
|
|
27
|
+
const benchmarkTasks = /* @__PURE__ */ new WeakMap();
|
|
27
28
|
async function runBenchmarkSuite(suite, runner) {
|
|
28
29
|
const { Task, Bench } = await runner.importTinybench();
|
|
29
30
|
const start = performance.now();
|
|
30
31
|
const benchmarkGroup = [];
|
|
31
32
|
const benchmarkSuiteGroup = [];
|
|
32
33
|
for (const task of suite.tasks) {
|
|
33
|
-
if (task.mode !== "run" && task.mode !== "queued")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (task.meta?.benchmark) {
|
|
37
|
-
benchmarkGroup.push(task);
|
|
38
|
-
} else if (task.type === "suite") {
|
|
39
|
-
benchmarkSuiteGroup.push(task);
|
|
40
|
-
}
|
|
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);
|
|
41
37
|
}
|
|
42
38
|
// run sub suites sequentially
|
|
43
|
-
for (const subSuite of benchmarkSuiteGroup)
|
|
44
|
-
await runBenchmarkSuite(subSuite, runner);
|
|
45
|
-
}
|
|
39
|
+
for (const subSuite of benchmarkSuiteGroup) await runBenchmarkSuite(subSuite, runner);
|
|
46
40
|
if (benchmarkGroup.length) {
|
|
47
41
|
const defer = createDefer();
|
|
48
42
|
suite.result = {
|
|
@@ -62,9 +56,7 @@ async function runBenchmarkSuite(suite, runner) {
|
|
|
62
56
|
const samples = result.samples;
|
|
63
57
|
result.sampleCount = samples.length;
|
|
64
58
|
result.median = samples.length % 2 ? samples[Math.floor(samples.length / 2)] : (samples[samples.length / 2] + samples[samples.length / 2 - 1]) / 2;
|
|
65
|
-
if (!runner.config.benchmark?.includeSamples)
|
|
66
|
-
result.samples.length = 0;
|
|
67
|
-
}
|
|
59
|
+
if (!runner.config.benchmark?.includeSamples) result.samples.length = 0;
|
|
68
60
|
updateTask$1("test-finished", benchmark);
|
|
69
61
|
}, { once: true });
|
|
70
62
|
task.addEventListener("error", (e) => {
|
|
@@ -114,9 +106,7 @@ class NodeBenchmarkRunner {
|
|
|
114
106
|
return await import('tinybench');
|
|
115
107
|
}
|
|
116
108
|
importFile(filepath, source) {
|
|
117
|
-
if (source === "setup")
|
|
118
|
-
getWorkerState().moduleCache.delete(filepath);
|
|
119
|
-
}
|
|
109
|
+
if (source === "setup") getWorkerState().moduleCache.delete(filepath);
|
|
120
110
|
return this.__vitest_executor.executeId(filepath);
|
|
121
111
|
}
|
|
122
112
|
async runSuite(suite) {
|
|
@@ -127,40 +117,42 @@ class NodeBenchmarkRunner {
|
|
|
127
117
|
}
|
|
128
118
|
}
|
|
129
119
|
|
|
120
|
+
// worker context is shared between all tests
|
|
121
|
+
const workerContext = Object.create(null);
|
|
130
122
|
class VitestTestRunner {
|
|
131
123
|
snapshotClient = getSnapshotClient();
|
|
132
124
|
workerState = getWorkerState();
|
|
133
125
|
__vitest_executor;
|
|
134
126
|
cancelRun = false;
|
|
135
|
-
assertionsErrors = new WeakMap();
|
|
127
|
+
assertionsErrors = /* @__PURE__ */ new WeakMap();
|
|
136
128
|
pool = this.workerState.ctx.pool;
|
|
137
129
|
constructor(config) {
|
|
138
130
|
this.config = config;
|
|
139
131
|
}
|
|
140
132
|
importFile(filepath, source) {
|
|
141
|
-
if (source === "setup")
|
|
142
|
-
this.workerState.moduleCache.delete(filepath);
|
|
143
|
-
}
|
|
133
|
+
if (source === "setup") this.workerState.moduleCache.delete(filepath);
|
|
144
134
|
return this.__vitest_executor.executeId(filepath);
|
|
145
135
|
}
|
|
146
136
|
onCollectStart(file) {
|
|
147
137
|
this.workerState.current = file;
|
|
148
138
|
}
|
|
139
|
+
onCleanupWorkerContext(listener) {
|
|
140
|
+
this.workerState.onCleanup(listener);
|
|
141
|
+
}
|
|
149
142
|
onAfterRunFiles() {
|
|
150
143
|
this.snapshotClient.clear();
|
|
151
|
-
this.workerState.current =
|
|
144
|
+
this.workerState.current = void 0;
|
|
145
|
+
}
|
|
146
|
+
getWorkerContext() {
|
|
147
|
+
return workerContext;
|
|
152
148
|
}
|
|
153
149
|
async onAfterRunSuite(suite) {
|
|
154
|
-
if (this.config.logHeapUsage && typeof process !== "undefined")
|
|
155
|
-
suite.result.heap = process.memoryUsage().heapUsed;
|
|
156
|
-
}
|
|
150
|
+
if (this.config.logHeapUsage && typeof process !== "undefined") suite.result.heap = process.memoryUsage().heapUsed;
|
|
157
151
|
if (suite.mode !== "skip" && "filepath" in suite) {
|
|
158
152
|
// mark snapshots in skipped tests as not obsolete
|
|
159
|
-
for (const test of getTests(suite)) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.snapshotClient.skipTest(suite.file.filepath, name);
|
|
163
|
-
}
|
|
153
|
+
for (const test of getTests(suite)) if (test.mode === "skip") {
|
|
154
|
+
const name = getNames(test).slice(1).join(" > ");
|
|
155
|
+
this.snapshotClient.skipTest(suite.file.filepath, name);
|
|
164
156
|
}
|
|
165
157
|
const result = await this.snapshotClient.finish(suite.file.filepath);
|
|
166
158
|
await rpc().snapshotSaved(result);
|
|
@@ -168,9 +160,7 @@ class VitestTestRunner {
|
|
|
168
160
|
this.workerState.current = suite.suite || suite.file;
|
|
169
161
|
}
|
|
170
162
|
onAfterRunTask(test) {
|
|
171
|
-
if (this.config.logHeapUsage && typeof process !== "undefined")
|
|
172
|
-
test.result.heap = process.memoryUsage().heapUsed;
|
|
173
|
-
}
|
|
163
|
+
if (this.config.logHeapUsage && typeof process !== "undefined") test.result.heap = process.memoryUsage().heapUsed;
|
|
174
164
|
this.workerState.current = test.suite || test.file;
|
|
175
165
|
}
|
|
176
166
|
cancel(_reason) {
|
|
@@ -182,22 +172,14 @@ class VitestTestRunner {
|
|
|
182
172
|
return inject(key);
|
|
183
173
|
}
|
|
184
174
|
async onBeforeRunTask(test) {
|
|
185
|
-
if (this.cancelRun)
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
if (test.mode !== "run" && test.mode !== "queued") {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
175
|
+
if (this.cancelRun) test.mode = "skip";
|
|
176
|
+
if (test.mode !== "run" && test.mode !== "queued") return;
|
|
191
177
|
this.workerState.current = test;
|
|
192
178
|
}
|
|
193
179
|
async onBeforeRunSuite(suite) {
|
|
194
|
-
if (this.cancelRun)
|
|
195
|
-
suite.mode = "skip";
|
|
196
|
-
}
|
|
180
|
+
if (this.cancelRun) suite.mode = "skip";
|
|
197
181
|
// initialize snapshot state before running file suite
|
|
198
|
-
if (suite.mode !== "skip" && "filepath" in suite)
|
|
199
|
-
await this.snapshotClient.setup(suite.file.filepath, this.workerState.config.snapshotOptions);
|
|
200
|
-
}
|
|
182
|
+
if (suite.mode !== "skip" && "filepath" in suite) await this.snapshotClient.setup(suite.file.filepath, this.workerState.config.snapshotOptions);
|
|
201
183
|
this.workerState.current = suite;
|
|
202
184
|
}
|
|
203
185
|
onBeforeTryTask(test) {
|
|
@@ -214,27 +196,17 @@ class VitestTestRunner {
|
|
|
214
196
|
}, globalThis[GLOBAL_EXPECT]);
|
|
215
197
|
}
|
|
216
198
|
onAfterTryTask(test) {
|
|
217
|
-
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } =
|
|
218
|
-
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (isExpectingAssertions === true && assertionCalls === 0) {
|
|
222
|
-
throw isExpectingAssertionsError;
|
|
223
|
-
}
|
|
224
|
-
if (this.config.expect.requireAssertions && assertionCalls === 0) {
|
|
225
|
-
throw this.assertionsErrors.get(test);
|
|
226
|
-
}
|
|
199
|
+
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
200
|
+
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber) throw expectedAssertionsNumberErrorGen();
|
|
201
|
+
if (isExpectingAssertions === true && assertionCalls === 0) throw isExpectingAssertionsError;
|
|
202
|
+
if (this.config.expect.requireAssertions && assertionCalls === 0) throw this.assertionsErrors.get(test);
|
|
227
203
|
}
|
|
228
204
|
extendTaskContext(context) {
|
|
229
205
|
// create error during the test initialization so we have a nice stack trace
|
|
230
|
-
if (this.config.expect.requireAssertions)
|
|
231
|
-
this.assertionsErrors.set(context.task, new Error("expected any number of assertion, but got none"));
|
|
232
|
-
}
|
|
206
|
+
if (this.config.expect.requireAssertions) this.assertionsErrors.set(context.task, new Error("expected any number of assertion, but got none"));
|
|
233
207
|
let _expect;
|
|
234
208
|
Object.defineProperty(context, "expect", { get() {
|
|
235
|
-
if (!_expect)
|
|
236
|
-
_expect = createExpect(context.task);
|
|
237
|
-
}
|
|
209
|
+
if (!_expect) _expect = createExpect(context.task);
|
|
238
210
|
return _expect;
|
|
239
211
|
} });
|
|
240
212
|
Object.defineProperty(context, "_local", { get() {
|
|
@@ -242,23 +214,22 @@ class VitestTestRunner {
|
|
|
242
214
|
} });
|
|
243
215
|
return context;
|
|
244
216
|
}
|
|
217
|
+
getImportDurations() {
|
|
218
|
+
const entries = [...this.workerState.moduleExecutionInfo?.entries() ?? []];
|
|
219
|
+
return Object.fromEntries(entries.map(([filepath, { duration, selfTime }]) => [normalize(filepath), {
|
|
220
|
+
selfTime,
|
|
221
|
+
totalTime: duration
|
|
222
|
+
}]));
|
|
223
|
+
}
|
|
245
224
|
}
|
|
246
225
|
function clearModuleMocks(config) {
|
|
247
226
|
const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
|
|
248
227
|
// since each function calls another, we can just call one
|
|
249
|
-
if (restoreMocks)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
vi.clearAllMocks();
|
|
255
|
-
}
|
|
256
|
-
if (unstubEnvs) {
|
|
257
|
-
vi.unstubAllEnvs();
|
|
258
|
-
}
|
|
259
|
-
if (unstubGlobals) {
|
|
260
|
-
vi.unstubAllGlobals();
|
|
261
|
-
}
|
|
228
|
+
if (restoreMocks) vi.restoreAllMocks();
|
|
229
|
+
else if (mockReset) vi.resetAllMocks();
|
|
230
|
+
else if (clearMocks) vi.clearAllMocks();
|
|
231
|
+
if (unstubEnvs) vi.unstubAllEnvs();
|
|
232
|
+
if (unstubGlobals) vi.unstubAllGlobals();
|
|
262
233
|
}
|
|
263
234
|
|
|
264
235
|
export { NodeBenchmarkRunner, VitestTestRunner };
|
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.fjCdwEIl.js';
|
|
2
2
|
import '@vitest/snapshot/environment';
|
|
3
|
-
import './chunks/utils.
|
|
3
|
+
import './chunks/utils.XdZDrNZV.js';
|
|
4
4
|
import '@vitest/utils';
|
package/dist/suite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { g as getBenchFn, a as getBenchOptions } from './chunks/benchmark.
|
|
1
|
+
export { g as getBenchFn, a as getBenchOptions } from './chunks/benchmark.CYdenmiT.js';
|
|
2
2
|
export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
|
|
3
3
|
export { createChainable } from '@vitest/runner/utils';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './chunks/utils.
|
|
5
|
+
import './chunks/utils.XdZDrNZV.js';
|