vitest 3.1.0-beta.1 → 3.1.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 (88) hide show
  1. package/LICENSE.md +29 -0
  2. package/dist/browser.js +4 -4
  3. package/dist/chunks/base.bV8rwssx.js +41 -0
  4. package/dist/chunks/benchmark.BKUatJGy.js +39 -0
  5. package/dist/chunks/cac.1WcTh-zl.js +1529 -0
  6. package/dist/chunks/{cli-api.BwkkJsRe.js → cli-api.2yb7XCwB.js} +4640 -5072
  7. package/dist/chunks/console.D6t261w0.js +173 -0
  8. package/dist/chunks/constants.BZZyIeIE.js +43 -0
  9. package/dist/chunks/coverage.0iPg4Wrz.js +33 -0
  10. package/dist/chunks/{coverage.gV8doR2Y.js → coverage.SfnlalVs.js} +2424 -2482
  11. package/dist/chunks/creator.CuL7xDWI.js +705 -0
  12. package/dist/chunks/date.CDOsz-HY.js +53 -0
  13. package/dist/chunks/defaults.DmfNPoe5.js +114 -0
  14. package/dist/chunks/{env.D4Lgay0q.js → env.Dq0hM4Xv.js} +1 -1
  15. package/dist/chunks/execute.CwmnH2oH.js +791 -0
  16. package/dist/chunks/git.DXfdBEfR.js +74 -0
  17. package/dist/chunks/{globals.BEpDe-k3.js → globals.DCbUWjip.js} +10 -10
  18. package/dist/chunks/{index.D7Ny8f_s.js → index.BDobFbcz.js} +6 -7
  19. package/dist/chunks/index.CwHmn5H5.js +2422 -0
  20. package/dist/chunks/index.DFXFpH3w.js +607 -0
  21. package/dist/chunks/index.VfYQ6MXY.js +104 -0
  22. package/dist/chunks/inspector.DbDkSkFn.js +54 -0
  23. package/dist/chunks/node.IqGoMrm4.js +15 -0
  24. package/dist/chunks/{reporters.d.r7poTZjA.d.ts → reporters.d.CfRkRKN2.d.ts} +52 -20
  25. package/dist/chunks/rpc.DGgL5dw7.js +92 -0
  26. package/dist/chunks/run-once.I7PpBOk1.js +47 -0
  27. package/dist/chunks/runBaseTests.CqmKSG99.js +134 -0
  28. package/dist/chunks/setup-common.DEGDGBiA.js +88 -0
  29. package/dist/chunks/{typechecker.BlF3eHsb.js → typechecker.CG0zmr19.js} +620 -622
  30. package/dist/chunks/utils.BfxieIyZ.js +66 -0
  31. package/dist/chunks/utils.CtocqOoE.js +72 -0
  32. package/dist/chunks/utils.Lot3J_8U.js +194 -0
  33. package/dist/chunks/{vi.nSCvwQ7l.js → vi.B-PuvDzu.js} +878 -1019
  34. package/dist/chunks/vite.d.4pkSbgmp.d.ts +23 -0
  35. package/dist/chunks/vm.Lp7mPCVW.js +796 -0
  36. package/dist/cli.js +2 -2
  37. package/dist/config.cjs +97 -103
  38. package/dist/config.d.ts +6 -4
  39. package/dist/config.js +6 -6
  40. package/dist/coverage.d.ts +2 -1
  41. package/dist/coverage.js +7 -7
  42. package/dist/environments.js +1 -1
  43. package/dist/execute.d.ts +0 -2
  44. package/dist/execute.js +1 -1
  45. package/dist/index.d.ts +6 -5
  46. package/dist/index.js +6 -6
  47. package/dist/node.d.ts +17 -6
  48. package/dist/node.js +36 -45
  49. package/dist/path.js +1 -4
  50. package/dist/reporters.d.ts +2 -1
  51. package/dist/reporters.js +4 -4
  52. package/dist/runners.js +231 -267
  53. package/dist/snapshot.js +2 -2
  54. package/dist/suite.js +2 -2
  55. package/dist/worker.js +98 -114
  56. package/dist/workers/forks.js +22 -22
  57. package/dist/workers/runVmTests.js +61 -66
  58. package/dist/workers/threads.js +13 -13
  59. package/dist/workers/vmForks.js +24 -24
  60. package/dist/workers/vmThreads.js +15 -15
  61. package/dist/workers.d.ts +2 -1
  62. package/dist/workers.js +10 -10
  63. package/package.json +17 -17
  64. package/dist/chunks/base.DV59CbtV.js +0 -45
  65. package/dist/chunks/benchmark.DL72EVN-.js +0 -40
  66. package/dist/chunks/cac.BjmXy7OV.js +0 -1664
  67. package/dist/chunks/console.CN7AiMGV.js +0 -179
  68. package/dist/chunks/constants.DTYd6dNH.js +0 -46
  69. package/dist/chunks/coverage.A3sS5-Wm.js +0 -40
  70. package/dist/chunks/creator.BsBnpTzI.js +0 -670
  71. package/dist/chunks/date.W2xKR2qe.js +0 -53
  72. package/dist/chunks/defaults.C2Ndd9wx.js +0 -119
  73. package/dist/chunks/execute.eDH0aFFd.js +0 -839
  74. package/dist/chunks/git.B5SDxu-n.js +0 -69
  75. package/dist/chunks/index.DOyx6FYJ.js +0 -2551
  76. package/dist/chunks/index.K90BXFOx.js +0 -658
  77. package/dist/chunks/index.uXkkC4xl.js +0 -111
  78. package/dist/chunks/inspector.DKLceBVD.js +0 -54
  79. package/dist/chunks/node.AKq966Jp.js +0 -15
  80. package/dist/chunks/rpc.TVf73xOu.js +0 -102
  81. package/dist/chunks/run-once.2ogXb3JV.js +0 -28
  82. package/dist/chunks/runBaseTests.BVrL_ow3.js +0 -142
  83. package/dist/chunks/setup-common.CPvtqi8q.js +0 -96
  84. package/dist/chunks/utils.C8RiOc4B.js +0 -77
  85. package/dist/chunks/utils.Cn0zI1t3.js +0 -68
  86. package/dist/chunks/utils.bLM2atbD.js +0 -198
  87. package/dist/chunks/vite.d.Fvq-NZoa.d.ts +0 -11
  88. package/dist/chunks/vm.jEFQDlX_.js +0 -852
