vitest 3.2.0-beta.1 → 3.2.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 (46) hide show
  1. package/LICENSE.md +0 -232
  2. package/dist/browser.d.ts +2 -0
  3. package/dist/browser.js +3 -4
  4. package/dist/chunks/{base.SfTiRNZf.js → base.DwtwORaC.js} +2 -2
  5. package/dist/chunks/{cac.TfX2-DVH.js → cac.I9MLYfT-.js} +10 -8
  6. package/dist/chunks/{cli-api.2970Nj9J.js → cli-api.d6IK1pnk.js} +48 -16
  7. package/dist/chunks/{coverage.z0LVMxgb.js → coverage.OGU09Jbh.js} +126 -4215
  8. package/dist/chunks/{creator.CuL7xDWI.js → creator.DGAdZ4Hj.js} +18 -39
  9. package/dist/chunks/{execute.BpmIjFTD.js → execute.JlGHLJZT.js} +3 -5
  10. package/dist/chunks/{global.d.BCOHQEpR.d.ts → global.d.BPa1eL3O.d.ts} +10 -10
  11. package/dist/chunks/{globals.Cg4NtV4P.js → globals.CpxW8ccg.js} +1 -2
  12. package/dist/chunks/{index.Bw6JxgX8.js → index.CK1YOQaa.js} +7 -7
  13. package/dist/chunks/{index.CUacZlWG.js → index.CV36oG_L.js} +881 -948
  14. package/dist/chunks/{index.BPc7M5ni.js → index.CfXMNXHg.js} +1 -13
  15. package/dist/chunks/index.CmC5OK9L.js +275 -0
  16. package/dist/chunks/{index.DbWBPwtH.js → index.DswW_LEs.js} +1 -1
  17. package/dist/chunks/{index.DBIGubLC.js → index.X0nbfr6-.js} +7 -7
  18. package/dist/chunks/{reporters.d.DGm4k1Wx.d.ts → reporters.d.CLC9rhKy.d.ts} +17 -0
  19. package/dist/chunks/{runBaseTests.CguliJB5.js → runBaseTests.Dn2vyej_.js} +3 -4
  20. package/dist/chunks/{setup-common.BP6KrF_Z.js → setup-common.CYo3Y0dD.js} +1 -3
  21. package/dist/chunks/typechecker.DnTrplSJ.js +897 -0
  22. package/dist/chunks/{vite.d.DjP_ALCZ.d.ts → vite.d.CBZ3M_ru.d.ts} +1 -1
  23. package/dist/chunks/{vm.CuLHT1BG.js → vm.C1HHjtNS.js} +1 -1
  24. package/dist/cli.js +20 -1
  25. package/dist/config.d.ts +3 -3
  26. package/dist/coverage.d.ts +1 -1
  27. package/dist/coverage.js +4 -7
  28. package/dist/execute.js +1 -1
  29. package/dist/index.d.ts +5 -27
  30. package/dist/index.js +1 -2
  31. package/dist/node.d.ts +4 -4
  32. package/dist/node.js +16 -18
  33. package/dist/reporters.d.ts +1 -1
  34. package/dist/reporters.js +14 -14
  35. package/dist/workers/forks.js +2 -2
  36. package/dist/workers/runVmTests.js +3 -4
  37. package/dist/workers/threads.js +2 -2
  38. package/dist/workers/vmForks.js +2 -2
  39. package/dist/workers/vmThreads.js +2 -2
  40. package/dist/workers.js +3 -3
  41. package/package.json +15 -19
  42. package/dist/chunks/run-once.Dimr7O9f.js +0 -47
  43. package/dist/chunks/typechecker.DYQbn8uK.js +0 -956
  44. package/dist/chunks/utils.8gfOgtry.js +0 -207
  45. package/dist/utils.d.ts +0 -3
  46. package/dist/utils.js +0 -2
