vitest 1.0.0-beta.4 → 1.0.0-beta.6

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 (66) hide show
  1. package/LICENSE.md +1 -513
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +4 -4
  4. package/dist/child.js +13 -17
  5. package/dist/{chunk-api-setup.6d19ab38.js → chunks/api-setup.jHV5vgr2.js} +97 -39
  6. package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
  7. package/dist/chunks/integrations-globals.eip0xL77.js +29 -0
  8. package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
  9. package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.hf2msWA9.js} +1 -1
  10. package/dist/cli-wrapper.js +2 -18
  11. package/dist/cli.js +19 -24
  12. package/dist/config.cjs +1 -1
  13. package/dist/config.d.ts +4 -6
  14. package/dist/config.js +1 -1
  15. package/dist/coverage.d.ts +25 -15
  16. package/dist/coverage.js +118 -49
  17. package/dist/entry-vm.js +13 -13
  18. package/dist/entry.js +14 -14
  19. package/dist/environments.d.ts +1 -1
  20. package/dist/environments.js +1 -1
  21. package/dist/execute.d.ts +1 -1
  22. package/dist/execute.js +3 -3
  23. package/dist/index.d.ts +168 -39
  24. package/dist/index.js +10 -10
  25. package/dist/node.d.ts +5 -5
  26. package/dist/node.js +17 -22
  27. package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
  28. package/dist/{reporters-50c2bd49.d.ts → reporters-vMlHjCdM.d.ts} +335 -365
  29. package/dist/reporters.d.ts +1 -1
  30. package/dist/reporters.js +7 -8
  31. package/dist/runners.d.ts +1 -1
  32. package/dist/runners.js +8 -8
  33. package/dist/{suite-ad69b7cd.d.ts → suite-vfxzpeqE.d.ts} +1 -1
  34. package/dist/suite.d.ts +2 -2
  35. package/dist/suite.js +3 -3
  36. package/dist/{vendor-benchmark.b6befc50.js → vendor/benchmark.WVm6DARl.js} +1 -1
  37. package/dist/{vendor-date.6e993429.js → vendor/date.Ns1pGd_X.js} +1 -0
  38. package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.ewIbzajW.js} +2 -1
  39. package/dist/{vendor-execute.157302d6.js → vendor/execute.aMjV5C9u.js} +2 -4
  40. package/dist/{vendor-index.72df742e.js → vendor/index.VL3WbvjT.js} +4 -4
  41. package/dist/{vendor-index.2b92937b.js → vendor/index.XU72Rmy8.js} +1 -1
  42. package/dist/{vendor-index.57925a34.js → vendor/index.h0j9y5vy.js} +5 -5
  43. package/dist/vendor/index.xL8XjTLv.js +3962 -0
  44. package/dist/vendor/loader.-JDdZ5RJ.js +39 -0
  45. package/dist/{vendor-node.65461b16.js → vendor/node.1xm0UoNi.js} +1904 -5957
  46. package/dist/{vendor-reporters.d24d80a4.js → vendor/reporters.pr8MinP9.js} +429 -377
  47. package/dist/{vendor-rpc.171f65fb.js → vendor/rpc.Bl-ysZIr.js} +1 -1
  48. package/dist/{vendor-run-once.fb836747.js → vendor/run-once.X3E7xx3F.js} +1 -1
  49. package/dist/{vendor-vi.3baa7c4a.js → vendor/vi.JXuS6emb.js} +4 -4
  50. package/dist/vm.js +13 -18
  51. package/dist/worker.js +13 -18
  52. package/import-meta.d.ts +5 -0
  53. package/index.cjs +5 -0
  54. package/package.json +52 -53
  55. package/dist/chunk-install-pkg.e1d6323e.js +0 -1740
  56. package/dist/chunk-integrations-globals.2b099e04.js +0 -29
  57. package/dist/vendor-index.8efe7746.js +0 -2236
  58. package/dist/vendor-loader.9c966f23.js +0 -2089
  59. /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
  60. /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
  61. /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
  62. /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
  63. /package/dist/{vendor-global.c3664e75.js → vendor/global.L7JRz1qU.js} +0 -0
  64. /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
  65. /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
  66. /package/dist/{vendor-tasks.f9d75aed.js → vendor/tasks.IknbGB2n.js} +0 -0
