vitest 0.25.8 → 0.26.1

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 (45) hide show
  1. package/LICENSE.md +0 -142
  2. package/browser.d.ts +1 -0
  3. package/dist/browser.d.ts +8 -5
  4. package/dist/browser.js +17 -16
  5. package/dist/{chunk-api-setup.dc71e384.js → chunk-api-setup.adeab271.js} +45 -46
  6. package/dist/{chunk-env-node.67948209.js → chunk-env-node.b3664da2.js} +1 -1
  7. package/dist/{chunk-install-pkg.579a5a27.js → chunk-install-pkg.6dd2bae6.js} +19 -19
  8. package/dist/chunk-integrations-globals.96914902.js +27 -0
  9. package/dist/{chunk-node-git.5a1b1656.js → chunk-node-git.a90c0582.js} +10 -6
  10. package/dist/{chunk-runtime-chain.f86e5250.js → chunk-runtime-chain.4cd984be.js} +8 -8
  11. package/dist/{chunk-runtime-error.616e92ca.js → chunk-runtime-error.f5c8aaf2.js} +10 -8
  12. package/dist/{chunk-runtime-mocker.99b910d0.js → chunk-runtime-mocker.3fa602ba.js} +73 -65
  13. package/dist/{chunk-runtime-rpc.42aebbb9.js → chunk-runtime-rpc.54d72169.js} +2 -2
  14. package/dist/{chunk-runtime-setup.5398e2c4.js → chunk-runtime-setup.9cdedce6.js} +21 -34
  15. package/dist/{chunk-vite-node-externalize.b9495318.js → chunk-snapshot-manager.e54d78b8.js} +82 -358
  16. package/dist/{chunk-typecheck-constants.ed987901.js → chunk-typecheck-constants.06e1fe5b.js} +8 -7
  17. package/dist/{chunk-utils-env.03f840f2.js → chunk-utils-env.3fdc1793.js} +8 -8
  18. package/dist/{chunk-runtime-test-state.3f86f48f.js → chunk-utils-import.afe2ffde.js} +50 -19
  19. package/dist/{chunk-utils-source-map.29ff1088.js → chunk-utils-source-map.59ba6b0a.js} +6 -4
  20. package/dist/{chunk-utils-timers.793fd179.js → chunk-utils-timers.715da787.js} +31 -15
  21. package/dist/cli-wrapper.js +10 -5
  22. package/dist/cli.js +30 -25
  23. package/dist/config.d.ts +6 -3
  24. package/dist/entry.js +18 -16
  25. package/dist/environments.d.ts +6 -3
  26. package/dist/environments.js +2 -2
  27. package/dist/{index-5aad25c1.d.ts → index-1e9f7f83.d.ts} +1 -1
  28. package/dist/index.d.ts +30 -12
  29. package/dist/index.js +12 -10
  30. package/dist/loader.js +12 -7
  31. package/dist/node.d.ts +21 -20
  32. package/dist/node.js +33 -25
  33. package/dist/suite.js +10 -8
  34. package/dist/{types-71ccd11d.d.ts → types-c41bae41.d.ts} +39 -279
  35. package/dist/vendor-index.2e96c50b.js +215 -0
  36. package/dist/vendor-index.783e7f3e.js +71 -0
  37. package/dist/{vendor-index.e1d4cf84.js → vendor-index.7a2cebfe.js} +16 -16
  38. package/dist/{vendor-index.737c3cff.js → vendor-index.b2fdde54.js} +9 -8
  39. package/dist/worker.js +21 -18
  40. package/environments.d.ts +1 -0
  41. package/package.json +4 -4
  42. package/dist/chunk-integrations-globals.4d261bb8.js +0 -25
  43. package/dist/chunk-vite-node-source-map.b4ea5792.js +0 -446
  44. package/dist/chunk-vite-node-utils.0e4a6a88.js +0 -1385
  45. package/dist/vendor-source-map-support.1ce17397.js +0 -707
package/LICENSE.md CHANGED
@@ -335,34 +335,6 @@ Repository: micromatch/braces
335
335
 
336
336
  ---------------------------------------
337
337
 
