vitest 0.18.1 → 0.20.0
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 +5 -5
- package/dist/browser.d.ts +1890 -0
- package/dist/browser.mjs +22 -0
- package/dist/{chunk-api-setup.9d3f7670.mjs → chunk-api-setup.7c4c8879.mjs} +24 -6
- package/dist/{chunk-constants.d4406290.mjs → chunk-constants.16825f0c.mjs} +5 -4
- package/dist/{chunk-env-node.bbba78e5.mjs → chunk-defaults.1c51d585.mjs} +461 -457
- package/dist/{chunk-install-pkg.2dcb2c04.mjs → chunk-install-pkg.6c6dc0c2.mjs} +11 -10
- package/dist/chunk-integrations-globals.56a11010.mjs +26 -0
- package/dist/{chunk-utils-global.0a7416cf.mjs → chunk-mock-date.9160e13b.mjs} +16 -41
- package/dist/chunk-node-git.43dbdd42.mjs +1139 -0
- package/dist/chunk-runtime-chain.b6c2cdbc.mjs +2041 -0
- package/dist/chunk-runtime-error.0aa0dc06.mjs +648 -0
- package/dist/{chunk-runtime-chain.b60d57da.mjs → chunk-runtime-hooks.3ee34848.mjs} +14 -2014
- package/dist/{chunk-runtime-mocker.1d853e3a.mjs → chunk-runtime-mocker.0a8f7c5e.mjs} +23 -17
- package/dist/{chunk-runtime-rpc.9d1f4c48.mjs → chunk-runtime-rpc.dbf0b31d.mjs} +3 -1
- package/dist/chunk-utils-global.fa20c2f6.mjs +5 -0
- package/dist/{chunk-utils-source-map.c03f8bc4.mjs → chunk-utils-source-map.8198ebd9.mjs} +2 -2
- package/dist/chunk-utils-timers.b48455ed.mjs +27 -0
- package/dist/chunk-vite-node-client.a247c2c2.mjs +320 -0
- package/dist/chunk-vite-node-debug.c5887932.mjs +76 -0
- package/dist/{chunk-vite-node-externalize.6956d2d9.mjs → chunk-vite-node-externalize.2e90dadf.mjs} +165 -1182
- package/dist/{chunk-vite-node-utils.8077cd3c.mjs → chunk-vite-node-utils.9dfd1e3f.mjs} +4 -312
- package/dist/cli.mjs +10 -10
- package/dist/config.cjs +6 -3
- package/dist/config.d.ts +2 -0
- package/dist/config.mjs +6 -3
- package/dist/entry.mjs +17 -598
- package/dist/index.d.ts +81 -6
- package/dist/index.mjs +10 -5
- package/dist/loader.mjs +35 -0
- package/dist/node.d.ts +71 -4
- package/dist/node.mjs +13 -12
- package/dist/suite.mjs +15 -0
- package/dist/vendor-index.61438b77.mjs +335 -0
- package/dist/{vendor-index.4bf9c627.mjs → vendor-index.62ce5c33.mjs} +11 -343
- package/dist/worker.mjs +9 -6
- package/package.json +12 -4
- package/dist/chunk-integrations-globals.00b6e1ad.mjs +0 -23
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
2
|
+
import assert$1 from 'assert';
|
|
3
|
+
import require$$2 from 'events';
|
|
4
|
+
|
|
5
|
+
var onetime$1 = {exports: {}};
|
|
6
|
+
|
|
7
|
+
var mimicFn$2 = {exports: {}};
|
|
8
|
+
|
|
9
|
+
const mimicFn$1 = (to, from) => {
|
|
10
|
+
for (const prop of Reflect.ownKeys(from)) {
|
|
11
|
+
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
mimicFn$2.exports = mimicFn$1;
|
|
18
|
+
// TODO: Remove this for the next major release
|
|
19
|
+
mimicFn$2.exports.default = mimicFn$1;
|
|
20
|
+
|
|
21
|
+
const mimicFn = mimicFn$2.exports;
|
|
22
|
+
|
|
23
|
+
const calledFunctions = new WeakMap();
|
|
24
|
+
|
|
25
|
+
const onetime = (function_, options = {}) => {
|
|
26
|
+
if (typeof function_ !== 'function') {
|
|
27
|
+
throw new TypeError('Expected a function');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let returnValue;
|
|
31
|
+
let callCount = 0;
|
|
32
|
+
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
33
|
+
|
|
34
|
+
const onetime = function (...arguments_) {
|
|
35
|
+
calledFunctions.set(onetime, ++callCount);
|
|
36
|
+
|
|
37
|
+
if (callCount === 1) {
|
|
38
|
+
returnValue = function_.apply(this, arguments_);
|
|
39
|
+
function_ = null;
|
|
40
|
+
} else if (options.throw === true) {
|
|
41
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return returnValue;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
mimicFn(onetime, function_);
|
|
48
|
+
calledFunctions.set(onetime, callCount);
|
|
49
|
+
|
|
50
|
+
return onetime;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
onetime$1.exports = onetime;
|
|
54
|
+
// TODO: Remove this for the next major release
|
|
55
|
+
onetime$1.exports.default = onetime;
|
|
56
|
+
|
|
57
|
+
onetime$1.exports.callCount = function_ => {
|
|
58
|
+
if (!calledFunctions.has(function_)) {
|
|
59
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return calledFunctions.get(function_);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var signalExit = {exports: {}};
|
|
66
|
+
|
|
67
|
+
var signals$1 = {exports: {}};
|
|
68
|
+
|
|
69
|
+
var hasRequiredSignals;
|
|
70
|
+
|
|
71
|
+
function requireSignals () {
|
|
72
|
+
if (hasRequiredSignals) return signals$1.exports;
|
|
73
|
+
hasRequiredSignals = 1;
|
|
74
|
+
(function (module) {
|
|
75
|
+
// This is not the set of all possible signals.
|
|
76
|
+
//
|
|
77
|
+
// It IS, however, the set of all signals that trigger
|
|
78
|
+
// an exit on either Linux or BSD systems. Linux is a
|
|
79
|
+
// superset of the signal names supported on BSD, and
|
|
80
|
+
// the unknown signals just fail to register, so we can
|
|
81
|
+
// catch that easily enough.
|
|
82
|
+
//
|
|
83
|
+
// Don't bother with SIGKILL. It's uncatchable, which
|
|
84
|
+
// means that we can't fire any callbacks anyway.
|
|
85
|
+
//
|
|
86
|
+
// If a user does happen to register a handler on a non-
|
|
87
|
+
// fatal signal like SIGWINCH or something, and then
|
|
88
|
+
// exit, it'll end up firing `process.emit('exit')`, so
|
|
89
|
+
// the handler will be fired anyway.
|
|
90
|
+
//
|
|
91
|
+
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
92
|
+
// artificially, inherently leave the process in a
|
|
93
|
+
// state from which it is not safe to try and enter JS
|
|
94
|
+
// listeners.
|
|
95
|
+
module.exports = [
|
|
96
|
+
'SIGABRT',
|
|
97
|
+
'SIGALRM',
|
|
98
|
+
'SIGHUP',
|
|
99
|
+
'SIGINT',
|
|
100
|
+
'SIGTERM'
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
if (process.platform !== 'win32') {
|
|
104
|
+
module.exports.push(
|
|
105
|
+
'SIGVTALRM',
|
|
106
|
+
'SIGXCPU',
|
|
107
|
+
'SIGXFSZ',
|
|
108
|
+
'SIGUSR2',
|
|
109
|
+
'SIGTRAP',
|
|
110
|
+
'SIGSYS',
|
|
111
|
+
'SIGQUIT',
|
|
112
|
+
'SIGIOT'
|
|
113
|
+
// should detect profiler and enable/disable accordingly.
|
|
114
|
+
// see #21
|
|
115
|
+
// 'SIGPROF'
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (process.platform === 'linux') {
|
|
120
|
+
module.exports.push(
|
|
121
|
+
'SIGIO',
|
|
122
|
+
'SIGPOLL',
|
|
123
|
+
'SIGPWR',
|
|
124
|
+
'SIGSTKFLT',
|
|
125
|
+
'SIGUNUSED'
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
} (signals$1));
|
|
129
|
+
return signals$1.exports;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Note: since nyc uses this module to output coverage, any lines
|
|
133
|
+
// that are in the direct sync flow of nyc's outputCoverage are
|
|
134
|
+
// ignored, since we can never get coverage for them.
|
|
135
|
+
// grab a reference to node's real process object right away
|
|
136
|
+
var process$1 = commonjsGlobal.process;
|
|
137
|
+
|
|
138
|
+
const processOk = function (process) {
|
|
139
|
+
return process &&
|
|
140
|
+
typeof process === 'object' &&
|
|
141
|
+
typeof process.removeListener === 'function' &&
|
|
142
|
+
typeof process.emit === 'function' &&
|
|
143
|
+
typeof process.reallyExit === 'function' &&
|
|
144
|
+
typeof process.listeners === 'function' &&
|
|
145
|
+
typeof process.kill === 'function' &&
|
|
146
|
+
typeof process.pid === 'number' &&
|
|
147
|
+
typeof process.on === 'function'
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// some kind of non-node environment, just no-op
|
|
151
|
+
/* istanbul ignore if */
|
|
152
|
+
if (!processOk(process$1)) {
|
|
153
|
+
signalExit.exports = function () {
|
|
154
|
+
return function () {}
|
|
155
|
+
};
|
|
156
|
+
} else {
|
|
157
|
+
var assert = assert$1;
|
|
158
|
+
var signals = requireSignals();
|
|
159
|
+
var isWin = /^win/i.test(process$1.platform);
|
|
160
|
+
|
|
161
|
+
var EE = require$$2;
|
|
162
|
+
/* istanbul ignore if */
|
|
163
|
+
if (typeof EE !== 'function') {
|
|
164
|
+
EE = EE.EventEmitter;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var emitter;
|
|
168
|
+
if (process$1.__signal_exit_emitter__) {
|
|
169
|
+
emitter = process$1.__signal_exit_emitter__;
|
|
170
|
+
} else {
|
|
171
|
+
emitter = process$1.__signal_exit_emitter__ = new EE();
|
|
172
|
+
emitter.count = 0;
|
|
173
|
+
emitter.emitted = {};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Because this emitter is a global, we have to check to see if a
|
|
177
|
+
// previous version of this library failed to enable infinite listeners.
|
|
178
|
+
// I know what you're about to say. But literally everything about
|
|
179
|
+
// signal-exit is a compromise with evil. Get used to it.
|
|
180
|
+
if (!emitter.infinite) {
|
|
181
|
+
emitter.setMaxListeners(Infinity);
|
|
182
|
+
emitter.infinite = true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
signalExit.exports = function (cb, opts) {
|
|
186
|
+
/* istanbul ignore if */
|
|
187
|
+
if (!processOk(commonjsGlobal.process)) {
|
|
188
|
+
return function () {}
|
|
189
|
+
}
|
|
190
|
+
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
|
|
191
|
+
|
|
192
|
+
if (loaded === false) {
|
|
193
|
+
load();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
var ev = 'exit';
|
|
197
|
+
if (opts && opts.alwaysLast) {
|
|
198
|
+
ev = 'afterexit';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var remove = function () {
|
|
202
|
+
emitter.removeListener(ev, cb);
|
|
203
|
+
if (emitter.listeners('exit').length === 0 &&
|
|
204
|
+
emitter.listeners('afterexit').length === 0) {
|
|
205
|
+
unload();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
emitter.on(ev, cb);
|
|
209
|
+
|
|
210
|
+
return remove
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
var unload = function unload () {
|
|
214
|
+
if (!loaded || !processOk(commonjsGlobal.process)) {
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
loaded = false;
|
|
218
|
+
|
|
219
|
+
signals.forEach(function (sig) {
|
|
220
|
+
try {
|
|
221
|
+
process$1.removeListener(sig, sigListeners[sig]);
|
|
222
|
+
} catch (er) {}
|
|
223
|
+
});
|
|
224
|
+
process$1.emit = originalProcessEmit;
|
|
225
|
+
process$1.reallyExit = originalProcessReallyExit;
|
|
226
|
+
emitter.count -= 1;
|
|
227
|
+
};
|
|
228
|
+
signalExit.exports.unload = unload;
|
|
229
|
+
|
|
230
|
+
var emit = function emit (event, code, signal) {
|
|
231
|
+
/* istanbul ignore if */
|
|
232
|
+
if (emitter.emitted[event]) {
|
|
233
|
+
return
|
|
234
|
+
}
|
|
235
|
+
emitter.emitted[event] = true;
|
|
236
|
+
emitter.emit(event, code, signal);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// { <signal>: <listener fn>, ... }
|
|
240
|
+
var sigListeners = {};
|
|
241
|
+
signals.forEach(function (sig) {
|
|
242
|
+
sigListeners[sig] = function listener () {
|
|
243
|
+
/* istanbul ignore if */
|
|
244
|
+
if (!processOk(commonjsGlobal.process)) {
|
|
245
|
+
return
|
|
246
|
+
}
|
|
247
|
+
// If there are no other listeners, an exit is coming!
|
|
248
|
+
// Simplest way: remove us and then re-send the signal.
|
|
249
|
+
// We know that this will kill the process, so we can
|
|
250
|
+
// safely emit now.
|
|
251
|
+
var listeners = process$1.listeners(sig);
|
|
252
|
+
if (listeners.length === emitter.count) {
|
|
253
|
+
unload();
|
|
254
|
+
emit('exit', null, sig);
|
|
255
|
+
/* istanbul ignore next */
|
|
256
|
+
emit('afterexit', null, sig);
|
|
257
|
+
/* istanbul ignore next */
|
|
258
|
+
if (isWin && sig === 'SIGHUP') {
|
|
259
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
260
|
+
// so use a supported signal instead
|
|
261
|
+
sig = 'SIGINT';
|
|
262
|
+
}
|
|
263
|
+
/* istanbul ignore next */
|
|
264
|
+
process$1.kill(process$1.pid, sig);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
signalExit.exports.signals = function () {
|
|
270
|
+
return signals
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
var loaded = false;
|
|
274
|
+
|
|
275
|
+
var load = function load () {
|
|
276
|
+
if (loaded || !processOk(commonjsGlobal.process)) {
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
loaded = true;
|
|
280
|
+
|
|
281
|
+
// This is the number of onSignalExit's that are in play.
|
|
282
|
+
// It's important so that we can count the correct number of
|
|
283
|
+
// listeners on signals, and don't wait for the other one to
|
|
284
|
+
// handle it instead of us.
|
|
285
|
+
emitter.count += 1;
|
|
286
|
+
|
|
287
|
+
signals = signals.filter(function (sig) {
|
|
288
|
+
try {
|
|
289
|
+
process$1.on(sig, sigListeners[sig]);
|
|
290
|
+
return true
|
|
291
|
+
} catch (er) {
|
|
292
|
+
return false
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
process$1.emit = processEmit;
|
|
297
|
+
process$1.reallyExit = processReallyExit;
|
|
298
|
+
};
|
|
299
|
+
signalExit.exports.load = load;
|
|
300
|
+
|
|
301
|
+
var originalProcessReallyExit = process$1.reallyExit;
|
|
302
|
+
var processReallyExit = function processReallyExit (code) {
|
|
303
|
+
/* istanbul ignore if */
|
|
304
|
+
if (!processOk(commonjsGlobal.process)) {
|
|
305
|
+
return
|
|
306
|
+
}
|
|
307
|
+
process$1.exitCode = code || /* istanbul ignore next */ 0;
|
|
308
|
+
emit('exit', process$1.exitCode, null);
|
|
309
|
+
/* istanbul ignore next */
|
|
310
|
+
emit('afterexit', process$1.exitCode, null);
|
|
311
|
+
/* istanbul ignore next */
|
|
312
|
+
originalProcessReallyExit.call(process$1, process$1.exitCode);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
var originalProcessEmit = process$1.emit;
|
|
316
|
+
var processEmit = function processEmit (ev, arg) {
|
|
317
|
+
if (ev === 'exit' && processOk(commonjsGlobal.process)) {
|
|
318
|
+
/* istanbul ignore else */
|
|
319
|
+
if (arg !== undefined) {
|
|
320
|
+
process$1.exitCode = arg;
|
|
321
|
+
}
|
|
322
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
323
|
+
/* istanbul ignore next */
|
|
324
|
+
emit('exit', process$1.exitCode, null);
|
|
325
|
+
/* istanbul ignore next */
|
|
326
|
+
emit('afterexit', process$1.exitCode, null);
|
|
327
|
+
/* istanbul ignore next */
|
|
328
|
+
return ret
|
|
329
|
+
} else {
|
|
330
|
+
return originalProcessEmit.apply(this, arguments)
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export { onetime$1 as o, signalExit as s };
|