package/LICENSE.md CHANGED
@@ -681,6 +681,35 @@ Repository: terkelg/prompts
681
681
 
682
682
  ---------------------------------------
683
683
 
684
+ ## quansync
685
+ License: MIT
686
+ By: Anthony Fu, 三咲智子 Kevin Deng
687
+ Repository: git+https://github.com/quansync-dev/quansync.git
688
+
689
+ > MIT License
690
+ >
691
+ > Copyright (c) 2025-PRESENT Anthony Fu <https://github.com/antfu> and Kevin Deng <https://github.com/sxzz>
692
+ >
693
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
694
+ > of this software and associated documentation files (the "Software"), to deal
695
+ > in the Software without restriction, including without limitation the rights
696
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
697
+ > copies of the Software, and to permit persons to whom the Software is
698
+ > furnished to do so, subject to the following conditions:
699
+ >
700
+ > The above copyright notice and this permission notice shall be included in all
701
+ > copies or substantial portions of the Software.
702
+ >
703
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
704
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
705
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
706
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
707
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
708
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
709
+ > SOFTWARE.
710
+
711
+ ---------------------------------------
712
+
684
713
  ## resolve-pkg-maps
685
714
  License: MIT
686
715
  By: Hiroki Osame
package/dist/browser.js CHANGED
@@ -1,9 +1,9 @@
1
- export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.CPvtqi8q.js';
1
+ export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.DEGDGBiA.js';
2
2
  export { collectTests, processError, startTests } from '@vitest/runner';