338
- ## buffer-from
339
- License: MIT
340
- Repository: LinusU/buffer-from
341
-
342
- > MIT License
343
- >
344
- > Copyright (c) 2016, 2018 Linus Unnebäck
345
- >
346
- > Permission is hereby granted, free of charge, to any person obtaining a copy
347
- > of this software and associated documentation files (the "Software"), to deal
348
- > in the Software without restriction, including without limitation the rights
349
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
350
- > copies of the Software, and to permit persons to whom the Software is
351
- > furnished to do so, subject to the following conditions:
352
- >
353
- > The above copyright notice and this permission notice shall be included in all
354
- > copies or substantial portions of the Software.
355
- >
356
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
357
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
358
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
359
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
360
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
361
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
362
- > SOFTWARE.
363
-
364
- ---------------------------------------
365
-
366
338
  ## cac
367
339
  License: MIT
368
340
  By: egoist
@@ -1773,57 +1745,6 @@ Repository: micromatch/picomatch
1773
1745
 
1774
1746
  ---------------------------------------
1775
1747
 
1776
- ## pkg-types
1777
- License: MIT
1778
- Repository: unjs/pkg-types
1779
-
1780
- > MIT License
1781
- >
1782
- > Copyright (c) Pooya Parsa <pooya@pi0.io>
1783
- >
1784
- > Permission is hereby granted, free of charge, to any person obtaining a copy
1785
- > of this software and associated documentation files (the "Software"), to deal
1786
- > in the Software without restriction, including without limitation the rights
1787
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1788
- > copies of the Software, and to permit persons to whom the Software is
1789
- > furnished to do so, subject to the following conditions:
1790
- >
1791
- > The above copyright notice and this permission notice shall be included in all
1792
- > copies or substantial portions of the Software.
1793
- >
1794
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1795
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1796
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1797
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1798
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1799
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1800
- > SOFTWARE.
1801
- >
1802
- > --------------------------------------------------------------------------------
1803
- >
1804
- > Copyright Joyent, Inc. and other Node contributors.
1805
- >
1806
- > Permission is hereby granted, free of charge, to any person obtaining a
1807
- > copy of this software and associated documentation files (the
1808
- > "Software"), to deal in the Software without restriction, including
1809
- > without limitation the rights to use, copy, modify, merge, publish,
1810
- > distribute, sublicense, and/or sell copies of the Software, and to permit
1811
- > persons to whom the Software is furnished to do so, subject to the
1812
- > following conditions:
1813
- >
1814
- > The above copyright notice and this permission notice shall be included
1815
- > in all copies or substantial portions of the Software.
1816
- >
1817
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1818
- > OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1819
- > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1820
- > NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1821
- > DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1822
- > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1823
- > USE OR OTHER DEALINGS IN THE SOFTWARE.
1824
-
1825
- ---------------------------------------
1826
-
1827
1748
  ## pretty-format
1828
1749
  License: MIT
1829
1750
  By: James Kyle
@@ -2116,34 +2037,6 @@ Repository: chalk/slice-ansi
2116
2037
 
2117
2038
  ---------------------------------------
2118
2039
 
2119
- ## source-map-support
2120
- License: MIT
2121
- Repository: https://github.com/evanw/node-source-map-support
2122
-
2123
- > The MIT License (MIT)
2124
- >
2125
- > Copyright (c) 2014 Evan Wallace
2126
- >
2127
- > Permission is hereby granted, free of charge, to any person obtaining a copy
2128
- > of this software and associated documentation files (the "Software"), to deal
2129
- > in the Software without restriction, including without limitation the rights
2130
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2131
- > copies of the Software, and to permit persons to whom the Software is
2132
- > furnished to do so, subject to the following conditions:
2133
- >
2134
- > The above copyright notice and this permission notice shall be included in all
2135
- > copies or substantial portions of the Software.
2136
- >
2137
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2138
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2139
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2140
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2141
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2142
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2143
- > SOFTWARE.
2144
-
2145
- ---------------------------------------
2146
-
2147
2040
  ## string-width
2148
2041
  License: MIT
2149
2042
  By: Sindre Sorhus
@@ -2251,41 +2144,6 @@ Repository: git+ssh://git@github.com/chaijs/type-detect.git
2251
2144
 
2252
2145
  ---------------------------------------
2253
2146
 
