vitest 3.2.0-beta.1 → 3.2.0-beta.3
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 +0 -232
- package/dist/browser.d.ts +5 -3
- package/dist/browser.js +3 -4
- package/dist/chunks/{base.SfTiRNZf.js → base.D4119yLM.js} +4 -3
- package/dist/chunks/{benchmark.BoF7jW0Q.js → benchmark.Cf_PACH1.js} +1 -1
- package/dist/chunks/{cac.TfX2-DVH.js → cac.DWaWHIIE.js} +21 -16
- package/dist/chunks/{cli-api.2970Nj9J.js → cli-api.CnmEXkxs.js} +292 -59
- package/dist/chunks/{config.d.UqE-KR0o.d.ts → config.d.D2ROskhv.d.ts} +2 -0
- package/dist/chunks/{console.K1NMVOSc.js → console.Cwr-MFPV.js} +3 -2
- package/dist/chunks/{constants.BZZyIeIE.js → constants.DnKduX2e.js} +1 -0
- package/dist/chunks/{coverage.z0LVMxgb.js → coverage.C73DaDgS.js} +241 -4226
- package/dist/chunks/{creator.CuL7xDWI.js → creator.C8WKy2eW.js} +26 -44
- package/dist/chunks/{date.CDOsz-HY.js → date.ByMsSlOr.js} +25 -0
- package/dist/chunks/{defaults.DSxsTG0h.js → defaults.DpVH7vbg.js} +1 -0
- package/dist/chunks/{environment.d.D8YDy2v5.d.ts → environment.d.cL3nLXbE.d.ts} +1 -0
- package/dist/chunks/{execute.BpmIjFTD.js → execute.B3q-2LPV.js} +28 -5
- package/dist/chunks/{global.d.BCOHQEpR.d.ts → global.d.BNLIi6yo.d.ts} +13 -11
- package/dist/chunks/{globals.Cg4NtV4P.js → globals.CI21aWXF.js} +7 -7
- package/dist/chunks/{index.DFXFpH3w.js → index.2jgTs_Q5.js} +19 -1
- package/dist/chunks/{index.CUacZlWG.js → index.Bter3jj9.js} +954 -954
- package/dist/chunks/{index.DbWBPwtH.js → index.CbT4iuwc.js} +7 -4
- package/dist/chunks/index.D3XRDfWc.js +213 -0
- package/dist/chunks/{index.BPc7M5ni.js → index.DNgLEKsQ.js} +5 -15
- package/dist/chunks/index.JOzufsrU.js +276 -0
- package/dist/chunks/{index.DBIGubLC.js → index.X0nbfr6-.js} +7 -7
- package/dist/chunks/{inspector.DbDkSkFn.js → inspector.BFsh5KO0.js} +3 -0
- package/dist/chunks/{node.3xsWotC9.js → node.Be-ntJnD.js} +1 -1
- package/dist/chunks/{reporters.d.DGm4k1Wx.d.ts → reporters.d.Bt4IGtsa.d.ts} +41 -6
- package/dist/chunks/{rpc.D9_013TY.js → rpc.BKExFSRG.js} +2 -1
- package/dist/chunks/{runBaseTests.CguliJB5.js → runBaseTests.B_M1TTsK.js} +19 -11
- package/dist/chunks/{setup-common.BP6KrF_Z.js → setup-common.CF-O-dZX.js} +2 -3
- package/dist/chunks/typechecker.BgzF-6iO.js +954 -0
- package/dist/chunks/{utils.CgTj3MsC.js → utils.BlI4TC7Y.js} +1 -0
- package/dist/chunks/{utils.BfxieIyZ.js → utils.DPCq3gzW.js} +3 -0
- package/dist/chunks/{vi.BFR5YIgu.js → vi.pkoYCV6A.js} +25 -2
- package/dist/chunks/{vite.d.DjP_ALCZ.d.ts → vite.d.B-Kx3KCF.d.ts} +3 -1
- package/dist/chunks/{vm.CuLHT1BG.js → vm.DPYem2so.js} +72 -4
- package/dist/chunks/{worker.d.CoCI7hzP.d.ts → worker.d.BKbBp2ga.d.ts} +2 -2
- package/dist/chunks/{worker.d.D5Xdi-Zr.d.ts → worker.d.Bl1O4kuf.d.ts} +1 -1
- package/dist/cli.js +21 -2
- package/dist/config.cjs +2 -0
- package/dist/config.d.ts +7 -6
- package/dist/config.js +2 -2
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +7 -10
- package/dist/environments.d.ts +6 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +9 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +25 -35
- package/dist/index.js +5 -6
- package/dist/node.d.ts +18 -10
- package/dist/node.js +22 -22
- package/dist/reporters.d.ts +4 -4
- package/dist/reporters.js +14 -14
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +13 -5
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +9 -5
- package/dist/workers/forks.js +6 -4
- package/dist/workers/runVmTests.js +14 -10
- 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 +4 -4
- package/dist/workers.js +10 -10
- package/package.json +22 -26
- package/dist/chunks/index.Bw6JxgX8.js +0 -143
- package/dist/chunks/run-once.Dimr7O9f.js +0 -47
- package/dist/chunks/typechecker.DYQbn8uK.js +0 -956
- package/dist/chunks/utils.8gfOgtry.js +0 -207
- package/dist/utils.d.ts +0 -3
- package/dist/utils.js +0 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Task, TaskMeta, Suite, File, TaskResultPack, SequenceSetupFiles, SequenceHooks, CancelReason } from '@vitest/runner';
|
|
2
|
-
import { b as Awaitable, U as UserConsoleLog, c as Arrayable$1, A as AfterSuiteRunMeta, L as LabelColor, f as EnvironmentOptions, P as ProvidedContext } from './environment.d.
|
|
2
|
+
import { b as Awaitable, U as UserConsoleLog, c as Arrayable$1, A as AfterSuiteRunMeta, L as LabelColor, f as EnvironmentOptions, P as ProvidedContext } from './environment.d.cL3nLXbE.js';
|
|
3
3
|
import { ParsedStack, TestError, SerializedError, ErrorWithDiff, Arrayable, Awaitable as Awaitable$1 } from '@vitest/utils';
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
5
|
import { TransformResult as TransformResult$1, UserConfig as UserConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions, ViteDevServer, ModuleNode } from 'vite';
|
|
6
6
|
import { Console } from 'node:console';
|
|
7
7
|
import { MockedModule } from '@vitest/mocker';
|
|
8
8
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
9
|
-
import { T as TestExecutionMethod } from './worker.d.
|
|
10
|
-
import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.
|
|
9
|
+
import { T as TestExecutionMethod } from './worker.d.BKbBp2ga.js';
|
|
10
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.D2ROskhv.js';
|
|
11
11
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
12
12
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
13
13
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
@@ -714,7 +714,6 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
714
714
|
onHookStart(hook: ReportedHookContext): void;
|
|
715
715
|
onHookEnd(hook: ReportedHookContext): void;
|
|
716
716
|
onInit(ctx: Vitest): void;
|
|
717
|
-
onPathsCollected(paths?: string[]): void;
|
|
718
717
|
onTestRunEnd(): void;
|
|
719
718
|
}
|
|
720
719
|
|
|
@@ -826,6 +825,9 @@ declare class FileCoverage implements FileCoverageData {
|
|
|
826
825
|
b: { [key: string]: number[] };
|
|
827
826
|
}
|
|
828
827
|
|
|
828
|
+
// for compatibility reasons, the reporter produces a JSON similar to the one produced by the Jest JSON reporter
|
|
829
|
+
// the following types are extracted from the Jest repository (and simplified)
|
|
830
|
+
// the commented-out fields are the missing ones
|
|
829
831
|
type Status = "passed" | "failed" | "skipped" | "pending" | "todo" | "disabled";
|
|
830
832
|
type Milliseconds = number;
|
|
831
833
|
interface Callsite {
|
|
@@ -946,8 +948,13 @@ declare class DotReporter extends BaseReporter {
|
|
|
946
948
|
private createSummary;
|
|
947
949
|
}
|
|
948
950
|
|
|
951
|
+
interface GithubActionsReporterOptions {
|
|
952
|
+
onWritePath?: (path: string) => string;
|
|
953
|
+
}
|
|
949
954
|
declare class GithubActionsReporter implements Reporter {
|
|
950
955
|
ctx: Vitest;
|
|
956
|
+
options: GithubActionsReporterOptions;
|
|
957
|
+
constructor(options?: GithubActionsReporterOptions);
|
|
951
958
|
onInit(ctx: Vitest): void;
|
|
952
959
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
953
960
|
}
|
|
@@ -1425,6 +1432,7 @@ interface Thresholds {
|
|
|
1425
1432
|
}
|
|
1426
1433
|
|
|
1427
1434
|
type BuiltinEnvironment = "node" | "jsdom" | "happy-dom" | "edge-runtime";
|
|
1435
|
+
// Record is used, so user can get intellisense for builtin environments, but still allow custom environments
|
|
1428
1436
|
type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
1429
1437
|
|
|
1430
1438
|
type CSSModuleScopeStrategy = "stable" | "scoped" | "non-scoped";
|
|
@@ -1444,6 +1452,15 @@ interface SequenceOptions {
|
|
|
1444
1452
|
*/
|
|
1445
1453
|
sequencer?: TestSequencerConstructor;
|
|
1446
1454
|
/**
|
|
1455
|
+
* Controls the order in which this project runs its tests when using multiple [projects](/guide/projects).
|
|
1456
|
+
*
|
|
1457
|
+
* - Projects with the same group order number will run together, and groups are run from lowest to highest.
|
|
1458
|
+
* - If you don’t set this option, all projects run in parallel.
|
|
1459
|
+
* - If several projects use the same group order, they will run at the same time.
|
|
1460
|
+
* @default 0
|
|
1461
|
+
*/
|
|
1462
|
+
groupOrder?: number;
|
|
1463
|
+
/**
|
|
1447
1464
|
* Should files and tests run in random order.
|
|
1448
1465
|
* @default false
|
|
1449
1466
|
*/
|
|
@@ -2164,6 +2181,11 @@ interface TypecheckConfig {
|
|
|
2164
2181
|
* Path to tsconfig, relative to the project root.
|
|
2165
2182
|
*/
|
|
2166
2183
|
tsconfig?: string;
|
|
2184
|
+
/**
|
|
2185
|
+
* Minimum time in milliseconds it takes to spawn the typechecker.
|
|
2186
|
+
* @default 10_000
|
|
2187
|
+
*/
|
|
2188
|
+
spawnTimeout?: number;
|
|
2167
2189
|
}
|
|
2168
2190
|
interface UserConfig extends InlineConfig {
|
|
2169
2191
|
/**
|
|
@@ -2277,6 +2299,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
2277
2299
|
shuffle?: boolean
|
|
2278
2300
|
concurrent?: boolean
|
|
2279
2301
|
seed: number
|
|
2302
|
+
groupOrder: number
|
|
2280
2303
|
};
|
|
2281
2304
|
typecheck: Omit<TypecheckConfig, "enabled"> & {
|
|
2282
2305
|
enabled: boolean
|
|
@@ -2341,6 +2364,7 @@ interface BrowserProvider {
|
|
|
2341
2364
|
openPage: (sessionId: string, url: string, beforeNavigate?: () => Promise<void>) => Promise<void>;
|
|
2342
2365
|
getCDPSession?: (sessionId: string) => Promise<CDPSession>;
|
|
2343
2366
|
close: () => Awaitable$1<void>;
|
|
2367
|
+
// eslint-disable-next-line ts/method-signature-style -- we want to allow extended options
|
|
2344
2368
|
initialize(ctx: TestProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
|
|
2345
2369
|
}
|
|
2346
2370
|
interface BrowserProviderModule {
|
|
@@ -2598,6 +2622,14 @@ declare class TestProject {
|
|
|
2598
2622
|
private _provided;
|
|
2599
2623
|
constructor(path: string | number, vitest: Vitest, options?: InitializeProjectOptions | undefined);
|
|
2600
2624
|
/**
|
|
2625
|
+
* The unique hash of this project. This value is consistent between the reruns.
|
|
2626
|
+
*
|
|
2627
|
+
* It is based on the root of the project (not consistent between OS) and its name.
|
|
2628
|
+
*/
|
|
2629
|
+
get hash(): string;
|
|
2630
|
+
// "provide" is a property, not a method to keep the context when destructed in the global setup,
|
|
2631
|
+
// making it a method would be a breaking change, and can be done in Vitest 3 at minimum
|
|
2632
|
+
/**
|
|
2601
2633
|
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
2602
2634
|
*/
|
|
2603
2635
|
provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
|
|
@@ -2648,6 +2680,7 @@ declare class TestProject {
|
|
|
2648
2680
|
teardownGlobalSetup(): Promise<void>;
|
|
2649
2681
|
/** @deprecated use `vitest.logger` instead */
|
|
2650
2682
|
get logger(): Logger;
|
|
2683
|
+
// it's possible that file path was imported with different queries (?raw, ?url, etc)
|
|
2651
2684
|
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
2652
2685
|
getModulesByFilepath(file: string): Set<ModuleNode>;
|
|
2653
2686
|
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
@@ -2698,6 +2731,7 @@ declare class TestProject {
|
|
|
2698
2731
|
getName(): string;
|
|
2699
2732
|
/** @deprecated internal */
|
|
2700
2733
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
2734
|
+
private _setHash;
|
|
2701
2735
|
private _serializeOverriddenConfig;
|
|
2702
2736
|
private clearTmpDir;
|
|
2703
2737
|
/** @deprecated */
|
|
@@ -2862,7 +2896,7 @@ declare class Vitest {
|
|
|
2862
2896
|
private _cache?;
|
|
2863
2897
|
private _snapshot?;
|
|
2864
2898
|
private _workspaceConfigPath?;
|
|
2865
|
-
constructor(mode: VitestRunMode, options?: VitestOptions);
|
|
2899
|
+
constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
|
|
2866
2900
|
private _onRestartListeners;
|
|
2867
2901
|
private _onClose;
|
|
2868
2902
|
private _onSetServer;
|
|
@@ -2897,7 +2931,7 @@ declare class Vitest {
|
|
|
2897
2931
|
*/
|
|
2898
2932
|
get cache(): VitestCache;
|
|
2899
2933
|
/** @deprecated internal */
|
|
2900
|
-
setServer(options: UserConfig, server: ViteDevServer
|
|
2934
|
+
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
2901
2935
|
/**
|
|
2902
2936
|
* Inject new test projects into the workspace.
|
|
2903
2937
|
* @param config Glob, config path or a custom config options.
|
|
@@ -3029,6 +3063,7 @@ declare class Vitest {
|
|
|
3029
3063
|
*/
|
|
3030
3064
|
resetGlobalTestNamePattern(): void;
|
|
3031
3065
|
private _rerunTimer;
|
|
3066
|
+
// we can't use a single `triggerId` yet because vscode extension relies on this
|
|
3032
3067
|
private scheduleRerun;
|
|
3033
3068
|
/**
|
|
3034
3069
|
* Invalidate a file in all projects.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSafeTimers } from '@vitest/utils';
|
|
2
2
|
import { c as createBirpc } from './index.CJ0plNrh.js';
|
|
3
|
-
import { g as getWorkerState } from './utils.
|
|
3
|
+
import { g as getWorkerState } from './utils.BlI4TC7Y.js';
|
|
4
4
|
|
|
5
5
|
const { get } = Reflect;
|
|
6
6
|
function withSafeTimers(fn) {
|
|
@@ -56,6 +56,7 @@ function createRuntimeRpc(options) {
|
|
|
56
56
|
if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId") {
|
|
57
57
|
message += ` with "${JSON.stringify(args)}"`;
|
|
58
58
|
}
|
|
59
|
+
// JSON.stringify cannot serialize Error instances
|
|
59
60
|
if (functionName === "onUnhandledError") {
|
|
60
61
|
message += ` with "${args[0]?.message || args[0]}"`;
|
|
61
62
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
4
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.
|
|
5
|
-
import { a as globalExpect, v as vi } from './vi.
|
|
6
|
-
import { c as closeInspector } from './inspector.
|
|
3
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.CbT4iuwc.js';
|
|
4
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.CF-O-dZX.js';
|
|
5
|
+
import { a as globalExpect, v as vi } from './vi.pkoYCV6A.js';
|
|
6
|
+
import { c as closeInspector } from './inspector.BFsh5KO0.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import timers from 'node:timers';
|
|
9
9
|
import timersPromises from 'node:timers/promises';
|
|
@@ -11,27 +11,27 @@ import util from 'node:util';
|
|
|
11
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
12
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
13
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
14
|
-
import { V as VitestIndex } from './index.
|
|
15
|
-
import { g as getWorkerState, r as resetModules } from './utils.
|
|
14
|
+
import { V as VitestIndex } from './index.DNgLEKsQ.js';
|
|
15
|
+
import { g as getWorkerState, r as resetModules } from './utils.BlI4TC7Y.js';
|
|
16
16
|
import 'chai';
|
|
17
17
|
import 'node:path';
|
|
18
18
|
import '../path.js';
|
|
19
19
|
import 'node:url';
|
|
20
|
-
import './rpc.
|
|
20
|
+
import './rpc.BKExFSRG.js';
|
|
21
21
|
import './index.CJ0plNrh.js';
|
|
22
22
|
import './coverage.0iPg4Wrz.js';
|
|
23
23
|
import '@vitest/snapshot';
|
|
24
|
-
import './run-once.Dimr7O9f.js';
|
|
25
24
|
import '@vitest/expect';
|
|
26
25
|
import '@vitest/runner/utils';
|
|
27
26
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
28
27
|
import '@vitest/utils/error';
|
|
29
28
|
import '@vitest/spy';
|
|
30
29
|
import '@vitest/utils/source-map';
|
|
31
|
-
import './date.
|
|
32
|
-
import './benchmark.
|
|
30
|
+
import './date.ByMsSlOr.js';
|
|
31
|
+
import './benchmark.Cf_PACH1.js';
|
|
33
32
|
import 'expect-type';
|
|
34
33
|
|
|
34
|
+
// this should only be used in Node
|
|
35
35
|
let globalSetup = false;
|
|
36
36
|
async function setupGlobalEnv(config, { environment }, executor) {
|
|
37
37
|
await setupCommonEnv(config);
|
|
@@ -49,10 +49,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
49
49
|
globalSetup = true;
|
|
50
50
|
if (environment.transformMode === "web") {
|
|
51
51
|
const _require = createRequire(import.meta.url);
|
|
52
|
+
// always mock "required" `css` files, because we cannot process them
|
|
52
53
|
_require.extensions[".css"] = resolveCss;
|
|
53
54
|
_require.extensions[".scss"] = resolveCss;
|
|
54
55
|
_require.extensions[".sass"] = resolveCss;
|
|
55
56
|
_require.extensions[".less"] = resolveCss;
|
|
57
|
+
// since we are using Vite, we can assume how these will be resolved
|
|
56
58
|
KNOWN_ASSET_TYPES.forEach((type) => {
|
|
57
59
|
_require.extensions[`.${type}`] = resolveAsset;
|
|
58
60
|
});
|
|
@@ -60,6 +62,7 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
60
62
|
} else {
|
|
61
63
|
process.env.SSR = "1";
|
|
62
64
|
}
|
|
65
|
+
// @ts-expect-error not typed global for patched timers
|
|
63
66
|
globalThis.__vitest_required__ = {
|
|
64
67
|
util,
|
|
65
68
|
timers,
|
|
@@ -77,22 +80,25 @@ function resolveAsset(mod, url) {
|
|
|
77
80
|
mod.exports = url;
|
|
78
81
|
}
|
|
79
82
|
async function setupConsoleLogSpy() {
|
|
80
|
-
const { createCustomConsole } = await import('./console.
|
|
83
|
+
const { createCustomConsole } = await import('./console.Cwr-MFPV.js');
|
|
81
84
|
globalThis.console = createCustomConsole();
|
|
82
85
|
}
|
|
83
86
|
async function withEnv({ environment }, options, fn) {
|
|
87
|
+
// @ts-expect-error untyped global
|
|
84
88
|
globalThis.__vitest_environment__ = environment.name;
|
|
85
89
|
globalExpect.setState({ environment: environment.name });
|
|
86
90
|
const env = await environment.setup(globalThis, options);
|
|
87
91
|
try {
|
|
88
92
|
await fn();
|
|
89
93
|
} finally {
|
|
94
|
+
// Run possible setTimeouts, e.g. the onces used by ConsoleLogSpy
|
|
90
95
|
const { setTimeout } = getSafeTimers();
|
|
91
96
|
await new Promise((resolve) => setTimeout(resolve));
|
|
92
97
|
await env.teardown(globalThis);
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
// browser shouldn't call this!
|
|
96
102
|
async function run(method, files, config, environment, executor) {
|
|
97
103
|
const workerState = getWorkerState();
|
|
98
104
|
const isIsolatedThreads = config.pool === "threads" && (config.poolOptions?.threads?.isolate ?? true);
|
|
@@ -123,7 +129,9 @@ async function run(method, files, config, environment, executor) {
|
|
|
123
129
|
} else {
|
|
124
130
|
await collectTests([file], runner);
|
|
125
131
|
}
|
|
132
|
+
// reset after tests, because user might call `vi.setConfig` in setupFile
|
|
126
133
|
vi.resetConfig();
|
|
134
|
+
// mocks should not affect different files
|
|
127
135
|
vi.restoreAllMocks();
|
|
128
136
|
}
|
|
129
137
|
await stopCoverageInsideWorker(config.coverage, executor, { isolate });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { r as resolveCoverageProviderModule } from './coverage.0iPg4Wrz.js';
|
|
2
2
|
import { addSerializer } from '@vitest/snapshot';
|
|
3
3
|
import { setSafeTimers } from '@vitest/utils';
|
|
4
|
-
import { r as resetRunOnceCounter } from './run-once.Dimr7O9f.js';
|
|
5
4
|
|
|
6
5
|
async function startCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
7
6
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
@@ -27,7 +26,6 @@ async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
|
27
26
|
|
|
28
27
|
let globalSetup = false;
|
|
29
28
|
async function setupCommonEnv(config) {
|
|
30
|
-
resetRunOnceCounter();
|
|
31
29
|
setupDefines(config.defines);
|
|
32
30
|
setupEnv(config.env);
|
|
33
31
|
if (globalSetup) {
|
|
@@ -36,7 +34,7 @@ async function setupCommonEnv(config) {
|
|
|
36
34
|
globalSetup = true;
|
|
37
35
|
setSafeTimers();
|
|
38
36
|
if (config.globals) {
|
|
39
|
-
(await import('./globals.
|
|
37
|
+
(await import('./globals.CI21aWXF.js')).registerApiGlobally();
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
function setupDefines(defines) {
|
|
@@ -48,6 +46,7 @@ function setupEnv(env) {
|
|
|
48
46
|
if (typeof process === "undefined") {
|
|
49
47
|
return;
|
|
50
48
|
}
|
|
49
|
+
// same boolean-to-string assignment as VitestPlugin.configResolved
|
|
51
50
|
const { PROD, DEV,...restEnvs } = env;
|
|
52
51
|
process.env.PROD = PROD ? "1" : "";
|
|
53
52
|
process.env.DEV = DEV ? "1" : "";
|