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
@@ -1,198 +0,0 @@
1
- import { stripVTControlCharacters } from 'node:util';
2
- import { slash } from '@vitest/utils';
3
- import { isAbsolute, relative, dirname, basename } from 'pathe';
4
- import c from 'tinyrainbow';
5
-
6
- const F_RIGHT = "\u2192";
7
- const F_DOWN = "\u2193";
8
- const F_DOWN_RIGHT = "\u21B3";
9
- const F_POINTER = "\u276F";
10
- const F_DOT = "\xB7";
11
- const F_CHECK = "\u2713";
12
- const F_CROSS = "\xD7";
13
- const F_LONG_DASH = "\u23AF";
14
- const F_TREE_NODE_MIDDLE = "\u251C\u2500\u2500";
15
- const F_TREE_NODE_END = "\u2514\u2500\u2500";
16
-
17
- const pointer = c.yellow(F_POINTER);
18
- const skipped = c.dim(c.gray(F_DOWN));
19
- const benchmarkPass = c.green(F_DOT);
20
- const testPass = c.green(F_CHECK);
21
- const taskFail = c.red(F_CROSS);
22
- const suiteFail = c.red(F_POINTER);
23
- const pending = c.gray("\xB7");
24
- function getCols(delta = 0) {
25
- let length = process.stdout?.columns;
26
- if (!length || Number.isNaN(length)) {
27
- length = 30;
28
- }
29
- return Math.max(length + delta, 0);
30
- }
31
- function divider(text, left, right) {
32
- const cols = getCols();
33
- if (text) {
34
- const textLength = stripVTControlCharacters(text).length;
35
- if (left == null && right != null) {
36
- left = cols - textLength - right;
37
- } else {
38
- left = left ?? Math.floor((cols - textLength) / 2);
39
- right = cols - textLength - left;
40
- }
41
- left = Math.max(0, left);
42
- right = Math.max(0, right);
43
- return `${F_LONG_DASH.repeat(left)}${text}${F_LONG_DASH.repeat(right)}`;
44
- }
45
- return F_LONG_DASH.repeat(cols);
46
- }
47
- function formatTestPath(root, path) {
48
- if (isAbsolute(path)) {
49
- path = relative(root, path);
50
- }
51
- const dir = dirname(path);
52
- const ext = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)?.[0] || "";
53
- const base = basename(path, ext);
54
- return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
55
- }
56
- function renderSnapshotSummary(rootDir, snapshots) {
57
- const summary = [];
58
- if (snapshots.added) {
59
- summary.push(c.bold(c.green(`${snapshots.added} written`)));
60
- }
61
- if (snapshots.unmatched) {
62
- summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
63
- }
64
- if (snapshots.updated) {
65
- summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
66
- }
67
- if (snapshots.filesRemoved) {
68
- if (snapshots.didUpdate) {
69
- summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
70
- } else {
71
- summary.push(
72
- c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `))
73
- );
74
- }
75
- }
76
- if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
77
- const [head, ...tail] = snapshots.filesRemovedList;
78
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
79
- tail.forEach((key) => {
80
- summary.push(` ${c.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
81
- });
82
- }
83
- if (snapshots.unchecked) {
84
- if (snapshots.didUpdate) {
85
- summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
86
- } else {
87
- summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
88
- }
89
- snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
90
- summary.push(
91
- `${c.gray(F_DOWN_RIGHT)} ${formatTestPath(
92
- rootDir,
93
- uncheckedFile.filePath
94
- )}`
95
- );
96
- uncheckedFile.keys.forEach(
97
- (key) => summary.push(` ${c.gray(F_DOT)} ${key}`)
98
- );
99
- });
100
- }
101
- return summary;
102
- }
103
- function countTestErrors(tasks) {
104
- return tasks.reduce((c2, i) => c2 + (i.result?.errors?.length || 0), 0);
105
- }
106
- function getStateString(tasks, name = "tests", showTotal = true) {
107
- if (tasks.length === 0) {
108
- return c.dim(`no ${name}`);
109
- }
110
- const passed = tasks.filter((i) => i.result?.state === "pass");
111
- const failed = tasks.filter((i) => i.result?.state === "fail");
112
- const skipped2 = tasks.filter((i) => i.mode === "skip");
113
- const todo = tasks.filter((i) => i.mode === "todo");
114
- return [
115
- failed.length ? c.bold(c.red(`${failed.length} failed`)) : null,
116
- passed.length ? c.bold(c.green(`${passed.length} passed`)) : null,
117
- skipped2.length ? c.yellow(`${skipped2.length} skipped`) : null,
118
- todo.length ? c.gray(`${todo.length} todo`) : null
119
- ].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
120
- }
121
- function getStateSymbol(task) {
122
- if (task.mode === "skip" || task.mode === "todo") {
123
- return skipped;
124
- }
125
- if (!task.result) {
126
- return pending;
127
- }
128
- if (task.result.state === "run" || task.result.state === "queued") {
129
- if (task.type === "suite") {
130
- return pointer;
131
- }
132
- }
133
- if (task.result.state === "pass") {
134
- return task.meta?.benchmark ? benchmarkPass : testPass;
135
- }
136
- if (task.result.state === "fail") {
137
- return task.type === "suite" ? suiteFail : taskFail;
138
- }
139
- return " ";
140
- }
141
- function formatTimeString(date) {
142
- return date.toTimeString().split(" ")[0];
143
- }
144
- function formatTime(time) {
145
- if (time > 1e3) {
146
- return `${(time / 1e3).toFixed(2)}s`;
147
- }
148
- return `${Math.round(time)}ms`;
149
- }
150
- function formatProjectName(name, suffix = " ") {
151
- if (!name) {
152
- return "";
153
- }
154
- if (!c.isColorSupported) {
155
- return `|${name}|${suffix}`;
156
- }
157
- const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
158
- const colors = [c.bgYellow, c.bgCyan, c.bgGreen, c.bgMagenta];
159
- return c.black(colors[index % colors.length](` ${name} `)) + suffix;
160
- }
161
- function withLabel(color, label, message) {
162
- return `${c.bold(c.inverse(c[color](` ${label} `)))} ${message ? c[color](message) : ""}`;
163
- }
164
- function padSummaryTitle(str) {
165
- return c.dim(`${str.padStart(11)} `);
166
- }
167
- function truncateString(text, maxLength) {
168
- const plainText = stripVTControlCharacters(text);
169
- if (plainText.length <= maxLength) {
170
- return text;
171
- }
172
- return `${plainText.slice(0, maxLength - 1)}\u2026`;
173
- }
174
-
175
- var utils = /*#__PURE__*/Object.freeze({
176
- __proto__: null,
177
- benchmarkPass: benchmarkPass,
178
- countTestErrors: countTestErrors,
179
- divider: divider,
180
- formatProjectName: formatProjectName,
181
- formatTestPath: formatTestPath,
182
- formatTime: formatTime,
183
- formatTimeString: formatTimeString,
184
- getStateString: getStateString,
185
- getStateSymbol: getStateSymbol,
186
- padSummaryTitle: padSummaryTitle,
187
- pending: pending,
188
- pointer: pointer,
189
- renderSnapshotSummary: renderSnapshotSummary,
190
- skipped: skipped,
191
- suiteFail: suiteFail,
192
- taskFail: taskFail,
193
- testPass: testPass,
194
- truncateString: truncateString,
195
- withLabel: withLabel
196
- });
197
-
198
- export { F_POINTER as F, formatProjectName as a, taskFail as b, F_CHECK as c, divider as d, F_RIGHT as e, formatTimeString as f, getStateSymbol as g, getStateString as h, formatTime as i, countTestErrors as j, F_TREE_NODE_END as k, F_TREE_NODE_MIDDLE as l, padSummaryTitle as p, renderSnapshotSummary as r, truncateString as t, utils as u, withLabel as w };
@@ -1,11 +0,0 @@
1
- import { I as InlineConfig } from './reporters.d.r7poTZjA.js';
2
-
3
- type VitestInlineConfig = InlineConfig;
4
- declare module "vite" {
5
- interface UserConfig {
6
- /**
7
- * Options for Vitest
8
- */
9
- test?: VitestInlineConfig;
10
- }
11
- }