@@ -0,0 +1,457 @@
1
+ import require$$0 from 'fs';
2
+ import p from 'path';
3
+ import { g as getDefaultExportFromCjs } from '../vendor/_commonjsHelpers.jjO7Zipk.js';
4
+ import require$$0$1 from 'util';
5
+ import execa from 'execa';
6
+
7
+ var findUp$1 = {exports: {}};
8
+
9
+ var locatePath = {exports: {}};
10
+
11
+ class Node {
12
+ /// value;
13
+ /// next;
14
+
15
+ constructor(value) {
16
+ this.value = value;
17
+
18
+ // TODO: Remove this when targeting Node.js 12.
19
+ this.next = undefined;
20
+ }
21
+ }
22
+
23
+ let Queue$1 = class Queue {
24
+ // TODO: Use private class fields when targeting Node.js 12.
25
+ // #_head;
26
+ // #_tail;
27
+ // #_size;
28
+
29
+ constructor() {
30
+ this.clear();
31
+ }
32
+
33
+ enqueue(value) {
34
+ const node = new Node(value);
35
+
36
+ if (this._head) {
37
+ this._tail.next = node;
38
+ this._tail = node;
39
+ } else {
40
+ this._head = node;
41
+ this._tail = node;
42
+ }
43
+
44
+ this._size++;
45
+ }
46
+
47
+ dequeue() {
48
+ const current = this._head;
49
+ if (!current) {
50
+ return;
51
+ }
52
+
53
+ this._head = this._head.next;
54
+ this._size--;
55
+ return current.value;
56
+ }
57
+
58
+ clear() {
59
+ this._head = undefined;
60
+ this._tail = undefined;
61
+ this._size = 0;
62
+ }
63
+
64
+ get size() {
65
+ return this._size;
66
+ }
67
+
68
+ * [Symbol.iterator]() {
69
+ let current = this._head;
70
+
71
+ while (current) {
72
+ yield current.value;
73
+ current = current.next;
74
+ }
75
+ }
76
+ };
77
+
78
+ var yoctoQueue = Queue$1;
79
+
80
+ const Queue = yoctoQueue;
81
+
82
+ const pLimit$1 = concurrency => {
83
+ if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
84
+ throw new TypeError('Expected `concurrency` to be a number from 1 and up');
85
+ }
86
+
87
+ const queue = new Queue();
88
+ let activeCount = 0;
89
+
90
+ const next = () => {
91
+ activeCount--;
92
+
93
+ if (queue.size > 0) {
94
+ queue.dequeue()();
95
+ }
96
+ };
97
+
98
+ const run = async (fn, resolve, ...args) => {
99
+ activeCount++;
100
+
101
+ const result = (async () => fn(...args))();
102
+
103
+ resolve(result);
104
+
105
+ try {
106
+ await result;
107
+ } catch {}
108
+
109
+ next();
110
+ };
111
+
112
+ const enqueue = (fn, resolve, ...args) => {
113
+ queue.enqueue(run.bind(null, fn, resolve, ...args));
114
+
115
+ (async () => {
116
+ // This function needs to wait until the next microtask before comparing
117
+ // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
118
+ // when the run function is dequeued and called. The comparison in the if-statement
119
+ // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
120
+ await Promise.resolve();
121
+
122
+ if (activeCount < concurrency && queue.size > 0) {
123
+ queue.dequeue()();
124
+ }
125
+ })();
126
+ };
127
+
128
+ const generator = (fn, ...args) => new Promise(resolve => {
129
+ enqueue(fn, resolve, ...args);
130
+ });
131
+
132
+ Object.defineProperties(generator, {
133
+ activeCount: {
134
+ get: () => activeCount
135
+ },
136
+ pendingCount: {
137
+ get: () => queue.size
138
+ },
139
+ clearQueue: {
140
+ value: () => {
141
+ queue.clear();
142
+ }
143
+ }
144
+ });
145
+
146
+ return generator;
147
+ };
148
+
149
+ var pLimit_1 = pLimit$1;
150
+
151
+ const pLimit = pLimit_1;
152
+
153
+ class EndError extends Error {
154
+ constructor(value) {
155
+ super();
156
+ this.value = value;
157
+ }
158
+ }
159
+
160
+ // The input can also be a promise, so we await it
161
+ const testElement = async (element, tester) => tester(await element);
162
+
163
+ // The input can also be a promise, so we `Promise.all()` them both
164
+ const finder = async element => {
165
+ const values = await Promise.all(element);
166
+ if (values[1] === true) {
167
+ throw new EndError(values[0]);
168
+ }
169
+
170
+ return false;
171
+ };
172
+
173
+ const pLocate$1 = async (iterable, tester, options) => {
174
+ options = {
175
+ concurrency: Infinity,
176
+ preserveOrder: true,
177
+ ...options
178
+ };
179
+
180
+ const limit = pLimit(options.concurrency);
181
+
182
+ // Start all the promises concurrently with optional limit
183
+ const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
184
+
185
+ // Check the promises either serially or concurrently
186
+ const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
187
+
188
+ try {
189
+ await Promise.all(items.map(element => checkLimit(finder, element)));
190
+ } catch (error) {
191
+ if (error instanceof EndError) {
192
+ return error.value;
193
+ }
194
+
195
+ throw error;
196
+ }
197
+ };
198
+
199
+ var pLocate_1 = pLocate$1;
200
+
201
+ const path = p;
202
+ const fs$1 = require$$0;
203
+ const {promisify: promisify$1} = require$$0$1;
204
+ const pLocate = pLocate_1;
205
+
206
+ const fsStat = promisify$1(fs$1.stat);
207
+ const fsLStat = promisify$1(fs$1.lstat);
208
+
209
+ const typeMappings = {
210
+ directory: 'isDirectory',
211
+ file: 'isFile'
212
+ };
213
+
214
+ function checkType({type}) {
215
+ if (type in typeMappings) {
216
+ return;
217
+ }
218
+
219
+ throw new Error(`Invalid type specified: ${type}`);
220
+ }
221
+
222
+ const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
223
+
224
+ locatePath.exports = async (paths, options) => {
225
+ options = {
226
+ cwd: process.cwd(),
227
+ type: 'file',
228
+ allowSymlinks: true,
229
+ ...options
230
+ };
231
+
232
+ checkType(options);
233
+
234
+ const statFn = options.allowSymlinks ? fsStat : fsLStat;
235
+
236
+ return pLocate(paths, async path_ => {
237
+ try {
238
+ const stat = await statFn(path.resolve(options.cwd, path_));
239
+ return matchType(options.type, stat);
240
+ } catch {
241
+ return false;
242
+ }
243
+ }, options);
244
+ };
245
+
246
+ locatePath.exports.sync = (paths, options) => {
247
+ options = {
248
+ cwd: process.cwd(),
249
+ allowSymlinks: true,
250
+ type: 'file',
251
+ ...options
252
+ };
253
+
254
+ checkType(options);
255
+
256
+ const statFn = options.allowSymlinks ? fs$1.statSync : fs$1.lstatSync;
257
+
258
+ for (const path_ of paths) {
259
+ try {
260
+ const stat = statFn(path.resolve(options.cwd, path_));
261
+
262
+ if (matchType(options.type, stat)) {
263
+ return path_;
264
+ }
265
+ } catch {}
266
+ }
267
+ };
268
+
269
+ var locatePathExports = locatePath.exports;
270
+
271
+ var pathExists = {exports: {}};
272
+
273
+ const fs = require$$0;
274
+ const {promisify} = require$$0$1;
275
+
276
+ const pAccess = promisify(fs.access);
277
+
278
+ pathExists.exports = async path => {
279
+ try {
280
+ await pAccess(path);
281
+ return true;
282
+ } catch (_) {
283
+ return false;
284
+ }
285
+ };
286
+
287
+ pathExists.exports.sync = path => {
288
+ try {
289
+ fs.accessSync(path);
290
+ return true;
291
+ } catch (_) {
292
+ return false;
293
+ }
294
+ };
295
+
296
+ var pathExistsExports = pathExists.exports;
297
+
298
+ (function (module) {
299
+ const path = p;
300
+ const locatePath = locatePathExports;
301
+ const pathExists = pathExistsExports;
302
+
303
+ const stop = Symbol('findUp.stop');
304
+
305
+ module.exports = async (name, options = {}) => {
306
+ let directory = path.resolve(options.cwd || '');
307
+ const {root} = path.parse(directory);
308
+ const paths = [].concat(name);
309
+
310
+ const runMatcher = async locateOptions => {
311
+ if (typeof name !== 'function') {
312
+ return locatePath(paths, locateOptions);
313
+ }
314
+
315
+ const foundPath = await name(locateOptions.cwd);
316
+ if (typeof foundPath === 'string') {
317
+ return locatePath([foundPath], locateOptions);
318
+ }
319
+
320
+ return foundPath;
321
+ };
322
+
323
+ // eslint-disable-next-line no-constant-condition
324
+ while (true) {
325
+ // eslint-disable-next-line no-await-in-loop
326
+ const foundPath = await runMatcher({...options, cwd: directory});
327
+
328
+ if (foundPath === stop) {
329
+ return;
330
+ }
331
+
332
+ if (foundPath) {
333
+ return path.resolve(directory, foundPath);
334
+ }
335
+
336
+ if (directory === root) {
337
+ return;
338
+ }
339
+
340
+ directory = path.dirname(directory);
341
+ }
342
+ };
343
+
344
+ module.exports.sync = (name, options = {}) => {
345
+ let directory = path.resolve(options.cwd || '');
346
+ const {root} = path.parse(directory);
347
+ const paths = [].concat(name);
348
+
349
+ const runMatcher = locateOptions => {
350
+ if (typeof name !== 'function') {
351
+ return locatePath.sync(paths, locateOptions);
352
+ }
353
+
354
+ const foundPath = name(locateOptions.cwd);
355
+ if (typeof foundPath === 'string') {
356
+ return locatePath.sync([foundPath], locateOptions);
357
+ }
358
+
359
+ return foundPath;
360
+ };
361
+
362
+ // eslint-disable-next-line no-constant-condition
363
+ while (true) {
364
+ const foundPath = runMatcher({...options, cwd: directory});
365
+
366
+ if (foundPath === stop) {
367
+ return;
368
+ }
369
+
370
+ if (foundPath) {
371
+ return path.resolve(directory, foundPath);
372
+ }
373
+
374
+ if (directory === root) {
375
+ return;
376
+ }
377
+
378
+ directory = path.dirname(directory);
379
+ }
380
+ };
381
+
382
+ module.exports.exists = pathExists;
383
+
384
+ module.exports.sync.exists = pathExists.sync;
385
+
386
+ module.exports.stop = stop;
387
+ } (findUp$1));
388
+
389
+ var findUpExports = findUp$1.exports;
390
+ var findUp = /*@__PURE__*/getDefaultExportFromCjs(findUpExports);
391
+
392
+ // src/detect.ts
393
+ var AGENTS = ["pnpm", "yarn", "npm", "pnpm@6", "yarn@berry", "bun"];
394
+ var LOCKS = {
395
+ "bun.lockb": "bun",
396
+ "pnpm-lock.yaml": "pnpm",
397
+ "yarn.lock": "yarn",
398
+ "package-lock.json": "npm",
399
+ "npm-shrinkwrap.json": "npm"
400
+ };
401
+ async function detectPackageManager(cwd = process.cwd()) {
402
+ let agent = null;
403
+ const lockPath = await findUp(Object.keys(LOCKS), { cwd });
404
+ let packageJsonPath;
405
+ if (lockPath)
406
+ packageJsonPath = p.resolve(lockPath, "../package.json");
407
+ else
408
+ packageJsonPath = await findUp("package.json", { cwd });
409
+ if (packageJsonPath && require$$0.existsSync(packageJsonPath)) {
410
+ try {
411
+ const pkg = JSON.parse(require$$0.readFileSync(packageJsonPath, "utf8"));
412
+ if (typeof pkg.packageManager === "string") {
413
+ const [name, version] = pkg.packageManager.split("@");
414
+ if (name === "yarn" && parseInt(version) > 1)
415
+ agent = "yarn@berry";
416
+ else if (name === "pnpm" && parseInt(version) < 7)
417
+ agent = "pnpm@6";
418
+ else if (name in AGENTS)
419
+ agent = name;
420
+ else
421
+ console.warn("[ni] Unknown packageManager:", pkg.packageManager);
422
+ }
423
+ } catch {
424
+ }
425
+ }
426
+ if (!agent && lockPath)
427
+ agent = LOCKS[p.basename(lockPath)];
428
+ return agent;
429
+ }
430
+ async function installPackage(names, options = {}) {
431
+ const detectedAgent = options.packageManager || await detectPackageManager(options.cwd) || "npm";
432
+ const [agent] = detectedAgent.split("@");
433
+ if (!Array.isArray(names))
434
+ names = [names];
435
+ const args = options.additionalArgs || [];
436
+ if (options.preferOffline) {
437
+ if (detectedAgent === "yarn@berry")
438
+ args.unshift("--cached");
439
+ else
440
+ args.unshift("--prefer-offline");
441
+ }
442
+ return execa(
443
+ agent,
444
+ [
445
+ agent === "yarn" ? "add" : "install",
446
+ options.dev ? "-D" : "",
447
+ ...args,
448
+ ...names
449
+ ].filter(Boolean),
450
+ {
451
+ stdio: options.silent ? "ignore" : "inherit",
452
+ cwd: options.cwd
453
+ }
454
+ );
455
+ }
456
+
457
+ export { detectPackageManager, installPackage };
@@ -0,0 +1,29 @@
1
+ import { g as globalApis } from '../vendor/constants.WSvnD_fn.js';
2
+ import { i as index } from '../vendor/index.VL3WbvjT.js';
3
+ import '@vitest/runner';
4
+ import '../vendor/benchmark.WVm6DARl.js';
5
+ import '@vitest/runner/utils';
6
+ import '@vitest/utils';
7
+ import '../vendor/index.XU72Rmy8.js';
8
+ import 'pathe';
9
+ import 'std-env';
10
+ import '../vendor/global.L7JRz1qU.js';
11
+ import '../vendor/run-once.X3E7xx3F.js';
12
+ import '../vendor/vi.JXuS6emb.js';
13
+ import 'chai';
14
+ import '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
+ import '@vitest/expect';
16
+ import '@vitest/snapshot';
17
+ import '@vitest/utils/error';
18
+ import '../vendor/tasks.IknbGB2n.js';
19
+ import '@vitest/utils/source-map';
20
+ import '../vendor/date.Ns1pGd_X.js';
21
+ import '@vitest/spy';
22
+
23
+ function registerApiGlobally() {
24
+ globalApis.forEach((api) => {
25
+ globalThis[api] = index[api];
26
+ });
27
+ }
28
+
29
+ export { registerApiGlobally };
@@ -1,22 +1,5 @@
1
1
  import { resolve } from 'pathe';
