vitest 3.1.0-beta.1 → 3.1.0-beta.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 (85) hide show
  1. package/dist/browser.js +4 -4
  2. package/dist/chunks/base.CylSMlTD.js +41 -0
  3. package/dist/chunks/benchmark.BKUatJGy.js +39 -0
  4. package/dist/chunks/cac.JtTXbKz0.js +1525 -0
  5. package/dist/chunks/{cli-api.BwkkJsRe.js → cli-api.BTtPTYMs.js} +4638 -5072
  6. package/dist/chunks/console.D6t261w0.js +173 -0
  7. package/dist/chunks/constants.BZZyIeIE.js +43 -0
  8. package/dist/chunks/coverage.0iPg4Wrz.js +33 -0
  9. package/dist/chunks/{coverage.gV8doR2Y.js → coverage.C2ohxaN0.js} +2216 -2479
  10. package/dist/chunks/creator.BEXek7yQ.js +640 -0
  11. package/dist/chunks/date.CDOsz-HY.js +53 -0
  12. package/dist/chunks/defaults.DmfNPoe5.js +114 -0
  13. package/dist/chunks/{env.D4Lgay0q.js → env.Dq0hM4Xv.js} +1 -1
  14. package/dist/chunks/execute.DZKwfrTs.js +791 -0
  15. package/dist/chunks/git.DXfdBEfR.js +74 -0
  16. package/dist/chunks/{globals.BEpDe-k3.js → globals.DCbUWjip.js} +10 -10
  17. package/dist/chunks/{index.D7Ny8f_s.js → index.BDobFbcz.js} +6 -7
  18. package/dist/chunks/index.DFXFpH3w.js +607 -0
  19. package/dist/chunks/index.VfYQ6MXY.js +104 -0
  20. package/dist/chunks/index.ZIOEXBQB.js +2382 -0
  21. package/dist/chunks/inspector.DbDkSkFn.js +54 -0
  22. package/dist/chunks/node.IqGoMrm4.js +15 -0
  23. package/dist/chunks/{reporters.d.r7poTZjA.d.ts → reporters.d.5g6jXhoW.d.ts} +14 -3
  24. package/dist/chunks/rpc.DGgL5dw7.js +92 -0
  25. package/dist/chunks/run-once.I7PpBOk1.js +47 -0
  26. package/dist/chunks/runBaseTests.CqmKSG99.js +134 -0
  27. package/dist/chunks/setup-common.DEGDGBiA.js +88 -0
  28. package/dist/chunks/{typechecker.BlF3eHsb.js → typechecker.C2IpOhid.js} +620 -622
  29. package/dist/chunks/utils.BfxieIyZ.js +66 -0
  30. package/dist/chunks/utils.CtocqOoE.js +72 -0
  31. package/dist/chunks/utils.OLmtDstN.js +194 -0
  32. package/dist/chunks/{vi.nSCvwQ7l.js → vi.B-PuvDzu.js} +878 -1019
  33. package/dist/chunks/vite.d.Dh1jE-_V.d.ts +23 -0
  34. package/dist/chunks/vm.BW5voG-u.js +789 -0
  35. package/dist/cli.js +2 -2
  36. package/dist/config.cjs +97 -103
  37. package/dist/config.d.ts +3 -3
  38. package/dist/config.js +6 -6
  39. package/dist/coverage.d.ts +1 -1
  40. package/dist/coverage.js +6 -6
  41. package/dist/environments.js +1 -1
  42. package/dist/execute.js +1 -1
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.js +6 -6
  45. package/dist/node.d.ts +3 -3
  46. package/dist/node.js +36 -45
  47. package/dist/path.js +1 -4
  48. package/dist/reporters.d.ts +1 -1
  49. package/dist/reporters.js +4 -4
  50. package/dist/runners.js +231 -267
  51. package/dist/snapshot.js +2 -2
  52. package/dist/suite.js +2 -2
  53. package/dist/worker.js +98 -114
  54. package/dist/workers/forks.js +22 -22
  55. package/dist/workers/runVmTests.js +61 -66
  56. package/dist/workers/threads.js +13 -13
  57. package/dist/workers/vmForks.js +24 -24
  58. package/dist/workers/vmThreads.js +15 -15
  59. package/dist/workers.js +10 -10
  60. package/package.json +11 -11
  61. package/dist/chunks/base.DV59CbtV.js +0 -45
  62. package/dist/chunks/benchmark.DL72EVN-.js +0 -40
  63. package/dist/chunks/cac.BjmXy7OV.js +0 -1664
  64. package/dist/chunks/console.CN7AiMGV.js +0 -179
  65. package/dist/chunks/constants.DTYd6dNH.js +0 -46
  66. package/dist/chunks/coverage.A3sS5-Wm.js +0 -40
  67. package/dist/chunks/creator.BsBnpTzI.js +0 -670
  68. package/dist/chunks/date.W2xKR2qe.js +0 -53
  69. package/dist/chunks/defaults.C2Ndd9wx.js +0 -119
  70. package/dist/chunks/execute.eDH0aFFd.js +0 -839
  71. package/dist/chunks/git.B5SDxu-n.js +0 -69
  72. package/dist/chunks/index.DOyx6FYJ.js +0 -2551
  73. package/dist/chunks/index.K90BXFOx.js +0 -658
  74. package/dist/chunks/index.uXkkC4xl.js +0 -111
  75. package/dist/chunks/inspector.DKLceBVD.js +0 -54
  76. package/dist/chunks/node.AKq966Jp.js +0 -15
  77. package/dist/chunks/rpc.TVf73xOu.js +0 -102
  78. package/dist/chunks/run-once.2ogXb3JV.js +0 -28
  79. package/dist/chunks/runBaseTests.BVrL_ow3.js +0 -142
  80. package/dist/chunks/setup-common.CPvtqi8q.js +0 -96
  81. package/dist/chunks/utils.C8RiOc4B.js +0 -77
  82. package/dist/chunks/utils.Cn0zI1t3.js +0 -68
  83. package/dist/chunks/utils.bLM2atbD.js +0 -198
  84. package/dist/chunks/vite.d.Fvq-NZoa.d.ts +0 -11
  85. package/dist/chunks/vm.jEFQDlX_.js +0 -852
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.DZKwfrTs.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 };