2254
- ## ufo
2255
- License: MIT
2256
- Repository: unjs/ufo
2257
-
2258
- > MIT License
2259
- >
2260
- > Copyright (c) Pooya Parsa <pooya@pi0.io>
2261
- >
2262
- > Permission is hereby granted, free of charge, to any person obtaining a copy
2263
- > of this software and associated documentation files (the "Software"), to deal
2264
- > in the Software without restriction, including without limitation the rights
2265
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2266
- > copies of the Software, and to permit persons to whom the Software is
2267
- > furnished to do so, subject to the following conditions:
2268
- >
2269
- > The above copyright notice and this permission notice shall be included in all
2270
- > copies or substantial portions of the Software.
2271
- >
2272
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2273
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2274
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2275
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2276
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2277
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2278
- > SOFTWARE.
2279
-
2280
- ---------------------------------------
2281
-
2282
- ## vite-node
2283
- License: MIT
2284
- By: Anthony Fu
2285
- Repository: git+https://github.com/vitest-dev/vitest.git
2286
-
2287
- ---------------------------------------
2288
-
2289
2147
  ## which
2290
2148
  License: ISC
2291
2149
  By: Isaac Z. Schlueter
package/browser.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/browser'
package/dist/browser.d.ts CHANGED
@@ -1,14 +1,17 @@
1
- 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, 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';
2
- import { b as ResolvedConfig } from './types-71ccd11d.js';
3
- 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
+ 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, 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-1e9f7f83.js';
2
+ import { b as ResolvedConfig } from './types-c41bae41.js';
3
+ 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-c41bae41.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
7
7
  export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
8
8
  import 'tinyspy';
9
9
  import 'vite';
10
- import 'fs';
11
- import 'worker_threads';
10
+ import 'vite-node/client';
11
+ import 'vite-node/server';
12
+ import 'vite-node';
13
+ import 'node:fs';
14
+ import 'node:worker_threads';
12
15
 
13
16
  declare function startTests(paths: string[], config: ResolvedConfig): Promise<void>;
14
17
 
package/dist/browser.js CHANGED
@@ -1,31 +1,32 @@
1
- export { 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, o as onTestFailed } from './chunk-runtime-test-state.3f86f48f.js';
4
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.5398e2c4.js';
1
+ export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.4cd984be.js';
2
+ import { e as dist } from './chunk-utils-import.afe2ffde.js';
3
+ export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.afe2ffde.js';
4
+ export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.9cdedce6.js';
5
5
  import * as chai from 'chai';
6
6
  export { chai };
7
7
  export { assert, should } from 'chai';
8
8
  import 'util';
9
- import './chunk-typecheck-constants.ed987901.js';
10
- import 'path';
11
- import './chunk-utils-env.03f840f2.js';
9
+ import './chunk-typecheck-constants.06e1fe5b.js';
10
+ import 'node:path';
11
+ import './chunk-utils-env.3fdc1793.js';
12
12
  import 'tty';
13
- import 'url';
13
+ import 'node:url';
14
+ import 'path';
14
15
  import 'local-pkg';
15
16
  import './vendor-_commonjsHelpers.addc3445.js';
16
- import './chunk-runtime-rpc.42aebbb9.js';
17
- import './chunk-utils-timers.793fd179.js';
17
+ import './chunk-runtime-rpc.54d72169.js';
18
+ import './chunk-utils-timers.715da787.js';
19
+ import 'node:fs';
20
+ import './chunk-utils-source-map.59ba6b0a.js';
18
21
  import 'fs';
19
- import './chunk-utils-source-map.29ff1088.js';
20
22
  import './spy.js';
21
23
  import 'tinyspy';
22
24
  import 'perf_hooks';
23
25
  import './chunk-integrations-coverage.befed097.js';
24
- import './chunk-runtime-error.616e92ca.js';
25
- import './vendor-source-map-support.1ce17397.js';
26
- import 'source-map';
27
- import './chunk-env-node.67948209.js';
28
- import 'console';
26
+ import './chunk-runtime-error.f5c8aaf2.js';
27
+ import 'vite-node/source-map';
28
+ import './chunk-env-node.b3664da2.js';
29
+ import 'node:console';
29
30
 
30
31
 
31
32
 
@@ -1,5 +1,5 @@
1
- import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-source-map.b4ea5792.js';
1
+ import { promises } from 'node:fs';
2
+ import { c as createBirpc } from './vendor-index.783e7f3e.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -8,19 +8,48 @@ import require$$5 from 'crypto';
8
8
  import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