2
- import { e as execa } from './vendor-index.8efe7746.js';
3
- import 'node:buffer';
4
- import 'node:path';
5
- import 'node:child_process';
6
- import 'node:process';
7
- import './vendor-_commonjsHelpers.7d1333e8.js';
8
- import 'child_process';
9
- import 'path';
10
- import 'fs';
11
- import 'node:url';
12
- import 'node:os';
13
- import 'assert';
14
- import 'events';
15
- import 'node:fs';
16
- import 'buffer';
17
- import 'stream';
18
- import 'util';
19
- import 'node:util';
2
+ import { execa } from 'execa';
20
3
 
21
4
  class VitestGit {
22
5
  constructor(cwd) {
@@ -2,7 +2,7 @@ import { Writable } from 'node:stream';
2
2
  import { Console } from 'node:console';
3
3
  import { relative } from 'node:path';
4
4
  import { getSafeTimers } from '@vitest/utils';
5
- import { R as RealDate } from './vendor-date.6e993429.js';
5
+ import { R as RealDate } from '../vendor/date.Ns1pGd_X.js';
6
6
 
7
7
  const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
8
8
  function getTaskIdByStack(root) {
@@ -1,23 +1,7 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
  import c from 'picocolors';
3
- import { e as execa } from './vendor-index.8efe7746.js';
4
- import { E as EXIT_CODE_RESTART } from './vendor-constants.538d9b49.js';
5
- import 'node:buffer';
6
- import 'node:path';
7
- import 'node:child_process';
8
- import 'node:process';
9
- import './vendor-_commonjsHelpers.7d1333e8.js';
10
- import 'child_process';
11
- import 'path';
12
- import 'fs';
13
- import 'node:os';
14
- import 'assert';
15
- import 'events';
16
- import 'node:fs';
17
- import 'buffer';
18
- import 'stream';
19
- import 'util';
20
- import 'node:util';
3
+ import { execa } from 'execa';
4
+ import { E as EXIT_CODE_RESTART } from './vendor/constants.WSvnD_fn.js';
21
5
 
22
6
  const ENTRY = new URL("./cli.js", import.meta.url);
23
7
  const NODE_ARGS = [
package/dist/cli.js CHANGED
@@ -1,19 +1,20 @@
1
1
  import { normalize } from 'pathe';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest } from './vendor-node.65461b16.js';
5
- import './vendor-index.2b92937b.js';
6
- import { d as divider } from './vendor-reporters.d24d80a4.js';
7
- import { t as toArray } from './vendor-base.9c08bbd0.js';
4
+ import { v as version, s as startVitest } from './vendor/node.1xm0UoNi.js';
5
+ import './vendor/index.XU72Rmy8.js';
6
+ import { d as divider } from './vendor/reporters.pr8MinP9.js';
7
+ import { t as toArray } from './vendor/base._79unx2z.js';
8
8
  import 'vite';
9
9
  import 'node:path';
10
10
  import 'node:url';
11
11
  import 'node:process';
12
12
  import 'node:fs';
13
- import './vendor-constants.538d9b49.js';
14
- import './vendor-_commonjsHelpers.7d1333e8.js';
13
+ import './vendor/constants.WSvnD_fn.js';
14
+ import './vendor/_commonjsHelpers.jjO7Zipk.js';
15
15
  import 'os';
16
16
  import 'path';
17
+ import './vendor/index.xL8XjTLv.js';
17
18
  import 'util';
18
19
  import 'stream';
19
20
  import 'events';
@@ -22,47 +23,41 @@ import 'vite-node/utils';
22
23
  import 'vite-node/client';
23
24
  import '@vitest/snapshot/manager';
24
25
  import 'vite-node/server';
25
- import './vendor-coverage.78040316.js';
26
- import './vendor-paths.84fc7a99.js';
26
+ import './vendor/coverage.v6aD8iAh.js';
27
+ import './paths.js';
27
28
  import 'node:v8';
28
29
  import 'node:os';
29
30
  import 'node:events';
30
31
  import 'tinypool';
31
- import './vendor-index.1ca68bd5.js';
32
+ import './vendor/index.cAUulNDf.js';
32
33
  import 'node:worker_threads';
33
34
  import '@vitest/utils';
34
35
  import 'node:fs/promises';
35
36
  import 'node:perf_hooks';
36
- import './vendor-index.8efe7746.js';
37
- import 'node:buffer';
38
- import 'node:child_process';
39
- import 'child_process';
40
- import 'assert';
41
- import 'buffer';
42
- import 'node:util';
37
+ import 'execa';
43
38
  import '@vitest/utils/source-map';
44
39
  import 'local-pkg';
45
40
  import 'std-env';
46
41
  import 'module';
47
- import 'acorn';
48
42
  import 'acorn-walk';
49
43
  import '@vitest/runner/utils';
50
44
  import 'node:crypto';
45
+ import 'assert';
51
46
  import 'magic-string';
52
47
  import 'strip-literal';
53
- import './vendor-environments.dcc4a34e.js';
48
+ import './vendor/environments.ewIbzajW.js';
54
49
  import 'node:console';
55
50
  import 'node:readline';
56
51
  import 'readline';
57
- import './vendor-global.c3664e75.js';
58
- import './chunk-runtime-console.f3263f87.js';
52
+ import './vendor/global.L7JRz1qU.js';
53
+ import './chunks/runtime-console.hf2msWA9.js';
59
54
  import 'node:stream';
60
- import './vendor-date.6e993429.js';
61
- import './vendor-tasks.f9d75aed.js';
55
+ import './vendor/date.Ns1pGd_X.js';
56
+ import './vendor/tasks.IknbGB2n.js';
62
57
  import 'node:module';
63
58
 
64
59
  const cli = cac("vitest");
65
- cli.version(version).option("-r, --root <path>", "Root path").option("-c, --config <path>", "Path to config file").option("-u, --update", "Update snapshot").option("-w, --watch", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp pattern").option("--dir <path>", "Base directory to scan for the test files").option("--ui", "Enable UI").option("--open", "Open UI automatically (default: !process.env.CI))").option("--api [api]", "Serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report", { default: { 100: false } }).option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--pool <pool>", "Specify pool, if not running in the browser (default: threads)").option("--poolOptions <options>", "Specify pool options").option("--poolOptions.threads.isolate", "Isolate tests in threads pool (default: true)").option("--poolOptions.forks.isolate", "Isolate tests in forks pool (default: true)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order, use --sequence.concurrent to run tests in parallel)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed", { default: 0 }).option("--retry <times>", "Retry the test specific number of times if it fails", { default: 0 }).option("--diff <path>", "Path to a diff config that will be used to generate diff interface").option("--expand-snapshot-diff", "Show full diff when snapshot fails").option("--typecheck [options]", "Custom options for typecheck pool").option("--typecheck.enabled", "Enable typechecking alongside tests (default: false)").option("--typecheck.only", "Run only typecheck tests. This automatically enables typecheck (default: false)").help();
60
+ cli.version(version).option("-r, --root <path>", "Root path").option("-c, --config <path>", "Path to config file").option("-u, --update", "Update snapshot").option("-w, --watch", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp pattern").option("--dir <path>", "Base directory to scan for the test files").option("--ui", "Enable UI").option("--open", "Open UI automatically (default: !process.env.CI))").option("--api [api]", "Serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser API with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--pool <pool>", "Specify pool, if not running in the browser (default: threads)").option("--poolOptions <options>", "Specify pool options").option("--poolOptions.threads.isolate", "Isolate tests in threads pool (default: true)").option("--poolOptions.forks.isolate", "Isolate tests in forks pool (default: true)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order, use --sequence.concurrent to run tests in parallel)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed (default: 0)").option("--retry <times>", "Retry the test specific number of times if it fails (default: 0)").option("--diff <path>", "Path to a diff config that will be used to generate diff interface").option("--expand-snapshot-diff", "Show full diff when snapshot fails").option("--typecheck [options]", "Custom options for typecheck pool").option("--typecheck.enabled", "Enable typechecking alongside tests (default: false)").option("--typecheck.only", "Run only typecheck tests. This automatically enables typecheck (default: false)").option("--project <name>", "The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2").help();
66
61
  cli.command("run [...filters]").action(run);
67
62
  cli.command("related [...filters]").action(runRelated);
68
63
  cli.command("watch [...filters]").action(watch);
@@ -103,7 +98,7 @@ async function run(cliFilters, options) {
103
98
  await start("test", cliFilters, options);
104
99
  }
105
100
  async function benchmark(cliFilters, options) {
106
- console.warn(c.yellow("Benchmarking is an experimental feature.\nBreaking changes might not follow semver, please pin Vitest's version when using it."));
101
+ console.warn(c.yellow("Benchmarking is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
107
102
  await start("benchmark", cliFilters, options);
108
103
  }
109
104
  function normalizeCliOptions(argv) {
package/dist/config.cjs CHANGED
@@ -78,7 +78,7 @@ const config = {
78
78
  api: false,
79
79
  ui: false,
80
80
  uiBase: "/__vitest__/",
81
- open: true,
81
+ open: !stdEnv.isCI,
82
82
  css: {
83
83
  include: []
84
84
  },
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
3
- import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-50c2bd49.js';
3
+ import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-vMlHjCdM.js';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
6
6
  import '@vitest/snapshot';
@@ -76,11 +76,9 @@ declare function defineConfig(config: UserConfig$1): UserConfig$1;
76
76
  declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
77
77
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
78
78
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
79
- declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
80
- declare function defineWorkspace(config: (string | (UserProjectConfigExport & {
79
+ declare function defineProject<T extends UserProjectConfigExport>(config: T): T;
80
+ declare function defineWorkspace<T extends (string | (UserProjectConfigExport & {
81
81
  extends?: string;
82
- }))[]): (string | (UserProjectConfigExport & {
83
- extends?: string | undefined;
84
- }))[];
82
+ }))[]>(config: T): T;
85
83
 
86
84
  export { type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserProjectConfigExport, type UserProjectConfigFn, type UserWorkspaceConfig, configDefaults, coverageConfigDefaults, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace };