vitest 0.25.8 → 0.26.0

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 (33) hide show
  1. package/LICENSE.md +0 -142
  2. package/dist/browser.d.ts +6 -3
  3. package/dist/browser.js +9 -10
  4. package/dist/{chunk-api-setup.dc71e384.js → chunk-api-setup.08f3b356.js} +39 -42
  5. package/dist/{chunk-integrations-globals.4d261bb8.js → chunk-integrations-globals.cab94a09.js} +5 -5
  6. package/dist/{chunk-runtime-chain.f86e5250.js → chunk-runtime-chain.e655f6cc.js} +4 -5
  7. package/dist/{chunk-runtime-error.616e92ca.js → chunk-runtime-error.dfbbf9be.js} +5 -5
  8. package/dist/{chunk-runtime-mocker.99b910d0.js → chunk-runtime-mocker.35fabb8b.js} +65 -64
  9. package/dist/{chunk-runtime-rpc.42aebbb9.js → chunk-runtime-rpc.7959fc79.js} +1 -1
  10. package/dist/{chunk-runtime-setup.5398e2c4.js → chunk-runtime-setup.4c1b529e.js} +16 -29
  11. package/dist/{chunk-vite-node-externalize.b9495318.js → chunk-snapshot-manager.7d978f79.js} +36 -322
  12. package/dist/{chunk-typecheck-constants.ed987901.js → chunk-typecheck-constants.3f865d14.js} +5 -4
  13. package/dist/{chunk-runtime-test-state.3f86f48f.js → chunk-utils-import.ca62c9d7.js} +49 -18
  14. package/dist/{chunk-utils-source-map.29ff1088.js → chunk-utils-source-map.5bbb50cd.js} +6 -4
  15. package/dist/cli.js +12 -13
  16. package/dist/config.d.ts +4 -1
  17. package/dist/entry.js +9 -9
  18. package/dist/environments.d.ts +4 -1
  19. package/dist/{index-5aad25c1.d.ts → index-c3f83a58.d.ts} +1 -1
  20. package/dist/index.d.ts +28 -10
  21. package/dist/index.js +6 -6
  22. package/dist/loader.js +7 -6
  23. package/dist/node.d.ts +18 -18
  24. package/dist/node.js +14 -14
  25. package/dist/suite.js +4 -4
  26. package/dist/{types-71ccd11d.d.ts → types-56bcd6c3.d.ts} +16 -273
  27. package/dist/vendor-index.783e7f3e.js +71 -0
  28. package/dist/vendor-index.96e022fd.js +211 -0
  29. package/dist/worker.js +12 -14
  30. package/package.json +4 -4
  31. package/dist/chunk-vite-node-source-map.b4ea5792.js +0 -446
  32. package/dist/chunk-vite-node-utils.0e4a6a88.js +0 -1385
  33. package/dist/vendor-source-map-support.1ce17397.js +0 -707
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { p as picocolors, n as normalize } from './chunk-utils-env.03f840f2.js';
2
2
  import { EventEmitter } from 'events';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.b9495318.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.7d978f79.js';
4
4
  import 'tty';
5
5
  import 'url';
6
6
  import 'path';
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
9
  import './chunk-env-node.67948209.js';
10
10
  import 'console';
11
- import './chunk-typecheck-constants.ed987901.js';
11
+ import './chunk-typecheck-constants.3f865d14.js';
12
12
  import 'vite';
13
13
  import 'process';
14
14
  import 'fs';
@@ -16,27 +16,26 @@ import 'os';
16
16
  import 'util';
17
17
  import 'stream';
18
18
  import './vendor-_commonjsHelpers.addc3445.js';
19
- import './chunk-vite-node-source-map.b4ea5792.js';
20
- import 'module';
21
- import 'vm';
22
- import './chunk-vite-node-utils.0e4a6a88.js';
23
- import 'acorn';
24
- import 'assert';
25
- import 'debug';
26
- import './vendor-source-map-support.1ce17397.js';
27
- import 'source-map';
28
- import 'perf_hooks';
19
+ import 'vite-node/client';
20
+ import 'vite-node/server';
29
21
  import 'fs/promises';
