vitest 0.0.129 → 0.0.133

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 (40) hide show
  1. package/dist/_commonjsHelpers-c9e3b764.js +1 -0
  2. package/dist/cli.js +10 -9
  3. package/dist/constants-0211a379.js +34 -0
  4. package/dist/diff-18d4a7eb.js +4750 -0
  5. package/dist/entry.js +94 -33
  6. package/dist/externalize-2f63779d.js +1 -0
  7. package/dist/global-5d1fb309.js +21 -0
  8. package/dist/index-26cb6e63.js +1644 -0
  9. package/dist/index-354a6abd.js +40 -0
  10. package/dist/index-4cd25949.js +782 -0
  11. package/dist/index-720a83c6.js +396 -0
  12. package/dist/index-7975be53.js +331 -0
  13. package/dist/index-7f7acd60.js +8548 -0
  14. package/dist/index-e909c175.js +63 -0
  15. package/dist/index-fa899e66.js +5708 -0
  16. package/dist/index.d.ts +142 -27
  17. package/dist/index.js +4 -3
  18. package/dist/jest-mock-30625866.js +1 -0
  19. package/dist/magic-string.es-94000aea.js +1361 -0
  20. package/dist/node.d.ts +111 -4
  21. package/dist/node.js +9 -8
  22. package/dist/rpc-8c7cc374.js +1 -0
  23. package/dist/setup-5aaf533e.js +4365 -0
  24. package/dist/vi-aec007e7.js +3461 -0
  25. package/dist/worker.js +11 -7
  26. package/package.json +9 -9
  27. package/dist/constants-868b9a2e.js +0 -33
  28. package/dist/diff-be830986.js +0 -4751
  29. package/dist/global-0254dd68.js +0 -20
  30. package/dist/index-06712022.js +0 -39
  31. package/dist/index-42a3a132.js +0 -366
  32. package/dist/index-42d44ee5.js +0 -1643
  33. package/dist/index-93dcb598.js +0 -5707
  34. package/dist/index-a73f33e0.js +0 -62
  35. package/dist/index-cb02ee01.js +0 -330
  36. package/dist/index-cce5de77.js +0 -781
  37. package/dist/index-d30b5ed0.js +0 -8579
  38. package/dist/magic-string.es-98a8bfa0.js +0 -1360
  39. package/dist/setup-6e09a65a.js +0 -4364
  40. package/dist/vi-fe26a646.js +0 -3460