- import url from 'url';
12
- import { A as API_PATH } from './chunk-utils-env.03f840f2.js';
13
- import 'module';
14
- import 'vm';
15
- import './chunk-vite-node-utils.0e4a6a88.js';
16
- import 'acorn';
17
- import 'path';
18
- import 'assert';
19
- import 'util';
20
- import 'debug';
21
- import './vendor-source-map-support.1ce17397.js';
22
- import 'source-map';
11
+ import require$$7 from 'url';
12
+ import { A as API_PATH } from './chunk-utils-env.3fdc1793.js';
13
+ import './chunk-typecheck-constants.06e1fe5b.js';
23
14
  import 'tty';
15
+ import 'node:url';
16
+ import 'path';
17
+ import 'node:path';
18
+ import 'local-pkg';
19
+
20
+ async function getModuleGraph(ctx, id) {
21
+ const graph = {};
22
+ const externalized = /* @__PURE__ */ new Set();
23
+ const inlined = /* @__PURE__ */ new Set();
24
+ function clearId(id2) {
25
+ return (id2 == null ? void 0 : id2.replace(/\?v=\w+$/, "")) || "";
26
+ }
27
+ async function get(mod, seen = /* @__PURE__ */ new Map()) {
28
+ if (!mod || !mod.id)
29
+ return;
30
+ if (seen.has(mod))
31
+ return seen.get(mod);
32
+ let id2 = clearId(mod.id);
33
+ seen.set(mod, id2);
34
+ const rewrote = await ctx.vitenode.shouldExternalize(id2);
35
+ if (rewrote) {
36
+ id2 = rewrote;
37
+ externalized.add(id2);
38
+ seen.set(mod, id2);
39
+ } else {
40
+ inlined.add(id2);
41
+ }
42
+ const mods = Array.from(mod.importedModules).filter((i) => i.id && !i.id.includes("/vitest/dist/"));
43
+ graph[id2] = (await Promise.all(mods.map((m) => get(m, seen)))).filter(Boolean);
44
+ return id2;
45
+ }
46
+ await get(ctx.server.moduleGraph.getModuleById(id));
47
+ return {
48
+ graph,
49
+ externalized: Array.from(externalized),
50
+ inlined: Array.from(inlined)
51
+ };
52
+ }
24
53
 
25
54
  /*! (c) 2020 Andrea Giammarchi */
26
55
 
@@ -2540,7 +2569,7 @@ const http$1 = require$$2$1;
2540
2569
  const net = require$$3;
2541
2570
  const tls = require$$4;
2542
2571
  const { randomBytes, createHash: createHash$1 } = require$$5;
2543
- const { URL: URL$1 } = url;
2572
+ const { URL: URL$1 } = require$$7;
2544
2573
 
2545
2574
  const PerMessageDeflate$1 = permessageDeflate;
2546
2575
  const Receiver = receiver;
@@ -4488,37 +4517,7 @@ function setup(ctx) {
4488
4517
  }
4489
4518
  },
4490
4519
  async getModuleGraph(id) {
4491
- const graph = {};
4492
- const externalized = /* @__PURE__ */ new Set();
4493
- const inlined = /* @__PURE__ */ new Set();
4494
- function clearId(id2) {
4495
- return (id2 == null ? void 0 : id2.replace(/\?v=\w+$/, "")) || "";
4496
- }
4497
- async function get(mod, seen = /* @__PURE__ */ new Map()) {
4498
- if (!mod || !mod.id)
4499
- return;
4500
- if (seen.has(mod))
4501
- return seen.get(mod);
4502
- let id2 = clearId(mod.id);
4503
- seen.set(mod, id2);
4504
- const rewrote = await ctx.vitenode.shouldExternalize(id2);
4505
- if (rewrote) {
4506
- id2 = rewrote;
4507
- externalized.add(id2);
4508
- seen.set(mod, id2);
4509
- } else {
4510
- inlined.add(id2);
4511
- }
4512
- const mods = Array.from(mod.importedModules).filter((i) => i.id && !i.id.includes("/vitest/dist/"));
4513
- graph[id2] = (await Promise.all(mods.map((m) => get(m, seen)))).filter(Boolean);
4514
- return id2;
4515
- }
4516
- await get(ctx.server.moduleGraph.getModuleById(id));
4517
- return {
4518
- graph,
4519
- externalized: Array.from(externalized),
4520
- inlined: Array.from(inlined)
4521
- };
4520
+ return getModuleGraph(ctx, id);
4522
4521
  },