@@ -1,207 +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 = "→";
7
- const F_DOWN = "↓";
8
- const F_DOWN_RIGHT = "↳";
9
- const F_POINTER = "❯";
10
- const F_DOT = "·";
11
- const F_CHECK = "✓";
12
- const F_CROSS = "×";
13
- const F_LONG_DASH = "⎯";
14
- const F_TREE_NODE_MIDDLE = "├──";
15
- const F_TREE_NODE_END = "└──";
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("·");
24
- const labelDefaultColors = [
25
- c.bgYellow,
26
- c.bgCyan,
27
- c.bgGreen,
28
- c.bgMagenta
29
- ];
30
- function getCols(delta = 0) {
31
- let length = process.stdout?.columns;
32
- if (!length || Number.isNaN(length)) {
33
- length = 30;
34
- }
35
- return Math.max(length + delta, 0);
36
- }
37
- function errorBanner(message) {
38
- return divider(c.bold(c.bgRed(` ${message} `)), null, null, c.red);
39
- }
40
- function divider(text, left, right, color) {
41
- const cols = getCols();
42
- const c = color || ((text) => text);
43
- if (text) {
44
- const textLength = stripVTControlCharacters(text).length;
45
- if (left == null && right != null) {
46
- left = cols - textLength - right;
47
- } else {
48
- left = left ?? Math.floor((cols - textLength) / 2);
49
- right = cols - textLength - left;
50
- }
51
- left = Math.max(0, left);
52
- right = Math.max(0, right);
53
- return `${c(F_LONG_DASH.repeat(left))}${text}${c(F_LONG_DASH.repeat(right))}`;
54
- }
55
- return F_LONG_DASH.repeat(cols);
56
- }
57
- function formatTestPath(root, path) {
58
- if (isAbsolute(path)) {
59
- path = relative(root, path);
60
- }
61
- const dir = dirname(path);
62
- const ext = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)?.[0] || "";
63
- const base = basename(path, ext);
64
- return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
65
- }
66
- function renderSnapshotSummary(rootDir, snapshots) {
67
- const summary = [];
68
- if (snapshots.added) {
69
- summary.push(c.bold(c.green(`${snapshots.added} written`)));
70
- }
71
- if (snapshots.unmatched) {
72
- summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
73
- }
74
- if (snapshots.updated) {
75
- summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
76
- }
77
- if (snapshots.filesRemoved) {
78
- if (snapshots.didUpdate) {
79
- summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
80
- } else {
81
- summary.push(c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `)));
82
- }
83
- }
84
- if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
85
- const [head, ...tail] = snapshots.filesRemovedList;
86
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
87
- tail.forEach((key) => {
88
- summary.push(` ${c.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
89
- });
90
- }
91
- if (snapshots.unchecked) {
92
- if (snapshots.didUpdate) {
93
- summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
94
- } else {
95
- summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
96
- }
97
- snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
98
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
99
- uncheckedFile.keys.forEach((key) => summary.push(` ${c.gray(F_DOT)} ${key}`));
100
- });
101
- }
102
- return summary;
103
- }
104
- function countTestErrors(tasks) {
105
- return tasks.reduce((c, i) => c + (i.result?.errors?.length || 0), 0);
106
- }
107
- function getStateString(tasks, name = "tests", showTotal = true) {
108
- if (tasks.length === 0) {
109
- return c.dim(`no ${name}`);
110
- }
111
- const passed = tasks.filter((i) => i.result?.state === "pass");
112
- const failed = tasks.filter((i) => i.result?.state === "fail");
113
- const skipped = tasks.filter((i) => i.mode === "skip");
114
- const todo = tasks.filter((i) => i.mode === "todo");
115
- return [
116
- failed.length ? c.bold(c.red(`${failed.length} failed`)) : null,
117
- passed.length ? c.bold(c.green(`${passed.length} passed`)) : null,
118
- skipped.length ? c.yellow(`${skipped.length} skipped`) : null,
119
- todo.length ? c.gray(`${todo.length} todo`) : null
120
- ].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
121
- }
122
- function getStateSymbol(task) {
123
- if (task.mode === "skip" || task.mode === "todo") {
124
- return skipped;
125
- }
126
- if (!task.result) {
127
- return pending;
128
- }
129
- if (task.result.state === "run" || task.result.state === "queued") {
130
- if (task.type === "suite") {
131
- return pointer;
132
- }
133
- }
134
- if (task.result.state === "pass") {
135
- return task.meta?.benchmark ? benchmarkPass : testPass;
136
- }
137
- if (task.result.state === "fail") {
138
- return task.type === "suite" ? suiteFail : taskFail;
139
- }
140
- return " ";
141
- }
142
- function formatTimeString(date) {
143
- return date.toTimeString().split(" ")[0];
144
- }
145
- function formatTime(time) {
146
- if (time > 1e3) {
147
- return `${(time / 1e3).toFixed(2)}s`;
148
- }
149
- return `${Math.round(time)}ms`;
150
- }
151
- function formatProjectName(project, suffix = " ") {
152
- if (!project?.name) {
153
- return "";
154
- }
155
- if (!c.isColorSupported) {
156
- return `|${project.name}|${suffix}`;
157
- }
158
- let background = project.color && c[`bg${capitalize(project.color)}`];
159
- if (!background) {
160
- const index = project.name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
161
- background = labelDefaultColors[index % labelDefaultColors.length];
162
- }
163
- return c.black(background(` ${project.name} `)) + suffix;
164
- }
165
- function withLabel(color, label, message) {
166
- const bgColor = `bg${color.charAt(0).toUpperCase()}${color.slice(1)}`;
167
- return `${c.bold(c[bgColor](` ${label} `))} ${message ? c[color](message) : ""}`;
168
- }
169
- function padSummaryTitle(str) {
170
- return c.dim(`${str.padStart(11)} `);
171
- }
172
- function truncateString(text, maxLength) {
173
- const plainText = stripVTControlCharacters(text);
174
- if (plainText.length <= maxLength) {
175
- return text;
176
- }
177
- return `${plainText.slice(0, maxLength - 1)}…`;
178
- }
179
- function capitalize(text) {
180
- return `${text[0].toUpperCase()}${text.slice(1)}`;
181
- }
182
-
183
- var utils = /*#__PURE__*/Object.freeze({
184
- __proto__: null,
185
- benchmarkPass: benchmarkPass,
186
- countTestErrors: countTestErrors,
187
- divider: divider,
188
- errorBanner: errorBanner,
189
- formatProjectName: formatProjectName,
190
- formatTestPath: formatTestPath,
191
- formatTime: formatTime,
192
- formatTimeString: formatTimeString,
193
- getStateString: getStateString,
194
- getStateSymbol: getStateSymbol,
195
- padSummaryTitle: padSummaryTitle,
196
- pending: pending,
197
- pointer: pointer,
198
- renderSnapshotSummary: renderSnapshotSummary,
199
- skipped: skipped,
200
- suiteFail: suiteFail,
201
- taskFail: taskFail,
202
- testPass: testPass,
203
- truncateString: truncateString,
204
- withLabel: withLabel
205
- });
206
-
207
- export { F_POINTER as F, taskFail as a, F_CHECK as b, formatProjectName as c, divider as d, errorBanner as e, formatTimeString as f, getStateSymbol as g, F_RIGHT as h, getStateString as i, formatTime as j, countTestErrors as k, F_TREE_NODE_END as l, F_TREE_NODE_MIDDLE as m, padSummaryTitle as p, renderSnapshotSummary as r, truncateString as t, utils as u, withLabel as w };
package/dist/utils.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from '@vitest/utils';
2
- export * from '@vitest/utils/source-map';
3
- import '@vitest/mocker';
package/dist/utils.js DELETED
@@ -1,2 +0,0 @@
1
- export * from '@vitest/utils';
2
- export * from '@vitest/utils/source-map';