vitest 0.26.3 → 0.27.1
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 +15 -66
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +15 -15
- package/dist/{chunk-api-setup.47a09f0f.js → chunk-api-setup.2be3cc38.js} +60 -31
- package/dist/{chunk-install-pkg.6dd2bae6.js → chunk-install-pkg.7b006b3e.js} +8 -8
- package/dist/{chunk-integrations-coverage.befed097.js → chunk-integrations-coverage.44413252.js} +19 -1
- package/dist/chunk-integrations-globals.02f1259c.js +27 -0
- package/dist/{chunk-typecheck-constants.06e1fe5b.js → chunk-mock-date.149ed990.js} +19 -32
- package/dist/{chunk-node-git.a90c0582.js → chunk-node-git.125c9008.js} +3 -4
- package/dist/{chunk-runtime-chain.f51aa930.js → chunk-runtime-chain.4e2aa823.js} +1193 -1029
- package/dist/{chunk-runtime-error.f5c8aaf2.js → chunk-runtime-error.97854396.js} +2 -2
- package/dist/{chunk-runtime-mocker.887bf8c8.js → chunk-runtime-mocker.4755840f.js} +10 -8
- package/dist/{chunk-runtime-rpc.54d72169.js → chunk-runtime-rpc.25cc9413.js} +2 -2
- package/dist/{chunk-runtime-setup.a06d5c72.js → chunk-runtime-setup.56d71d30.js} +51 -52
- package/dist/{chunk-snapshot-manager.70695b70.js → chunk-snapshot-manager.1a2dbf96.js} +468 -302
- package/dist/{chunk-utils-env.3fdc1793.js → chunk-utils-env.f4a39d2c.js} +8 -70
- package/dist/{chunk-utils-import.e7f64637.js → chunk-utils-import.16d9fb0d.js} +22 -8
- package/dist/chunk-utils-source-map.4e9b891d.js +408 -0
- package/dist/{chunk-utils-timers.715da787.js → chunk-utils-timers.52534f96.js} +2977 -3458
- package/dist/cli-wrapper.js +15 -15
- package/dist/cli.js +15 -627
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -1
- package/dist/entry.js +14 -14
- package/dist/environments.d.ts +1 -1
- package/dist/{index-761e769b.d.ts → index-1cfc7f58.d.ts} +4 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -12
- package/dist/loader.js +9 -10
- package/dist/node.d.ts +2 -2
- package/dist/node.js +14 -12
- package/dist/spy.js +2 -102
- package/dist/suite.js +10 -10
- package/dist/{types-bae746aa.d.ts → types-5617096e.d.ts} +97 -77
- package/dist/{vendor-index.b2fdde54.js → vendor-index.451e37bc.js} +1 -1
- package/dist/vendor-index.723a074f.js +102 -0
- package/dist/vendor-index.b0346fe4.js +395 -0
- package/dist/{vendor-index.7a2cebfe.js → vendor-index.e6c27006.js} +12 -12
- package/dist/worker.js +24 -19
- package/package.json +13 -8
- package/dist/chunk-integrations-globals.ee28730b.js +0 -27
- package/dist/chunk-utils-source-map.5278ee22.js +0 -86
- package/dist/vendor-index.2e96c50b.js +0 -215
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import 'acorn';
|
|
2
|
+
import { builtinModules } from 'node:module';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import assert from 'node:assert';
|
|
6
|
+
import process$1 from 'node:process';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import v8 from 'node:v8';
|
|
9
|
+
import { format, inspect } from 'node:util';
|
|
10
|
+
|
|
11
|
+
const BUILTIN_MODULES = new Set(builtinModules);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef ErrnoExceptionFields
|
|
15
|
+
* @property {number | undefined} [errnode]
|
|
16
|
+
* @property {string | undefined} [code]
|
|
17
|
+
* @property {string | undefined} [path]
|
|
18
|
+
* @property {string | undefined} [syscall]
|
|
19
|
+
* @property {string | undefined} [url]
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Error & ErrnoExceptionFields} ErrnoException
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const isWindows = process$1.platform === 'win32';
|
|
25
|
+
|
|
26
|
+
const own$1 = {}.hasOwnProperty;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
|
|
30
|
+
* We cannot use Intl.ListFormat because it's not available in
|
|
31
|
+
* --without-intl builds.
|
|
32
|
+
*
|
|
33
|
+
* @param {Array<string>} array
|
|
34
|
+
* An array of strings.
|
|
35
|
+
* @param {string} [type]
|
|
36
|
+
* The list type to be inserted before the last element.
|
|
37
|
+
* @returns {string}
|
|
38
|
+
*/
|
|
39
|
+
function formatList(array, type = 'and') {
|
|
40
|
+
return array.length < 3
|
|
41
|
+
? array.join(` ${type} `)
|
|
42
|
+
: `${array.slice(0, -1).join(', ')}, ${type} ${array[array.length - 1]}`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @type {Map<string, MessageFunction|string>} */
|
|
46
|
+
const messages = new Map();
|
|
47
|
+
const nodeInternalPrefix = '__node_internal_';
|
|
48
|
+
/** @type {number} */
|
|
49
|
+
let userStackTraceLimit;
|
|
50
|
+
|
|
51
|
+
createError(
|
|
52
|
+
'ERR_INVALID_MODULE_SPECIFIER',
|
|
53
|
+
/**
|
|
54
|
+
* @param {string} request
|
|
55
|
+
* @param {string} reason
|
|
56
|
+
* @param {string} [base]
|
|
57
|
+
*/
|
|
58
|
+
(request, reason, base = undefined) => {
|
|
59
|
+
return `Invalid module "${request}" ${reason}${
|
|
60
|
+
base ? ` imported from ${base}` : ''
|
|
61
|
+
}`
|
|
62
|
+
},
|
|
63
|
+
TypeError
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
createError(
|
|
67
|
+
'ERR_INVALID_PACKAGE_CONFIG',
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} path
|
|
70
|
+
* @param {string} [base]
|
|
71
|
+
* @param {string} [message]
|
|
72
|
+
*/
|
|
73
|
+
(path, base, message) => {
|
|
74
|
+
return `Invalid package config ${path}${
|
|
75
|
+
base ? ` while importing ${base}` : ''
|
|
76
|
+
}${message ? `. ${message}` : ''}`
|
|
77
|
+
},
|
|
78
|
+
Error
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
createError(
|
|
82
|
+
'ERR_INVALID_PACKAGE_TARGET',
|
|
83
|
+
/**
|
|
84
|
+
* @param {string} pkgPath
|
|
85
|
+
* @param {string} key
|
|
86
|
+
* @param {unknown} target
|
|
87
|
+
* @param {boolean} [isImport=false]
|
|
88
|
+
* @param {string} [base]
|
|
89
|
+
*/
|
|
90
|
+
(pkgPath, key, target, isImport = false, base = undefined) => {
|
|
91
|
+
const relError =
|
|
92
|
+
typeof target === 'string' &&
|
|
93
|
+
!isImport &&
|
|
94
|
+
target.length > 0 &&
|
|
95
|
+
!target.startsWith('./');
|
|
96
|
+
if (key === '.') {
|
|
97
|
+
assert(isImport === false);
|
|
98
|
+
return (
|
|
99
|
+
`Invalid "exports" main target ${JSON.stringify(target)} defined ` +
|
|
100
|
+
`in the package config ${pkgPath}package.json${
|
|
101
|
+
base ? ` imported from ${base}` : ''
|
|
102
|
+
}${relError ? '; targets must start with "./"' : ''}`
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return `Invalid "${
|
|
107
|
+
isImport ? 'imports' : 'exports'
|
|
108
|
+
}" target ${JSON.stringify(
|
|
109
|
+
target
|
|
110
|
+
)} defined for '${key}' in the package config ${pkgPath}package.json${
|
|
111
|
+
base ? ` imported from ${base}` : ''
|
|
112
|
+
}${relError ? '; targets must start with "./"' : ''}`
|
|
113
|
+
},
|
|
114
|
+
Error
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
createError(
|
|
118
|
+
'ERR_MODULE_NOT_FOUND',
|
|
119
|
+
/**
|
|
120
|
+
* @param {string} path
|
|
121
|
+
* @param {string} base
|
|
122
|
+
* @param {string} [type]
|
|
123
|
+
*/
|
|
124
|
+
(path, base, type = 'package') => {
|
|
125
|
+
return `Cannot find ${type} '${path}' imported from ${base}`
|
|
126
|
+
},
|
|
127
|
+
Error
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
createError(
|
|
131
|
+
'ERR_NETWORK_IMPORT_DISALLOWED',
|
|
132
|
+
"import of '%s' by %s is not supported: %s",
|
|
133
|
+
Error
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
createError(
|
|
137
|
+
'ERR_PACKAGE_IMPORT_NOT_DEFINED',
|
|
138
|
+
/**
|
|
139
|
+
* @param {string} specifier
|
|
140
|
+
* @param {string} packagePath
|
|
141
|
+
* @param {string} base
|
|
142
|
+
*/
|
|
143
|
+
(specifier, packagePath, base) => {
|
|
144
|
+
return `Package import specifier "${specifier}" is not defined${
|
|
145
|
+
packagePath ? ` in package ${packagePath}package.json` : ''
|
|
146
|
+
} imported from ${base}`
|
|
147
|
+
},
|
|
148
|
+
TypeError
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
createError(
|
|
152
|
+
'ERR_PACKAGE_PATH_NOT_EXPORTED',
|
|
153
|
+
/**
|
|
154
|
+
* @param {string} pkgPath
|
|
155
|
+
* @param {string} subpath
|
|
156
|
+
* @param {string} [base]
|
|
157
|
+
*/
|
|
158
|
+
(pkgPath, subpath, base = undefined) => {
|
|
159
|
+
if (subpath === '.')
|
|
160
|
+
return `No "exports" main defined in ${pkgPath}package.json${
|
|
161
|
+
base ? ` imported from ${base}` : ''
|
|
162
|
+
}`
|
|
163
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${
|
|
164
|
+
base ? ` imported from ${base}` : ''
|
|
165
|
+
}`
|
|
166
|
+
},
|
|
167
|
+
Error
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
createError(
|
|
171
|
+
'ERR_UNSUPPORTED_DIR_IMPORT',
|
|
172
|
+
"Directory import '%s' is not supported " +
|
|
173
|
+
'resolving ES modules imported from %s',
|
|
174
|
+
Error
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
createError(
|
|
178
|
+
'ERR_UNKNOWN_FILE_EXTENSION',
|
|
179
|
+
/**
|
|
180
|
+
* @param {string} ext
|
|
181
|
+
* @param {string} path
|
|
182
|
+
*/
|
|
183
|
+
(ext, path) => {
|
|
184
|
+
return `Unknown file extension "${ext}" for ${path}`
|
|
185
|
+
},
|
|
186
|
+
TypeError
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
createError(
|
|
190
|
+
'ERR_INVALID_ARG_VALUE',
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} name
|
|
193
|
+
* @param {unknown} value
|
|
194
|
+
* @param {string} [reason='is invalid']
|
|
195
|
+
*/
|
|
196
|
+
(name, value, reason = 'is invalid') => {
|
|
197
|
+
let inspected = inspect(value);
|
|
198
|
+
|
|
199
|
+
if (inspected.length > 128) {
|
|
200
|
+
inspected = `${inspected.slice(0, 128)}...`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const type = name.includes('.') ? 'property' : 'argument';
|
|
204
|
+
|
|
205
|
+
return `The ${type} '${name}' ${reason}. Received ${inspected}`
|
|
206
|
+
},
|
|
207
|
+
TypeError
|
|
208
|
+
// Note: extra classes have been shaken out.
|
|
209
|
+
// , RangeError
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
createError(
|
|
213
|
+
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
|
|
214
|
+
/**
|
|
215
|
+
* @param {URL} url
|
|
216
|
+
* @param {Array<string>} supported
|
|
217
|
+
*/
|
|
218
|
+
(url, supported) => {
|
|
219
|
+
let message = `Only URLs with a scheme in: ${formatList(
|
|
220
|
+
supported
|
|
221
|
+
)} are supported by the default ESM loader`;
|
|
222
|
+
|
|
223
|
+
if (isWindows && url.protocol.length === 2) {
|
|
224
|
+
message += '. On Windows, absolute paths must be valid file:// URLs';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
message += `. Received protocol '${url.protocol}'`;
|
|
228
|
+
return message
|
|
229
|
+
},
|
|
230
|
+
Error
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Utility function for registering the error codes. Only used here. Exported
|
|
235
|
+
* *only* to allow for testing.
|
|
236
|
+
* @param {string} sym
|
|
237
|
+
* @param {MessageFunction|string} value
|
|
238
|
+
* @param {ErrorConstructor} def
|
|
239
|
+
* @returns {new (...args: Array<any>) => Error}
|
|
240
|
+
*/
|
|
241
|
+
function createError(sym, value, def) {
|
|
242
|
+
// Special case for SystemError that formats the error message differently
|
|
243
|
+
// The SystemErrors only have SystemError as their base classes.
|
|
244
|
+
messages.set(sym, value);
|
|
245
|
+
|
|
246
|
+
return makeNodeErrorWithCode(def, sym)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @param {ErrorConstructor} Base
|
|
251
|
+
* @param {string} key
|
|
252
|
+
* @returns {ErrorConstructor}
|
|
253
|
+
*/
|
|
254
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
255
|
+
// @ts-expect-error It’s a Node error.
|
|
256
|
+
return NodeError
|
|
257
|
+
/**
|
|
258
|
+
* @param {Array<unknown>} args
|
|
259
|
+
*/
|
|
260
|
+
function NodeError(...args) {
|
|
261
|
+
const limit = Error.stackTraceLimit;
|
|
262
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
|
|
263
|
+
const error = new Base();
|
|
264
|
+
// Reset the limit and setting the name property.
|
|
265
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
|
|
266
|
+
const message = getMessage(key, args, error);
|
|
267
|
+
Object.defineProperties(error, {
|
|
268
|
+
// Note: no need to implement `kIsNodeError` symbol, would be hard,
|
|
269
|
+
// probably.
|
|
270
|
+
message: {
|
|
271
|
+
value: message,
|
|
272
|
+
enumerable: false,
|
|
273
|
+
writable: true,
|
|
274
|
+
configurable: true
|
|
275
|
+
},
|
|
276
|
+
toString: {
|
|
277
|
+
/** @this {Error} */
|
|
278
|
+
value() {
|
|
279
|
+
return `${this.name} [${key}]: ${this.message}`
|
|
280
|
+
},
|
|
281
|
+
enumerable: false,
|
|
282
|
+
writable: true,
|
|
283
|
+
configurable: true
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
captureLargerStackTrace(error);
|
|
288
|
+
// @ts-expect-error It’s a Node error.
|
|
289
|
+
error.code = key;
|
|
290
|
+
return error
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @returns {boolean}
|
|
296
|
+
*/
|
|
297
|
+
function isErrorStackTraceLimitWritable() {
|
|
298
|
+
// Do no touch Error.stackTraceLimit as V8 would attempt to install
|
|
299
|
+
// it again during deserialization.
|
|
300
|
+
try {
|
|
301
|
+
// @ts-expect-error: not in types?
|
|
302
|
+
if (v8.startupSnapshot.isBuildingSnapshot()) {
|
|
303
|
+
return false
|
|
304
|
+
}
|
|
305
|
+
} catch {}
|
|
306
|
+
|
|
307
|
+
const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');
|
|
308
|
+
if (desc === undefined) {
|
|
309
|
+
return Object.isExtensible(Error)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return own$1.call(desc, 'writable') && desc.writable !== undefined
|
|
313
|
+
? desc.writable
|
|
314
|
+
: desc.set !== undefined
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* This function removes unnecessary frames from Node.js core errors.
|
|
319
|
+
* @template {(...args: unknown[]) => unknown} T
|
|
320
|
+
* @param {T} fn
|
|
321
|
+
* @returns {T}
|
|
322
|
+
*/
|
|
323
|
+
function hideStackFrames(fn) {
|
|
324
|
+
// We rename the functions that will be hidden to cut off the stacktrace
|
|
325
|
+
// at the outermost one
|
|
326
|
+
const hidden = nodeInternalPrefix + fn.name;
|
|
327
|
+
Object.defineProperty(fn, 'name', {value: hidden});
|
|
328
|
+
return fn
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const captureLargerStackTrace = hideStackFrames(
|
|
332
|
+
/**
|
|
333
|
+
* @param {Error} error
|
|
334
|
+
* @returns {Error}
|
|
335
|
+
*/
|
|
336
|
+
// @ts-expect-error: fine
|
|
337
|
+
function (error) {
|
|
338
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
339
|
+
if (stackTraceLimitIsWritable) {
|
|
340
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
341
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
Error.captureStackTrace(error);
|
|
345
|
+
|
|
346
|
+
// Reset the limit
|
|
347
|
+
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
|
348
|
+
|
|
349
|
+
return error
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* @param {string} key
|
|
355
|
+
* @param {Array<unknown>} args
|
|
356
|
+
* @param {Error} self
|
|
357
|
+
* @returns {string}
|
|
358
|
+
*/
|
|
359
|
+
function getMessage(key, args, self) {
|
|
360
|
+
const message = messages.get(key);
|
|
361
|
+
assert(typeof message !== 'undefined', 'expected `message` to be found');
|
|
362
|
+
|
|
363
|
+
if (typeof message === 'function') {
|
|
364
|
+
assert(
|
|
365
|
+
message.length <= args.length, // Default options do not count.
|
|
366
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not ` +
|
|
367
|
+
`match the required ones (${message.length}).`
|
|
368
|
+
);
|
|
369
|
+
return Reflect.apply(message, self, args)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const regex = /%[dfijoOs]/g;
|
|
373
|
+
let expectedLength = 0;
|
|
374
|
+
while (regex.exec(message) !== null) expectedLength++;
|
|
375
|
+
assert(
|
|
376
|
+
expectedLength === args.length,
|
|
377
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not ` +
|
|
378
|
+
`match the required ones (${expectedLength}).`
|
|
379
|
+
);
|
|
380
|
+
if (args.length === 0) return message
|
|
381
|
+
|
|
382
|
+
args.unshift(message);
|
|
383
|
+
return Reflect.apply(format, null, args)
|
|
384
|
+
}
|
|
385
|
+
function isNodeBuiltin(id = "") {
|
|
386
|
+
id = id.replace(/^node:/, "").split("/")[0];
|
|
387
|
+
return BUILTIN_MODULES.has(id);
|
|
388
|
+
}
|
|
389
|
+
pathToFileURL(process.cwd());
|
|
390
|
+
const CJS_RE = /([\s;]|^)(module.exports\b|exports\.\w|require\s*\(|global\.\w)/m;
|
|
391
|
+
function hasCJSSyntax(code) {
|
|
392
|
+
return CJS_RE.test(code);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export { hasCJSSyntax as h, isNodeBuiltin as i };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import require$$0$1 from 'child_process';
|
|
2
|
-
import
|
|
2
|
+
import k from 'path';
|
|
3
3
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
4
4
|
import require$$0 from 'fs';
|
|
5
|
-
import
|
|
5
|
+
import require$$0$2 from 'assert';
|
|
6
6
|
import require$$2 from 'events';
|
|
7
|
-
import require$$0$
|
|
8
|
-
import require$$0$
|
|
7
|
+
import require$$0$4 from 'buffer';
|
|
8
|
+
import require$$0$3 from 'stream';
|
|
9
9
|
import util from 'util';
|
|
10
10
|
|
|
11
11
|
var crossSpawn = {exports: {}};
|
|
@@ -172,7 +172,7 @@ const isWindows = process.platform === 'win32' ||
|
|
|
172
172
|
process.env.OSTYPE === 'cygwin' ||
|
|
173
173
|
process.env.OSTYPE === 'msys';
|
|
174
174
|
|
|
175
|
-
const path$2 =
|
|
175
|
+
const path$2 = k;
|
|
176
176
|
const COLON = isWindows ? ';' : ':';
|
|
177
177
|
const isexe = isexe_1;
|
|
178
178
|
|
|
@@ -311,7 +311,7 @@ pathKey$1.exports = pathKey;
|
|
|
311
311
|
// TODO: Remove this for the next major release
|
|
312
312
|
pathKey$1.exports.default = pathKey;
|
|
313
313
|
|
|
314
|
-
const path$1 =
|
|
314
|
+
const path$1 = k;
|
|
315
315
|
const which = which_1;
|
|
316
316
|
const getPathKey = pathKey$1.exports;
|
|
317
317
|
|
|
@@ -451,7 +451,7 @@ function readShebang$1(command) {
|
|
|
451
451
|
|
|
452
452
|
var readShebang_1 = readShebang$1;
|
|
453
453
|
|
|
454
|
-
const path =
|
|
454
|
+
const path = k;
|
|
455
455
|
const resolveCommand = resolveCommand_1;
|
|
456
456
|
const escape = _escape;
|
|
457
457
|
const readShebang = readShebang_1;
|
|
@@ -729,7 +729,7 @@ if (!processOk(process$1)) {
|
|
|
729
729
|
return function () {}
|
|
730
730
|
};
|
|
731
731
|
} else {
|
|
732
|
-
var assert =
|
|
732
|
+
var assert = require$$0$2;
|
|
733
733
|
var signals = requireSignals();
|
|
734
734
|
var isWin = /^win/i.test(process$1.platform);
|
|
735
735
|
|
|
@@ -909,7 +909,7 @@ if (!processOk(process$1)) {
|
|
|
909
909
|
|
|
910
910
|
var getStream$1 = {exports: {}};
|
|
911
911
|
|
|
912
|
-
const {PassThrough: PassThroughStream} = require$$0$
|
|
912
|
+
const {PassThrough: PassThroughStream} = require$$0$3;
|
|
913
913
|
|
|
914
914
|
var bufferStream$1 = options => {
|
|
915
915
|
options = {...options};
|
|
@@ -961,8 +961,8 @@ var bufferStream$1 = options => {
|
|
|
961
961
|
return stream;
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
const {constants: BufferConstants} = require$$0$
|
|
965
|
-
const stream = require$$0$
|
|
964
|
+
const {constants: BufferConstants} = require$$0$4;
|
|
965
|
+
const stream = require$$0$3;
|
|
966
966
|
const {promisify} = util;
|
|
967
967
|
const bufferStream = bufferStream$1;
|
|
968
968
|
|
|
@@ -1022,7 +1022,7 @@ getStream$1.exports.buffer = (stream, options) => getStream(stream, {...options,
|
|
|
1022
1022
|
getStream$1.exports.array = (stream, options) => getStream(stream, {...options, array: true});
|
|
1023
1023
|
getStream$1.exports.MaxBufferError = MaxBufferError;
|
|
1024
1024
|
|
|
1025
|
-
const { PassThrough } = require$$0$
|
|
1025
|
+
const { PassThrough } = require$$0$3;
|
|
1026
1026
|
|
|
1027
1027
|
var mergeStream = function (/*streams...*/) {
|
|
1028
1028
|
var sources = [];
|
package/dist/worker.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { b as resolve,
|
|
1
|
+
import { r as relative, b as resolve, f as distDir } from './chunk-utils-env.f4a39d2c.js';
|
|
2
2
|
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import '
|
|
5
|
+
import { isPrimitive } from 'vite-node/utils';
|
|
6
|
+
import { g as getWorkerState } from './chunk-mock-date.149ed990.js';
|
|
7
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.4755840f.js';
|
|
8
|
+
import { r as rpc } from './chunk-runtime-rpc.25cc9413.js';
|
|
9
|
+
import { p as processError } from './chunk-runtime-error.97854396.js';
|
|
10
10
|
import 'node:url';
|
|
11
11
|
import 'path';
|
|
12
12
|
import 'node:path';
|
|
13
|
+
import 'picocolors';
|
|
13
14
|
import 'local-pkg';
|
|
14
|
-
import 'vite-node/utils';
|
|
15
15
|
import 'vite';
|
|
16
|
-
import './vendor-index.
|
|
16
|
+
import './vendor-index.b0346fe4.js';
|
|
17
17
|
import 'acorn';
|
|
18
18
|
import 'node:module';
|
|
19
19
|
import 'node:fs';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
23
|
-
import '
|
|
20
|
+
import 'node:assert';
|
|
21
|
+
import 'node:process';
|
|
22
|
+
import 'node:v8';
|
|
23
|
+
import 'node:util';
|
|
24
|
+
import './chunk-utils-timers.52534f96.js';
|
|
24
25
|
import 'util';
|
|
25
|
-
import './chunk-utils-timers.715da787.js';
|
|
26
26
|
import 'chai';
|
|
27
27
|
|
|
28
28
|
let _viteNode;
|
|
@@ -31,18 +31,23 @@ const mockMap = /* @__PURE__ */ new Map();
|
|
|
31
31
|
async function startViteNode(ctx) {
|
|
32
32
|
if (_viteNode)
|
|
33
33
|
return _viteNode;
|
|
34
|
+
const { config } = ctx;
|
|
34
35
|
const processExit = process.exit;
|
|
35
|
-
process.on("beforeExit", (code) => {
|
|
36
|
-
rpc().onWorkerExit(code);
|
|
37
|
-
});
|
|
38
36
|
process.exit = (code = process.exitCode || 0) => {
|
|
39
|
-
|
|
37
|
+
const error = new Error(`process.exit called with "${code}"`);
|
|
38
|
+
rpc().onWorkerExit(error, code);
|
|
40
39
|
return processExit(code);
|
|
41
40
|
};
|
|
42
41
|
process.on("unhandledRejection", (err) => {
|
|
43
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
const worker = getWorkerState();
|
|
44
|
+
const error = processError(err);
|
|
45
|
+
if (worker.filepath && !isPrimitive(error)) {
|
|
46
|
+
error.VITEST_TEST_NAME = (_a = worker.current) == null ? void 0 : _a.name;
|
|
47
|
+
error.VITEST_TEST_PATH = relative(config.root, worker.filepath);
|
|
48
|
+
}
|
|
49
|
+
rpc().onUnhandledRejection(error);
|
|
44
50
|
});
|
|
45
|
-
const { config } = ctx;
|
|
46
51
|
const { run: run2 } = (await executeInViteNode({
|
|
47
52
|
files: [
|
|
48
53
|
resolve(distDir, "entry.js")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.27.1",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"test",
|
|
23
23
|
"jest"
|
|
24
24
|
],
|
|
25
|
+
"sideEffects": false,
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
28
|
"require": {
|
|
@@ -105,16 +106,19 @@
|
|
|
105
106
|
"@types/node": "*",
|
|
106
107
|
"acorn": "^8.8.1",
|
|
107
108
|
"acorn-walk": "^8.2.0",
|
|
109
|
+
"cac": "^6.7.14",
|
|
108
110
|
"chai": "^4.3.7",
|
|
109
111
|
"debug": "^4.3.4",
|
|
110
112
|
"local-pkg": "^0.4.2",
|
|
113
|
+
"picocolors": "^1.0.0",
|
|
111
114
|
"source-map": "^0.6.1",
|
|
112
115
|
"strip-literal": "^1.0.0",
|
|
113
116
|
"tinybench": "^2.3.1",
|
|
114
117
|
"tinypool": "^0.3.0",
|
|
115
118
|
"tinyspy": "^1.0.2",
|
|
116
119
|
"vite": "^3.0.0 || ^4.0.0",
|
|
117
|
-
"
|
|
120
|
+
"why-is-node-running": "^2.2.2",
|
|
121
|
+
"vite-node": "0.27.1"
|
|
118
122
|
},
|
|
119
123
|
"devDependencies": {
|
|
120
124
|
"@antfu/install-pkg": "^0.1.1",
|
|
@@ -127,7 +131,6 @@
|
|
|
127
131
|
"@types/prompts": "^2.4.2",
|
|
128
132
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
129
133
|
"birpc": "^0.2.3",
|
|
130
|
-
"cac": "^6.7.14",
|
|
131
134
|
"chai-subset": "^1.6.0",
|
|
132
135
|
"cli-truncate": "^3.1.0",
|
|
133
136
|
"diff": "^5.1.0",
|
|
@@ -137,25 +140,27 @@
|
|
|
137
140
|
"fast-glob": "^3.2.12",
|
|
138
141
|
"find-up": "^6.3.0",
|
|
139
142
|
"flatted": "^3.2.7",
|
|
140
|
-
"get-tsconfig": "^4.
|
|
143
|
+
"get-tsconfig": "^4.3.0",
|
|
141
144
|
"happy-dom": "^7.8.1",
|
|
142
145
|
"jsdom": "^20.0.3",
|
|
143
146
|
"log-update": "^5.0.1",
|
|
144
147
|
"magic-string": "^0.27.0",
|
|
145
148
|
"micromatch": "^4.0.5",
|
|
146
|
-
"mlly": "^1.
|
|
149
|
+
"mlly": "^1.1.0",
|
|
147
150
|
"natural-compare": "^1.4.0",
|
|
148
151
|
"p-limit": "^4.0.0",
|
|
149
152
|
"pathe": "^0.2.0",
|
|
150
|
-
"picocolors": "^1.0.0",
|
|
151
153
|
"pkg-types": "^1.0.1",
|
|
152
154
|
"pretty-format": "^27.5.1",
|
|
153
155
|
"prompts": "^2.4.2",
|
|
154
156
|
"rollup": "^2.79.1",
|
|
155
157
|
"strip-ansi": "^7.0.1",
|
|
156
158
|
"typescript": "^4.9.4",
|
|
157
|
-
"ws": "^8.
|
|
158
|
-
"@vitest/
|
|
159
|
+
"ws": "^8.12.0",
|
|
160
|
+
"@vitest/expect": "0.27.1",
|
|
161
|
+
"@vitest/ui": "0.27.1",
|
|
162
|
+
"@vitest/utils": "0.27.1",
|
|
163
|
+
"@vitest/spy": "0.27.1"
|
|
159
164
|
},
|
|
160
165
|
"scripts": {
|
|
161
166
|
"build": "rimraf dist && rollup -c",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { m as globalApis } from './chunk-utils-env.3fdc1793.js';
|
|
2
|
-
import { i as index } from './chunk-utils-import.e7f64637.js';
|
|
3
|
-
import 'tty';
|
|
4
|
-
import 'node:url';
|
|
5
|
-
import 'path';
|
|
6
|
-
import './chunk-runtime-chain.f51aa930.js';
|
|
7
|
-
import 'util';
|
|
8
|
-
import 'chai';
|
|
9
|
-
import './chunk-typecheck-constants.06e1fe5b.js';
|
|
10
|
-
import 'node:path';
|
|
11
|
-
import 'local-pkg';
|
|
12
|
-
import './vendor-_commonjsHelpers.addc3445.js';
|
|
13
|
-
import './chunk-runtime-rpc.54d72169.js';
|
|
14
|
-
import './chunk-utils-timers.715da787.js';
|
|
15
|
-
import 'node:fs';
|
|
16
|
-
import './chunk-utils-source-map.5278ee22.js';
|
|
17
|
-
import 'fs';
|
|
18
|
-
import './spy.js';
|
|
19
|
-
import 'tinyspy';
|
|
20
|
-
|
|
21
|
-
function registerApiGlobally() {
|
|
22
|
-
globalApis.forEach((api) => {
|
|
23
|
-
globalThis[api] = index[api];
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { registerApiGlobally };
|