vitest 1.1.1 → 1.1.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/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule } from './reporters-O4LBziQ_.js';
2
+ import { R as ResolvedConfig, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule } from './reporters-qc5Smpt5.js';
3
3
  import { VitestExecutor } from './execute.js';
4
4
  import 'vite';
5
5
  import 'vite-node';
package/dist/browser.js CHANGED
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
13
13
  globalSetup = true;
14
14
  setSafeTimers();
15
15
  if (config.globals)
16
- (await import('./chunks/integrations-globals.nOa2-o57.js')).registerApiGlobally();
16
+ (await import('./chunks/integrations-globals.tnKXwyh5.js')).registerApiGlobally();
17
17
  }
18
18
  function setupDefines(defines) {
19
19
  for (const key in defines)
package/dist/child.js CHANGED
@@ -4,7 +4,7 @@ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
4
4
  import { parseRegexp } from '@vitest/utils';
5
5
  import { workerId } from 'tinypool';
6
6
  import { l as loadEnvironment } from './vendor/loader.L9CYwKn1.js';
7
- import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.vStuEOaI.js';
7
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.cedv4NLQ.js';
8
8
  import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
9
9
  import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
10
10
  import 'pathe';
@@ -12,6 +12,7 @@ import require$$3 from 'net';
12
12
  import require$$4 from 'tls';
13
13
  import require$$7 from 'url';
14
14
  import { g as getDefaultExportFromCjs } from '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
+ import { isFileServingAllowed } from 'vite';
15
16
  import { A as API_PATH } from '../vendor/constants.WSvnD_fn.js';
16
17
  import '../vendor/index.XU72Rmy8.js';
17
18
  import '@vitest/utils';
@@ -55,6 +56,19 @@ async function getModuleGraph(ctx, id) {
55
56
  };
56
57
  }
57
58
 
59
+ function cloneByOwnProperties(value) {
60
+ return Object.getOwnPropertyNames(value).reduce((clone, prop) => ({
61
+ ...clone,
62
+ [prop]: value[prop]
63
+ }), {});
64
+ }
65
+ function stringifyReplace(key, value) {
66
+ if (value instanceof Error)
67
+ return cloneByOwnProperties(value);
68
+ else
69
+ return value;
70
+ }
71
+
58
72
  /*! (c) 2020 Andrea Giammarchi */
59
73
 
60
74
  const {parse: $parse, stringify: $stringify} = JSON;
@@ -4551,12 +4565,13 @@ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
4551
4565
 
4552
4566
  var WebSocketServer$1 = /*@__PURE__*/getDefaultExportFromCjs(websocketServer);
4553
4567
 
