vitest 1.0.0-beta.3 → 1.0.0-beta.5
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.
- package/LICENSE.md +3 -498
- package/dist/browser.d.ts +1 -2
- package/dist/browser.js +4 -4
- package/dist/child.js +15 -18
- package/dist/{chunk-api-setup.37a43981.js → chunks/api-setup.jHV5vgr2.js} +101 -39
- package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
- package/dist/chunks/integrations-globals.-pds_Gug.js +29 -0
- package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
- package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.iCAG0Yz3.js} +1 -1
- package/dist/cli-wrapper.js +2 -18
- package/dist/cli.js +21 -23
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +4 -7
- package/dist/config.js +2 -1
- package/dist/coverage.d.ts +25 -16
- package/dist/coverage.js +118 -49
- package/dist/entry-vm.js +13 -13
- package/dist/entry.js +14 -14
- package/dist/environments.d.ts +1 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -3
- package/dist/execute.js +3 -4
- package/dist/index.d.ts +396 -95
- package/dist/index.js +10 -10
- package/dist/node.d.ts +10 -6
- package/dist/node.js +17 -22
- package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
- package/dist/{reporters-1678fe04.d.ts → reporters-ANEBTnOh.d.ts} +336 -340
- package/dist/reporters.d.ts +1 -2
- package/dist/reporters.js +7 -8
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +8 -9
- package/dist/{suite-0579b50d.d.ts → suite-C1OmA61l.d.ts} +1 -1
- package/dist/suite.d.ts +2 -3
- package/dist/suite.js +3 -3
- package/dist/{vendor-benchmark.44931cfa.js → vendor/benchmark.WVm6DARl.js} +1 -1
- package/dist/{vendor-execute.e6e4e89b.js → vendor/execute.aMjV5C9u.js} +4 -7
- package/dist/vendor/global.L7JRz1qU.js +14 -0
- package/dist/{vendor-index.68ecee35.js → vendor/index.Npc-eff0.js} +11 -4
- package/dist/{vendor-index.29282562.js → vendor/index.XU72Rmy8.js} +1 -1
- package/dist/{vendor-index.3d079eea.js → vendor/index.h0j9y5vy.js} +5 -5
- package/dist/vendor/index.xL8XjTLv.js +3962 -0
- package/dist/vendor/loader.CU0NY2Is.js +39 -0
- package/dist/{vendor-node.327f8f1f.js → vendor/node.c-kzGvOB.js} +2192 -5614
- package/dist/{vendor-reporters.b9600369.js → vendor/reporters.1xKxm8im.js} +424 -374
- package/dist/{vendor-rpc.cbd8e972.js → vendor/rpc.Bl-ysZIr.js} +1 -1
- package/dist/{vendor-run-once.3e5ef7d7.js → vendor/run-once.X3E7xx3F.js} +1 -1
- package/dist/{vendor-vi.d30b47ae.js → vendor/vi.voNYQWB_.js} +35 -38
- package/dist/vm.js +16 -20
- package/dist/worker.js +16 -20
- package/index.cjs +5 -0
- package/package.json +50 -54
- package/dist/chunk-install-pkg.6349b322.js +0 -1740
- package/dist/chunk-integrations-globals.9df12d91.js +0 -29
- package/dist/vendor-global.97e4527c.js +0 -9
- package/dist/vendor-index.8efe7746.js +0 -2236
- package/dist/vendor-loader.9c966f23.js +0 -2089
- /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
- /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
- /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
- /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
- /package/dist/{vendor-date.6e993429.js → vendor/date.W90-E5kF.js} +0 -0
- /package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.hpEVJZPC.js} +0 -0
- /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
- /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
- /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.Npc-eff0.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.voNYQWB_.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.W90-E5kF.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 {
|
|
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 '
|
|
5
|
+
import { R as RealDate } from '../vendor/date.W90-E5kF.js';
|
|
6
6
|
|
|
7
7
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
8
8
|
function getTaskIdByStack(root) {
|
package/dist/cli-wrapper.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import c from 'picocolors';
|
|
3
|
-
import {
|
|
4
|
-
import { E as EXIT_CODE_RESTART } from './vendor
|
|
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
|
|
5
|
-
import './vendor
|
|
6
|
-
import { d as divider } from './vendor
|
|
7
|
-
import { t as toArray } from './vendor
|
|
4
|
+
import { v as version, s as startVitest } from './vendor/node.c-kzGvOB.js';
|
|
5
|
+
import './vendor/index.XU72Rmy8.js';
|
|
6
|
+
import { d as divider } from './vendor/reporters.1xKxm8im.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
|
|
14
|
-
import './vendor
|
|
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,52 +23,49 @@ 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
|
|
26
|
-
import './
|
|
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
|
|
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 '
|
|
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
|
|
48
|
+
import './vendor/environments.hpEVJZPC.js';
|
|
54
49
|
import 'node:console';
|
|
55
50
|
import 'node:readline';
|
|
56
51
|
import 'readline';
|
|
57
|
-
import './vendor
|
|
58
|
-
import './
|
|
52
|
+
import './vendor/global.L7JRz1qU.js';
|
|
53
|
+
import './chunks/runtime-console.iCAG0Yz3.js';
|
|
59
54
|
import 'node:stream';
|
|
60
|
-
import './vendor
|
|
61
|
-
import './vendor
|
|
55
|
+
import './vendor/date.W90-E5kF.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").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
|
|
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)").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);
|
|
69
64
|
cli.command("dev [...filters]").action(watch);
|
|
70
65
|
cli.command("bench [...filters]").action(benchmark);
|
|
66
|
+
cli.command("typecheck [...filters]").action(() => {
|
|
67
|
+
throw new Error(`Running typecheck via "typecheck" command is removed. Please use "--typecheck" to run your regular tests alongside typechecking, or "--typecheck.only" to run only typecheck tests.`);
|
|
68
|
+
});
|
|
71
69
|
cli.command("[...filters]").action((filters, options) => start("test", filters, options));
|
|
72
70
|
try {
|
|
73
71
|
cli.parse();
|
package/dist/config.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**
|
|
|
11
11
|
const defaultCoverageExcludes = [
|
|
12
12
|
"coverage/**",
|
|
13
13
|
"dist/**",
|
|
14
|
+
"**/[.]**",
|
|
14
15
|
"packages/*/test?(s)/**",
|
|
15
16
|
"**/*.d.ts",
|
|
16
17
|
"**/virtual:*",
|
|
@@ -77,7 +78,7 @@ const config = {
|
|
|
77
78
|
api: false,
|
|
78
79
|
ui: false,
|
|
79
80
|
uiBase: "/__vitest__/",
|
|
80
|
-
open:
|
|
81
|
+
open: !stdEnv.isCI,
|
|
81
82
|
css: {
|
|
82
83
|
include: []
|
|
83
84
|
},
|