vitest 4.0.0-beta.7 → 4.0.0-beta.9
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/dist/browser.d.ts +5 -5
- package/dist/browser.js +4 -4
- package/dist/chunks/{runBaseTests.D6sfuWBM.js → base.CA5N8Af0.js} +55 -26
- package/dist/chunks/{benchmark.UW6Ezvxy.js → benchmark.CJUa-Hsa.js} +1 -1
- package/dist/chunks/{browser.d.DOMmqJQx.d.ts → browser.d.DtfyY9yS.d.ts} +1 -1
- package/dist/chunks/{cac.Dsn7ixFt.js → cac.Dt7e1TIu.js} +6 -25
- package/dist/chunks/{cli-api.DfGJyldU.js → cli-api.eAzsLIxz.js} +88 -209
- package/dist/chunks/{config.d._GBBbReY.d.ts → config.d.DacWrqWe.d.ts} +1 -0
- package/dist/chunks/{console.B0quX7yH.js → console.7h5kHUIf.js} +1 -1
- package/dist/chunks/{coverage.Dvxug1RM.js → coverage.CDRAMTt7.js} +25 -56
- package/dist/chunks/{globals.lgsmH00r.js → globals.CJrTTbxC.js} +5 -6
- package/dist/chunks/{index.C3EbxYwt.js → index.BIP7prJq.js} +7 -3
- package/dist/chunks/{index.D2B6d2vv.js → index.BjKEiSn0.js} +1 -1
- package/dist/chunks/{index.AR8aAkCC.js → index.C832ioot.js} +5 -6
- package/dist/chunks/{moduleRunner.d.CX4DuqOx.d.ts → moduleRunner.d.DxTLreRD.d.ts} +4 -1
- package/dist/chunks/{node.BOqcT2jW.js → node.CyipiPvJ.js} +1 -1
- package/dist/chunks/{plugin.d.vcD4xbMS.d.ts → plugin.d.CIk0YiKb.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BC86JJdB.d.ts → reporters.d.DmP-iHLr.d.ts} +451 -561
- package/dist/chunks/{index.CsFXYRkW.js → resolveSnapshotEnvironment.Bvv2zr69.js} +16 -21
- package/dist/chunks/{rpc.RpPylpp0.js → rpc.BKr6mtxz.js} +1 -1
- package/dist/chunks/{setup-common.hLGRxhC8.js → setup-common.B7I37Tji.js} +4 -4
- package/dist/chunks/{startModuleRunner.C8TW8zTN.js → startModuleRunner.BDRvKSdz.js} +7 -2
- package/dist/chunks/test.BAlBebnP.js +214 -0
- package/dist/chunks/{typechecker.DSo_maXz.js → typechecker.DB-fIMaH.js} +44 -1
- package/dist/chunks/{utils.C7__0Iv5.js → utils.D2R2NiOH.js} +1 -10
- package/dist/chunks/{vi.BfdOiD4j.js → vi.BB37KeLx.js} +16 -16
- package/dist/chunks/{vm.BHBje7cC.js → vm.CjLTDaST.js} +12 -7
- package/dist/chunks/{worker.d.DYlqbejz.d.ts → worker.d.B2r4Ln6p.d.ts} +1 -1
- package/dist/chunks/{worker.d.BKu8cnnX.d.ts → worker.d.DJ6qxO2w.d.ts} +1 -1
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +10 -10
- package/dist/coverage.d.ts +8 -8
- package/dist/coverage.js +2 -2
- package/dist/index.d.ts +11 -12
- package/dist/index.js +5 -8
- package/dist/module-evaluator.d.ts +4 -3
- package/dist/module-evaluator.js +3 -3
- package/dist/module-runner.js +2 -2
- package/dist/node.d.ts +23 -14
- package/dist/node.js +8 -8
- package/dist/reporters.d.ts +8 -8
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +11 -215
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +2 -3
- package/dist/workers/forks.js +27 -4
- package/dist/workers/runVmTests.js +18 -19
- package/dist/workers/threads.js +27 -4
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +26 -8
- package/package.json +10 -14
- package/dist/chunks/base.BXI97p6t.js +0 -39
package/dist/coverage.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
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.DmP-iHLr.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
3
|
import { A as AfterSuiteRunMeta } from './chunks/environment.d.2fYMoz3o.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import './chunks/
|
|
7
|
+
import '@vitest/mocker';
|
|
8
|
+
import '@vitest/utils/source-map';
|
|
9
|
+
import './chunks/browser.d.DtfyY9yS.js';
|
|
10
|
+
import './chunks/worker.d.B2r4Ln6p.js';
|
|
10
11
|
import 'vite/module-runner';
|
|
11
|
-
import './chunks/config.d.
|
|
12
|
+
import './chunks/config.d.DacWrqWe.js';
|
|
12
13
|
import '@vitest/pretty-format';
|
|
13
14
|
import '@vitest/snapshot';
|
|
14
15
|
import '@vitest/utils/diff';
|
|
15
|
-
import '@vitest/
|
|
16
|
-
import '@vitest/utils/source-map';
|
|
17
|
-
import 'chai';
|
|
16
|
+
import '@vitest/expect';
|
|
18
17
|
import 'vitest/optional-types.js';
|
|
19
18
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
20
19
|
import '@vitest/runner/utils';
|
|
@@ -22,6 +21,7 @@ import 'tinybench';
|
|
|
22
21
|
import './chunks/coverage.d.BZtK59WP.js';
|
|
23
22
|
import '@vitest/snapshot/manager';
|
|
24
23
|
import 'node:fs';
|
|
24
|
+
import 'node:console';
|
|
25
25
|
|
|
26
26
|
type Threshold = "lines" | "functions" | "statements" | "branches";
|
|
27
27
|
interface ResolvedThreshold {
|
package/dist/coverage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.CDRAMTt7.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:path';
|
|
4
4
|
import '@vitest/utils';
|
|
@@ -24,7 +24,7 @@ import 'node:tty';
|
|
|
24
24
|
import 'node:events';
|
|
25
25
|
import './chunks/index.Bgo3tNWt.js';
|
|
26
26
|
import 'tinypool';
|
|
27
|
-
import './chunks/typechecker.
|
|
27
|
+
import './chunks/typechecker.DB-fIMaH.js';
|
|
28
28
|
import 'node:perf_hooks';
|
|
29
29
|
import '@vitest/utils/source-map';
|
|
30
30
|
import 'tinyexec';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { S as SerializedTestSpecification } from './chunks/browser.d.
|
|
2
|
-
export { B as BrowserTesterOptions } from './chunks/browser.d.
|
|
1
|
+
import { S as SerializedTestSpecification } from './chunks/browser.d.DtfyY9yS.js';
|
|
2
|
+
export { B as BrowserTesterOptions } from './chunks/browser.d.DtfyY9yS.js';
|
|
3
3
|
import './chunks/global.d.K6uBQHzY.js';
|
|
4
4
|
import { File, TestAnnotation, TaskResultPack, TaskEventPack, TaskPopulated } from '@vitest/runner';
|
|
5
5
|
export { CancelReason, HookCleanupCallback, HookListener, 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 { a as BirpcReturn } from './chunks/worker.d.
|
|
7
|
-
export { C as ContextRPC, c as ContextTestEnvironment, b as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
8
|
-
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.
|
|
9
|
-
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.
|
|
6
|
+
import { a as BirpcReturn } from './chunks/worker.d.B2r4Ln6p.js';
|
|
7
|
+
export { C as ContextRPC, c as ContextTestEnvironment, b as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.B2r4Ln6p.js';
|
|
8
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.DacWrqWe.js';
|
|
9
|
+
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.DacWrqWe.js';
|
|
10
10
|
import { b as Awaitable, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/environment.d.2fYMoz3o.js';
|
|
11
11
|
export { A as AfterSuiteRunMeta } from './chunks/environment.d.2fYMoz3o.js';
|
|
12
12
|
import { ExpectStatic } from '@vitest/expect';
|
|
13
|
-
export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers } from '@vitest/expect';
|
|
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';
|
|
@@ -21,9 +21,6 @@ export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer,
|
|
|
21
21
|
export { ParsedStack, SerializedError, TestError } from '@vitest/utils';
|
|
22
22
|
export { DiffOptions } from '@vitest/utils/diff';
|
|
23
23
|
export { EvaluatedModules } from 'vite/module-runner';
|
|
24
|
-
import * as chai from 'chai';
|
|
25
|
-
export { chai };
|
|
26
|
-
export { assert, should } from 'chai';
|
|
27
24
|
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
|
|
28
25
|
import '@vitest/pretty-format';
|
|
29
26
|
import '@vitest/mocker';
|
|
@@ -82,6 +79,8 @@ type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
|
|
|
82
79
|
|
|
83
80
|
declare function createExpect(test?: TaskPopulated): ExpectStatic;
|
|
84
81
|
declare const globalExpect: ExpectStatic;
|
|
82
|
+
declare const assert: Chai.Assert;
|
|
83
|
+
declare const should: () => Chai.Should;
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* Gives access to injected context provided from the main thread.
|
|
@@ -479,7 +478,7 @@ interface VitestUtils {
|
|
|
479
478
|
*/
|
|
480
479
|
setConfig: (config: RuntimeOptions) => void;
|
|
481
480
|
/**
|
|
482
|
-
* If config was changed with `vi.setConfig`, this will reset it to the original state.
|
|
481
|
+
* If config was changed with `vi.setConfig`, this will reset it to the original state().
|
|
483
482
|
*/
|
|
484
483
|
resetConfig: () => void;
|
|
485
484
|
}
|
|
@@ -496,5 +495,5 @@ interface BrowserUI {
|
|
|
496
495
|
setIframeViewport: (width: number, height: number) => Promise<void>;
|
|
497
496
|
}
|
|
498
497
|
|
|
499
|
-
export { LabelColor, ModuleGraphData, ProvidedContext, SerializedConfig, SerializedTestSpecification, UserConsoleLog, assertType, createExpect, globalExpect as expect, inject, vi, vitest };
|
|
498
|
+
export { LabelColor, ModuleGraphData, ProvidedContext, SerializedConfig, SerializedTestSpecification, UserConsoleLog, assert, assertType, createExpect, globalExpect as expect, inject, should, vi, vitest };
|
|
500
499
|
export type { AssertType, BrowserUI, TransformResultWithSource, VitestUtils, WebSocketEvents, WebSocketHandlers, WebSocketRPC };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
export { c as createExpect,
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
3
|
-
export { a as assertType } from './chunks/index.
|
|
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.BB37KeLx.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.CJUa-Hsa.js';
|
|
3
|
+
export { a as assertType } from './chunks/index.C832ioot.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
|
export { EvaluatedModules } from 'vite/module-runner';
|
|
7
|
-
|
|
8
|
-
export { chai };
|
|
9
|
-
export { assert, should } from 'chai';
|
|
10
|
-
import '@vitest/expect';
|
|
7
|
+
export { chai } from '@vitest/expect';
|
|
11
8
|
import '@vitest/runner/utils';
|
|
12
|
-
import './chunks/utils.
|
|
9
|
+
import './chunks/utils.D2R2NiOH.js';
|
|
13
10
|
import '@vitest/utils';
|
|
14
11
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
15
12
|
import '@vitest/snapshot';
|
|
@@ -1,9 +1,10 @@
|
|
|
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.DxTLreRD.js';
|
|
3
3
|
import 'node:vm';
|
|
4
|
-
import '
|
|
4
|
+
import '@vitest/spy';
|
|
5
|
+
import './chunks/worker.d.B2r4Ln6p.js';
|
|
5
6
|
import '@vitest/runner';
|
|
6
|
-
import './chunks/config.d.
|
|
7
|
+
import './chunks/config.d.DacWrqWe.js';
|
|
7
8
|
import '@vitest/pretty-format';
|
|
8
9
|
import '@vitest/snapshot';
|
|
9
10
|
import '@vitest/utils/diff';
|
package/dist/module-evaluator.js
CHANGED
|
@@ -128,10 +128,10 @@ class VitestModuleEvaluator {
|
|
|
128
128
|
if (this.compiledFunctionArgumentsNames) argumentsList.push(...this.compiledFunctionArgumentsNames);
|
|
129
129
|
// add 'use strict' since ESM enables it by default
|
|
130
130
|
const codeDefinition = `'use strict';async (${argumentsList.join(",")})=>{{`, wrappedCode = `${codeDefinition}${code}\n}}`, options = {
|
|
131
|
-
filename: module.
|
|
131
|
+
filename: module.id,
|
|
132
132
|
lineOffset: 0,
|
|
133
133
|
columnOffset: -codeDefinition.length
|
|
134
|
-
}, finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(filename, codeDefinition.length);
|
|
134
|
+
}, finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
135
135
|
try {
|
|
136
136
|
const initModule = this.vm ? vm.runInContext(wrappedCode, this.vm.context, options) : vm.runInThisContext(wrappedCode, options), dynamicRequest = async (dep, options) => {
|
|
137
137
|
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
@@ -158,7 +158,7 @@ class VitestModuleEvaluator {
|
|
|
158
158
|
} finally {
|
|
159
159
|
// moduleExecutionInfo needs to use Node filename instead of the normalized one
|
|
160
160
|
// because we rely on this behaviour in coverage-v8, for example
|
|
161
|
-
this.options.moduleExecutionInfo?.set(filename, finishModuleExecutionInfo());
|
|
161
|
+
this.options.moduleExecutionInfo?.set(options.filename, finishModuleExecutionInfo());
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
createRequire(filename) {
|
package/dist/module-runner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.BDRvKSdz.js';
|
|
3
|
+
export { g as getWorkerState } from './chunks/utils.D2R2NiOH.js';
|
|
4
4
|
import 'node:module';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'node:vm';
|
package/dist/node.d.ts
CHANGED
|
@@ -3,37 +3,37 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
|
|
|
3
3
|
export { vite as Vite };
|
|
4
4
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
5
5
|
import { IncomingMessage } from 'node:http';
|
|
6
|
-
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject,
|
|
7
|
-
export {
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
6
|
+
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as Pool, l as TestSequencer, L as Logger } from './chunks/reporters.d.DmP-iHLr.js';
|
|
7
|
+
export { an as BaseCoverageOptions, G as BenchmarkUserOptions, K as BrowserBuiltinProvider, N as BrowserCommand, Q as BrowserCommandContext, X as BrowserConfigOptions, Y as BrowserInstanceOption, Z as BrowserModuleMocker, _ as BrowserOrchestrator, $ as BrowserProvider, a0 as BrowserProviderInitializationOptions, a1 as BrowserProviderModule, a2 as BrowserProviderOptions, a3 as BrowserScript, a4 as BrowserServerState, a5 as BrowserServerStateSession, ac as BuiltinEnvironment, a6 as CDPSession, ad as CSSModuleScopeStrategy, ao as CoverageIstanbulOptions, ap as CoverageOptions, aq as CoverageProvider, ar as CoverageProviderModule, as as CoverageReporter, c as CoverageV8Options, at as CustomProviderOptions, ae as DepsOptimizationOptions, af as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, o as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a7 as ParentProjectBrowser, ag as PoolOptions, a8 as ProjectBrowser, ah as ProjectConfig, b as ReportContext, av as ReportedHookContext, aw as Reporter, aj as ResolveSnapshotPathHandler, ak as ResolveSnapshotPathHandlerContext, a9 as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ai as ResolvedProjectConfig, S as SerializedTestProject, p as TaskOptions, q as TestCase, r as TestCollection, s as TestDiagnostic, t as TestModule, u as TestModuleState, v as TestResult, w as TestResultFailed, x as TestResultPassed, y as TestResultSkipped, ax as TestRunEndReason, au as TestRunResult, F as TestSequencerConstructor, z as TestState, B as TestSuite, D as TestSuiteState, aa as ToMatchScreenshotComparators, ab as ToMatchScreenshotOptions, al as TypecheckConfig, U as UserWorkspaceConfig, am as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, E as experimental_getRunnerTask } from './chunks/reporters.d.DmP-iHLr.js';
|
|
8
|
+
import { Awaitable } from '@vitest/utils';
|
|
9
|
+
export { SerializedError } from '@vitest/utils';
|
|
10
|
+
import { R as RuntimeRPC } from './chunks/worker.d.B2r4Ln6p.js';
|
|
11
|
+
export { T as TestExecutionType } from './chunks/worker.d.B2r4Ln6p.js';
|
|
10
12
|
import { Writable } from 'node:stream';
|
|
11
|
-
export { V as VitestPluginContext } from './chunks/plugin.d.
|
|
12
|
-
export { W as WorkerContext } from './chunks/worker.d.
|
|
13
|
+
export { V as VitestPluginContext } from './chunks/plugin.d.CIk0YiKb.js';
|
|
14
|
+
export { W as WorkerContext } from './chunks/worker.d.DJ6qxO2w.js';
|
|
13
15
|
import { Debugger } from 'debug';
|
|
14
16
|
import './chunks/global.d.K6uBQHzY.js';
|
|
15
17
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
16
|
-
export { b as RuntimeConfig } from './chunks/config.d.
|
|
17
|
-
export { SerializedError } from '@vitest/utils';
|
|
18
|
+
export { b as RuntimeConfig } from './chunks/config.d.DacWrqWe.js';
|
|
18
19
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
19
20
|
import './chunks/environment.d.2fYMoz3o.js';
|
|
20
|
-
import 'node:console';
|
|
21
|
-
import './chunks/browser.d.DOMmqJQx.js';
|
|
22
21
|
import '@vitest/mocker';
|
|
23
22
|
import '@vitest/utils/source-map';
|
|
23
|
+
import './chunks/browser.d.DtfyY9yS.js';
|
|
24
24
|
import '@vitest/pretty-format';
|
|
25
25
|
import '@vitest/snapshot';
|
|
26
26
|
import '@vitest/utils/diff';
|
|
27
|
-
import '
|
|
27
|
+
import '@vitest/expect';
|
|
28
28
|
import 'vitest/optional-types.js';
|
|
29
29
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
30
30
|
import 'tinybench';
|
|
31
31
|
import './chunks/coverage.d.BZtK59WP.js';
|
|
32
32
|
import '@vitest/snapshot/manager';
|
|
33
33
|
import 'node:fs';
|
|
34
|
+
import 'node:console';
|
|
34
35
|
import 'vite/module-runner';
|
|
35
36
|
import 'node:worker_threads';
|
|
36
|
-
import '@vitest/expect';
|
|
37
37
|
|
|
38
38
|
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
39
39
|
interface TscErrorInfo {
|
|
@@ -128,6 +128,15 @@ declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$
|
|
|
128
128
|
|
|
129
129
|
declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
|
|
130
130
|
|
|
131
|
+
type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) => Awaitable<void>;
|
|
132
|
+
interface ProcessPool {
|
|
133
|
+
name: string;
|
|
134
|
+
runTests: RunWithFiles;
|
|
135
|
+
collectTests: RunWithFiles;
|
|
136
|
+
close?: () => Awaitable<void>;
|
|
137
|
+
}
|
|
138
|
+
declare function getFilePoolName(project: TestProject): Pool;
|
|
139
|
+
|
|
131
140
|
interface MethodsOptions {
|
|
132
141
|
cacheFs?: boolean;
|
|
133
142
|
// do not report files
|
|
@@ -166,5 +175,5 @@ declare const createViteServer: typeof vite.createServer;
|
|
|
166
175
|
// rolldownVersion is exported only by rolldown-vite
|
|
167
176
|
declare const rolldownVersion: string | undefined;
|
|
168
177
|
|
|
169
|
-
export { ApiConfig, BaseSequencer, GitNotFoundError, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, Vitest, VitestOptions, VitestPlugin, VitestRunMode,
|
|
170
|
-
export type { CliParseOptions, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget };
|
|
178
|
+
export { ApiConfig, BaseSequencer, GitNotFoundError, Pool, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, Vitest, VitestOptions, VitestPlugin, VitestRunMode, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, escapeTestName, getFilePoolName, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
|
|
179
|
+
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget };
|
package/dist/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
|
|
3
3
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
4
|
-
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.
|
|
5
|
-
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, h as createDebugger, g as createViteLogger, c as createVitest, e as escapeTestName, d as experimental_getRunnerTask, i as isValidApiRequest, f as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.eAzsLIxz.js';
|
|
5
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, h as createDebugger, g as createViteLogger, c as createVitest, e as escapeTestName, d as experimental_getRunnerTask, i as isValidApiRequest, f as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.eAzsLIxz.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.Dt7e1TIu.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.CDRAMTt7.js';
|
|
8
|
+
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.CDRAMTt7.js';
|
|
9
9
|
import { slash, deepClone } from '@vitest/utils';
|
|
10
10
|
import { f as findUp } from './chunks/index.X0nbfr6-.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
|
@@ -18,9 +18,9 @@ import 'node:path';
|
|
|
18
18
|
import 'node:os';
|
|
19
19
|
import '@vitest/snapshot/manager';
|
|
20
20
|
import './chunks/index.Bgo3tNWt.js';
|
|
21
|
-
import './chunks/index.
|
|
21
|
+
import './chunks/index.BIP7prJq.js';
|
|
22
22
|
import 'node:fs/promises';
|
|
23
|
-
import './chunks/typechecker.
|
|
23
|
+
import './chunks/typechecker.DB-fIMaH.js';
|
|
24
24
|
import 'node:perf_hooks';
|
|
25
25
|
import '@vitest/utils/source-map';
|
|
26
26
|
import 'tinyexec';
|
|
@@ -54,7 +54,7 @@ import '@vitest/mocker/node';
|
|
|
54
54
|
import './chunks/defaults.CXFFjsi8.js';
|
|
55
55
|
import './chunks/resolver.Bx6lE0iq.js';
|
|
56
56
|
import 'es-module-lexer';
|
|
57
|
-
import './chunks/index.
|
|
57
|
+
import './chunks/index.BjKEiSn0.js';
|
|
58
58
|
import 'node:assert';
|
|
59
59
|
import '@vitest/utils/error';
|
|
60
60
|
import 'node:readline';
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aL as BaseReporter, aM as BenchmarkBuiltinReporters, ay as BenchmarkReporter, az as BenchmarkReportsMap, aN as BuiltinReporterOptions, aO as BuiltinReporters, aA as DefaultReporter, aB as DotReporter, aC as GithubActionsReporter, aD as HangingProcessReporter, aF as JUnitReporter, aP as JsonAssertionResult, aE as JsonReporter, aQ as JsonTestResult, aR as JsonTestResults, av as ReportedHookContext, aw as Reporter, aG as ReportersMap, aH as TapFlatReporter, aI as TapReporter, ax as TestRunEndReason, aJ as VerboseBenchmarkReporter, aK as VerboseReporter } from './chunks/reporters.d.DmP-iHLr.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import './chunks/environment.d.2fYMoz3o.js';
|
|
5
5
|
import 'node:stream';
|
|
6
6
|
import 'vite';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import './chunks/
|
|
7
|
+
import '@vitest/mocker';
|
|
8
|
+
import '@vitest/utils/source-map';
|
|
9
|
+
import './chunks/browser.d.DtfyY9yS.js';
|
|
10
|
+
import './chunks/worker.d.B2r4Ln6p.js';
|
|
10
11
|
import 'vite/module-runner';
|
|
11
|
-
import './chunks/config.d.
|
|
12
|
+
import './chunks/config.d.DacWrqWe.js';
|
|
12
13
|
import '@vitest/pretty-format';
|
|
13
14
|
import '@vitest/snapshot';
|
|
14
15
|
import '@vitest/utils/diff';
|
|
15
|
-
import '@vitest/
|
|
16
|
-
import '@vitest/utils/source-map';
|
|
17
|
-
import 'chai';
|
|
16
|
+
import '@vitest/expect';
|
|
18
17
|
import 'vitest/optional-types.js';
|
|
19
18
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
20
19
|
import '@vitest/runner/utils';
|
|
@@ -22,3 +21,4 @@ import 'tinybench';
|
|
|
22
21
|
import './chunks/coverage.d.BZtK59WP.js';
|
|
23
22
|
import '@vitest/snapshot/manager';
|
|
24
23
|
import 'node:fs';
|
|
24
|
+
import 'node:console';
|
package/dist/reporters.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.BIP7prJq.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.BjKEiSn0.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'pathe';
|
|
6
|
-
import './chunks/typechecker.
|
|
6
|
+
import './chunks/typechecker.DB-fIMaH.js';
|
|
7
7
|
import 'node:os';
|
|
8
8
|
import 'node:perf_hooks';
|
|
9
9
|
import '@vitest/utils/source-map';
|
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 } from '@vitest/runner';
|
|
3
3
|
export { VitestRunner } from '@vitest/runner';
|
|
4
|
-
import { a as SerializedConfig } from './chunks/config.d.
|
|
4
|
+
import { a as SerializedConfig } from './chunks/config.d.DacWrqWe.js';
|
|
5
5
|
import '@vitest/pretty-format';
|
|
6
6
|
import '@vitest/snapshot';
|
|
7
7
|
import '@vitest/utils/diff';
|
package/dist/runners.js
CHANGED
|
@@ -1,221 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import 'chai';
|
|
1
|
+
export { N as NodeBenchmarkRunner, V as VitestTestRunner } from './chunks/test.BAlBebnP.js';
|
|
2
|
+
import '@vitest/runner';
|
|
3
|
+
import '@vitest/utils';
|
|
4
|
+
import './chunks/benchmark.CJUa-Hsa.js';
|
|
5
|
+
import '@vitest/runner/utils';
|
|
6
|
+
import './chunks/utils.D2R2NiOH.js';
|
|
7
|
+
import '@vitest/expect';
|
|
8
|
+
import '@vitest/utils/error';
|
|
9
|
+
import 'pathe';
|
|
10
|
+
import './chunks/vi.BB37KeLx.js';
|
|
12
11
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
13
12
|
import '@vitest/snapshot';
|
|
14
13
|
import '@vitest/spy';
|
|
15
14
|
import '@vitest/utils/source-map';
|
|
16
15
|
import './chunks/date.-jtEtIeV.js';
|
|
16
|
+
import './chunks/rpc.BKr6mtxz.js';
|
|
17
17
|
import './chunks/index.Bgo3tNWt.js';
|
|
18
|
-
|
|
19
|
-
function createBenchmarkResult(name) {
|
|
20
|
-
return {
|
|
21
|
-
name,
|
|
22
|
-
rank: 0,
|
|
23
|
-
rme: 0,
|
|
24
|
-
samples: []
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const benchmarkTasks = /* @__PURE__ */ new WeakMap();
|
|
28
|
-
async function runBenchmarkSuite(suite, runner) {
|
|
29
|
-
const { Task, Bench } = await runner.importTinybench(), start = performance.now(), benchmarkGroup = [], benchmarkSuiteGroup = [];
|
|
30
|
-
for (const task of suite.tasks) {
|
|
31
|
-
if (task.mode !== "run" && task.mode !== "queued") continue;
|
|
32
|
-
if (task.meta?.benchmark) benchmarkGroup.push(task);
|
|
33
|
-
else if (task.type === "suite") benchmarkSuiteGroup.push(task);
|
|
34
|
-
}
|
|
35
|
-
// run sub suites sequentially
|
|
36
|
-
for (const subSuite of benchmarkSuiteGroup) await runBenchmarkSuite(subSuite, runner);
|
|
37
|
-
if (benchmarkGroup.length) {
|
|
38
|
-
const defer = createDefer();
|
|
39
|
-
suite.result = {
|
|
40
|
-
state: "run",
|
|
41
|
-
startTime: start,
|
|
42
|
-
benchmark: createBenchmarkResult(suite.name)
|
|
43
|
-
}, updateTask$1("suite-prepare", suite);
|
|
44
|
-
const addBenchTaskListener = (task, benchmark) => {
|
|
45
|
-
task.addEventListener("complete", (e) => {
|
|
46
|
-
const task = e.task, taskRes = task.result, result = benchmark.result.benchmark;
|
|
47
|
-
benchmark.result.state = "pass", Object.assign(result, taskRes);
|
|
48
|
-
// compute extra stats and free raw samples as early as possible
|
|
49
|
-
const samples = result.samples;
|
|
50
|
-
if (result.sampleCount = samples.length, result.median = samples.length % 2 ? samples[Math.floor(samples.length / 2)] : (samples[samples.length / 2] + samples[samples.length / 2 - 1]) / 2, !runner.config.benchmark?.includeSamples) result.samples.length = 0;
|
|
51
|
-
updateTask$1("test-finished", benchmark);
|
|
52
|
-
}, { once: true }), task.addEventListener("error", (e) => {
|
|
53
|
-
const task = e.task;
|
|
54
|
-
defer.reject(benchmark ? task.result.error : e);
|
|
55
|
-
}, { once: true });
|
|
56
|
-
};
|
|
57
|
-
benchmarkGroup.forEach((benchmark) => {
|
|
58
|
-
const options = getBenchOptions(benchmark), benchmarkInstance = new Bench(options), benchmarkFn = getBenchFn(benchmark);
|
|
59
|
-
benchmark.result = {
|
|
60
|
-
state: "run",
|
|
61
|
-
startTime: start,
|
|
62
|
-
benchmark: createBenchmarkResult(benchmark.name)
|
|
63
|
-
};
|
|
64
|
-
const task = new Task(benchmarkInstance, benchmark.name, benchmarkFn);
|
|
65
|
-
benchmarkTasks.set(benchmark, task), addBenchTaskListener(task, benchmark);
|
|
66
|
-
});
|
|
67
|
-
const { setTimeout } = getSafeTimers(), tasks = [];
|
|
68
|
-
for (const benchmark of benchmarkGroup) {
|
|
69
|
-
const task = benchmarkTasks.get(benchmark);
|
|
70
|
-
updateTask$1("test-prepare", benchmark), await task.warmup(), tasks.push([await new Promise((resolve) => setTimeout(async () => {
|
|
71
|
-
resolve(await task.run());
|
|
72
|
-
})), benchmark]);
|
|
73
|
-
}
|
|
74
|
-
suite.result.duration = performance.now() - start, suite.result.state = "pass", updateTask$1("suite-finished", suite), defer.resolve(null), await defer;
|
|
75
|
-
}
|
|
76
|
-
function updateTask$1(event, task) {
|
|
77
|
-
updateTask(event, task, runner);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
class NodeBenchmarkRunner {
|
|
81
|
-
moduleRunner;
|
|
82
|
-
constructor(config) {
|
|
83
|
-
this.config = config;
|
|
84
|
-
}
|
|
85
|
-
async importTinybench() {
|
|
86
|
-
return await import('tinybench');
|
|
87
|
-
}
|
|
88
|
-
importFile(filepath, source) {
|
|
89
|
-
if (source === "setup") {
|
|
90
|
-
const moduleNode = getWorkerState().evaluatedModules.getModuleById(filepath);
|
|
91
|
-
if (moduleNode) getWorkerState().evaluatedModules.invalidateModule(moduleNode);
|
|
92
|
-
}
|
|
93
|
-
return this.moduleRunner.import(filepath);
|
|
94
|
-
}
|
|
95
|
-
async runSuite(suite) {
|
|
96
|
-
await runBenchmarkSuite(suite, this);
|
|
97
|
-
}
|
|
98
|
-
async runTask() {
|
|
99
|
-
throw new Error("`test()` and `it()` is only available in test mode.");
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// import type { VitestExecutor } from '../execute'
|
|
104
|
-
// worker context is shared between all tests
|
|
105
|
-
const workerContext = Object.create(null);
|
|
106
|
-
class VitestTestRunner {
|
|
107
|
-
snapshotClient = getSnapshotClient();
|
|
108
|
-
workerState = getWorkerState();
|
|
109
|
-
moduleRunner;
|
|
110
|
-
cancelRun = false;
|
|
111
|
-
assertionsErrors = /* @__PURE__ */ new WeakMap();
|
|
112
|
-
pool = this.workerState.ctx.pool;
|
|
113
|
-
constructor(config) {
|
|
114
|
-
this.config = config;
|
|
115
|
-
}
|
|
116
|
-
importFile(filepath, source) {
|
|
117
|
-
if (source === "setup") {
|
|
118
|
-
const moduleNode = this.workerState.evaluatedModules.getModuleById(filepath);
|
|
119
|
-
if (moduleNode) this.workerState.evaluatedModules.invalidateModule(moduleNode);
|
|
120
|
-
}
|
|
121
|
-
return this.moduleRunner.import(filepath);
|
|
122
|
-
}
|
|
123
|
-
onCollectStart(file) {
|
|
124
|
-
this.workerState.current = file;
|
|
125
|
-
}
|
|
126
|
-
onCleanupWorkerContext(listener) {
|
|
127
|
-
this.workerState.onCleanup(listener);
|
|
128
|
-
}
|
|
129
|
-
onAfterRunFiles() {
|
|
130
|
-
this.snapshotClient.clear(), this.workerState.current = void 0;
|
|
131
|
-
}
|
|
132
|
-
getWorkerContext() {
|
|
133
|
-
return workerContext;
|
|
134
|
-
}
|
|
135
|
-
async onAfterRunSuite(suite) {
|
|
136
|
-
if (this.config.logHeapUsage && typeof process !== "undefined") suite.result.heap = process.memoryUsage().heapUsed;
|
|
137
|
-
if (suite.mode !== "skip" && "filepath" in suite) {
|
|
138
|
-
// mark snapshots in skipped tests as not obsolete
|
|
139
|
-
for (const test of getTests(suite)) if (test.mode === "skip") {
|
|
140
|
-
const name = getNames(test).slice(1).join(" > ");
|
|
141
|
-
this.snapshotClient.skipTest(suite.file.filepath, name);
|
|
142
|
-
}
|
|
143
|
-
const result = await this.snapshotClient.finish(suite.file.filepath);
|
|
144
|
-
if (this.workerState.config.snapshotOptions.updateSnapshot === "none" && result.unchecked) {
|
|
145
|
-
let message = `Obsolete snapshots found when no snapshot update is expected.\n`;
|
|
146
|
-
for (const key of result.uncheckedKeys) message += `· ${key}\n`;
|
|
147
|
-
suite.result.errors ??= [], suite.result.errors.push(processError(new Error(message))), suite.result.state = "fail";
|
|
148
|
-
}
|
|
149
|
-
await rpc().snapshotSaved(result);
|
|
150
|
-
}
|
|
151
|
-
this.workerState.current = suite.suite || suite.file;
|
|
152
|
-
}
|
|
153
|
-
onAfterRunTask(test) {
|
|
154
|
-
if (this.config.logHeapUsage && typeof process !== "undefined") test.result.heap = process.memoryUsage().heapUsed;
|
|
155
|
-
this.workerState.current = test.suite || test.file;
|
|
156
|
-
}
|
|
157
|
-
cancel(_reason) {
|
|
158
|
-
this.cancelRun = true;
|
|
159
|
-
}
|
|
160
|
-
injectValue(key) {
|
|
161
|
-
// inject has a very limiting type controlled by ProvidedContext
|
|
162
|
-
// some tests override it which causes the build to fail
|
|
163
|
-
return inject(key);
|
|
164
|
-
}
|
|
165
|
-
async onBeforeRunTask(test) {
|
|
166
|
-
if (this.cancelRun) test.mode = "skip";
|
|
167
|
-
test.mode !== "run" && test.mode !== "queued" || (this.workerState.current = test);
|
|
168
|
-
}
|
|
169
|
-
async onBeforeRunSuite(suite) {
|
|
170
|
-
if (this.cancelRun) suite.mode = "skip";
|
|
171
|
-
// initialize snapshot state before running file suite
|
|
172
|
-
if (suite.mode !== "skip" && "filepath" in suite) await this.snapshotClient.setup(suite.file.filepath, this.workerState.config.snapshotOptions);
|
|
173
|
-
this.workerState.current = suite;
|
|
174
|
-
}
|
|
175
|
-
onBeforeTryTask(test) {
|
|
176
|
-
clearModuleMocks(this.config), this.snapshotClient.clearTest(test.file.filepath, test.id), setState({
|
|
177
|
-
assertionCalls: 0,
|
|
178
|
-
isExpectingAssertions: false,
|
|
179
|
-
isExpectingAssertionsError: null,
|
|
180
|
-
expectedAssertionsNumber: null,
|
|
181
|
-
expectedAssertionsNumberErrorGen: null,
|
|
182
|
-
currentTestName: getTestName(test),
|
|
183
|
-
snapshotState: this.snapshotClient.getSnapshotState(test.file.filepath)
|
|
184
|
-
}, globalThis[GLOBAL_EXPECT]);
|
|
185
|
-
}
|
|
186
|
-
onAfterTryTask(test) {
|
|
187
|
-
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
188
|
-
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber) throw expectedAssertionsNumberErrorGen();
|
|
189
|
-
if (isExpectingAssertions === true && assertionCalls === 0) throw isExpectingAssertionsError;
|
|
190
|
-
if (this.config.expect.requireAssertions && assertionCalls === 0) throw this.assertionsErrors.get(test);
|
|
191
|
-
}
|
|
192
|
-
extendTaskContext(context) {
|
|
193
|
-
// create error during the test initialization so we have a nice stack trace
|
|
194
|
-
if (this.config.expect.requireAssertions) this.assertionsErrors.set(context.task, /* @__PURE__ */ new Error("expected any number of assertion, but got none"));
|
|
195
|
-
let _expect;
|
|
196
|
-
return Object.defineProperty(context, "expect", { get() {
|
|
197
|
-
if (!_expect) _expect = createExpect(context.task);
|
|
198
|
-
return _expect;
|
|
199
|
-
} }), Object.defineProperty(context, "_local", { get() {
|
|
200
|
-
return _expect != null;
|
|
201
|
-
} }), context;
|
|
202
|
-
}
|
|
203
|
-
getImportDurations() {
|
|
204
|
-
const entries = [...this.workerState.moduleExecutionInfo?.entries() ?? []];
|
|
205
|
-
return Object.fromEntries(entries.map(([filepath, { duration, selfTime }]) => [normalize(filepath), {
|
|
206
|
-
selfTime,
|
|
207
|
-
totalTime: duration
|
|
208
|
-
}]));
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
function clearModuleMocks(config) {
|
|
212
|
-
const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
|
|
213
|
-
// since each function calls another, we can just call one
|
|
214
|
-
if (restoreMocks) vi.restoreAllMocks();
|
|
215
|
-
else if (mockReset) vi.resetAllMocks();
|
|
216
|
-
else if (clearMocks) vi.clearAllMocks();
|
|
217
|
-
if (unstubEnvs) vi.unstubAllEnvs();
|
|
218
|
-
if (unstubGlobals) vi.unstubAllGlobals();
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
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.CyipiPvJ.js';
|
|
2
2
|
import '@vitest/snapshot/environment';
|
|
3
|
-
import './chunks/utils.
|
|
3
|
+
import './chunks/utils.D2R2NiOH.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.CJUa-Hsa.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.D2R2NiOH.js';
|
package/dist/worker.js
CHANGED
|
@@ -8,8 +8,8 @@ import { resolve } from 'pathe';
|
|
|
8
8
|
import { V as VitestTransport } from './chunks/moduleTransport.I-bgQy0S.js';
|
|
9
9
|
import { e as environments } from './chunks/index.DfviD7lX.js';
|
|
10
10
|
import { s as setupInspect } from './chunks/inspector.CvQD-Nie.js';
|
|
11
|
-
import { c as createRuntimeRpc, a as rpcDone } from './chunks/rpc.
|
|
12
|
-
import { i as isChildProcess
|
|
11
|
+
import { c as createRuntimeRpc, a as rpcDone } from './chunks/rpc.BKr6mtxz.js';
|
|
12
|
+
import { i as isChildProcess } from './chunks/utils.D2R2NiOH.js';
|
|
13
13
|
import { d as disposeInternalListeners } from './chunks/utils.C2YI6McM.js';
|
|
14
14
|
import 'node:console';
|
|
15
15
|
import '@vitest/utils';
|
|
@@ -77,7 +77,6 @@ async function cleanup() {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (isChildProcess()) {
|
|
80
|
-
setProcessTitle(`vitest ${workerId}`);
|
|
81
80
|
const isProfiling = process.execArgv.some((execArg) => execArg.startsWith("--prof") || execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof") || execArg.startsWith("--diagnostic-dir"));
|
|
82
81
|
if (isProfiling)
|
|
83
82
|
// Work-around for nodejs/node#55094
|