vitest 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{api-setup.omeaEsoT.js → api-setup.srzH0bDf.js} +1 -1
  4. package/dist/chunks/{integrations-globals.9QpVy4UR.js → integrations-globals.J_6tnlri.js} +2 -2
  5. package/dist/chunks/{runtime-runBaseTests.S8ZSFig3.js → runtime-runBaseTests.QReNMrJA.js} +4 -4
  6. package/dist/cli.js +1 -1
  7. package/dist/config.d.ts +1 -1
  8. package/dist/coverage.d.ts +1 -1
  9. package/dist/environments.d.ts +1 -1
  10. package/dist/execute.d.ts +3 -3
  11. package/dist/execute.js +1 -1
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +3 -3
  14. package/dist/node.d.ts +2 -2
  15. package/dist/node.js +1 -1
  16. package/dist/{reporters-rzC174PQ.d.ts → reporters-1evA5lom.d.ts} +1 -1
  17. package/dist/reporters.d.ts +1 -1
  18. package/dist/runners.d.ts +1 -1
  19. package/dist/runners.js +1 -1
  20. package/dist/{suite-MFRDkZcV.d.ts → suite-ghspeorC.d.ts} +1 -1
  21. package/dist/suite.d.ts +3 -3
  22. package/dist/suite.js +1 -1
  23. package/dist/vendor/{base.4sEqnqgY.js → base.Rmxiv35Y.js} +2 -2
  24. package/dist/vendor/{execute.edwByI27.js → execute.TxmaEFIQ.js} +3 -14
  25. package/dist/vendor/{index.vs_-lzuF.js → index.LgG0iblq.js} +1 -1
  26. package/dist/vendor/{index.kwCLJK4i.js → index.RDKo8czB.js} +1 -1
  27. package/dist/vendor/{node.p6h5JSuL.js → node.Zme77R4t.js} +53 -37
  28. package/dist/vendor/{setup-common.4GIL70qB.js → setup-common.C2iBd0K0.js} +1 -1
  29. package/dist/vendor/{vi.Bw2UL9c9.js → vi.PPwhENHF.js} +6 -4
  30. package/dist/vendor/{vm.9N6CwTZh.js → vm.jVxKtN5R.js} +15 -5
  31. package/dist/workers/forks.js +2 -2
  32. package/dist/workers/runVmTests.js +4 -4
  33. package/dist/workers/threads.js +2 -2
  34. package/dist/workers/vmForks.js +2 -2
  35. package/dist/workers/vmThreads.js +2 -2
  36. package/dist/workers.d.ts +1 -1
  37. package/dist/workers.js +3 -3
  38. package/package.json +9 -8
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-rzC174PQ.js';
2
+ import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-1evA5lom.js';
3
3
  import { VitestExecutor } from './execute.js';
4
4
  import 'vite';
5
5
  import 'vite-node';
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- export { l as loadDiffConfig, s as setupCommonEnv } from './vendor/setup-common.4GIL70qB.js';
2
+ export { l as loadDiffConfig, s as setupCommonEnv } from './vendor/setup-common.C2iBd0K0.js';
3
3
  export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.E7sG1b3r.js';
4
4
  import '@vitest/utils';
5
5
  import './vendor/run-once.Olz_Zkd8.js';
@@ -15,7 +15,7 @@ import { g as getDefaultExportFromCjs } from '../vendor/_commonjsHelpers.jjO7Zip
15
15
  import { isFileServingAllowed } from 'vite';
16
16
  import { A as API_PATH } from '../vendor/constants.i1PoEnhr.js';
17
17
  import '../vendor/index.rJjbcrrp.js';
18
- import { W as WorkspaceProject } from '../vendor/node.p6h5JSuL.js';
18
+ import { W as WorkspaceProject } from '../vendor/node.Zme77R4t.js';
19
19
  import '@vitest/utils';
20
20
  import { parseErrorStacktrace } from '@vitest/utils/source-map';
21
21
  import { a as isPrimitive } from '../vendor/base.QYERqzkH.js';
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from '../vendor/constants.i1PoEnhr.js';
2
- import { V as VitestIndex } from '../vendor/index.vs_-lzuF.js';
2
+ import { V as VitestIndex } from '../vendor/index.LgG0iblq.js';
3
3
  import '@vitest/runner';
4
4
  import '../vendor/benchmark.IlKmJkUU.js';
5
5
  import '@vitest/runner/utils';
@@ -9,7 +9,7 @@ import 'pathe';
9
9
  import 'std-env';
10
10
  import '../vendor/global.CkGT_TMy.js';
11
11
  import '../vendor/run-once.Olz_Zkd8.js';
12
- import '../vendor/vi.Bw2UL9c9.js';
12
+ import '../vendor/vi.PPwhENHF.js';
13
13
  import 'chai';
14
14
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
15
  import '@vitest/expect';
@@ -1,17 +1,17 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests } from '@vitest/runner';
3
3
  import '../vendor/index.rJjbcrrp.js';
4
- import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.Bw2UL9c9.js';
4
+ import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.PPwhENHF.js';
5
5
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
6
- import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.kwCLJK4i.js';
6
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.RDKo8czB.js';
7
7
  import { createRequire } from 'node:module';
8
8
  import util from 'node:util';
9
9
  import timers from 'node:timers';
10
10
  import { isatty } from 'node:tty';
11
11
  import { installSourcemapsSupport } from 'vite-node/source-map';
12
12
  import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
13
- import { V as VitestIndex } from '../vendor/index.vs_-lzuF.js';
14
- import { s as setupCommonEnv } from '../vendor/setup-common.4GIL70qB.js';
13
+ import { V as VitestIndex } from '../vendor/index.LgG0iblq.js';
14
+ import { s as setupCommonEnv } from '../vendor/setup-common.C2iBd0K0.js';
15
15
  import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
16
16
  import 'pathe';
17
17
  import 'std-env';
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { normalize } from 'pathe';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest } from './vendor/node.p6h5JSuL.js';
4
+ import { v as version, s as startVitest } from './vendor/node.Zme77R4t.js';
5
5
  import './vendor/index.rJjbcrrp.js';
