vitest 0.16.0 → 0.18.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/dist/{chunk-api-setup.f43cd039.mjs → chunk-api-setup.63babd7c.mjs} +4 -4
- package/dist/{chunk-constants.7b9cfc82.mjs → chunk-constants.8eb2ed35.mjs} +8 -2
- package/dist/chunk-env-node.26c72624.mjs +675 -0
- package/dist/{chunk-install-pkg.3fa50769.mjs → chunk-install-pkg.2dcb2c04.mjs} +1 -1
- package/dist/{chunk-integrations-globals.d0c363a6.mjs → chunk-integrations-globals.61e4d6ae.mjs} +8 -8
- package/dist/{chunk-runtime-chain.7103058b.mjs → chunk-runtime-chain.eb764dff.mjs} +55 -188
- package/dist/{chunk-runtime-mocker.110e3634.mjs → chunk-runtime-mocker.79ccc3de.mjs} +36 -62
- package/dist/{chunk-runtime-rpc.5e78af38.mjs → chunk-runtime-rpc.cc6a06a2.mjs} +1 -1
- package/dist/{chunk-utils-global.79a8b1cc.mjs → chunk-utils-global.1b22c4fd.mjs} +69 -5
- package/dist/{chunk-utils-source-map.2556cba8.mjs → chunk-utils-source-map.957e7756.mjs} +10 -24
- package/dist/{chunk-vite-node-externalize.58e10976.mjs → chunk-vite-node-externalize.0791f2ed.mjs} +2683 -2553
- package/dist/{chunk-vite-node-utils.7450fc0c.mjs → chunk-vite-node-utils.af8ead96.mjs} +28 -13
- package/dist/cli.mjs +15 -15
- package/dist/config.cjs +5 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/entry.mjs +8 -8
- package/dist/index.d.ts +223 -18
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +236 -38
- package/dist/node.mjs +16 -16
- package/dist/{vendor-entry.efeeaa5c.mjs → vendor-entry.78de67ab.mjs} +18 -424
- package/dist/{vendor-index.e5dc6622.mjs → vendor-index.4bf9c627.mjs} +405 -405
- package/dist/{vendor-index.98e769c1.mjs → vendor-index.de788b6a.mjs} +7 -7
- package/dist/worker.mjs +8 -8
- package/package.json +9 -4
- package/dist/chunk-defaults.dc6dc23d.mjs +0 -302
|
@@ -250,14 +250,63 @@ function getWorkerState() {
|
|
|
250
250
|
return globalThis.__vitest_worker__;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
const RealDate = Date;
|
|
254
|
+
let now = null;
|
|
255
|
+
class MockDate extends RealDate {
|
|
256
|
+
constructor(y, m, d, h, M, s, ms) {
|
|
257
|
+
super();
|
|
258
|
+
let date;
|
|
259
|
+
switch (arguments.length) {
|
|
260
|
+
case 0:
|
|
261
|
+
if (now !== null)
|
|
262
|
+
date = new RealDate(now.valueOf());
|
|
263
|
+
else
|
|
264
|
+
date = new RealDate();
|
|
265
|
+
break;
|
|
266
|
+
case 1:
|
|
267
|
+
date = new RealDate(y);
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
d = typeof d === "undefined" ? 1 : d;
|
|
271
|
+
h = h || 0;
|
|
272
|
+
M = M || 0;
|
|
273
|
+
s = s || 0;
|
|
274
|
+
ms = ms || 0;
|
|
275
|
+
date = new RealDate(y, m, d, h, M, s, ms);
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
return date;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
MockDate.UTC = RealDate.UTC;
|
|
282
|
+
MockDate.now = function() {
|
|
283
|
+
return new MockDate().valueOf();
|
|
284
|
+
};
|
|
285
|
+
MockDate.parse = function(dateString) {
|
|
286
|
+
return RealDate.parse(dateString);
|
|
287
|
+
};
|
|
288
|
+
MockDate.toString = function() {
|
|
289
|
+
return RealDate.toString();
|
|
290
|
+
};
|
|
291
|
+
function mockDate(date) {
|
|
292
|
+
const dateObj = new RealDate(date.valueOf());
|
|
293
|
+
if (isNaN(dateObj.getTime()))
|
|
294
|
+
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
295
|
+
globalThis.Date = MockDate;
|
|
296
|
+
now = dateObj.valueOf();
|
|
297
|
+
}
|
|
298
|
+
function resetDate() {
|
|
299
|
+
globalThis.Date = RealDate;
|
|
300
|
+
}
|
|
301
|
+
|
|
253
302
|
function isFinalObj(obj) {
|
|
254
303
|
return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
|
|
255
304
|
}
|
|
256
305
|
function collectOwnProperties(obj, collector) {
|
|
257
306
|
const props = Object.getOwnPropertyNames(obj);
|
|
258
|
-
const
|
|
307
|
+
const symbols = Object.getOwnPropertySymbols(obj);
|
|
259
308
|
props.forEach((prop) => collector.add(prop));
|
|
260
|
-
|
|
309
|
+
symbols.forEach((symbol) => collector.add(symbol));
|
|
261
310
|
}
|
|
262
311
|
function getAllProperties(obj) {
|
|
263
312
|
const allProps = /* @__PURE__ */ new Set();
|
|
@@ -358,6 +407,21 @@ function assertTypes(value, name, types) {
|
|
|
358
407
|
function stdout() {
|
|
359
408
|
return console._stdout || process.stdout;
|
|
360
409
|
}
|
|
410
|
+
function random(seed) {
|
|
411
|
+
const x = Math.sin(seed++) * 1e4;
|
|
412
|
+
return x - Math.floor(x);
|
|
413
|
+
}
|
|
414
|
+
function shuffle(array, seed = RealDate.now()) {
|
|
415
|
+
let length = array.length;
|
|
416
|
+
while (length) {
|
|
417
|
+
const index = Math.floor(random(seed) * length--);
|
|
418
|
+
const previous = array[length];
|
|
419
|
+
array[length] = array[index];
|
|
420
|
+
array[index] = previous;
|
|
421
|
+
++seed;
|
|
422
|
+
}
|
|
423
|
+
return array;
|
|
424
|
+
}
|
|
361
425
|
|
|
362
426
|
function getTests(suite) {
|
|
363
427
|
return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
|
|
@@ -459,14 +523,14 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
459
523
|
`));
|
|
460
524
|
if (!promptInstall)
|
|
461
525
|
return false;
|
|
462
|
-
const prompts = await import('./vendor-index.
|
|
526
|
+
const prompts = await import('./vendor-index.de788b6a.mjs').then(function (n) { return n.i; });
|
|
463
527
|
const { install } = await prompts.prompt({
|
|
464
528
|
type: "confirm",
|
|
465
529
|
name: "install",
|
|
466
530
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
467
531
|
});
|
|
468
532
|
if (install) {
|
|
469
|
-
await (await import('./chunk-install-pkg.
|
|
533
|
+
await (await import('./chunk-install-pkg.2dcb2c04.mjs')).installPackage(dependency, { dev: true });
|
|
470
534
|
process.stderr.write(picocolors.exports.yellow(`
|
|
471
535
|
Package ${dependency} installed, re-run the command to start.
|
|
472
536
|
`));
|
|
@@ -510,4 +574,4 @@ class AggregateErrorPonyfill extends Error {
|
|
|
510
574
|
}
|
|
511
575
|
}
|
|
512
576
|
|
|
513
|
-
export { AggregateErrorPonyfill as A,
|
|
577
|
+
export { AggregateErrorPonyfill as A, safeSetInterval as B, safeClearInterval as C, getSuites as D, shuffle as E, toArray as F, normalize as G, deepMerge as H, toNamespacedPath as I, ensurePackageInstalled as J, stdout as K, extname as L, isWindows as M, mergeSlashes as N, getType as O, getAllProperties as P, deepClone as Q, RealDate as R, partitionSuiteChildren as S, hasTests as T, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, safeSetTimeout as f, getCallLastIndex as g, safeClearTimeout as h, isObject as i, join as j, resetModules as k, notNullish as l, mockDate as m, noop as n, basename as o, picocolors as p, resolve as q, resetDate as r, slash as s, isAbsolute as t, relative as u, isNode as v, withSafeTimers as w, getTests as x, hasFailed as y, hasFailedSnapshot as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as slash,
|
|
1
|
+
import { s as slash, l as notNullish, p as picocolors } from './chunk-utils-global.1b22c4fd.mjs';
|
|
2
2
|
|
|
3
3
|
var build = {};
|
|
4
4
|
|
|
@@ -7328,22 +7328,6 @@ function unifiedDiff(actual, expected, options = {}) {
|
|
|
7328
7328
|
return formatted.map((i) => indent + i).join("\n");
|
|
7329
7329
|
}
|
|
7330
7330
|
|
|
7331
|
-
var __defProp = Object.defineProperty;
|
|
7332
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7333
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7334
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7335
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7336
|
-
var __spreadValues = (a, b) => {
|
|
7337
|
-
for (var prop in b || (b = {}))
|
|
7338
|
-
if (__hasOwnProp.call(b, prop))
|
|
7339
|
-
__defNormalProp(a, prop, b[prop]);
|
|
7340
|
-
if (__getOwnPropSymbols)
|
|
7341
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
7342
|
-
if (__propIsEnum.call(b, prop))
|
|
7343
|
-
__defNormalProp(a, prop, b[prop]);
|
|
7344
|
-
}
|
|
7345
|
-
return a;
|
|
7346
|
-
};
|
|
7347
7331
|
const EXPECTED_COLOR = picocolors.exports.green;
|
|
7348
7332
|
const RECEIVED_COLOR = picocolors.exports.red;
|
|
7349
7333
|
const INVERTED_COLOR = picocolors.exports.inverse;
|
|
@@ -7416,16 +7400,18 @@ function stringify(object, maxDepth = 10, options) {
|
|
|
7416
7400
|
const MAX_LENGTH = 1e4;
|
|
7417
7401
|
let result;
|
|
7418
7402
|
try {
|
|
7419
|
-
result = format_1(object,
|
|
7403
|
+
result = format_1(object, {
|
|
7420
7404
|
maxDepth,
|
|
7421
|
-
plugins: PLUGINS
|
|
7422
|
-
|
|
7405
|
+
plugins: PLUGINS,
|
|
7406
|
+
...options
|
|
7407
|
+
});
|
|
7423
7408
|
} catch {
|
|
7424
|
-
result = format_1(object,
|
|
7409
|
+
result = format_1(object, {
|
|
7425
7410
|
callToJSON: false,
|
|
7426
7411
|
maxDepth,
|
|
7427
|
-
plugins: PLUGINS
|
|
7428
|
-
|
|
7412
|
+
plugins: PLUGINS,
|
|
7413
|
+
...options
|
|
7414
|
+
});
|
|
7429
7415
|
}
|
|
7430
7416
|
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
|
|
7431
7417
|
}
|
|
@@ -7449,4 +7435,4 @@ var matcherUtils = /*#__PURE__*/Object.freeze({
|
|
|
7449
7435
|
diff: diff
|
|
7450
7436
|
});
|
|
7451
7437
|
|
|
7452
|
-
export { posToNumber as a, parseStacktrace as b, stripAnsi as c,
|
|
7438
|
+
export { posToNumber as a, parseStacktrace as b, stripAnsi as c, cliTruncate as d, stringWidth as e, format_1 as f, getOriginalPos as g, ansiStyles as h, sliceAnsi as i, interpretSourcePos as j, lineSplitRE as l, matcherUtils as m, numberToPos as n, plugins_1 as p, stringify as s, unifiedDiff as u };
|