@@ -1,20 +0,0 @@
1
- import { g as globalApis } from './constants-868b9a2e.js';
2
- import { i as index } from './index-06712022.js';
3
- import 'url';
4
- import './index-42a3a132.js';
5
- import 'tty';
6
- import 'local-pkg';
7
- import 'path';
8
- import './vi-fe26a646.js';
9
- import './jest-mock-30625866.js';
10
- import 'chai';
11
- import 'tinyspy';
12
- import './_commonjsHelpers-c9e3b764.js';
13
-
14
- function registerApiGlobally() {
15
- globalApis.forEach((api) => {
16
- globalThis[api] = index[api];
17
- });
18
- }
19
-
20
- export { registerApiGlobally };
@@ -1,39 +0,0 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-fe26a646.js';
2
- import chai, { assert, should } from 'chai';
3
- import { s as spies, i as isMockFunction, a as spyOn, f as fn } from './jest-mock-30625866.js';
4
-
5
- const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
6
- const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
7
- const beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
8
- const afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
9
-
10
- const expect = (value, message) => {
11
- const { assertionCalls } = getState();
12
- setState({ assertionCalls: assertionCalls + 1 });
13
- return chai.expect(value, message);
14
- };
15
- Object.assign(expect, chai.expect);
16
-
17
- var index = /*#__PURE__*/Object.freeze({
18
- __proto__: null,
19
- suite: suite,
20
- test: test,
21
- describe: describe,
22
- it: it,
23
- beforeAll: beforeAll,
24
- afterAll: afterAll,
25
- beforeEach: beforeEach,
26
- afterEach: afterEach,
27
- assert: assert,
28
- should: should,
29
- chai: chai,
30
- expect: expect,
31
- spies: spies,
32
- isMockFunction: isMockFunction,
33
- spyOn: spyOn,
34
- fn: fn,
35
- vitest: vitest,
36
- vi: vi
37
- });
38
-
39
- export { afterAll as a, beforeAll as b, beforeEach as c, afterEach as d, expect as e, index as i };
@@ -1,366 +0,0 @@
1
- import { fileURLToPath, pathToFileURL } from 'url';
2
- import require$$0 from 'tty';
3
- import { isPackageExists } from 'local-pkg';
4
- import path from 'path';
5
-
6
- var picocolors = {exports: {}};
7
-
8
- let tty = require$$0;
9
-
10
- let isColorSupported =
11
- !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
12
- ("FORCE_COLOR" in process.env ||
13
- process.argv.includes("--color") ||
14
- process.platform === "win32" ||
15
- (tty.isatty(1) && process.env.TERM !== "dumb") ||
16
- "CI" in process.env);
17
-
18
- let formatter =
19
- (open, close, replace = open) =>
20
- input => {
21
- let string = "" + input;
22
- let index = string.indexOf(close, open.length);
23
- return ~index
24
- ? open + replaceClose(string, close, replace, index) + close
25
- : open + string + close
26
- };
27
-
28
- let replaceClose = (string, close, replace, index) => {
29
- let start = string.substring(0, index) + replace;
30
- let end = string.substring(index + close.length);
31
- let nextIndex = end.indexOf(close);
32
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
33
- };
34
-
35
- let createColors = (enabled = isColorSupported) => ({
36
- isColorSupported: enabled,
37
- reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
38
- bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
39
- dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
40
- italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
41
- underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
42
- inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
43
- hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
44
- strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
45
- black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
46
- red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
47
- green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
48
- yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
49
- blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
50
- magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
51
- cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
52
- white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
53
- gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
54
- bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
55
- bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
56
- bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
57
- bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
58
- bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
59
- bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
60
- bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
61
- bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
62
- });
63
-
64
- picocolors.exports = createColors();
65
- picocolors.exports.createColors = createColors;
66
-
67
- var c = picocolors.exports;
68
-
69
- function normalizeWindowsPath(input = "") {
70
- if (!input.includes("\\")) {
71
- return input;
72
- }
73
- return input.replace(/\\/g, "/");
74
- }
75
-
76
- const _UNC_REGEX = /^[/][/]/;
77
- const _UNC_DRIVE_REGEX = /^[/][/]([.]{1,2}[/])?([a-zA-Z]):[/]/;
78
- const _IS_ABSOLUTE_RE = /^\/|^\\|^[a-zA-Z]:[/\\]/;
79
- const sep = "/";
80
- const delimiter = ":";
81
- const normalize = function(path2) {
82
- if (path2.length === 0) {
83
- return ".";
84
- }
85
- path2 = normalizeWindowsPath(path2);
86
- const isUNCPath = path2.match(_UNC_REGEX);
87
- const hasUNCDrive = isUNCPath && path2.match(_UNC_DRIVE_REGEX);
88
- const isPathAbsolute = isAbsolute(path2);
89
- const trailingSeparator = path2[path2.length - 1] === "/";
90
- path2 = normalizeString(path2, !isPathAbsolute);
91
- if (path2.length === 0) {
92
- if (isPathAbsolute) {
93
- return "/";
94
- }
95
- return trailingSeparator ? "./" : ".";
96
- }
97
- if (trailingSeparator) {
98
- path2 += "/";
99
- }
100
- if (isUNCPath) {
101
- if (hasUNCDrive) {
102
- return `//./${path2}`;
103
- }
104
- return `//${path2}`;
105
- }
106
- return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
107
- };
108
- const join = function(...args) {
109
- if (args.length === 0) {
110
- return ".";
111
- }
112
- let joined;
113
- for (let i = 0; i < args.length; ++i) {
114
- const arg = args[i];
115
- if (arg.length > 0) {
116
- if (joined === void 0) {
117
- joined = arg;
118
- } else {
119
- joined += `/${arg}`;
120
- }
121
- }
122
- }
123
- if (joined === void 0) {
124
- return ".";
125
- }
126
- return normalize(joined);
127
- };
128
- const resolve = function(...args) {
129
- args = args.map((arg) => normalizeWindowsPath(arg));
130
- let resolvedPath = "";
131
- let resolvedAbsolute = false;
132
- for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
133
- const path2 = i >= 0 ? args[i] : process.cwd();
134
- if (path2.length === 0) {
135
- continue;
136
- }
137
- resolvedPath = `${path2}/${resolvedPath}`;
138
- resolvedAbsolute = isAbsolute(path2);
139
- }
140
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
141
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
142
- return `/${resolvedPath}`;
143
- }
144
- return resolvedPath.length > 0 ? resolvedPath : ".";
145
- };
146
- function normalizeString(path2, allowAboveRoot) {
147
- let res = "";
148
- let lastSegmentLength = 0;
149
- let lastSlash = -1;
150
- let dots = 0;
151
- let char = null;
152
- for (let i = 0; i <= path2.length; ++i) {
153
- if (i < path2.length) {
154
- char = path2[i];
155
- } else if (char === "/") {
156
- break;
157
- } else {
158
- char = "/";
159
- }
160
- if (char === "/") {
161
- if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
162
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
163
- if (res.length > 2) {
164
- const lastSlashIndex = res.lastIndexOf("/");
165
- if (lastSlashIndex === -1) {
166
- res = "";
167
- lastSegmentLength = 0;
168
- } else {
169
- res = res.slice(0, lastSlashIndex);
170
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
171
- }
172
- lastSlash = i;
173
- dots = 0;
174
- continue;
175
- } else if (res.length !== 0) {
176
- res = "";
177
- lastSegmentLength = 0;
178
- lastSlash = i;
179
- dots = 0;
180
- continue;
181
- }
182
- }
183
- if (allowAboveRoot) {
184
- res += res.length > 0 ? "/.." : "..";
185
- lastSegmentLength = 2;
186
- }
187
- } else {
188
- if (res.length > 0) {
189
- res += `/${path2.slice(lastSlash + 1, i)}`;
190
- } else {
191
- res = path2.slice(lastSlash + 1, i);
192
- }
193
- lastSegmentLength = i - lastSlash - 1;
194
- }
195
- lastSlash = i;
196
- dots = 0;
197
- } else if (char === "." && dots !== -1) {
198
- ++dots;
199
- } else {
200
- dots = -1;
201
- }
202
- }
203
- return res;
204
- }
205
- const isAbsolute = function(p) {
206
- return _IS_ABSOLUTE_RE.test(p);
207
- };
208
- const toNamespacedPath = function(p) {
209
- return normalizeWindowsPath(p);
210
- };
211
- const extname = function(p) {
212
- return path.posix.extname(normalizeWindowsPath(p));
213
- };
214
- const relative = function(from, to) {
215
- return path.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
216
- };
217
- const dirname = function(p) {
218
- return path.posix.dirname(normalizeWindowsPath(p));
219
- };
220
- const format = function(p) {
221
- return normalizeWindowsPath(path.posix.format(p));
222
- };
223
- const basename = function(p, ext) {
224
- return path.posix.basename(normalizeWindowsPath(p), ext);
225
- };
226
- const parse = function(p) {
227
- return path.posix.parse(normalizeWindowsPath(p));
228
- };
229
-
230
- const _path = /*#__PURE__*/Object.freeze({
231
- __proto__: null,
232
- sep: sep,
233
- delimiter: delimiter,
234
- normalize: normalize,
235
- join: join,
236
- resolve: resolve,
237
- normalizeString: normalizeString,
238
- isAbsolute: isAbsolute,
239
- toNamespacedPath: toNamespacedPath,
240
- extname: extname,
241
- relative: relative,
242
- dirname: dirname,
243
- format: format,
244
- basename: basename,
245
- parse: parse
246
- });
247
-
248
- const index = {
249
- ..._path
250
- };
251
-
252
- function notNullish(v) {
253
- return v != null;
254
- }
255
- function slash(str) {
256
- return str.replace(/\\/g, "/");
257
- }
258
- function mergeSlashes(str) {
259
- return str.replace(/\/\//g, "/");
260
- }
261
- const noop = () => {
262
- };
263
- function toArray(array) {
264
- array = array || [];
265
- if (Array.isArray(array))
266
- return array;
267
- return [array];
268
- }
269
- function getTests(suite) {
270
- return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
271
- }
272
- function getSuites(suite) {
273
- return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
274
- }
275
- function hasTests(suite) {
276
- return toArray(suite).some((s) => s.tasks.some((c) => c.type === "test" || hasTests(c)));
277
- }
278
- function hasFailed(suite) {
279
- return toArray(suite).some((s) => {
280
- var _a;
281
- return ((_a = s.result) == null ? void 0 : _a.state) === "fail" || s.type === "suite" && hasFailed(s.tasks);
282
- });
283
- }
284
- function getNames(task) {
285
- const names = [task.name];
286
- let current = task;
287
- while ((current == null ? void 0 : current.suite) || (current == null ? void 0 : current.file)) {
288
- current = current.suite || current.file;
289
- if (current == null ? void 0 : current.name)
290
- names.unshift(current.name);
291
- }
292
- return names;
293
- }
294
-
295
- const isWindows = process.platform === "win32";
296
- function partitionSuiteChildren(suite) {
297
- let tasksGroup = [];
298
- const tasksGroups = [];
299
- for (const c2 of suite.tasks) {
300
- if (tasksGroup.length === 0 || c2.concurrent === tasksGroup[0].concurrent) {
301
- tasksGroup.push(c2);
302
- } else {
303
- tasksGroups.push(tasksGroup);
304
- tasksGroup = [c2];
305
- }
306
- }
307
- if (tasksGroup.length > 0)
308
- tasksGroups.push(tasksGroup);
309
- return tasksGroups;
310
- }
311
- function getFullName(task) {
312
- return getNames(task).join(c.dim(" > "));
313
- }
314
- async function ensurePackageInstalled(dependency, promptInstall = !process.env.CI && process.stdout.isTTY) {
315
- if (isPackageExists(dependency))
316
- return true;
317
- process.stderr.write(c.red(`${c.inverse(c.red(" MISSING DEP "))} Can not find dependency '${dependency}'
318
-
319
- `));
320
- if (!promptInstall)
321
- return false;
322
- const prompts = await import('./index-93dcb598.js').then(function (n) { return n.i; });
323
- const { install } = await prompts.prompt({
324
- type: "confirm",
325
- name: "install",
326
- message: c.reset(`Do you want to install ${c.green(dependency)}?`)
327
- });
328
- if (install) {
329
- await (await import('./index-42d44ee5.js')).installPackage(dependency, { dev: true });
330
- return true;
331
- }
332
- return false;
333
- }
334
- function deepMerge(target, ...sources) {
335
- if (!sources.length)
336
- return target;
337
- const source = sources.shift();
338
- if (source === void 0)
339
- return target;
340
- if (isMergableObject(target) && isMergableObject(source)) {
341
- Object.keys(source).forEach((key) => {
342
- if (isMergableObject(source[key])) {
343
- if (!target[key])
344
- target[key] = {};
345
- deepMerge(target[key], source[key]);
346
- } else {
347
- target[key] = source[key];
348
- }
349
- });
350
- }
351
- return deepMerge(target, ...sources);
352
- }
353
- function isMergableObject(item) {
354
- return isObject(item) && !Array.isArray(item);
355
- }
356
- function isObject(val) {
357
- return toString.call(val) === "[object Object]";
358
- }
359
- function toFilePath(id, root) {
360
- let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(dirname(root)) ? id : id.startsWith("/") ? slash(resolve(root, id.slice(1))) : id;
361
- if (absolute.startsWith("//"))
362
- absolute = absolute.slice(1);
363
- return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
364
- }
365
-
366
- export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, join as q, relative as r, slash as s, toArray as t, index as u, getNames as v, partitionSuiteChildren as w, hasTests as x };