6
6
  import { d as divider } from './vendor/reporters.cA9x-5v-.js';
7
7
  import { t as toArray } from './vendor/base.QYERqzkH.js';
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
2
- export { aw as UserConfigExport, av as UserConfigFn, at as UserConfigFnObject, au as UserConfigFnPromise, ay as UserProjectConfigExport, ax as UserProjectConfigFn, a0 as UserWorkspaceConfig, aC as configDefaults, aF as coverageConfigDefaults, aE as defaultExclude, aD as defaultInclude, az as defineConfig, aA as defineProject, aB as defineWorkspace, aG as extraInlineDeps } from './reporters-rzC174PQ.js';
2
+ export { aw as UserConfigExport, av as UserConfigFn, at as UserConfigFnObject, au as UserConfigFnPromise, ay as UserProjectConfigExport, ax as UserProjectConfigFn, a0 as UserWorkspaceConfig, aC as configDefaults, aF as coverageConfigDefaults, aE as defaultExclude, aD as defaultInclude, az as defineConfig, aA as defineProject, aB as defineWorkspace, aG as extraInlineDeps } from './reporters-1evA5lom.js';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
5
5
  import '@vitest/snapshot';
@@ -1,4 +1,4 @@
1
- import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-rzC174PQ.js';
1
+ import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-1evA5lom.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-rzC174PQ.js';
1
+ import { E as Environment } from './reporters-1evA5lom.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/execute.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import vm from 'node:vm';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
3
  import { ViteNodeRunnerOptions } from 'vite-node';
4
- import { aq as PendingSuiteMock, ar as MockFactory, f as RuntimeRPC, p as WorkerGlobalState, as as MockMap } from './reporters-rzC174PQ.js';
4
+ import { aq as PendingSuiteMock, ar as MockFactory, f as RuntimeRPC, p as WorkerGlobalState, as as MockMap } from './reporters-1evA5lom.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
@@ -53,7 +53,7 @@ declare class VitestMocker {
53
53
  resolveMockPath(mockPath: string, external: string | null): string | null;
54
54
  mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
55
55
  unmockPath(path: string): void;
56
- mockPath(originalId: string, path: string, external: string | null, factory: MockFactory | undefined, throwIfExists: boolean): void;
56
+ mockPath(originalId: string, path: string, external: string | null, factory: MockFactory | undefined): void;
57
57
  importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
58
58
  importMock(rawId: string, importee: string): Promise<any>;
59
59
  requestWithMock(url: string, callstack: string[]): Promise<any>;
@@ -106,7 +106,7 @@ declare class ExternalModulesExecutor {
106
106
  constructor(options: ExternalModulesExecutorOptions);
107
107
  importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
108
108
  resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
109
- resolve(specifier: string, parent: string): Promise<string>;
109
+ resolve(specifier: string, parent: string): string;
110
110
  private findNearestPackageData;
111
111
  private wrapCoreSynteticModule;
112
112
  private wrapCommonJsSynteticModule;
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './vendor/execute.edwByI27.js';
1
+ export { V as VitestExecutor } from './vendor/execute.TxmaEFIQ.js';
2
2
  import 'node:vm';
3
3
  import 'node:url';
4
4
  import 'vite-node/client';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
2
  export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- export { b as bench } from './suite-MFRDkZcV.js';
3
+ export { b as bench } from './suite-ghspeorC.js';
4
4
  import { ExpectStatic } from '@vitest/expect';
5
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
- import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, r as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, t as UserConsoleLog, R as ResolvedConfig, u as ModuleGraphData, v as Reporter } from './reporters-rzC174PQ.js';
7
- export { Q as ApiConfig, a9 as ArgumentsType, a8 as Arrayable, a6 as Awaitable, B as BaseCoverageOptions, ao as BenchFunction, am as Benchmark, ap as BenchmarkAPI, an as BenchmarkResult, al as BenchmarkUserOptions, L as BuiltinEnvironment, O as CSSModuleScopeStrategy, y as CollectLineNumbers, z as CollectLines, ab as Constructable, G as Context, o as ContextRPC, a2 as ContextTestEnvironment, ai as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ah as CoverageReporter, aj as CoverageV8Options, ak as CustomProviderOptions, X as DepsOptimizationOptions, E as Environment, S as EnvironmentOptions, ad as EnvironmentReturn, K as HappyDOMOptions, Z as InlineConfig, J as JSDOMOptions, ac as ModuleCache, aa as MutableArray, a7 as Nullable, af as OnServerRestartHandler, H as Pool, I as PoolOptions, $ as ProjectConfig, w as RawErrsMap, ag as ReportContext, a4 as ResolveIdFunction, a as ResolvedCoverageOptions, a3 as ResolvedTestEnvironment, D as RootAndTarget, a1 as RunnerRPC, f as RuntimeRPC, Y as TransformModePatterns, x as TscErrorInfo, _ as TypecheckConfig, U as UserConfig, a0 as UserWorkspaceConfig, e as Vitest, N as VitestEnvironment, V as VitestRunMode, ae as VmEnvironmentReturn, q as WorkerContext, p as WorkerGlobalState, a5 as WorkerRPC } from './reporters-rzC174PQ.js';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, r as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, t as UserConsoleLog, R as ResolvedConfig, u as ModuleGraphData, v as Reporter } from './reporters-1evA5lom.js';
7
+ export { Q as ApiConfig, a9 as ArgumentsType, a8 as Arrayable, a6 as Awaitable, B as BaseCoverageOptions, ao as BenchFunction, am as Benchmark, ap as BenchmarkAPI, an as BenchmarkResult, al as BenchmarkUserOptions, L as BuiltinEnvironment, O as CSSModuleScopeStrategy, y as CollectLineNumbers, z as CollectLines, ab as Constructable, G as Context, o as ContextRPC, a2 as ContextTestEnvironment, ai as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ah as CoverageReporter, aj as CoverageV8Options, ak as CustomProviderOptions, X as DepsOptimizationOptions, E as Environment, S as EnvironmentOptions, ad as EnvironmentReturn, K as HappyDOMOptions, Z as InlineConfig, J as JSDOMOptions, ac as ModuleCache, aa as MutableArray, a7 as Nullable, af as OnServerRestartHandler, H as Pool, I as PoolOptions, $ as ProjectConfig, w as RawErrsMap, ag as ReportContext, a4 as ResolveIdFunction, a as ResolvedCoverageOptions, a3 as ResolvedTestEnvironment, D as RootAndTarget, a1 as RunnerRPC, f as RuntimeRPC, Y as TransformModePatterns, x as TscErrorInfo, _ as TypecheckConfig, U as UserConfig, a0 as UserWorkspaceConfig, e as Vitest, N as VitestEnvironment, V as VitestRunMode, ae as VmEnvironmentReturn, q as WorkerContext, p as WorkerGlobalState, a5 as WorkerRPC } from './reporters-1evA5lom.js';
8
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
9
9
  export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
