vitest 5.1.0 → 5.1.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 (61) hide show
  1. package/dist/browser.d.ts +6 -5
  2. package/dist/browser.js +7 -7
  3. package/dist/chunks/{base.Cof-UHJf.js → base.DCg6Jh4N.js} +12 -12
  4. package/dist/chunks/{browser.d.C7tWgUvw.d.ts → browser.d.B-QwH_F6.d.ts} +3 -3
  5. package/dist/chunks/{cac.BYbt0aJp.js → cac.DnNTZKhD.js} +15 -10
  6. package/dist/chunks/{cli-api.COfZo8lK.js → cli-api.9v9AxcPO.js} +444 -161
  7. package/dist/chunks/{config.d.B3YV4t0O.d.ts → config.d.BpJq6tRA.d.ts} +7 -1
  8. package/dist/chunks/{console.CQZ877Hi.js → console.DdxlsSsm.js} +4 -4
  9. package/dist/chunks/{creator.DHWmytIK.js → creator.B-BIoERb.js} +13 -11
  10. package/dist/chunks/{display.BlTmubjj.js → display.Cj2h2zsY.js} +1 -1
  11. package/dist/chunks/{doctor.B-oPbwps.js → doctor.DBFXC86z.js} +1 -1
  12. package/dist/chunks/{environment.d.BFQtFKdZ.d.ts → environment.d.rlpAM-ON.d.ts} +1 -1
  13. package/dist/chunks/{globals.ZKtKSkEf.js → globals.Cz5RAf6U.js} +10 -10
  14. package/dist/chunks/{index.Di8au7q4.js → index.6pLw0FLK.js} +220 -91
  15. package/dist/chunks/{index.w_oBZ9N8.js → index.BSqmIH9v.js} +3 -3
  16. package/dist/chunks/{index.Bi0NXYPf.js → index.C7Nn66Gy.js} +21 -9
  17. package/dist/chunks/{index.DmDMHCg8.js → index.CAmut2NG.js} +25 -1
  18. package/dist/chunks/{index.CZzC1gGg.js → index.D5jWOaqm.js} +35 -22
  19. package/dist/chunks/{index.D0heQG4v.js → index.Or9psEGe.js} +1 -1
  20. package/dist/chunks/{init-forks.BaDXQSD8.js → init-forks.q4IoGYZe.js} +7 -1
  21. package/dist/chunks/{init-threads.ZX_Vov0z.js → init-threads.Bf1Frg9S.js} +1 -1
  22. package/dist/chunks/{init.CO4AB7HZ.js → init.dGO4K2C0.js} +16 -8
  23. package/dist/chunks/{inspector.CvyFGlXm.js → inspector.D6o1NPo1.js} +12 -1
  24. package/dist/chunks/{modules.BJuCwlRJ.js → moduleSourceMap.Dp1WduWi.js} +31 -1
  25. package/dist/chunks/{native.upB-V0CK.js → native.D5q1ylZC.js} +2 -1
  26. package/dist/chunks/{nativeModuleMocker.Dh5azSB4.js → nativeModuleMocker.ihb3q7Cg.js} +4 -2
  27. package/dist/chunks/{plugin.d.LRFSN46m.d.ts → plugin.d.Bx2wJglX.d.ts} +58 -75
  28. package/dist/chunks/{plugins.DPQHVT0p.js → plugins.BPruPOR8.js} +1 -1
  29. package/dist/chunks/{rawSnapshot.DqSiqIEx.js → rawSnapshot.DvoRLRNr.js} +2 -2
  30. package/dist/chunks/{rpc.Uhkwr2NM.js → rpc.CNYWPa97.js} +3 -19
  31. package/dist/chunks/{rpc.d.3FOhdFx8.d.ts → rpc.d.DHfuwqP0.d.ts} +2 -2
  32. package/dist/chunks/{run.CjdgFZiW.js → run.zBhXlcZQ.js} +113 -49
  33. package/dist/chunks/{setup-common.CqAQCXzx.js → setup-common.kEGtNVHG.js} +3 -3
  34. package/dist/chunks/{source-map.DakdQc29.js → source-map.DPHGMWvM.js} +3 -1
  35. package/dist/chunks/{source-map.d.BkG8YK_3.d.ts → source-map.d.xB6_75fl.d.ts} +2 -1
  36. package/dist/chunks/{spy.DDMXghXv.js → spy.BO0hTE3G.js} +76 -53
  37. package/dist/chunks/{task-utils.d.D-gFPNFi.d.ts → task-utils.d.DgSjIb7r.d.ts} +1 -1
  38. package/dist/chunks/{utils.BBk_icFG.js → utils.sAsh2ClK.js} +2 -6
  39. package/dist/chunks/{vm.b4MbCAJQ.js → vm.DNr3Eju_.js} +4 -4
  40. package/dist/chunks/{worker.d.CyJRpyfZ.d.ts → worker.d.BigfbIsH.d.ts} +3 -3
  41. package/dist/cli.js +1 -1
  42. package/dist/config.d.ts +8 -8
  43. package/dist/index.d.ts +10 -10
  44. package/dist/index.js +10 -10
  45. package/dist/module-evaluator.d.ts +3 -3
  46. package/dist/module-evaluator.js +1 -1
  47. package/dist/node.d.ts +11 -10
  48. package/dist/node.js +18 -15
  49. package/dist/runtime.d.ts +5 -4
  50. package/dist/runtime.js +5 -3
  51. package/dist/spy.js +1 -1
  52. package/dist/worker.d.ts +4 -4
  53. package/dist/worker.js +19 -18
  54. package/dist/workers/forks.js +20 -19
  55. package/dist/workers/runVmTests.js +14 -14
  56. package/dist/workers/threads.js +20 -19
  57. package/dist/workers/vmForks.js +14 -13
  58. package/dist/workers/vmThreads.js +14 -13
  59. package/dist/workers/watchdog.js +20 -0
  60. package/package.json +21 -21
  61. /package/dist/chunks/{index.BoyTG_B7.js → dist.BoyTG_B7.js} +0 -0