4523
4522
  updateSnapshot(file) {
4524
4523
  if (!file)
@@ -1,4 +1,4 @@
1
- import { Console } from 'console';
1
+ import { Console } from 'node:console';
2
2
  import { importModule } from 'local-pkg';
3
3
 
4
4
  var node = {
@@ -1,10 +1,10 @@
1
- import fs$2 from 'fs';
2
- import path$2 from 'path';
1
+ import require$$0 from 'fs';
2
+ import g from 'path';
3
3
  import util from 'util';
4
- import childProcess$1 from 'child_process';
5
- import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.e1d4cf84.js';
4
+ import require$$0$2 from 'child_process';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.7a2cebfe.js';
6
6
  import { o as onetime$1 } from './vendor-index.9c919048.js';
7
- import require$$0 from 'os';
7
+ import require$$0$1 from 'os';
8
8
  import './vendor-_commonjsHelpers.addc3445.js';
9
9
  import 'assert';
10
10
  import 'events';
@@ -205,8 +205,8 @@ const pLocate$1 = async (iterable, tester, options) => {
205
205
 
206
206
  var pLocate_1 = pLocate$1;
207
207
 
208
- const path$1 = path$2;
209
- const fs$1 = fs$2;
208
+ const path$1 = g;
209
+ const fs$1 = require$$0;
210
210
  const {promisify: promisify$1} = util;
211
211
  const pLocate = pLocate_1;
212
212
 
@@ -275,7 +275,7 @@ locatePath.exports.sync = (paths, options) => {
275
275
 
276
276
  var pathExists = {exports: {}};
277
277
 
278
- const fs = fs$2;
278
+ const fs = require$$0;
279
279
  const {promisify} = util;
280
280
 
281
281
  const pAccess = promisify(fs.access);
@@ -299,7 +299,7 @@ pathExists.exports.sync = path => {
299
299
  };
300
300
 
301
301
  (function (module) {
302
- const path = path$2;
302
+ const path = g;
303
303
  const locatePath$1 = locatePath.exports;
304
304
  const pathExists$1 = pathExists.exports;
305
305
 
@@ -411,7 +411,7 @@ var stripFinalNewline$1 = input => {
411
411
  var npmRunPath$1 = {exports: {}};
412
412
 
413
413
  (function (module) {
414
- const path = path$2;
414
+ const path = g;
415
415
  const pathKey$1 = pathKey.exports;
416
416
 
417
417
  const npmRunPath = options => {
@@ -759,7 +759,7 @@ standard:"posix"};
759
759
  const SIGRTMIN=34;
760
760
  const SIGRTMAX=64;realtime.SIGRTMAX=SIGRTMAX;
761
761
 
762
- Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0;
762
+ Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0$1;
763
763
 
764
764
  var _core=core;
765
765
  var _realtime$1=realtime;
@@ -794,7 +794,7 @@ const number=supported?constantSignal:defaultNumber;
794
794
  return {name,number,description,supported,action,forced,standard};
795
795
  };
796
796
 
797
- Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0;
797
+ Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0$1;
798
798
 
799
799
  var _signals=signals;
800
800
  var _realtime=realtime;
@@ -1007,7 +1007,7 @@ stdio.exports.node = options => {
1007
1007
  return [...stdio, 'ipc'];
1008
1008
  };
1009
1009
 
1010
- const os = require$$0;
1010
+ const os = require$$0$1;
1011
1011
  const onExit = signalExit.exports;
1012
1012
 
1013
1013
  const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
@@ -1341,8 +1341,8 @@ var command = {
1341
1341
  parseCommand: parseCommand$1
1342
1342
  };
1343
1343
 
1344
- const path = path$2;
1345
- const childProcess = childProcess$1;
1344
+ const path = g;
1345
+ const childProcess = require$$0$2;
1346
1346
  const crossSpawn = crossSpawn$1.exports;
1347
1347
  const stripFinalNewline = stripFinalNewline$1;
1348
1348
  const npmRunPath = npmRunPath$1.exports;
@@ -1623,12 +1623,12 @@ async function detectPackageManager(cwd = process.cwd()) {
1623
1623
  const lockPath = await findUp(Object.keys(LOCKS), { cwd });
1624
1624
  let packageJsonPath;
1625
1625
  if (lockPath)
1626
- packageJsonPath = path$2.resolve(lockPath, "../package.json");
1626
+ packageJsonPath = g.resolve(lockPath, "../package.json");
1627
1627
  else
1628
1628
  packageJsonPath = await findUp("package.json", { cwd });
1629
- if (packageJsonPath && fs$2.existsSync(packageJsonPath)) {
1629
+ if (packageJsonPath && require$$0.existsSync(packageJsonPath)) {
1630
1630
  try {
1631
- const pkg = JSON.parse(fs$2.readFileSync(packageJsonPath, "utf8"));
1631
+ const pkg = JSON.parse(require$$0.readFileSync(packageJsonPath, "utf8"));
1632
1632
  if (typeof pkg.packageManager === "string") {
1633
1633
  const [name, version] = pkg.packageManager.split("@");
1634
1634
  if (name === "yarn" && parseInt(version) > 1)
@@ -1644,7 +1644,7 @@ async function detectPackageManager(cwd = process.cwd()) {
1644
1644
  }
1645
1645
  }
1646
1646
  if (!agent && lockPath)
1647
- agent = LOCKS[path$2.basename(lockPath)];
1647
+ agent = LOCKS[g.basename(lockPath)];
1648
1648
  return agent;
1649
1649
  }
1650
1650
  async function installPackage(names, options = {}) {
@@ -0,0 +1,27 @@
1
+ import { m as globalApis } from './chunk-utils-env.3fdc1793.js';
2
+ import { i as index } from './chunk-utils-import.afe2ffde.js';
3
+ import 'tty';
4
+ import 'node:url';
5
+ import 'path';
6
+ import './chunk-runtime-chain.4cd984be.js';
7
+ import 'util';
8
+ import 'chai';
9
+ import './chunk-typecheck-constants.06e1fe5b.js';
10
+ import 'node:path';
11
+ import 'local-pkg';
12
+ import './vendor-_commonjsHelpers.addc3445.js';
13
+ import './chunk-runtime-rpc.54d72169.js';
14
+ import './chunk-utils-timers.715da787.js';
15
+ import 'node:fs';
16
+ import './chunk-utils-source-map.59ba6b0a.js';
17
+ import 'fs';
18
+ import './spy.js';
19
+ import 'tinyspy';
20
+
21
+ function registerApiGlobally() {
22
+ globalApis.forEach((api) => {
23
+ globalThis[api] = index[api];
24
+ });
25
+ }
26
+
27
+ export { registerApiGlobally };
@@ -1,19 +1,23 @@
1
- import { b as resolve } from './chunk-utils-env.03f840f2.js';
2
- import { e as execa } from './vendor-index.737c3cff.js';
1
+ import { b as resolve } from './chunk-utils-env.3fdc1793.js';
2
+ import { e as execa } from './vendor-index.b2fdde54.js';
3
3
  import 'tty';
4
- import 'url';
4
+ import 'node:url';
5
5
  import 'path';
6
- import 'buffer';
6
+ import 'node:buffer';
7
+ import 'node:path';
8
+ import 'node:child_process';
9
+ import 'node:process';
10
+ import './vendor-index.7a2cebfe.js';
7
11
  import 'child_process';
8
- import 'process';
9
- import './vendor-index.e1d4cf84.js';
10
12
  import './vendor-_commonjsHelpers.addc3445.js';
11
13
  import 'fs';
12
14
  import 'assert';
13
15
  import 'events';
16
+ import 'buffer';
14
17
  import 'stream';
15
18
  import 'util';
16
19
  import 'os';
20
+ import 'node:os';
17
21
 
18
22
  class VitestGit {
19
23
  constructor(cwd) {
@@ -1,13 +1,14 @@
1
1
  import util$1 from 'util';
2
2
  import * as chai$2 from 'chai';
3
3
  import { expect, AssertionError, util } from 'chai';
4
- import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, o as objectAttr, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-typecheck-constants.ed987901.js';
4
+ import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getCurrentEnvironment, f as getFullName, o as objectAttr, n as noop, h as isRunningInTest, j as isRunningInBenchmark } from './chunk-typecheck-constants.06e1fe5b.js';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
6
- import { r as rpc } from './chunk-runtime-rpc.42aebbb9.js';
7
- import fs, { promises } from 'fs';
8
- import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.03f840f2.js';
9
- import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.793fd179.js';
10
- import { a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.29ff1088.js';
6
+ import { r as rpc } from './chunk-runtime-rpc.54d72169.js';
7
+ import fs from 'node:fs';
8
+ import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.3fdc1793.js';
9
+ import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.715da787.js';
10
+ import { a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.59ba6b0a.js';
11
+ import { promises } from 'fs';
11
12
  import { isMockFunction } from './spy.js';
12
13
 
13
14
  function createChainable(keys, fn) {
@@ -2077,7 +2078,6 @@ chai$2.use(Subset);
2077
2078
  chai$2.use(SnapshotPlugin);
2078
2079
  chai$2.use(JestAsymmetricMatchers);
2079
2080
 
2080
- const workerState$1 = getWorkerState();
2081
2081
  function createExpect(test) {
2082
2082
  var _a;
2083
2083
  const expect = (value, message) => {
@@ -2098,7 +2098,7 @@ function createExpect(test) {
2098
2098
  isExpectingAssertionsError: null,
2099
2099
  expectedAssertionsNumber: null,
2100
2100
  expectedAssertionsNumberErrorGen: null,
2101
- environment: workerState$1.config.environment,
2101
+ environment: getCurrentEnvironment(),
2102
2102
  testPath: (_a = test == null ? void 0 : test.suite.file) == null ? void 0 : _a.filepath,
2103
2103
  currentTestName: test ? getFullName(test) : void 0
2104
2104
  }, expect);
@@ -1,7 +1,7 @@
1
1
  import util$1 from 'util';
2
2
  import { util } from 'chai';
3
- import { a as stringify } from './chunk-utils-timers.793fd179.js';
4
- import { w as deepClone, x as getType } from './chunk-typecheck-constants.ed987901.js';
3
+ import { a as stringify } from './chunk-utils-timers.715da787.js';
4
+ import { x as deepClone, g as getWorkerState, y as getType } from './chunk-typecheck-constants.06e1fe5b.js';
5
5
 
6
6
  const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
7
7
  const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
@@ -18,7 +18,7 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
18
18
  if (!val || typeof val === "string")
19
19
  return val;
20
20
  if (typeof val === "function")
21
- return `Function<${val.name}>`;
21
+ return `Function<${val.name || "anonymous"}>`;
22
22
  if (typeof val === "symbol")
23
23
  return val.toString();
24
24
  if (typeof val !== "object")
@@ -79,10 +79,12 @@ function processError(err) {
79
79
  const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
80
80
  err.actual = replacedActual;
81
81
  err.expected = replacedExpected;
82
+ const workerState = getWorkerState();
83
+ const maxDiffSize = workerState.config.outputDiffMaxSize;
82
84
  if (typeof err.expected !== "string")
83
- err.expected = stringify(err.expected);
85
+ err.expected = stringify(err.expected, 10, { maxLength: maxDiffSize });
84
86
  if (typeof err.actual !== "string")
85
- err.actual = stringify(err.actual);
87
+ err.actual = stringify(err.actual, 10, { maxLength: maxDiffSize });
86
88
  try {
87
89
  if (typeof err.message === "string")
88
90
  err.message = normalizeErrorMessage(err.message);
@@ -106,13 +108,13 @@ function isReplaceable(obj1, obj2) {
106
108
  const obj2Type = getType(obj2);
107
109
  return obj1Type === obj2Type && obj1Type === "Object";
108
110
  }
109
- function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakMap(), expectedReplaced = /* @__PURE__ */ new WeakMap()) {
111
+ function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakSet(), expectedReplaced = /* @__PURE__ */ new WeakSet()) {
110
112
  if (!isReplaceable(actual, expected))
111
113
  return { replacedActual: actual, replacedExpected: expected };
112
114
  if (actualReplaced.has(actual) || expectedReplaced.has(expected))
113
115
  return { replacedActual: actual, replacedExpected: expected };
114
- actualReplaced.set(actual, true);
115
- expectedReplaced.set(expected, true);
116
+ actualReplaced.add(actual);
117
+ expectedReplaced.add(expected);
116
118
  util.getOwnEnumerableProperties(expected).forEach((key) => {
117
119
  const expectedValue = expected[key];
118
120
  const actualValue = actual[key];