30
22
  import './vendor-index.737c3cff.js';
31
23
  import 'buffer';
32
24
  import 'child_process';
33
25
  import './vendor-index.e1d4cf84.js';
26
+ import 'assert';
27
+ import 'source-map';
28
+ import 'module';
29
+ import 'acorn';
34
30
  import 'acorn-walk';
35
31
  import 'worker_threads';
36
32
  import 'tinypool';
33
+ import './vendor-index.783e7f3e.js';
34
+ import 'perf_hooks';
37
35
  import './chunk-utils-timers.793fd179.js';
38
- import './chunk-utils-source-map.29ff1088.js';
36
+ import './chunk-utils-source-map.5bbb50cd.js';
39
37
  import 'crypto';
38
+ import 'vite-node/utils';
40
39
  import './vendor-index.9c919048.js';
41
40
  import './chunk-magic-string.3a794426.js';
42
41
  import 'strip-literal';
package/dist/config.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv } from 'vite';
3
- import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-71ccd11d.js';
3
+ import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-56bcd6c3.js';
4
4
  import 'tinybench';
5
+ import 'vite-node/client';
6
+ import 'vite-node/server';
7
+ import 'vite-node';
5
8
  import 'fs';
6
9
  import 'worker_threads';
7
10
 
package/dist/entry.js CHANGED
@@ -1,28 +1,27 @@
1
1
  import { promises } from 'fs';
2
- import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.ed987901.js';
3
- import { v as vi } from './chunk-runtime-test-state.3f86f48f.js';
2
+ import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.3f865d14.js';
3
+ import { v as vi } from './chunk-utils-import.ca62c9d7.js';
4
4
  import { a as envs } from './chunk-env-node.67948209.js';
5
- import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.5398e2c4.js';
5
+ import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.4c1b529e.js';
6
6
  import 'path';
7
7
  import './chunk-utils-env.03f840f2.js';
8
8
  import 'tty';
9
9
  import 'url';
10
10
  import 'local-pkg';
11
- import './chunk-runtime-chain.f86e5250.js';
11
+ import './chunk-runtime-chain.e655f6cc.js';
12
12
  import 'util';
13
13
  import 'chai';
14
14
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.42aebbb9.js';
15
+ import './chunk-runtime-rpc.7959fc79.js';
16
16
  import './chunk-utils-timers.793fd179.js';
17
- import './chunk-utils-source-map.29ff1088.js';
17
+ import './chunk-utils-source-map.5bbb50cd.js';
18
18
  import './spy.js';
19
19
  import 'tinyspy';
20
20
  import 'console';
21
21
  import 'perf_hooks';
22
22
  import './chunk-integrations-coverage.befed097.js';
23
- import './chunk-runtime-error.616e92ca.js';
24
- import './vendor-source-map-support.1ce17397.js';
25
- import 'source-map';
23
+ import './chunk-runtime-error.dfbbf9be.js';
24
+ import 'vite-node/source-map';
26
25
 
