vitest 3.0.9 → 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.Ckwz_xSb.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.CqBhtcTq.d.ts → reporters.d.5g6jXhoW.d.ts} +25 -8
  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.CeVHgzve.js +0 -1659
  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.B8tIoLPT.js +0 -2526
  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.BUZTGxQ3.d.ts +0 -11
  85. package/dist/chunks/vm.jEFQDlX_.js +0 -852
@@ -0,0 +1,74 @@
1
+ import { resolve } from 'pathe';
2
+ import { x } from 'tinyexec';
3
+
4
+ class VitestGit {
5
+ root;
6
+ constructor(cwd) {
7
+ this.cwd = cwd;
8
+ }
9
+ async resolveFilesWithGitCommand(args) {
10
+ let result;
11
+ try {
12
+ result = await x("git", args, { nodeOptions: { cwd: this.root } });
13
+ } catch (e) {
14
+ e.message = e.stderr;
15
+ throw e;
16
+ }
17
+ return result.stdout.split("\n").filter((s) => s !== "").map((changedPath) => resolve(this.root, changedPath));
18
+ }
19
+ async findChangedFiles(options) {
20
+ const root = await this.getRoot(this.cwd);
21
+ if (!root) {
22
+ return null;
23
+ }
24
+ this.root = root;
25
+ const changedSince = options.changedSince;
26
+ if (typeof changedSince === "string") {
27
+ const [committed, staged, unstaged] = await Promise.all([
28
+ this.getFilesSince(changedSince),
29
+ this.getStagedFiles(),
30
+ this.getUnstagedFiles()
31
+ ]);
32
+ return [
33
+ ...committed,
34
+ ...staged,
35
+ ...unstaged
36
+ ];
37
+ }
38
+ const [staged, unstaged] = await Promise.all([this.getStagedFiles(), this.getUnstagedFiles()]);
39
+ return [...staged, ...unstaged];
40
+ }
41
+ getFilesSince(hash) {
42
+ return this.resolveFilesWithGitCommand([
43
+ "diff",
44
+ "--name-only",
45
+ `${hash}...HEAD`
46
+ ]);
47
+ }
48
+ getStagedFiles() {
49
+ return this.resolveFilesWithGitCommand([
50
+ "diff",
51
+ "--cached",
52
+ "--name-only"
53
+ ]);
54
+ }
55
+ getUnstagedFiles() {
56
+ return this.resolveFilesWithGitCommand([
57
+ "ls-files",
58
+ "--other",
59
+ "--modified",
60
+ "--exclude-standard"
61
+ ]);
62
+ }
63
+ async getRoot(cwd) {
64
+ const args = ["rev-parse", "--show-cdup"];
65
+ try {
66
+ const result = await x("git", args, { nodeOptions: { cwd } });
67
+ return resolve(cwd, result.stdout.trim());
68
+ } catch {
69
+ return null;
70
+ }
71
+ }
72
+ }
73
+
74
+ export { VitestGit };
@@ -1,26 +1,26 @@
1
- import { g as globalApis } from './constants.DTYd6dNH.js';
2
- import { V as VitestIndex } from './index.D7Ny8f_s.js';
3
- import './vi.nSCvwQ7l.js';
1
+ import { g as globalApis } from './constants.BZZyIeIE.js';
2
+ import { V as VitestIndex } from './index.BDobFbcz.js';
3
+ import './vi.B-PuvDzu.js';
4
4
  import '@vitest/expect';
5
5
  import '@vitest/runner';
6
6
  import '@vitest/runner/utils';
7
7
  import 'chai';
8
- import './utils.C8RiOc4B.js';
8
+ import './utils.CtocqOoE.js';
9
9
  import '@vitest/utils';
10
10
  import './_commonjsHelpers.BFTU3MAI.js';
11
11
  import '@vitest/snapshot';
12
12
  import '@vitest/utils/error';
13
13
  import '@vitest/spy';
14
14
  import '@vitest/utils/source-map';
15
- import './date.W2xKR2qe.js';
16
- import './run-once.2ogXb3JV.js';
17
- import './benchmark.DL72EVN-.js';
15
+ import './date.CDOsz-HY.js';
16
+ import './run-once.I7PpBOk1.js';
17
+ import './benchmark.BKUatJGy.js';
18
18
  import 'expect-type';
19
19
 
20
20
  function registerApiGlobally() {
21
- globalApis.forEach((api) => {
22
- globalThis[api] = VitestIndex[api];
23
- });
21
+ globalApis.forEach((api) => {
22
+ globalThis[api] = VitestIndex[api];
23
+ });
24
24
  }
25
25
 
26
26
  export { registerApiGlobally };
@@ -1,20 +1,19 @@
1
- import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.nSCvwQ7l.js';
2
- import { i as isFirstRun, a as runOnce } from './run-once.2ogXb3JV.js';
3
- import { b as bench } from './benchmark.DL72EVN-.js';
1
+ import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.B-PuvDzu.js';
2
+ import { i as isFirstRun, a as runOnce } from './run-once.I7PpBOk1.js';
3
+ import { b as bench } from './benchmark.BKUatJGy.js';
4
4
  import { expectTypeOf } from 'expect-type';
5
5
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
8
8
 
9
9
  function getRunningMode() {
10
- return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
10
+ return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
11
11
  }
12
12
  function isWatchMode() {
13
- return getRunningMode() === "watch";
13
+ return getRunningMode() === "watch";
14
14
  }
15
15
 
16
- const assertType = function assertType2() {
17
- };
16
+ const assertType = function assertType() {};
18
17
 
19
18
  var VitestIndex = /*#__PURE__*/Object.freeze({
20
19
  __proto__: null,