vitest 0.15.2 → 0.17.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/dist/{chunk-api-setup.8cd5e92a.mjs → chunk-api-setup.c728e251.mjs} +4 -4
- package/dist/{chunk-constants.7b9cfc82.mjs → chunk-constants.27550afb.mjs} +8 -2
- package/dist/chunk-env-node.aa51c4cc.mjs +675 -0
- package/dist/{chunk-install-pkg.3fa50769.mjs → chunk-install-pkg.6f5930c3.mjs} +1 -1
- package/dist/{chunk-integrations-globals.d0c363a6.mjs → chunk-integrations-globals.3df36e26.mjs} +8 -8
- package/dist/{chunk-runtime-chain.7103058b.mjs → chunk-runtime-chain.6d23d202.mjs} +55 -188
- package/dist/{chunk-runtime-mocker.d3ca0a4e.mjs → chunk-runtime-mocker.34b9d585.mjs} +36 -62
- package/dist/{chunk-runtime-rpc.5e78af38.mjs → chunk-runtime-rpc.d986adb9.mjs} +1 -1
- package/dist/{chunk-utils-global.79a8b1cc.mjs → chunk-utils-global.4828c2e2.mjs} +66 -2
- package/dist/{chunk-utils-source-map.2556cba8.mjs → chunk-utils-source-map.a9047343.mjs} +9 -23
- package/dist/{chunk-vite-node-externalize.0ec89ad1.mjs → chunk-vite-node-externalize.0fc8ed68.mjs} +242 -206
- package/dist/{chunk-vite-node-utils.1bbdb2c1.mjs → chunk-vite-node-utils.0f776286.mjs} +29 -14
- package/dist/cli.mjs +12 -12
- 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 +201 -24
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +187 -20
- package/dist/node.mjs +13 -13
- package/dist/{vendor-entry.efeeaa5c.mjs → vendor-entry.1ad8a08d.mjs} +18 -424
- package/dist/{vendor-index.e5dc6622.mjs → vendor-index.a2a385d8.mjs} +0 -0
- package/dist/worker.mjs +12 -11
- package/package.json +10 -5
- package/dist/chunk-defaults.dc6dc23d.mjs +0 -302
|
@@ -250,6 +250,55 @@ 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
|
}
|
|
@@ -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)));
|
|
@@ -466,7 +530,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
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.6f5930c3.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, getSuites as B, safeSetInterval as C, safeClearInterval 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.4828c2e2.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
|
}
|