27
26
  function groupBy(collection, iteratee) {
28
27
  return collection.reduce((acc, item) => {
@@ -60,6 +59,7 @@ async function run(files, config) {
60
59
  const files2 = filesByEnv[environment];
61
60
  if (!files2 || !files2.length)
62
61
  continue;
62
+ globalThis.__vitest_environment__ = environment;
63
63
  const filesByOptions = groupBy(files2, ({ envOptions }) => JSON.stringify(envOptions));
64
64
  for (const options of Object.keys(filesByOptions)) {
65
65
  const files3 = filesByOptions[options];
@@ -1,6 +1,9 @@
1
- import { ae as Environment } from './types-71ccd11d.js';
1
+ import { ae as Environment } from './types-56bcd6c3.js';
2
2
  import 'vite';
3
3
  import 'tinybench';
4
+ import 'vite-node/client';
5
+ import 'vite-node/server';
6
+ import 'vite-node';
4
7
  import 'fs';
5
8
  import 'worker_threads';
6
9
 
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-71ccd11d.js';
2
+ import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-56bcd6c3.js';
3
3
 
4
4
  declare type Not<T extends boolean> = T extends true ? false : true;
5
5
  declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
package/dist/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
- import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-5aad25c1.js';
2
- export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-5aad25c1.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-71ccd11d.js';
4
- export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-71ccd11d.js';
1
+ import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-c3f83a58.js';
2
+ export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-c3f83a58.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-56bcd6c3.js';
4
+ export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-56bcd6c3.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
9
9
  export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
10
10
  import 'tinyspy';
11
+ import 'vite-node/client';
12
+ import 'vite-node/server';
13
+ import 'vite-node';
11
14
  import 'fs';
12
15
  import 'worker_threads';
13
16
 
@@ -136,17 +139,32 @@ declare class VitestUtils {
136
139
  clearAllMocks(): this;
137
140
  resetAllMocks(): this;
138
141
  restoreAllMocks(): this;
142
+ private _stubsGlobal;
143
+ private _stubsEnv;
139
144
  /**
140
- * Will put a value on global scope. Useful, if you are
141
- * using jsdom/happy-dom and want to mock global variables, like
142
- * `IntersectionObserver`.
145
+ * Makes value available on global namespace.
146
+ * Useful, if you want to have global variables available, like `IntersectionObserver`.
147
+ * You can return it back to original value with `vi.unstubGlobals`, or by enabling `unstubGlobals` config option.
143
148
  */
144
149
  stubGlobal(name: string | symbol | number, value: any): this;
150
+ /**
151
+ * Changes the value of `import.meta.env` and `process.env`.
152
+ * You can return it back to original value with `vi.unstubEnvs`, or by enabling `unstubEnvs` config option.
153
+ */
154
+ stubEnv(name: string, value: string): this;
155
+ /**
156
+ * Reset the value to original value that was available before first `vi.stubGlobal` was called.
157
+ */
158
+ unstubAllGlobals(): this;
159
+ /**
160
+ * Reset enviromental variables to the ones that were available before first `vi.stubEnv` was called.
161
+ */
162
+ unstubAllEnvs(): this;
145
163
  resetModules(): this;
146
164
  /**
147
- * Wait for all imports to load.
148
- * Useful, if you have a synchronous call that starts
149
- * importing a module that you cannot wait otherwise.
165
+ * Wait for all imports to load. Useful, if you have a synchronous call that starts
166
+ * importing a module that you cannot await otherwise.
167
+ * Will also wait for new imports, started during the wait.
150
168
  */
151
169
  dynamicImportSettled(): Promise<void>;
152
170
  private _config;
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.f86e5250.js';
2
- import { e as dist } from './chunk-runtime-test-state.3f86f48f.js';
3
- export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-runtime-test-state.3f86f48f.js';
1
+ export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.e655f6cc.js';
2
+ import { e as dist } from './chunk-utils-import.ca62c9d7.js';
3
+ export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.ca62c9d7.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
7
7
  import 'util';
8
- import './chunk-typecheck-constants.ed987901.js';
8
+ import './chunk-typecheck-constants.3f865d14.js';
9
9
  import 'path';
10
10
  import './chunk-utils-env.03f840f2.js';
11
11
  import 'tty';
12
12
  import 'url';
13
13
  import 'local-pkg';
14
14
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.42aebbb9.js';
15
+ import './chunk-runtime-rpc.7959fc79.js';
16
16
  import './chunk-utils-timers.793fd179.js';
17
17
  import 'fs';
18
- import './chunk-utils-source-map.29ff1088.js';
18
+ import './chunk-utils-source-map.5bbb50cd.js';
19
19
  import './spy.js';
20
20
  import 'tinyspy';
21
21
 
package/dist/loader.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import { pathToFileURL } from 'url';
2
2
  import { readFile } from 'fs/promises';
3
- import { i as isNodeBuiltin, n as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.0e4a6a88.js';
4
- import { g as getWorkerState } from './chunk-typecheck-constants.ed987901.js';
5
- import 'fs';
6
- import './chunk-utils-env.03f840f2.js';
7
- import 'tty';
8
- import 'path';
3
+ import { i as isNodeBuiltin, h as hasCJSSyntax } from './vendor-index.96e022fd.js';
4
+ import { normalizeModuleId } from 'vite-node/utils';
5
+ import { g as getWorkerState } from './chunk-typecheck-constants.3f865d14.js';
9
6
  import 'acorn';
10
7
  import 'module';
8
+ import 'fs';
9
+ import 'path';
11
10
  import 'assert';
12
11
  import 'util';
12
+ import './chunk-utils-env.03f840f2.js';
13
+ import 'tty';
13
14
  import 'local-pkg';
14
15
 
15
16
  var ModuleFormat = /* @__PURE__ */ ((ModuleFormat2) => {
package/dist/node.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as ModuleCacheMap, ay as ViteNodeRunnerOptions, az as MockMap, aA as ViteNodeRunner, aB as TestSequencer } from './types-71ccd11d.js';
2
- export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-71ccd11d.js';
1
+ import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as MockMap, ay as TestSequencer } from './types-56bcd6c3.js';
2
+ export { ay as TestSequencer, aA as TestSequencerConstructor, N as Vitest, az as startVitest } from './types-56bcd6c3.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
+ import { ViteNodeRunner } from 'vite-node/client';
5
+ import { ViteNodeRunnerOptions } from 'vite-node';
4
6
  import 'tinybench';
7
+ import 'vite-node/server';
5
8
  import 'fs';
6
9
  import 'worker_threads';
7
10
 
@@ -10,21 +13,17 @@ declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOver
10
13
  declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
11
14
 
12
15
  type Key = string | symbol;
13
- interface ViteRunnerRequest {
14
- (dep: string): any;
15
- callstack: string[];
16
- }
17
16
  declare class VitestMocker {
18
- options: ExecuteOptions;
19
- private moduleCache;
20
- private request;
17
+ runner: VitestRunner;
21
18
  private static pendingIds;
19
+ private static spyModulePath;
22
20
  private static spyModule?;
23
21
  private resolveCache;
24
- constructor(options: ExecuteOptions, moduleCache: ModuleCacheMap, request: ViteRunnerRequest);
22
+ constructor(runner: VitestRunner);
25
23
  private get root();
26
24
  private get base();
27
25
  private get mockMap();
26
+ private get moduleCache();
28
27
  getSuiteFilepath(): string;
29
28
  getMocks(): {
30
29
  [x: string]: string | (() => unknown) | null;
@@ -32,18 +31,17 @@ declare class VitestMocker {
32
31
  private resolvePath;
33
32
  private resolveMocks;
34
33
  private callFunctionMock;
35
- private getMockPath;
34
+ getMockPath(dep: string): string;
36
35
  getDependencyMock(id: string): string | (() => unknown) | null;
37
36
  normalizePath(path: string): string;
38
- getFsPath(path: string, external: string | null): string;
39
37
  resolveMockPath(mockPath: string, external: string | null): string | null;
40
38
  mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
41
39
  unmockPath(path: string): void;
42
40
  mockPath(originalId: string, path: string, external: string | null, factory?: () => any): void;
43
- importActual<T>(id: string, importer: string): Promise<T>;
44
- importMock(id: string, importer: string): Promise<any>;
45
- private ensureSpy;
46
- requestWithMock(dep: string): Promise<any>;
41
+ importActual<T>(rawId: string, importee: string): Promise<T>;
42
+ importMock(rawId: string, importee: string): Promise<any>;
43
+ initializeSpyModule(): Promise<void>;
44
+ requestWithMock(url: string, callstack: string[]): Promise<any>;
47
45
  queueMock(id: string, importer: string, factory?: () => unknown): void;
48
46
  queueUnmock(id: string, importer: string): void;
49
47
  }
@@ -53,12 +51,14 @@ interface ExecuteOptions extends ViteNodeRunnerOptions {
53
51
  }
54
52
  declare class VitestRunner extends ViteNodeRunner {
55
53
  options: ExecuteOptions;
54
+ mocker: VitestMocker;
56
55
  constructor(options: ExecuteOptions);
56
+ resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
57
+ dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
57
58
  prepareContext(context: Record<string, any>): Record<string, any> & {
58
- __vite_ssr_import__: (dep: string) => Promise<any>;
59
- __vite_ssr_dynamic_import__: (dep: string) => Promise<any>;
60
59
  __vitest_mocker__: VitestMocker;
61
60
  };
61
+ shouldInterop(path: string, mod: any): boolean;
62
62
  }
63
63
 
64
64
  declare class BaseSequencer implements TestSequencer {
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.b9495318.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.99b910d0.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.7d978f79.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.35fabb8b.js';
3
3
  import './chunk-utils-env.03f840f2.js';
4
4
  import 'tty';
5
5
  import 'url';
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
9
  import './chunk-env-node.67948209.js';
10
10
  import 'console';
11
- import './chunk-typecheck-constants.ed987901.js';
11
+ import './chunk-typecheck-constants.3f865d14.js';
12
12
  import 'vite';
13
13
  import 'process';
14
14
  import 'fs';
@@ -17,29 +17,29 @@ import 'util';
17
17
  import 'stream';
18
18
  import 'events';
19
19
  import './vendor-_commonjsHelpers.addc3445.js';
20
- import './chunk-vite-node-source-map.b4ea5792.js';
21
- import 'module';
22
- import 'vm';
23
- import './chunk-vite-node-utils.0e4a6a88.js';
24
- import 'acorn';
25
- import 'assert';
26
- import 'debug';
27
- import './vendor-source-map-support.1ce17397.js';
28
- import 'source-map';
29
- import 'perf_hooks';
20
+ import 'vite-node/client';
21
+ import 'vite-node/server';
30
22
  import 'fs/promises';
31
23
  import './vendor-index.737c3cff.js';
32
24
  import 'buffer';
33
25
  import 'child_process';
34
26
  import './vendor-index.e1d4cf84.js';
27
+ import 'assert';
28
+ import 'source-map';
29
+ import 'module';
30
+ import 'acorn';
35
31
  import 'acorn-walk';
36
32
  import 'worker_threads';
37
33
  import 'tinypool';
34
+ import './vendor-index.783e7f3e.js';
35
+ import 'perf_hooks';
38
36
  import './chunk-utils-timers.793fd179.js';
39
- import './chunk-utils-source-map.29ff1088.js';
37
+ import './chunk-utils-source-map.5bbb50cd.js';
40
38
  import 'crypto';
39
+ import 'vite-node/utils';
41
40
  import './vendor-index.9c919048.js';
42
41
  import './chunk-magic-string.3a794426.js';
43
42
  import 'strip-literal';
44
43
  import 'readline';
45
44
  import './vendor-index.9f20a9be.js';
45
+ import './vendor-index.96e022fd.js';
package/dist/suite.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import 'util';
2
2
  import 'chai';
3
- import './chunk-typecheck-constants.ed987901.js';
4
- export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.f86e5250.js';
3
+ import './chunk-typecheck-constants.3f865d14.js';
4
+ export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.e655f6cc.js';
5
5
  import 'path';
6
6
  import './chunk-utils-env.03f840f2.js';
7
7
  import 'tty';
8
8
  import 'url';
9
9
  import 'local-pkg';
10
10
  import './vendor-_commonjsHelpers.addc3445.js';
11
- import './chunk-runtime-rpc.42aebbb9.js';
11
+ import './chunk-runtime-rpc.7959fc79.js';
12
12
  import './chunk-utils-timers.793fd179.js';
13
13
  import 'fs';
14
- import './chunk-utils-source-map.29ff1088.js';
14
+ import './chunk-utils-source-map.5bbb50cd.js';
15
15
  import './spy.js';
16
16
  import 'tinyspy';