4554
- function setup(vitestOrWorkspace, server) {
4568
+ function setup(vitestOrWorkspace, _server) {
4555
4569
  var _a;
4556
4570
  const ctx = "ctx" in vitestOrWorkspace ? vitestOrWorkspace.ctx : vitestOrWorkspace;
4557
4571
  const wss = new WebSocketServer$1({ noServer: true });
4558
4572
  const clients = /* @__PURE__ */ new Map();
4559
- (_a = (server || ctx.server).httpServer) == null ? void 0 : _a.on("upgrade", (request, socket, head) => {
4573
+ const server = _server || ctx.server;
4574
+ (_a = server.httpServer) == null ? void 0 : _a.on("upgrade", (request, socket, head) => {
4560
4575
  if (!request.url)
4561
4576
  return;
4562
4577
  const { pathname } = new URL(request.url, "http://localhost");
@@ -4567,6 +4582,10 @@ function setup(vitestOrWorkspace, server) {
4567
4582
  setupClient(ws);
4568
4583
  });
4569
4584
  });
4585
+ function checkFileAccess(path) {
4586
+ if (!isFileServingAllowed(path, server))
4587
+ throw new Error(`Access denied to "${path}". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.`);
4588
+ }
4570
4589
  function setupClient(ws) {
4571
4590
  const rpc = createBirpc(
4572
4591
  {
@@ -4605,7 +4624,8 @@ function setup(vitestOrWorkspace, server) {
4605
4624
  return ctx.snapshot.resolveRawPath(testPath, rawPath);
4606
4625
  },
4607
4626
  async readSnapshotFile(snapshotPath) {
4608
- if (!ctx.snapshot.resolvedPaths.has(snapshotPath) || !existsSync(snapshotPath))
4627
+ checkFileAccess(snapshotPath);
4628
+ if (!existsSync(snapshotPath))
4609
4629
  return null;
4610
4630
  return promises.readFile(snapshotPath, "utf-8");
4611
4631
  },
@@ -4620,13 +4640,13 @@ function setup(vitestOrWorkspace, server) {
4620
4640
  return promises.writeFile(id, content, "utf-8");
4621
4641
  },
4622
4642
  async saveSnapshotFile(id, content) {
4623
- if (!ctx.snapshot.resolvedPaths.has(id))
4624
- throw new Error(`Snapshot file "${id}" does not exist.`);
4643
+ checkFileAccess(id);
4625
4644
  await promises.mkdir(dirname(id), { recursive: true });
4626
4645
  return promises.writeFile(id, content, "utf-8");
4627
4646
  },
4628
4647
  async removeSnapshotFile(id) {
4629
- if (!ctx.snapshot.resolvedPaths.has(id) || !existsSync(id))
4648
+ checkFileAccess(id);
4649
+ if (!existsSync(id))
4630
4650
  throw new Error(`Snapshot file "${id}" does not exist.`);
4631
4651
  return promises.unlink(id);
4632
4652
  },
@@ -4672,7 +4692,7 @@ function setup(vitestOrWorkspace, server) {
4672
4692
  post: (msg) => ws.send(msg),
4673
4693
  on: (fn) => ws.on("message", fn),
4674
4694
  eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
4675
- serialize: stringify,
4695
+ serialize: (data) => stringify(data, stringifyReplace),
4676
4696
  deserialize: parse$3
4677
4697
  }
4678
4698
  );
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from '../vendor/constants.WSvnD_fn.js';
2
- import { i as index } from '../vendor/index.n6c6aC2Y.js';
2
+ import { i as index } from '../vendor/index.IhksUGLR.js';
3
3
  import '@vitest/runner';
4
4
  import '../vendor/benchmark.WVm6DARl.js';
5
5
  import '@vitest/runner/utils';
@@ -9,7 +9,7 @@ import 'pathe';
9
9
  import 'std-env';
10
10
  import '../vendor/global.L7JRz1qU.js';
11
11
  import '../vendor/run-once.X3E7xx3F.js';
12
- import '../vendor/vi.ciwVQ0al.js';
12
+ import '../vendor/vi.DTC--YO5.js';
13
13
  import 'chai';
14
14
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
15
  import '@vitest/expect';
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
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.d5m7SYoI.js';
4
+ import { v as version, s as startVitest } from './vendor/node.wTZytysZ.js';
5
5
  import './vendor/index.XU72Rmy8.js';
6
- import { d as divider } from './vendor/reporters.oUR9etwS.js';
6
+ import { d as divider } from './vendor/reporters.7Y4WN6gc.js';
7
7
  import { t as toArray } from './vendor/base._79unx2z.js';
8
8
  import 'vite';
9
9
  import 'node:path';
@@ -45,6 +45,7 @@ import '@vitest/runner/utils';
45
45
  import 'node:crypto';
46
46
  import 'assert';
47
47
  import 'magic-string';
48
+ import '@vitest/utils/ast';
48
49
  import 'strip-literal';
49
50
  import './vendor/environments.QJtma9XQ.js';
50
51
  import 'node:console';
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
3
- import { a as ResolvedCoverageOptions, C as CoverageV8Options, P as ProjectConfig } from './reporters-O4LBziQ_.js';
3
+ import { a as ResolvedCoverageOptions, C as CoverageV8Options, P as ProjectConfig } from './reporters-qc5Smpt5.js';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
6
6
  import '@vitest/snapshot';
@@ -1,4 +1,4 @@
1
- import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-O4LBziQ_.js';
1
+ import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-qc5Smpt5.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/entry-vm.js CHANGED
@@ -8,7 +8,7 @@ import { setupColors, createColors } from '@vitest/utils';
8
8
  import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor/index.h0j9y5vy.js';
9
9
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor/coverage.v6aD8iAh.js';
10
10
  import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
11
- import { i as index } from './vendor/index.n6c6aC2Y.js';
11
+ import { i as index } from './vendor/index.IhksUGLR.js';
12
12
  import { setupCommonEnv } from './browser.js';
13
13
  import 'chai';
14
14
  import '@vitest/snapshot/environment';
@@ -21,7 +21,7 @@ import '@vitest/runner/utils';
21
21
  import './vendor/index.XU72Rmy8.js';
22
22
  import 'std-env';
23
23
  import './vendor/run-once.X3E7xx3F.js';
24
- import './vendor/vi.ciwVQ0al.js';
24
+ import './vendor/vi.DTC--YO5.js';
25
25
  import './vendor/_commonjsHelpers.jjO7Zipk.js';
26
26
  import '@vitest/expect';
27
27
  import '@vitest/snapshot';
package/dist/entry.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests } from '@vitest/runner';
3
3
  import './vendor/index.XU72Rmy8.js';
4
- import { a as globalExpect, r as resetModules, v as vi } from './vendor/vi.ciwVQ0al.js';
4
+ import { a as globalExpect, r as resetModules, v as vi } from './vendor/vi.DTC--YO5.js';
5
5
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor/coverage.v6aD8iAh.js';
6
6
  import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor/index.h0j9y5vy.js';
7
7
  import { createRequire } from 'node:module';
@@ -10,7 +10,7 @@ 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 { i as index } from './vendor/index.n6c6aC2Y.js';
13
+ import { i as index } from './vendor/index.IhksUGLR.js';
14
14
  import { setupCommonEnv } from './browser.js';
15
15
  import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
16
16
  import 'pathe';
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-O4LBziQ_.js';
1
+ import { E as Environment } from './reporters-qc5Smpt5.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 { am as PendingSuiteMock, an as MockFactory, ao as MockMap, a2 as WorkerGlobalState, g as RuntimeRPC } from './reporters-O4LBziQ_.js';
4
+ import { am as PendingSuiteMock, an as MockFactory, ao as MockMap, a2 as WorkerGlobalState, g as RuntimeRPC } from './reporters-qc5Smpt5.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
@@ -53,12 +53,12 @@ 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): void;
56
+ mockPath(originalId: string, path: string, external: string | null, factory: MockFactory | undefined, throwIfExists: boolean): 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>;
60
- queueMock(id: string, importer: string, factory?: MockFactory): void;
61
- queueUnmock(id: string, importer: string): void;
60
+ queueMock(id: string, importer: string, factory?: MockFactory, throwIfCached?: boolean): void;
61
+ queueUnmock(id: string, importer: string, throwIfCached?: boolean): void;
62
62
  }
63
63
 
64
64
  interface ModuleEvaluateOptions {
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './vendor/execute.vStuEOaI.js';
1
+ export { V as VitestExecutor } from './vendor/execute.cedv4NLQ.js';
2
2
  import 'node:url';
3
3
  import 'node:vm';
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-dF4WyktM.js';
3
+ export { b as bench } from './suite-WwpgKT7k.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, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-O4LBziQ_.js';
7
- export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-O4LBziQ_.js';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-qc5Smpt5.js';
7
+ export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-qc5Smpt5.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.WVm6DARl.js';
3
3
  export { i as isFirstRun, r as runOnce } from './vendor/run-once.X3E7xx3F.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.ciwVQ0al.js';
5
- import { d as dist } from './vendor/index.n6c6aC2Y.js';
6
- export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.n6c6aC2Y.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.DTC--YO5.js';
5
+ import { d as dist } from './vendor/index.IhksUGLR.js';
6
+ export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.IhksUGLR.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, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-O4LBziQ_.js';
2
- export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-O4LBziQ_.js';
1
+ import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-qc5Smpt5.js';
2
+ export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-qc5Smpt5.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, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.d5m7SYoI.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.wTZytysZ.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
@@ -41,7 +41,7 @@ import 'node:module';
41
41
  import 'local-pkg';
42
42
  import 'module';
43
43
  import 'acorn-walk';
44
- import './vendor/reporters.oUR9etwS.js';
44
+ import './vendor/reporters.7Y4WN6gc.js';
45
45
  import './chunks/runtime-console.hf2msWA9.js';
46
46
  import 'node:stream';
47
47
  import 'node:console';
@@ -50,6 +50,7 @@ import './vendor/tasks.IknbGB2n.js';
50
50
  import 'node:crypto';
51
51
  import 'assert';
52
52
  import 'magic-string';
53
+ import '@vitest/utils/ast';
53
54
  import 'strip-literal';
54
55
  import './vendor/environments.QJtma9XQ.js';
55
56
  import 'node:readline';
@@ -959,6 +959,7 @@ interface ListRendererOptions$1 {
959
959
  renderSucceed?: boolean;
960
960
  logger: Logger;
961
961
  showHeap: boolean;
962
+ slowTestThreshold: number;
962
963
  mode: VitestRunMode;
963
964
  }
964
965
  declare function createListRenderer(_tasks: Task[], options: ListRendererOptions$1): {
@@ -1084,6 +1085,7 @@ interface ListRendererOptions {
1084
1085
  renderSucceed?: boolean;
1085
1086
  logger: Logger;
1086
1087
  showHeap: boolean;
1088
+ slowTestThreshold: number;
1087
1089
  }
1088
1090
  declare function createTableRenderer(_tasks: Task[], options: ListRendererOptions): {
1089
1091
  start(): any;
@@ -1223,6 +1225,7 @@ interface PendingSuiteMock {
1223
1225
  id: string;
1224
1226
  importer: string;
1225
1227
  type: 'mock' | 'unmock';
1228
+ throwIfCached: boolean;
1226
1229
  factory?: MockFactory;
1227
1230
  }
1228
1231
 
@@ -2057,7 +2060,6 @@ interface InlineConfig {
2057
2060
  api?: boolean | number | ApiConfig;
2058
2061
  /**
2059
2062
  * Enable Vitest UI
2060
- * @internal
2061
2063
  */
2062
2064
  ui?: boolean;
2063
2065
  /**
@@ -1,4 +1,4 @@
1
- export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-O4LBziQ_.js';
1
+ export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-qc5Smpt5.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/reporters.js CHANGED
@@ -1,4 +1,4 @@
1
- export { e as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, f as DotReporter, H as HangingProcessReporter, g as JUnitReporter, J as JsonReporter, R as ReportersMap, h as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/reporters.oUR9etwS.js';
1
+ export { e as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, f as DotReporter, H as HangingProcessReporter, g as JUnitReporter, J as JsonReporter, R as ReportersMap, h as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/reporters.7Y4WN6gc.js';
2
2
  import 'node:perf_hooks';
3
3
  import 'picocolors';
4
4
  import './vendor/index.XU72Rmy8.js';
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-O4LBziQ_.js';
2
+ import { R as ResolvedConfig } from './reporters-qc5Smpt5.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.ciwVQ0al.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.DTC--YO5.js';
3
3
  import './vendor/index.XU72Rmy8.js';
4
4
  import { a as rpc } from './vendor/rpc.Bl-ysZIr.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 { ak as BenchFunction, al as BenchmarkAPI } from './reporters-O4LBziQ_.js';
3
+ import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-qc5Smpt5.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
1
  export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-dF4WyktM.js';
4
- import './reporters-O4LBziQ_.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-WwpgKT7k.js';
4
+ import './reporters-qc5Smpt5.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
@@ -119,7 +119,7 @@ class VitestMocker {
119
119
  if (mock.type === "unmock")
120
120
  this.unmockPath(fsPath);
121
121
  if (mock.type === "mock")
122
- this.mockPath(mock.id, fsPath, external, mock.factory);
122
+ this.mockPath(mock.id, fsPath, external, mock.factory, mock.throwIfCached);
123
123
  }));
124
124
  VitestMocker.pendingIds = [];
125
125
  }
@@ -298,9 +298,13 @@ ${c.green(`vi.mock("${mockpath}", async (importOriginal) => {
298
298
  delete mock[id];
299
299
  this.deleteCachedItem(id);
300
300
  }
301
- mockPath(originalId, path, external, factory) {
302
- const suitefile = this.getSuiteFilepath();
301
+ mockPath(originalId, path, external, factory, throwIfExists) {
303
302
  const id = this.normalizePath(path);
303
+ if (throwIfExists && this.moduleCache.has(id))
304
+ throw new Error(`[vitest] Cannot mock "${originalId}" because it is already loaded. Did you import it in a setup file?
305
+
306
+ 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`);
307
+ const suitefile = this.getSuiteFilepath();
304
308
  const mocks = this.mockMap.get(suitefile) || {};
305
309
  const resolves = this.resolveCache.get(suitefile) || {};
306
310
  mocks[id] = factory || this.resolveMockPath(path, external);
@@ -356,11 +360,11 @@ ${c.green(`vi.mock("${mockpath}", async (importOriginal) => {
356
360
  if (typeof mock === "string" && !callstack.includes(mock))
357
361
  return mock;
358
362
  }
359
- queueMock(id, importer, factory) {
360
- VitestMocker.pendingIds.push({ type: "mock", id, importer, factory });
363
+ queueMock(id, importer, factory, throwIfCached = false) {
364
+ VitestMocker.pendingIds.push({ type: "mock", id, importer, factory, throwIfCached });
361
365
  }
362
- queueUnmock(id, importer) {
363
- VitestMocker.pendingIds.push({ type: "unmock", id, importer });
366
+ queueUnmock(id, importer, throwIfCached = false) {
367
+ VitestMocker.pendingIds.push({ type: "unmock", id, importer, throwIfCached });
364
368
  }
365
369
  }
366
370
 
@@ -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.WVm6DARl.js';
3
3
  import { i as isFirstRun, r as runOnce } from './run-once.X3E7xx3F.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.ciwVQ0al.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DTC--YO5.js';
5
5
  import { g as getWorkerState } from './global.L7JRz1qU.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -37,12 +37,13 @@ import { createRequire } from 'node:module';
37
37
  import { isPackageExists, resolveModule } from 'local-pkg';
38
38
  import { isCI, provider as provider$1 } from 'std-env';
39
39
  import ge from 'module';
40
- import { ancestor, simple, findNodeAround } from 'acorn-walk';
40
+ import { ancestor, findNodeAround } from 'acorn-walk';
41
41
  import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, hasFailed } from '@vitest/runner/utils';
42
- import { R as ReportersMap, B as BenchmarkReportsMap, s as stripAnsi, a as ansiStyles, b as sliceAnsi, d as divider, F as F_POINTER, c as cliTruncate } from './reporters.oUR9etwS.js';
42
+ import { R as ReportersMap, B as BenchmarkReportsMap, s as stripAnsi, a as ansiStyles, b as sliceAnsi, d as divider, F as F_POINTER, c as cliTruncate } from './reporters.7Y4WN6gc.js';
43
43
  import crypto, { createHash } from 'node:crypto';
44
44
  import require$$0$3 from 'assert';
45
45
  import MagicString from 'magic-string';
46
+ import { esmWalker } from '@vitest/utils/ast';
46
47
  import { stripLiteral } from 'strip-literal';
47
48
  import { g as getEnvPackageName } from './environments.QJtma9XQ.js';
48
49
  import readline from 'node:readline';
@@ -63,7 +64,7 @@ function _mergeNamespaces(n, m) {
63
64
  return Object.freeze(n);
64
65
  }
65
66
 
66
- var version$1 = "1.1.1";
67
+ var version$1 = "1.1.3";
67
68
 
68
69
  const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
69
70
  async function ensurePackageInstalled(dependency, root) {
@@ -3612,7 +3613,7 @@ function getWorkerMemoryLimit(config) {
3612
3613
  var _a, _b, _c, _d;
3613
3614
  const memoryLimit = (_b = (_a = config.poolOptions) == null ? void 0 : _a.vmThreads) == null ? void 0 : _b.memoryLimit;
3614
3615
  if (memoryLimit)
3615
- return stringToBytes(memoryLimit);
3616
+ return memoryLimit;
3616
3617
  return 1 / (((_d = (_c = config.poolOptions) == null ? void 0 : _c.vmThreads) == null ? void 0 : _d.maxThreads) ?? getDefaultThreadsCount(config));
3617
3618
  }
3618
3619
  function stringToBytes(input, percentageReference) {
@@ -3661,7 +3662,7 @@ function stringToBytes(input, percentageReference) {
3661
3662
  } else if (input > 1) {
3662
3663
  return Math.floor(input);
3663
3664
  } else {
3664
- throw new Error('Unexpected numerical input for "experimentalVmWorkerMemoryLimit"');
3665
+ throw new Error('Unexpected numerical input for "memoryLimit"');
3665
3666
  }
3666
3667
  }
3667
3668
  return null;
@@ -3787,7 +3788,7 @@ function getMemoryLimit(config) {
3787
3788
  config.watch ? memory / 2 : memory
3788
3789
  );
3789
3790
  }
3790
- if (limit && limit > 1)
3791
+ if (typeof limit === "number" && limit > 1 || typeof limit === "string" && limit.at(-1) !== "%")
3791
3792
  return stringToBytes(limit);
3792
3793
  return null;
3793
3794
  }
@@ -6479,7 +6480,7 @@ createLogUpdate(process$2.stdout);
6479
6480
 
6480
6481
  createLogUpdate(process$2.stderr);
6481
6482
 
6482
- var version = "1.1.1";
6483
+ var version = "1.1.3";
6483
6484
 
6484
6485
  async function printError(error, project, options) {
6485
6486
  const { showCodeFrame = true, fullStack = false, type } = options;
@@ -6884,6 +6885,14 @@ function transformImportSpecifiers(node) {
6884
6885
  return "";
6885
6886
  return `{ ${dynamicImports} }`;
6886
6887
  }
6888
+ function getBetterEnd(code, node) {
6889
+ let end = node.end;
6890
+ if (code[node.end] === ";")
6891
+ end += 1;
6892
+ if (code[node.end + 1] === "\n")
6893
+ end += 1;
6894
+ return end;
6895
+ }
6887
6896
  const regexpHoistable = /^[ \t]*\b(vi|vitest)\s*\.\s*(mock|unmock|hoisted)\(/m;
6888
6897
  const regexpAssignedHoisted = /=[ \t]*(\bawait|)[ \t]*\b(vi|vitest)\s*\.\s*hoisted\(/;
6889
6898
  const hashbangRE = /^#!.*\n/;
@@ -6902,55 +6911,84 @@ ${err.message}`);
6902
6911
  return;
6903
6912
  }
6904
6913
  const hoistIndex = ((_a = code.match(hashbangRE)) == null ? void 0 : _a[0].length) ?? 0;
6905
- let hoistedCode = "";
6906
6914
  let hoistedVitestImports = "";
6915
+ let uid = 0;
6916
+ const idToImportMap = /* @__PURE__ */ new Map();
6907
6917
  const transformImportDeclaration = (node) => {
6908
6918
  const source = node.source.value;
6909
- const namespace = node.specifiers.find((specifier) => specifier.type === "ImportNamespaceSpecifier");
6910
- let code2 = "";
6911
- if (namespace)
6912
- code2 += `const ${namespace.local.name} = await import('${source}')
6913
- `;
6914
- const specifiers = transformImportSpecifiers(node);
6915
- if (specifiers) {
6916
- if (namespace)
6917
- code2 += `const ${specifiers} = ${namespace.local.name}
6918
- `;
6919
- else
6920
- code2 += `const ${specifiers} = await import('${source}')
6919
+ const importId = `__vi_import_${uid++}__`;
6920
+ const hasSpecifiers = node.specifiers.length > 0;
6921
+ const code2 = hasSpecifiers ? `const ${importId} = await import('${source}')
6922
+ ` : `await import('${source}')
6921
6923
  `;
6922
- } else if (!namespace) {
6923
- code2 += `await import('${source}')
6924
- `;
6925
- }
6926
- return code2;
6924
+ return {
6925
+ code: code2,
6926
+ id: importId
6927
+ };
6927
6928
  };
6928
- function hoistImport(node) {
6929
- s.remove(node.start, node.end);
6929
+ function defineImport(node) {
6930
6930
  if (node.source.value === "vitest") {
6931
- const code3 = `const ${transformImportSpecifiers(node)} = await import('vitest')
6931
+ const code2 = `const ${transformImportSpecifiers(node)} = await import('vitest')
6932
6932
  `;
6933
- hoistedVitestImports += code3;
6933
+ hoistedVitestImports += code2;
6934
+ s.remove(node.start, getBetterEnd(code2, node));
6934
6935
  return;
6935
6936
  }
6936
- const code2 = transformImportDeclaration(node);
6937
- s.appendLeft(hoistIndex, code2);
6937
+ const declaration = transformImportDeclaration(node);
6938
+ if (!declaration)
6939
+ return null;
6940
+ s.appendLeft(hoistIndex, declaration.code);
6941
+ return declaration.id;
6938
6942
  }
6939
6943
  for (const node of ast.body) {
6940
- if (node.type === "ImportDeclaration")
6941
- hoistImport(node);
6944
+ if (node.type === "ImportDeclaration") {
6945
+ const importId = defineImport(node);
6946
+ if (!importId)
6947
+ continue;
6948
+ s.remove(node.start, getBetterEnd(code, node));
6949
+ for (const spec of node.specifiers) {
6950
+ if (spec.type === "ImportSpecifier") {
6951
+ idToImportMap.set(
6952
+ spec.local.name,
6953
+ `${importId}.${spec.imported.name}`
6954
+ );
6955
+ } else if (spec.type === "ImportDefaultSpecifier") {
6956
+ idToImportMap.set(spec.local.name, `${importId}.default`);
6957
+ } else {
6958
+ idToImportMap.set(spec.local.name, importId);
6959
+ }
6960
+ }
6961
+ }
6942
6962
  }
6943
- simple(ast, {
6944
- CallExpression(_node) {
6963
+ const declaredConst = /* @__PURE__ */ new Set();
6964
+ const hoistedNodes = [];
6965
+ esmWalker(ast, {
6966
+ onIdentifier(id2, info, parentStack) {
6967
+ const binding = idToImportMap.get(id2.name);
6968
+ if (!binding)
6969
+ return;
6970
+ if (info.hasBindingShortcut) {
6971
+ s.appendLeft(id2.end, `: ${binding}`);
6972
+ } else if (info.classDeclaration) {
6973
+ if (!declaredConst.has(id2.name)) {
6974
+ declaredConst.add(id2.name);
6975
+ const topNode = parentStack[parentStack.length - 2];
6976
+ s.prependRight(topNode.start, `const ${id2.name} = ${binding};
6977
+ `);
6978
+ }
6979
+ } else if (
6980
+ // don't transform class name identifier
6981
+ !info.classExpression
6982
+ ) {
6983
+ s.update(id2.start, id2.end, binding);
6984
+ }
6985
+ },
6986
+ onCallExpression(node) {
6945
6987
  var _a2, _b;
6946
- const node = _node;
6947
6988
  if (node.callee.type === "MemberExpression" && isIdentifier(node.callee.object) && (node.callee.object.name === "vi" || node.callee.object.name === "vitest") && isIdentifier(node.callee.property)) {
6948
6989
  const methodName = node.callee.property.name;
6949
- if (methodName === "mock" || methodName === "unmock") {
6950
- hoistedCode += `${code.slice(node.start, node.end)}
6951
- `;
6952
- s.remove(node.start, node.end);
6953
- }
6990
+ if (methodName === "mock" || methodName === "unmock")
6991
+ hoistedNodes.push(node);
6954
6992
  if (methodName === "hoisted") {
6955
6993
  const declarationNode = (_a2 = findNodeAround(ast, node.start, "VariableDeclaration")) == null ? void 0 : _a2.node;
6956
6994
  const init = (_b = declarationNode == null ? void 0 : declarationNode.declarations[0]) == null ? void 0 : _b.init;
@@ -6959,18 +6997,20 @@ ${err.message}`);
6959
6997
  };
6960
6998
  const canMoveDeclaration = init && init.type === "CallExpression" && isViHoisted(init) || init && init.type === "AwaitExpression" && init.argument.type === "CallExpression" && isViHoisted(init.argument);
6961
6999
  if (canMoveDeclaration) {
6962
- hoistedCode += `${code.slice(declarationNode.start, declarationNode.end)}
6963
- `;
6964
- s.remove(declarationNode.start, declarationNode.end);
7000
+ hoistedNodes.push(declarationNode);
6965
7001
  } else {
6966
- hoistedCode += `${code.slice(node.start, node.end)}
6967
- `;
6968
- s.remove(node.start, node.end);
7002
+ hoistedNodes.push(node);
6969
7003
  }
6970
7004
  }
6971
7005
  }
6972
7006
  }
6973
7007
  });
7008
+ const hoistedCode = hoistedNodes.map((node) => {
7009
+ const end = getBetterEnd(code, node);
7010
+ const nodeCode = s.slice(node.start, end);
7011
+ s.remove(node.start, end);
7012
+ return `${nodeCode}${nodeCode.endsWith("\n") ? "" : "\n"}`;
7013
+ }).join("");
6974
7014
  if (hoistedCode || hoistedVitestImports) {
6975
7015
  s.prepend(
6976
7016
  hoistedVitestImports + (!hoistedVitestImports && hoistedCode ? API_NOT_FOUND_CHECK : "") + hoistedCode
@@ -7136,7 +7176,7 @@ async function createBrowserServer(project, configFile) {
7136
7176
  ]
7137
7177
  });
7138
7178
  await server.listen();
7139
- (await import('../chunks/api-setup.jHV5vgr2.js')).setup(project, server);
7179
+ (await import('../chunks/api-setup.mFKdEKxa.js')).setup(project, server);
7140
7180
  return server;
7141
7181
  }
7142
7182
 
@@ -7843,7 +7883,9 @@ class Vitest {
7843
7883
  const serverRestart = server.restart;
7844
7884
  server.restart = async (...args) => {
7845
7885
  await Promise.all(this._onRestartListeners.map((fn) => fn()));
7846
- return await serverRestart(...args);
7886
+ await serverRestart(...args);
7887
+ this.unregisterWatcher();
7888
+ this.registerWatcher();
7847
7889
  };
7848
7890
  server.watcher.on("change", async (file) => {
7849
7891
  file = normalize(file);
@@ -7851,6 +7893,8 @@ class Vitest {
7851
7893
  if (isConfig) {
7852
7894
  await Promise.all(this._onRestartListeners.map((fn) => fn("config")));
7853
7895
  await serverRestart();
7896
+ this.unregisterWatcher();
7897
+ this.registerWatcher();
7854
7898
  }
7855
7899
  });
7856
7900
  }
@@ -8300,8 +8344,13 @@ class Vitest {
8300
8344
  return [id];
8301
8345
  }
8302
8346
  const projects = this.getModuleProjects(id);
8303
- if (!projects.length)
8347
+ if (!projects.length) {
8348
+ if (this.state.filesMap.has(id) || this.projects.some((project) => project.isTestFile(id))) {
8349
+ this.changedTests.add(id);
8350
+ return [id];
8351
+ }
8304
8352
  return [];
8353
+ }
8305
8354
  const files = [];
8306
8355
  for (const project of projects) {
8307
8356
  const { server } = project;
@@ -8547,7 +8596,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
8547
8596
  try {
8548
8597
  await ctx.setServer(options, server, userConfig);
8549
8598
  if (options.api && options.watch)
8550
- (await import('../chunks/api-setup.jHV5vgr2.js')).setup(ctx);
8599
+ (await import('../chunks/api-setup.mFKdEKxa.js')).setup(ctx);
8551
8600
  } catch (err) {
8552
8601
  await ctx.logger.printError(err, { fullStack: true });
8553
8602
  process.exit(1);
@@ -1466,7 +1466,6 @@ function cliTruncate(text, columns, options = {}) {
1466
1466
  throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
1467
1467
  }
1468
1468
 
1469
- const DURATION_LONG$1 = 300;
1470
1469
  const outputMap$1 = /* @__PURE__ */ new WeakMap();
1471
1470
  function formatFilepath$1(path) {
1472
1471
  const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
@@ -1544,7 +1543,7 @@ function renderTree$1(tasks, options, level = 0, maxRows) {
1544
1543
  if (task.type === "test" && ((_b = task.result) == null ? void 0 : _b.repeatCount) && task.result.repeatCount > 0)
1545
1544
  suffix += c.yellow(` (repeat x${task.result.repeatCount})`);
1546
1545
  if (((_c = task.result) == null ? void 0 : _c.duration) != null) {
1547
- if (task.result.duration > DURATION_LONG$1)
1546
+ if (task.result.duration > options.slowTestThreshold)
1548
1547
  suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
1549
1548
  }
1550
1549
  if (options.showHeap && ((_d = task.result) == null ? void 0 : _d.heap) != null)
@@ -1672,6 +1671,7 @@ class DefaultReporter extends BaseReporter {
1672
1671
  if (this.isTTY) {
1673
1672
  this.rendererOptions.logger = this.ctx.logger;
1674
1673
  this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
1674
+ this.rendererOptions.slowTestThreshold = this.ctx.config.slowTestThreshold;
1675
1675
  this.rendererOptions.mode = this.mode;
1676
1676
  const files = this.ctx.state.getFiles(this.watchFilters);
1677
1677
  if (!this.renderer)
@@ -2425,7 +2425,6 @@ class JsonReporter {
2425
2425
  }
2426
2426
  }
2427
2427
 
2428
- const DURATION_LONG = 300;
2429
2428
  const outputMap = /* @__PURE__ */ new WeakMap();
2430
2429
  function formatFilepath(path) {
2431
2430
  const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
@@ -2525,7 +2524,7 @@ ${padding}`;
2525
2524
  if (task.mode === "skip" || task.mode === "todo")
2526
2525
  suffix += ` ${c.dim(c.gray("[skipped]"))}`;
2527
2526
  if (((_b = task.result) == null ? void 0 : _b.duration) != null) {
2528
- if (task.result.duration > DURATION_LONG)
2527
+ if (task.result.duration > options.slowTestThreshold)
2529
2528
  suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
2530
2529
  }
2531
2530
  if (options.showHeap && ((_c = task.result) == null ? void 0 : _c.heap) != null)
@@ -2606,6 +2605,7 @@ class TableReporter extends BaseReporter {
2606
2605
  if (this.isTTY) {
2607
2606
  this.rendererOptions.logger = this.ctx.logger;
2608
2607
  this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
2608
+ this.rendererOptions.slowTestThreshold = this.ctx.config.slowTestThreshold;
2609
2609
  const files = this.ctx.state.getFiles(this.watchFilters);
2610
2610
  if (!this.renderer)
2611
2611
  this.renderer = createTableRenderer(files, this.rendererOptions).start();
@@ -3406,7 +3406,8 @@ function createVitest() {
3406
3406
  _mocker.queueMock(
3407
3407
  path,
3408
3408
  importer,
3409
- factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0
3409
+ factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0,
3410
+ true
3410
3411
  );
3411
3412
  },
3412
3413
  unmock(path) {
@@ -3417,7 +3418,8 @@ function createVitest() {
3417
3418
  _mocker.queueMock(
3418
3419
  path,
3419
3420
  importer,
3420
- factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0
3421
+ factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0,
3422
+ false
3421
3423
  );
3422
3424
  },
3423
3425
  doUnmock(path) {
package/dist/vm.js CHANGED
@@ -8,7 +8,7 @@ import { resolve } from 'pathe';
8
8
  import { installSourcemapsSupport } from 'vite-node/source-map';
9
9
  import { distDir } from './paths.js';
10
10
  import { l as loadEnvironment } from './vendor/loader.L9CYwKn1.js';
11
- import { b as startVitestExecutor } from './vendor/execute.vStuEOaI.js';
11
+ import { b as startVitestExecutor } from './vendor/execute.cedv4NLQ.js';
12
12
  import { createCustomConsole } from './chunks/runtime-console.hf2msWA9.js';
13
13
  import { c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
14
14
  import './vendor/environments.QJtma9XQ.js';
package/dist/worker.js CHANGED
@@ -3,7 +3,7 @@ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
3
3
  import { workerId } from 'tinypool';
4
4
  import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
5
5
  import { l as loadEnvironment } from './vendor/loader.L9CYwKn1.js';
6
- import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.vStuEOaI.js';
6
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.cedv4NLQ.js';
7
7
  import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
8
8
  import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
9
9
  import 'pathe';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.1.3",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -132,7 +132,7 @@
132
132
  }
133
133
  },
134
134
  "dependencies": {
135
- "acorn-walk": "^8.3.0",
135
+ "acorn-walk": "^8.3.1",
136
136
  "cac": "^6.7.14",
137
137
  "chai": "^4.3.10",
138
138
  "debug": "^4.3.4",
@@ -147,12 +147,12 @@
147
147
  "tinypool": "^0.8.1",
148
148
  "vite": "^5.0.0",
149
149
  "why-is-node-running": "^2.2.2",
150
- "@vitest/snapshot": "1.1.1",
151
- "@vitest/spy": "1.1.1",
152
- "@vitest/utils": "1.1.1",
153
- "@vitest/runner": "1.1.1",
154
- "@vitest/expect": "1.1.1",
155
- "vite-node": "1.1.1"
150
+ "@vitest/runner": "1.1.3",
151
+ "@vitest/expect": "1.1.3",
152
+ "@vitest/spy": "1.1.3",
153
+ "@vitest/snapshot": "1.1.3",
154
+ "@vitest/utils": "1.1.3",
155
+ "vite-node": "1.1.3"
156
156
  },
157
157
  "devDependencies": {
158
158
  "@ampproject/remapping": "^2.2.1",