2
  export { b as bench } from './vendor/benchmark.IlKmJkUU.js';
3
3
  export { i as isFirstRun, a as runOnce } from './vendor/run-once.Olz_Zkd8.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.Bw2UL9c9.js';
5
- import { d as dist } from './vendor/index.vs_-lzuF.js';
6
- export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.vs_-lzuF.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.PPwhENHF.js';
5
+ import { d as dist } from './vendor/index.LgG0iblq.js';
6
+ export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.LgG0iblq.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VitestRunMode, U as UserConfig, d as VitestOptions, e as Vitest, R as ResolvedConfig, P as ProvidedContext, W as WorkspaceProject, f as RuntimeRPC, T as TestSequencer, g as WorkspaceSpec } from './reporters-rzC174PQ.js';
2
- export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, h as ProcessPool, j as TestSequencerConstructor, i as VitestPackageInstaller, s as startVitest } from './reporters-rzC174PQ.js';
1
+ import { V as VitestRunMode, U as UserConfig, d as VitestOptions, e as Vitest, R as ResolvedConfig, P as ProvidedContext, W as WorkspaceProject, f as RuntimeRPC, T as TestSequencer, g as WorkspaceSpec } from './reporters-1evA5lom.js';
2
+ export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, h as ProcessPool, j as TestSequencerConstructor, i as VitestPackageInstaller, s as startVitest } from './reporters-1evA5lom.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseSequencer, b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.p6h5JSuL.js';
1
+ export { B as BaseSequencer, b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.Zme77R4t.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
@@ -893,7 +893,7 @@ declare class Vitest {
893
893
  filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
894
894
  getProjectsByTestFile(file: string): WorkspaceSpec[];
895
895
  initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
896
- runFiles(paths: WorkspaceSpec[]): Promise<void>;
896
+ runFiles(paths: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
897
897
  cancelCurrentRun(reason: CancelReason): Promise<void>;
898
898
  rerunFiles(files?: string[], trigger?: string): Promise<void>;
899
899
  changeProjectName(pattern: string): Promise<void>;
@@ -1,4 +1,4 @@
1
- export { aQ as BaseReporter, aI as BasicReporter, aU as BenchmarkBuiltinReporters, aT as BenchmarkReportsMap, aS as BuiltinReporters, aH as DefaultReporter, aJ as DotReporter, aP as HangingProcessReporter, aN as JUnitReporter, aK as JsonReporter, v as Reporter, aR as ReportersMap, aO as TapFlatReporter, aM as TapReporter, aL as VerboseReporter } from './reporters-rzC174PQ.js';
1
+ export { aQ as BaseReporter, aI as BasicReporter, aU as BenchmarkBuiltinReporters, aT as BenchmarkReportsMap, aS as BuiltinReporters, aH as DefaultReporter, aJ as DotReporter, aP as HangingProcessReporter, aN as JUnitReporter, aK as JsonReporter, v as Reporter, aR as ReportersMap, aO as TapFlatReporter, aM as TapReporter, aL as VerboseReporter } from './reporters-1evA5lom.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-rzC174PQ.js';
2
+ import { R as ResolvedConfig } from './reporters-1evA5lom.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.Bw2UL9c9.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.PPwhENHF.js';
3
3
  import './vendor/index.rJjbcrrp.js';
4
4
  import { r as rpc } from './vendor/rpc.w4v8oCkK.js';
5
5
  import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { ao as BenchFunction, ap as BenchmarkAPI } from './reporters-rzC174PQ.js';
3
+ import { ao as BenchFunction, ap as BenchmarkAPI } from './reporters-1evA5lom.js';
4
4
  import { Options } from 'tinybench';
5
5
 
6
6
  declare function getBenchOptions(key: Custom): Options;
package/dist/suite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
1
+ export { createTaskCollector, getCurrentSuite, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-MFRDkZcV.js';
4
- import './reporters-rzC174PQ.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-ghspeorC.js';
4
+ import './reporters-1evA5lom.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
package/dist/suite.js CHANGED
@@ -1,4 +1,4 @@
1
- export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
1
+ export { createTaskCollector, getCurrentSuite, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
3
  export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.IlKmJkUU.js';
4
4
  import '@vitest/utils';
@@ -1,6 +1,6 @@
1
1
  import { ModuleCacheMap } from 'vite-node/client';
2
2
  import { p as provideWorkerState } from './global.CkGT_TMy.js';
3
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.edwByI27.js';
3
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.TxmaEFIQ.js';
4
4
 
5
5
  let _viteNode;
6
6
  const moduleCache = new ModuleCacheMap();
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
25
25
  ctx.files.forEach((i) => state.moduleCache.delete(i));
26
26
  const [executor, { run }] = await Promise.all([
27
27
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
28
- import('../chunks/runtime-runBaseTests.S8ZSFig3.js')
28
+ import('../chunks/runtime-runBaseTests.QReNMrJA.js')
29
29
  ]);
30
30
  await run(
31
31
  ctx.files,
@@ -2,7 +2,7 @@ import vm from 'node:vm';
2
2
  import { pathToFileURL } from 'node:url';
3
3
  import { ViteNodeRunner, DEFAULT_REQUEST_STUBS } from 'vite-node/client';
4
4
  import { isNodeBuiltin, isInternalRequest, toFilePath, isPrimitive } from 'vite-node/utils';
5
- import { resolve, isAbsolute, dirname, join, basename, extname, relative, normalize } from 'pathe';
5
+ import { resolve, isAbsolute, dirname, join, basename, extname, normalize, relative } from 'pathe';
6
6
  import { processError } from '@vitest/utils/error';
7
7
  import { distDir } from '../path.js';
8
8
  import { existsSync, readdirSync } from 'node:fs';
@@ -118,7 +118,7 @@ class VitestMocker {
118
118
  if (mock.type === "unmock")
119
119
  this.unmockPath(fsPath);
120
120
  if (mock.type === "mock")
121
- this.mockPath(mock.id, fsPath, external, mock.factory, mock.throwIfCached);
121
+ this.mockPath(mock.id, fsPath, external, mock.factory);
122
122
  }));
123
123
  VitestMocker.pendingIds = [];
124
124
  }
@@ -295,19 +295,8 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
295
295
  delete mock[id];
296
296
  this.deleteCachedItem(id);
297
297
  }
298
- mockPath(originalId, path, external, factory, throwIfExists) {
299
- var _a, _b, _c, _d;
298
+ mockPath(originalId, path, external, factory) {
300
299
  const id = this.normalizePath(path);
301
- const { config } = this.executor.state;
302
- const isIsolatedThreads = config.pool === "threads" && (((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) ?? true);
303
- const isIsolatedForks = config.pool === "forks" && (((_d = (_c = config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.isolate) ?? true);
304
- if (throwIfExists && (isIsolatedThreads || isIsolatedForks || config.pool === "vmThreads")) {
305
- const cached = this.moduleCache.has(id) && this.moduleCache.getByModuleId(id);
306
- if (cached && cached.importers.size)
307
- throw new Error(`[vitest] Cannot mock "${originalId}" because it is already loaded by "${[...cached.importers.values()].map((i) => relative(this.root, i)).join('", "')}".
308
-
309
- Please, remove the import if you want static imports to be mocked, or clear module cache by calling "vi.resetModules()" before mocking if you are going to import the file again. See: https://vitest.dev/guide/common-errors.html#cannot-mock-mocked-file-js-because-it-is-already-loaded`);
310
- }
311
300
  const suitefile = this.getSuiteFilepath();
312
301
  const mocks = this.mockMap.get(suitefile) || {};
313
302
  const resolves = this.resolveCache.get(suitefile) || {};
@@ -1,7 +1,7 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
2
  import { b as bench } from './benchmark.IlKmJkUU.js';
3
3
  import { i as isFirstRun, a as runOnce } from './run-once.Olz_Zkd8.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.Bw2UL9c9.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.PPwhENHF.js';
5
5
  import { g as getWorkerState } from './global.CkGT_TMy.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -5,7 +5,7 @@ import { distDir } from '../path.js';
5
5
  import { g as getWorkerState } from './global.CkGT_TMy.js';
6
6
  import { r as rpc } from './rpc.w4v8oCkK.js';
7
7
  import { t as takeCoverageInsideWorker } from './coverage.E7sG1b3r.js';
8
- import { l as loadDiffConfig } from './setup-common.4GIL70qB.js';
8
+ import { l as loadDiffConfig } from './setup-common.C2iBd0K0.js';
9
9
 
10
10
  function setupChaiConfig(config) {
11
11
  Object.assign(chai.config, config);
@@ -64,7 +64,7 @@ function _mergeNamespaces(n, m) {
64
64
  return Object.freeze(n);
65
65
  }
66
66
 
67
- var version$1 = "1.2.1";
67
+ var version$1 = "1.2.2";
68
68
 
69
69
  /*
70
70
  How it works:
@@ -3417,7 +3417,8 @@ function createThreadsPool(ctx, { execArgv, env }) {
3417
3417
  await pool.run(data, { transferList: [workerPort], name });
3418
3418
  } catch (error) {
3419
3419
  if (error instanceof Error && /Failed to terminate worker/.test(error.message))
3420
- ctx.state.addProcessTimeoutCause(`Failed to terminate worker while running ${files.join(", ")}.`);
3420
+ ctx.state.addProcessTimeoutCause(`Failed to terminate worker while running ${files.join(", ")}.
3421
+ See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for troubleshooting.`);
3421
3422
  else if (ctx.isCancelling && error instanceof Error && /The task has been cancelled/.test(error.message))
3422
3423
  ctx.state.cancelFiles(files, ctx.config.root, project.config.name);
3423
3424
  else
@@ -3705,7 +3706,8 @@ function createVmThreadsPool(ctx, { execArgv, env }) {
3705
3706
  await pool.run(data, { transferList: [workerPort], name });
3706
3707
  } catch (error) {
3707
3708
  if (error instanceof Error && /Failed to terminate worker/.test(error.message))
3708
- ctx.state.addProcessTimeoutCause(`Failed to terminate worker while running ${files.join(", ")}.`);
3709
+ ctx.state.addProcessTimeoutCause(`Failed to terminate worker while running ${files.join(", ")}.
3710
+ See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for troubleshooting.`);
3709
3711
  else if (ctx.isCancelling && error instanceof Error && /The task has been cancelled/.test(error.message))
3710
3712
  ctx.state.cancelFiles(files, ctx.config.root, project.config.name);
3711
3713
  else
@@ -4251,7 +4253,7 @@ function createTypecheckPool(ctx) {
4251
4253
  await ctx.report("onTaskUpdate", checker.getTestPacks());
4252
4254
  if (!project.config.typecheck.ignoreSourceErrors)
4253
4255
  sourceErrors.forEach((error) => ctx.state.catchError(error, "Unhandled Source Error"));
4254
- const processError = !hasFailed(files) && checker.getExitCode();
4256
+ const processError = !hasFailed(files) && !sourceErrors.length && checker.getExitCode();
4255
4257
  if (processError) {
4256
4258
  const error = new Error(checker.getOutput());
4257
4259
  error.stack = "";
@@ -6580,7 +6582,7 @@ createLogUpdate(process$2.stdout);
6580
6582
 
6581
6583
  createLogUpdate(process$2.stderr);
6582
6584
 
6583
- var version = "1.2.1";
6585
+ var version = "1.2.2";
6584
6586
 
6585
6587
  const HIGHLIGHT_SUPPORTED_EXTS = new Set(["js", "ts"].flatMap((lang) => [
6586
6588
  `.${lang}`,
@@ -7113,6 +7115,25 @@ ${err.message}`);
7113
7115
  frame: generateCodeFrame(highlightCode(id, code, colors), 4, node.start + 1)
7114
7116
  };
7115
7117
  }
7118
+ function assertNotDefaultExport(node, error) {
7119
+ var _a2;
7120
+ const defaultExport = (_a2 = findNodeAround(ast, node.start, "ExportDefaultDeclaration")) == null ? void 0 : _a2.node;
7121
+ if ((defaultExport == null ? void 0 : defaultExport.declaration) === node || (defaultExport == null ? void 0 : defaultExport.declaration.type) === "AwaitExpression" && defaultExport.declaration.argument === node)
7122
+ throw createSyntaxError(defaultExport, error);
7123
+ }
7124
+ function assertNotNamedExport(node, error) {
7125
+ var _a2;
7126
+ const nodeExported = (_a2 = findNodeAround(ast, node.start, "ExportNamedDeclaration")) == null ? void 0 : _a2.node;
7127
+ if ((nodeExported == null ? void 0 : nodeExported.declaration) === node)
7128
+ throw createSyntaxError(nodeExported, error);
7129
+ }
7130
+ function getVariableDeclaration(node) {
7131
+ var _a2, _b;
7132
+ const declarationNode = (_a2 = findNodeAround(ast, node.start, "VariableDeclaration")) == null ? void 0 : _a2.node;
7133
+ const init = (_b = declarationNode == null ? void 0 : declarationNode.declarations[0]) == null ? void 0 : _b.init;
7134
+ if (init && (init === node || init.type === "AwaitExpression" && init.argument === node))
7135
+ return declarationNode;
7136
+ }
7116
7137
  esmWalker(ast, {
7117
7138
  onIdentifier(id2, info, parentStack) {
7118
7139
  const binding = idToImportMap.get(id2.name);
@@ -7135,28 +7156,25 @@ ${err.message}`);
7135
7156
  }
7136
7157
  },
7137
7158
  onCallExpression(node) {
7138
- var _a2, _b, _c, _d, _e;
7159
+ var _a2;
7139
7160
  if (node.callee.type === "MemberExpression" && isIdentifier(node.callee.object) && (node.callee.object.name === "vi" || node.callee.object.name === "vitest") && isIdentifier(node.callee.property)) {
7140
7161
  const methodName = node.callee.property.name;
7141
- if (methodName === "mock" || methodName === "unmock")
7162
+ if (methodName === "mock" || methodName === "unmock") {
7163
+ const method = `${node.callee.object.name}.${methodName}`;
7164
+ assertNotDefaultExport(node, `Cannot export the result of "${method}". Remove export declaration because "${method}" doesn't return anything.`);
7165
+ const declarationNode = getVariableDeclaration(node);
7166
+ if (declarationNode)
7167
+ assertNotNamedExport(declarationNode, `Cannot export the result of "${method}". Remove export declaration because "${method}" doesn't return anything.`);
7142
7168
  hoistedNodes.push(node);
7169
+ }
7143
7170
  if (methodName === "hoisted") {
7144
- const defaultExport = (_a2 = findNodeAround(ast, node.start, "ExportDefaultDeclaration")) == null ? void 0 : _a2.node;
7145
- if ((defaultExport == null ? void 0 : defaultExport.declaration) === node || (defaultExport == null ? void 0 : defaultExport.declaration.type) === "AwaitExpression" && defaultExport.declaration.argument === node)
7146
- throw createSyntaxError(defaultExport, "Cannot export hoisted variable. You can control hoisting behavior by placing the import from this file first.");
7147
- const declarationNode = (_b = findNodeAround(ast, node.start, "VariableDeclaration")) == null ? void 0 : _b.node;
7148
- const init = (_c = declarationNode == null ? void 0 : declarationNode.declarations[0]) == null ? void 0 : _c.init;
7149
- const isViHoisted = (node2) => {
7150
- return node2.callee.type === "MemberExpression" && isIdentifier(node2.callee.object) && (node2.callee.object.name === "vi" || node2.callee.object.name === "vitest") && isIdentifier(node2.callee.property) && node2.callee.property.name === "hoisted";
7151
- };
7152
- const canMoveDeclaration = init && init.type === "CallExpression" && isViHoisted(init) || init && init.type === "AwaitExpression" && init.argument.type === "CallExpression" && isViHoisted(init.argument);
7153
- if (canMoveDeclaration) {
7154
- const nodeExported = (_d = findNodeAround(ast, declarationNode.start, "ExportNamedDeclaration")) == null ? void 0 : _d.node;
7155
- if ((nodeExported == null ? void 0 : nodeExported.declaration) === declarationNode)
7156
- throw createSyntaxError(nodeExported, "Cannot export hoisted variable. You can control hoisting behavior by placing the import from this file first.");
7171
+ assertNotDefaultExport(node, "Cannot export hoisted variable. You can control hoisting behavior by placing the import from this file first.");
7172
+ const declarationNode = getVariableDeclaration(node);
7173
+ if (declarationNode) {
7174
+ assertNotNamedExport(declarationNode, "Cannot export hoisted variable. You can control hoisting behavior by placing the import from this file first.");
7157
7175
  hoistedNodes.push(declarationNode);
7158
7176
  } else {
7159
- const awaitedExpression = (_e = findNodeAround(ast, node.start, "AwaitExpression")) == null ? void 0 : _e.node;
7177
+ const awaitedExpression = (_a2 = findNodeAround(ast, node.start, "AwaitExpression")) == null ? void 0 : _a2.node;
7160
7178
  hoistedNodes.push((awaitedExpression == null ? void 0 : awaitedExpression.argument) === node ? awaitedExpression : node);
7161
7179
  }
7162
7180
  }
@@ -7378,7 +7396,7 @@ async function createBrowserServer(project, configFile) {
7378
7396
  ]
7379
7397
  });
7380
7398
  await server.listen();
7381
- (await import('../chunks/api-setup.omeaEsoT.js')).setup(project, server);
7399
+ (await import('../chunks/api-setup.srzH0bDf.js')).setup(project, server);
7382
7400
  return server;
7383
7401
  }
7384
7402
 
@@ -8322,9 +8340,8 @@ class Vitest {
8322
8340
  this.config.related = void 0;
8323
8341
  if (files.length) {
8324
8342
  await this.cache.stats.populateStats(this.config.root, files);
8325
- await this.runFiles(files);
8343
+ await this.runFiles(files, true);
8326
8344
  }
8327
- await this.reportCoverage(true);
8328
8345
  if (this.config.watch)
8329
8346
  await this.report("onWatcherStart");
8330
8347
  }
@@ -8332,6 +8349,7 @@ class Vitest {
8332
8349
  const addImports = async ([project, filepath2]) => {
8333
8350
  if (deps.has(filepath2))
8334
8351
  return;
8352
+ deps.add(filepath2);
8335
8353
  const mod = project.server.moduleGraph.getModuleById(filepath2);
8336
8354
  const transformed = (mod == null ? void 0 : mod.ssrTransformResult) || await project.vitenode.transformRequest(filepath2);
8337
8355
  if (!transformed)
@@ -8340,13 +8358,12 @@ class Vitest {
8340
8358
  await Promise.all(dependencies.map(async (dep) => {
8341
8359
  const path = await project.server.pluginContainer.resolveId(dep, filepath2, { ssr: true });
8342
8360
  const fsPath = path && !path.external && path.id.split("?")[0];
8343
- if (fsPath && !fsPath.includes("node_modules") && !deps.has(fsPath) && existsSync(fsPath)) {
8344
- deps.add(fsPath);
8361
+ if (fsPath && !fsPath.includes("node_modules") && !deps.has(fsPath) && existsSync(fsPath))
8345
8362
  await addImports([project, fsPath]);
8346
- }
8347
8363
  }));
8348
8364
  };
8349
8365
  await addImports(filepath);
8366
+ deps.delete(filepath[1]);
8350
8367
  return deps;
8351
8368
  }
8352
8369
  async filterTestsBySource(specs) {
@@ -8397,7 +8414,7 @@ class Vitest {
8397
8414
  for await (const project of projects)
8398
8415
  await project.initializeGlobalSetup();
8399
8416
  }
8400
- async runFiles(paths) {
8417
+ async runFiles(paths, allTestsRun) {
8401
8418
  const filepaths = paths.map(([, file]) => file);
8402
8419
  this.state.collectPaths(filepaths);
8403
8420
  await this.report("onPathsCollected", filepaths);
@@ -8405,12 +8422,15 @@ class Vitest {
8405
8422
  this._onCancelListeners = [];
8406
8423
  this.isCancelling = false;
8407
8424
  this.runningPromise = (async () => {
8425
+ var _a;
8408
8426
  if (!this.pool)
8409
8427
  this.pool = createPool(this);
8410
8428
  const invalidates = Array.from(this.invalidates);
8411
8429
  this.invalidates.clear();
8412
8430
  this.snapshot.clear();
8413
8431
  this.state.clearErrors();
8432
+ if (!this.isFirstRun && this.config.coverage.cleanOnRerun)
8433
+ await ((_a = this.coverageProvider) == null ? void 0 : _a.clean());
8414
8434
  await this.initializeGlobalSetup(paths);
8415
8435
  try {
8416
8436
  await this.pool.runTests(paths, invalidates);
@@ -8425,7 +8445,9 @@ class Vitest {
8425
8445
  })().finally(async () => {
8426
8446
  const specs = Array.from(new Set(paths.map(([, p]) => p)));
8427
8447
  await this.report("onFinished", this.state.getFiles(specs), this.state.getUnhandledErrors());
8448
+ await this.reportCoverage(allTestsRun);
8428
8449
  this.runningPromise = void 0;
8450
+ this.isFirstRun = false;
8429
8451
  });
8430
8452
  return await this.runningPromise;
8431
8453
  }
@@ -8438,11 +8460,8 @@ class Vitest {
8438
8460
  const filteredFiles = await this.globTestFiles([this.filenamePattern]);
8439
8461
  files = files.filter((file) => filteredFiles.some((f) => f[1] === file));
8440
8462
  }
8441
- if (this.coverageProvider && this.config.coverage.cleanOnRerun)
8442
- await this.coverageProvider.clean();
8443
8463
  await this.report("onWatcherRerun", files, trigger);
8444
- await this.runFiles(files.flatMap((file) => this.getProjectsByTestFile(file)));
8445
- await this.reportCoverage(!trigger);
8464
+ await this.runFiles(files.flatMap((file) => this.getProjectsByTestFile(file)), !trigger);
8446
8465
  await this.report("onWatcherStart", this.state.getFiles(files));
8447
8466
  }
8448
8467
  async changeProjectName(pattern) {
@@ -8510,13 +8529,10 @@ class Vitest {
8510
8529
  return;
8511
8530
  }
8512
8531
  this.changedTests.clear();
8513
- if (this.coverageProvider && this.config.coverage.cleanOnRerun)
8514
- await this.coverageProvider.clean();
8515
8532
  const triggerIds = new Set(triggerId.map((id) => relative(this.config.root, id)));
8516
8533
  const triggerLabel = Array.from(triggerIds).join(", ");
8517
8534
  await this.report("onWatcherRerun", files, triggerLabel);
8518
- await this.runFiles(files.flatMap((file) => this.getProjectsByTestFile(file)));
8519
- await this.reportCoverage(false);
8535
+ await this.runFiles(files.flatMap((file) => this.getProjectsByTestFile(file)), false);
8520
8536
  await this.report("onWatcherStart", this.state.getFiles(files));
8521
8537
  }, WATCHER_DEBOUNCE);
8522
8538
  }
@@ -8865,7 +8881,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
8865
8881
  try {
8866
8882
  await ctx.setServer(options, server, userConfig);
8867
8883
  if (options.api && options.watch)
8868
- (await import('../chunks/api-setup.omeaEsoT.js')).setup(ctx);
8884
+ (await import('../chunks/api-setup.srzH0bDf.js')).setup(ctx);
8869
8885
  } catch (err) {
8870
8886
  await ctx.logger.printError(err, { fullStack: true });
8871
8887
  process.exit(1);
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
10
10
  globalSetup = true;
11
11
  setSafeTimers();
12
12
  if (config.globals)
13
- (await import('../chunks/integrations-globals.9QpVy4UR.js')).registerApiGlobally();
13
+ (await import('../chunks/integrations-globals.J_6tnlri.js')).registerApiGlobally();
14
14
  }
15
15
  function setupDefines(defines) {
16
16
  for (const key in defines)
@@ -3036,6 +3036,7 @@ defaultImplementation.install;
3036
3036
  var withGlobal_1 = withGlobal;
3037
3037
 
3038
3038
  class FakeTimers {
3039
+ _global;
3039
3040
  _clock;
3040
3041
  _fakingTime;
3041
3042
  _fakingDate;
@@ -3050,6 +3051,7 @@ class FakeTimers {
3050
3051
  this._fakingDate = false;
3051
3052
  this._fakingTime = false;
3052
3053
  this._fakeTimers = withGlobal_1(global);
3054
+ this._global = global;
3053
3055
  }
3054
3056
  clearAllTimers() {
3055
3057
  if (this._fakingTime)
@@ -3130,11 +3132,11 @@ class FakeTimers {
3130
3132
  throw new Error("process.nextTick cannot be mocked inside child_process");
3131
3133
  const existingFakedMethods = (((_c = this._userConfig) == null ? void 0 : _c.toFake) || toFake).filter((method) => {
3132
3134
  switch (method) {
3133
- case "hrtime":
3134
- case "nextTick":
3135
- return typeof process !== "undefined" && method in process && process[method];
3135
+ case "setImmediate":
3136
+ case "clearImmediate":
3137
+ return method in this._global && this._global[method];
3136
3138
  default:
3137
- return method in globalThis && globalThis[method];
3139
+ return true;
3138
3140
  }
3139
3141
  });
3140
3142
  this._clock = this._fakeTimers.install({
@@ -1,8 +1,8 @@
1
1
  import vm, { isContext } from 'node:vm';
2
- import { pathToFileURL, fileURLToPath } from 'node:url';
2
+ import { fileURLToPath, pathToFileURL } from 'node:url';
3
3
  import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
4
4
  import { createCustomConsole } from '../chunks/runtime-console.Iloo9fIt.js';
5
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.edwByI27.js';
5
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.TxmaEFIQ.js';
6
6
  import { distDir } from '../path.js';
7
7
  import { dirname as dirname$1 } from 'node:path';
8
8
  import { statSync, readFileSync } from 'node:fs';
@@ -54,6 +54,9 @@ class CommonjsExecutor {
54
54
  requiresCache.set(this, _require2);
55
55
  return _require2;
56
56
  }
57
+ static register = () => {
58
+ throw new Error(`[vitest] "register" is not available when running in Vitest.`);
59
+ };
57
60
  _compile(code, filename) {
58
61
  const cjsModule = Module$1.wrap(code);
59
62
  const script = new vm.Script(cjsModule, {
@@ -283,8 +286,13 @@ class EsmExecutor {
283
286
  importModuleDynamically: this.executor.importModuleDynamically,
284
287
  initializeImportMeta: (meta, mod) => {
285
288
  meta.url = mod.identifier;
289
+ if (mod.identifier.startsWith("file:")) {
290
+ const filename = fileURLToPath(mod.identifier);
291
+ meta.filename = filename;
292
+ meta.dirname = dirname$1(filename);
293
+ }
286
294
  meta.resolve = (specifier, importer) => {
287
- return this.executor.resolve(specifier, importer ?? mod.identifier);
295
+ return this.executor.resolve(specifier, importer != null ? importer.toString() : mod.identifier);
288
296
  };
289
297
  }
290
298
  }
@@ -493,10 +501,12 @@ class ExternalModulesExecutor {
493
501
  return this.esm.evaluateModule(module);
494
502
  };
495
503
  resolveModule = async (specifier, referencer) => {
496
- const identifier = await this.resolve(specifier, referencer);
504
+ let identifier = this.resolve(specifier, referencer);
505
+ if (identifier instanceof Promise)
506
+ identifier = await identifier;
497
507
  return await this.createModule(identifier);
498
508
  };
499
- async resolve(specifier, parent) {
509
+ resolve(specifier, parent) {
500
510
  for (const resolver of this.resolvers) {
501
511
  const id = resolver(specifier, parent);
502
512
  if (id)
@@ -1,10 +1,10 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createForksRpcOptions, u as unwrapForksConfig } from '../vendor/utils.GbToHGHI.js';
3
- import { r as runBaseTests } from '../vendor/base.4sEqnqgY.js';
3
+ import { r as runBaseTests } from '../vendor/base.Rmxiv35Y.js';
4
4
  import '@vitest/utils';
5
5
  import 'vite-node/client';
6
6
  import '../vendor/global.CkGT_TMy.js';
7
- import '../vendor/execute.edwByI27.js';
7
+ import '../vendor/execute.TxmaEFIQ.js';
8
8
  import 'node:vm';
9
9
  import 'node:url';
10
10
  import 'vite-node/utils';
@@ -5,11 +5,11 @@ import timers from 'node:timers';
5
5
  import { performance } from 'node:perf_hooks';
6
6
  import { startTests } from '@vitest/runner';
7
7
  import { setupColors, createColors } from '@vitest/utils';
8
- import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.kwCLJK4i.js';
8
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.RDKo8czB.js';
9
9
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
10
10
  import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
11
- import { V as VitestIndex } from '../vendor/index.vs_-lzuF.js';
12
- import { s as setupCommonEnv } from '../vendor/setup-common.4GIL70qB.js';
11
+ import { V as VitestIndex } from '../vendor/index.LgG0iblq.js';
12
+ import { s as setupCommonEnv } from '../vendor/setup-common.C2iBd0K0.js';
13
13
  import 'chai';
14
14
  import '@vitest/snapshot/environment';
15
15
  import 'pathe';
@@ -22,7 +22,7 @@ import '@vitest/runner/utils';
22
22
  import '../vendor/index.rJjbcrrp.js';
23
23
  import 'std-env';
24
24
  import '../vendor/run-once.Olz_Zkd8.js';
25
- import '../vendor/vi.Bw2UL9c9.js';
25
+ import '../vendor/vi.PPwhENHF.js';
26
26
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
27
27
  import '@vitest/expect';
28
28
  import '@vitest/snapshot';
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests } from '../vendor/base.4sEqnqgY.js';
1
+ import { r as runBaseTests } from '../vendor/base.Rmxiv35Y.js';
2
2
  import { a as createThreadsRpcOptions } from '../vendor/utils.GbToHGHI.js';
3
3
  import 'vite-node/client';
4
4
  import '../vendor/global.CkGT_TMy.js';
5
- import '../vendor/execute.edwByI27.js';
5
+ import '../vendor/execute.TxmaEFIQ.js';
6
6
  import 'node:vm';
7
7
  import 'node:url';
8
8
  import 'vite-node/utils';
@@ -1,6 +1,6 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createForksRpcOptions, u as unwrapForksConfig } from '../vendor/utils.GbToHGHI.js';
3
- import { r as runVmTests } from '../vendor/vm.9N6CwTZh.js';
3
+ import { r as runVmTests } from '../vendor/vm.jVxKtN5R.js';
4
4
  import '@vitest/utils';
5
5
  import 'node:vm';
6
6
  import 'node:url';
@@ -10,7 +10,7 @@ import 'node:stream';
10
10
  import 'node:console';
11
11
  import 'node:path';
12
12
  import '../vendor/date.Ns1pGd_X.js';
13
- import '../vendor/execute.edwByI27.js';
13
+ import '../vendor/execute.TxmaEFIQ.js';
14
14
  import 'vite-node/client';
15
15
  import 'vite-node/utils';
16
16
  import '@vitest/utils/error';
@@ -1,5 +1,5 @@
1
1
  import { a as createThreadsRpcOptions } from '../vendor/utils.GbToHGHI.js';
2
- import { r as runVmTests } from '../vendor/vm.9N6CwTZh.js';
2
+ import { r as runVmTests } from '../vendor/vm.jVxKtN5R.js';
3
3
  import '@vitest/utils';
4
4
  import 'node:vm';
5
5
  import 'node:url';
@@ -9,7 +9,7 @@ import 'node:stream';
9
9
  import 'node:console';
10
10
  import 'node:path';
11
11
  import '../vendor/date.Ns1pGd_X.js';
12
- import '../vendor/execute.edwByI27.js';
12
+ import '../vendor/execute.TxmaEFIQ.js';
13
13
  import 'vite-node/client';
14
14
  import 'vite-node/utils';
15
15
  import '@vitest/utils/error';
package/dist/workers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v8 from 'v8';
2
- import { n as BirpcOptions, f as RuntimeRPC, o as ContextRPC, p as WorkerGlobalState, q as WorkerContext, R as ResolvedConfig } from './reporters-rzC174PQ.js';
2
+ import { n as BirpcOptions, f as RuntimeRPC, o as ContextRPC, p as WorkerGlobalState, q as WorkerContext, R as ResolvedConfig } from './reporters-1evA5lom.js';
3
3
  import { Awaitable } from '@vitest/utils';
4
4
  import 'vite';
5
5
  import '@vitest/runner';
package/dist/workers.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapForksConfig } from './vendor/utils.GbToHGHI.js';
2
2
  export { p as provideWorkerState } from './vendor/global.CkGT_TMy.js';
3
3
  export { run as runVitestWorker } from './worker.js';
4
- export { r as runVmTests } from './vendor/vm.9N6CwTZh.js';
5
- export { r as runBaseTests } from './vendor/base.4sEqnqgY.js';
4
+ export { r as runVmTests } from './vendor/vm.jVxKtN5R.js';
5
+ export { r as runBaseTests } from './vendor/base.Rmxiv35Y.js';
6
6
  import '@vitest/utils';
7
7
  import 'node:url';
8
8
  import 'tinypool';
@@ -19,7 +19,7 @@ import './chunks/runtime-console.Iloo9fIt.js';
19
19
  import 'node:stream';
20
20
  import 'node:path';
21
21
  import './vendor/date.Ns1pGd_X.js';
22
- import './vendor/execute.edwByI27.js';
22
+ import './vendor/execute.TxmaEFIQ.js';
23
23
  import 'vite-node/utils';
24
24
  import '@vitest/utils/error';
25
25
  import './path.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.2.2",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -148,15 +148,15 @@
148
148
  "std-env": "^3.5.0",
149
149
  "strip-literal": "^1.3.0",
150
150
  "tinybench": "^2.5.1",
151
- "tinypool": "^0.8.1",
151
+ "tinypool": "^0.8.2",
152
152
  "vite": "^5.0.0",
153
153
  "why-is-node-running": "^2.2.2",
154
- "@vitest/expect": "1.2.1",
155
- "@vitest/snapshot": "1.2.1",
156
- "@vitest/runner": "1.2.1",
157
- "@vitest/spy": "1.2.1",
158
- "vite-node": "1.2.1",
159
- "@vitest/utils": "1.2.1"
154
+ "@vitest/expect": "1.2.2",
155
+ "@vitest/spy": "1.2.2",
156
+ "@vitest/snapshot": "1.2.2",
157
+ "@vitest/runner": "1.2.2",
158
+ "@vitest/utils": "1.2.2",
159
+ "vite-node": "1.2.2"
160
160
  },
161
161
  "devDependencies": {
162
162
  "@ampproject/remapping": "^2.2.1",
@@ -168,6 +168,7 @@
168
168
  "@types/istanbul-reports": "^3.0.4",
169
169
  "@types/jsdom": "^21.1.6",
170
170
  "@types/micromatch": "^4.0.6",
171
+ "@types/node": "^20.11.5",
171
172
  "@types/prompts": "^2.4.9",
172
173
  "@types/sinonjs__fake-timers": "^8.1.5",
173
174
  "birpc": "0.2.14",