@@ -1,4 +1,5 @@
1
1
  /// <reference types="chai" />
2
+ import { FetchResult } from 'vite/module-runner';
2
3
  import { Disposable } from 'vitest/optional-runtime-types.js';
3
4
  import { Fn, FnOptions, BenchOptions as BenchOptions$1, TaskResultCompleted, TaskResultRuntimeInfo, TaskResultTimestampProviderInfo, Statistics } from 'tinybench';
4
5
 
@@ -684,6 +685,10 @@ interface ResolveFunctionResult {
684
685
  url: string;
685
686
  }
686
687
  type ModuleType = "cjs" | "esm";
688
+ type VitestFetchResult = FetchResult & {
689
+ moduleType?: ModuleType;
690
+ sourceMap?: string;
691
+ };
687
692
  interface FetchCachedFileSystemResult {
688
693
  cached: true;
689
694
  tmp: string;
@@ -3777,6 +3782,7 @@ interface SerializedConfig {
3777
3782
  port?: number;
3778
3783
  host?: string;
3779
3784
  waitForDebugger?: boolean;
3785
+ openInMainProcess?: boolean;
3780
3786
  };
3781
3787
  watch: boolean;
3782
3788
  env: Record<string, any>;
@@ -3870,4 +3876,4 @@ type BrowserTraceViewRecordingMode = "off" | "on" | "failure-only";
3870
3876
  type BrowserTraceViewMode = "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure";
3871
3877
 
3872
3878
  export { fn as B, _vitest_spy as _, createChainable as a2, afterAll as b9, afterEach as ba, aroundAll as bb, aroundEach as bc, beforeAll as bd, beforeEach as be, onTestFailed as bf, onTestFinished as bg, disableDefaultColors as bj, SnapshotState as bq, format as f, inspect as i, stringify as s, spyOn as z };
3873
- export type { TestTryOptions as $, Awaitable as A, MaybeMockedDeep as C, DiffOptions as D, ExpectStatic as E, FileSpecification as F, MaybeMocked as G, MaybePartiallyMocked as H, MaybePartiallyMockedDeep as I, MockInstance as J, TestAPI as K, LabelColor as L, ModuleGraphData as M, SuiteCollector as N, SuiteAPI as O, ParsedStack as P, Suite as Q, RuntimeOptions as R, SerializedCoverageConfig as S, TestError as T, UserConsoleLog as U, VitestRunner as V, SuiteHooks as W, VitestRunnerImportSource as X, Task as Y, CancelReason as Z, File as a, TestArtifactLocation as a$, TestContext as a0, ImportDuration as a1, AfterSuiteRunMeta as a3, Assertion as a4, AsymmetricMatchersContaining as a5, BaselineData as a6, Bench as a7, BenchFn as a8, BenchFnOptions as a9, Mocked as aA, MockedClass as aB, MockedFunction as aC, MockedObject as aD, OnTestFailedHandler as aE, OnTestFinishedHandler as aF, RunMode as aG, TaskBase as aH, TaskResult as aI, TaskResultAttempt as aJ, RuntimeConfig as aK, SerializedError as aL, SnapshotData as aM, SnapshotMatchOptions as aN, SnapshotResult as aO, SnapshotSerializer as aP, SnapshotStateOptions as aQ, SnapshotSummary as aR, SnapshotUpdateState as aS, SuiteFactory as aT, SuiteOptions as aU, TaskCustomOptions as aV, TaskMeta as aW, TaskState as aX, TestAnnotationArtifact as aY, TestAnnotationLocation as aZ, TestArtifactBase as a_, BenchFromSource as aa, BenchOptions as ab, BenchRegistration as ac, BenchRegistrationInput as ad, BenchResult as ae, BenchRunOptions as af, BenchStorage as ag, BenchmarkGroup as ah, BenchmarkProvider as ai, BrowserTraceArtifact as aj, DeeplyAllowMatchers as ak, DomainMatchResult as al, FailureScreenshotArtifact as am, JestAssertion as an, RawMatcherFn as ao, Matchers as ap, MatchersObject as aq, MockContext as ar, MockResult as as, MockResultIncomplete as at, MockResultReturn as au, MockResultThrow as av, MockSettledResult as aw, MockSettledResultFulfilled as ax, MockSettledResultIncomplete as ay, MockSettledResultRejected as az, SerializedConfig as b, TestArtifactRegistry as b0, TestAttachment as b1, TestBenchmark as b2, TestBenchmarkTask as b3, TestFunction as b4, TestOptions as b5, TestTags as b6, UncheckedSnapshot as b7, VisualRegressionArtifact as b8, SequenceHooks as bh, SequenceSetupFiles as bi, SerializableRetry as bk, BrowserTraceViewMode as bl, BrowserTraceViewRecordingMode as bm, Arrayable as bn, AsyncLeak as bo, PrettyFormatOptions as bp, PromisifyAssertion as br, Tester as bs, Plugin as bt, SnapshotEnvironment as bu, SnapshotEnvironmentOptions as bv, FetchCachedFileSystemResult as bw, ResolveFunctionResult as bx, SerializedDiffOptions as c, StringifyOptions as d, FakeTimersConfig as e, TestTagDefinition as g, TestAnnotation as h, TestArtifact as j, TaskResultPack as k, TaskEventPack as l, SerializedRootConfig as m, Test as n, TaskPopulated as o, ProvidedContext as p, MatcherState as q, SyncExpectationResult as r, AsyncExpectationResult as t, DomainSnapshotAdapter as u, ExpectationResult as v, Procedure as w, Mock as x, TemporalTimelike as y };
3879
+ export type { TestTryOptions as $, Awaitable as A, MaybeMockedDeep as C, DiffOptions as D, ExpectStatic as E, FileSpecification as F, MaybeMocked as G, MaybePartiallyMocked as H, MaybePartiallyMockedDeep as I, MockInstance as J, TestAPI as K, LabelColor as L, ModuleGraphData as M, SuiteCollector as N, SuiteAPI as O, ParsedStack as P, Suite as Q, RuntimeOptions as R, SerializedCoverageConfig as S, TestError as T, UserConsoleLog as U, VitestRunner as V, SuiteHooks as W, VitestRunnerImportSource as X, Task as Y, CancelReason as Z, File as a, TestArtifactLocation as a$, TestContext as a0, ImportDuration as a1, AfterSuiteRunMeta as a3, Assertion as a4, AsymmetricMatchersContaining as a5, BaselineData as a6, Bench as a7, BenchFn as a8, BenchFnOptions as a9, Mocked as aA, MockedClass as aB, MockedFunction as aC, MockedObject as aD, OnTestFailedHandler as aE, OnTestFinishedHandler as aF, RunMode as aG, TaskBase as aH, TaskResult as aI, TaskResultAttempt as aJ, RuntimeConfig as aK, SerializedError as aL, SnapshotData as aM, SnapshotMatchOptions as aN, SnapshotResult as aO, SnapshotSerializer as aP, SnapshotStateOptions as aQ, SnapshotSummary as aR, SnapshotUpdateState as aS, SuiteFactory as aT, SuiteOptions as aU, TaskCustomOptions as aV, TaskMeta as aW, TaskState as aX, TestAnnotationArtifact as aY, TestAnnotationLocation as aZ, TestArtifactBase as a_, BenchFromSource as aa, BenchOptions as ab, BenchRegistration as ac, BenchRegistrationInput as ad, BenchResult as ae, BenchRunOptions as af, BenchStorage as ag, BenchmarkGroup as ah, BenchmarkProvider as ai, BrowserTraceArtifact as aj, DeeplyAllowMatchers as ak, DomainMatchResult as al, FailureScreenshotArtifact as am, JestAssertion as an, RawMatcherFn as ao, Matchers as ap, MatchersObject as aq, MockContext as ar, MockResult as as, MockResultIncomplete as at, MockResultReturn as au, MockResultThrow as av, MockSettledResult as aw, MockSettledResultFulfilled as ax, MockSettledResultIncomplete as ay, MockSettledResultRejected as az, SerializedConfig as b, TestArtifactRegistry as b0, TestAttachment as b1, TestBenchmark as b2, TestBenchmarkTask as b3, TestFunction as b4, TestOptions as b5, TestTags as b6, UncheckedSnapshot as b7, VisualRegressionArtifact as b8, SequenceHooks as bh, SequenceSetupFiles as bi, SerializableRetry as bk, BrowserTraceViewMode as bl, BrowserTraceViewRecordingMode as bm, Arrayable as bn, AsyncLeak as bo, PrettyFormatOptions as bp, PromisifyAssertion as br, Tester as bs, Plugin as bt, SnapshotEnvironment as bu, SnapshotEnvironmentOptions as bv, VitestFetchResult as bw, FetchCachedFileSystemResult as bx, ResolveFunctionResult as by, SerializedDiffOptions as c, StringifyOptions as d, FakeTimersConfig as e, TestTagDefinition as g, TestAnnotation as h, TestArtifact as j, TaskResultPack as k, TaskEventPack as l, SerializedRootConfig as m, Test as n, TaskPopulated as o, ProvidedContext as p, MatcherState as q, SyncExpectationResult as r, AsyncExpectationResult as t, DomainSnapshotAdapter as u, ExpectationResult as v, Procedure as w, Mock as x, TemporalTimelike as y };
@@ -1,10 +1,10 @@
1
1
  import { Console } from 'node:console';
2
2
  import { relative } from 'node:path';
3
3
  import { Writable } from 'node:stream';
4
- import { a as getSafeTimers } from './source-map.DakdQc29.js';
4
+ import { a as getSafeTimers } from './source-map.DPHGMWvM.js';
5
5
  import { $ } from './tinyrainbow.Do8I1XRG.js';
6
6
  import { g as getWorkerState, E as EnvironmentTeardownError } from './utils.DYj33du9.js';
7
- import './index.D0heQG4v.js';
7
+ import './index.Or9psEGe.js';
8
8
  import './pathe.M-eThtNZ.zq3TM4NT.js';
9
9
 
10
10
  const RealDate = globalThis.Date;
@@ -85,7 +85,7 @@ function createCustomConsole(defaultState) {
85
85
  }
86
86
  const stdout = new Writable({ write(data, encoding, callback) {
87
87
  const s = state();
88
- const id = s?.current?.id || s?.current?.suite?.id || s.current?.file.id || getTaskIdByStack(s.config.root);
88
+ const id = s.current?.id || getTaskIdByStack(s.config.root);
89
89
  let timer = timers.get(id);
90
90
  if (timer) timer.stdoutTime = timer.stdoutTime || RealDate.now();
91
91
  else {
@@ -112,7 +112,7 @@ function createCustomConsole(defaultState) {
112
112
  } });
113
113
  const stderr = new Writable({ write(data, encoding, callback) {
114
114
  const s = state();
115
- const id = s?.current?.id || s?.current?.suite?.id || s.current?.file.id || getTaskIdByStack(s.config.root);
115
+ const id = s.current?.id || getTaskIdByStack(s.config.root);
116
116
  let timer = timers.get(id);
117
117
  if (timer) timer.stderrTime = timer.stderrTime || RealDate.now();
118
118
  else {
@@ -1,8 +1,8 @@
1
1
  import { existsSync, writeFileSync, readFileSync } from 'node:fs';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import { resolve, dirname, relative } from 'node:path';
4
- import { detectPackageManager, installPackage } from './index.BoyTG_B7.js';
5
- import { p as prompt, n as findConfigFile } from './index.Di8au7q4.js';
4
+ import { detectPackageManager, installPackage } from './dist.BoyTG_B7.js';
5
+ import { p as prompt, n as findConfigFile } from './index.6pLw0FLK.js';
6
6
  import { x } from 'tinyexec';
7
7
  import { $ } from './tinyrainbow.Do8I1XRG.js';
8
8
  import 'node:process';
@@ -21,34 +21,36 @@ import './defaults.B1FCaFfh.js';
21
21
  import 'node:os';
22
22
  import './env.BKKtU2WC.js';
23
23
  import 'std-env';
24
+ import './inspector.D6o1NPo1.js';
24
25
  import 'node:crypto';
25
26
  import '../path.js';
26
- import './modules.BJuCwlRJ.js';
27
+ import './moduleSourceMap.Dp1WduWi.js';
28
+ import 'node:buffer';
27
29
  import 'magic-string';
28
30
  import '@vitest/mocker/node';
29
31
  import 'node:console';
30
32
  import 'node:stream';
31
- import './display.BlTmubjj.js';
32
- import './index.D0heQG4v.js';
33
+ import './display.Cj2h2zsY.js';
34
+ import './index.Or9psEGe.js';
35
+ import 'node:child_process';
33
36
  import 'node:perf_hooks';
34
- import './source-map.DakdQc29.js';
35
- import './run.CjdgFZiW.js';
37
+ import './source-map.DPHGMWvM.js';
38
+ import './run.zBhXlcZQ.js';
36
39
  import '../task-utils.js';
37
40
  import 'obug';
38
41
  import './resolver.BzpmeQeT.js';
39
42
  import 'es-module-lexer';
40
43
  import './offset.Dy-5Fdfn.js';
41
- import './utils.BBk_icFG.js';
44
+ import './utils.sAsh2ClK.js';
42
45
  import '#module-evaluator';
46
+ import './index.CAmut2NG.js';
43
47
  import 'picomatch';
44
48
  import './module-dependencies._2Eei3FO.js';
45
49
  import './coverage.jGCktcGP.js';
46
50
  import 'node:tty';
47
51
  import 'node:events';
48
- import './index.DmDMHCg8.js';
49
- import 'node:child_process';
50
52
  import 'node:worker_threads';
51
- import './cac.BYbt0aJp.js';
53
+ import './cac.DnNTZKhD.js';
52
54
  import 'events';
53
55
  import 'readline';
54
56
 
@@ -1,4 +1,4 @@
1
- import { f as format$1, p as plugins, c as createDOMElementFilter } from './index.D0heQG4v.js';
1
+ import { f as format$1, p as plugins, c as createDOMElementFilter } from './index.Or9psEGe.js';
2
2
 
3
3
  const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
4
4
  const PLUGINS = [
@@ -100,7 +100,7 @@ function log(...args) {
100
100
  console.log(...args);
101
101
  }
102
102
  async function doctor(cliFilters, options) {
103
- const { prepareVitest } = await import('./cli-api.COfZo8lK.js').then(function (n) { return n.j; });
103
+ const { prepareVitest } = await import('./cli-api.9v9AxcPO.js').then(function (n) { return n.j; });
104
104
  log();
105
105
  log($.inverse($.bold($.blue(" DOCTOR "))), "resolving the current configuration...");
106
106
  const ctx = await prepareVitest({
@@ -1,4 +1,4 @@
1
- import { A as Awaitable } from './config.d.B3YV4t0O.js';
1
+ import { A as Awaitable } from './config.d.BpJq6tRA.js';
2
2
 
3
3
  interface EnvironmentReturn {
4
4
  teardown: (global: any) => Awaitable<void>;
@@ -1,22 +1,22 @@
1
1
  import { g as globalApis } from './constants.DLYM6cZY.js';
2
- import { i as index } from './index.CZzC1gGg.js';
3
- import './run.CjdgFZiW.js';
4
- import './index.D0heQG4v.js';
2
+ import { i as index } from './index.D5jWOaqm.js';
3
+ import './run.zBhXlcZQ.js';
4
+ import './index.Or9psEGe.js';
5
5
  import './tinyrainbow.Do8I1XRG.js';
6
- import './display.BlTmubjj.js';
6
+ import './display.Cj2h2zsY.js';
7
7
  import './pathe.M-eThtNZ.zq3TM4NT.js';
8
- import './source-map.DakdQc29.js';
8
+ import './source-map.DPHGMWvM.js';
9
9
  import '../task-utils.js';
10
10
  import './utils.DYj33du9.js';
11
- import './spy.DDMXghXv.js';
11
+ import './spy.BO0hTE3G.js';
12
12
  import 'chai';
13
- import './plugins.DPQHVT0p.js';
14
- import './rawSnapshot.DqSiqIEx.js';
13
+ import './plugins.BPruPOR8.js';
14
+ import './rawSnapshot.DvoRLRNr.js';
15
15
  import './offset.Dy-5Fdfn.js';
16
- import './rpc.Uhkwr2NM.js';
16
+ import './index.CAmut2NG.js';
17
17
  import 'vite/module-runner';
18
- import './index.DmDMHCg8.js';
19
18
  import 'tinybench';
19
+ import './rpc.CNYWPa97.js';
20
20
  import 'expect-type';
21
21
 
22
22
  function registerApiGlobally() {