3
3
  import * as spy from '@vitest/spy';
4
4
  export { spy as SpyModule };
5
- import './chunks/coverage.A3sS5-Wm.js';
5
+ import './chunks/coverage.0iPg4Wrz.js';
6
6
  import '@vitest/snapshot';
7
7
  import '@vitest/utils';
8
- import './chunks/run-once.2ogXb3JV.js';
9
- import './chunks/utils.C8RiOc4B.js';
8
+ import './chunks/run-once.I7PpBOk1.js';
9
+ import './chunks/utils.CtocqOoE.js';
@@ -0,0 +1,41 @@
1
+ import { ModuleCacheMap } from 'vite-node/client';
2
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.CwmnH2oH.js';
3
+ import { p as provideWorkerState } from './utils.CtocqOoE.js';
4
+
5
+ let _viteNode;
6
+ const moduleCache = new ModuleCacheMap();
7
+ const moduleExecutionInfo = new Map();
8
+ async function startViteNode(options) {
9
+ if (_viteNode) {
10
+ return _viteNode;
11
+ }
12
+ _viteNode = await startVitestExecutor(options);
13
+ return _viteNode;
14
+ }
15
+ async function runBaseTests(method, state) {
16
+ const { ctx } = state;
17
+ state.moduleCache = moduleCache;
18
+ state.moduleExecutionInfo = moduleExecutionInfo;
19
+ provideWorkerState(globalThis, state);
20
+ if (ctx.invalidates) {
21
+ ctx.invalidates.forEach((fsPath) => {
22
+ moduleCache.delete(fsPath);
23
+ moduleCache.delete(`mock:${fsPath}`);
24
+ });
25
+ }
26
+ ctx.files.forEach((i) => state.moduleCache.delete(typeof i === "string" ? i : i.filepath));
27
+ const [executor, { run }] = await Promise.all([startViteNode({
28
+ state,
29
+ requestStubs: getDefaultRequestStubs()
30
+ }), import('./runBaseTests.CqmKSG99.js')]);
31
+ const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
32
+ filepath: f,
33
+ testLocations: undefined
34
+ } : f);
35
+ await run(method, fileSpecs, ctx.config, {
36
+ environment: state.environment,
37
+ options: ctx.environment.options
38
+ }, executor);
39
+ }
40
+
41
+ export { runBaseTests as r };
@@ -0,0 +1,39 @@
1
+ import { getCurrentSuite } from '@vitest/runner';
2
+ import { createChainable } from '@vitest/runner/utils';
3
+ import { noop } from '@vitest/utils';
4
+ import { g as getWorkerState } from './utils.CtocqOoE.js';
5
+
6
+ const benchFns = new WeakMap();
7
+ const benchOptsMap = new WeakMap();
8
+ function getBenchOptions(key) {
9
+ return benchOptsMap.get(key);
10
+ }
11
+ function getBenchFn(key) {
12
+ return benchFns.get(key);
13
+ }
14
+ const bench = createBenchmark(function(name, fn = noop, options = {}) {
15
+ if (getWorkerState().config.mode !== "benchmark") {
16
+ throw new Error("`bench()` is only available in benchmark mode.");
17
+ }
18
+ const task = getCurrentSuite().task(formatName(name), {
19
+ ...this,
20
+ meta: { benchmark: true }
21
+ });
22
+ benchFns.set(task, fn);
23
+ benchOptsMap.set(task, options);
24
+ });
25
+ function createBenchmark(fn) {
26
+ const benchmark = createChainable([
27
+ "skip",
28
+ "only",
29
+ "todo"
30
+ ], fn);
31
+ benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
32
+ benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
33
+ return benchmark;
34
+ }
35
+ function formatName(name) {
36
+ return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
37
+ }
38
+
39
+ export { getBenchOptions as a, bench as b, getBenchFn as g };