vitest 0.9.3 → 0.10.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 +7 -0
- package/dist/{chunk-api-setup.d764f144.js → chunk-api-setup.b55307fb.js} +41 -18
- package/dist/{chunk-constants.a6ce1057.js → chunk-constants.90075174.js} +1 -1
- package/dist/{chunk-defaults.aecec9d4.js → chunk-defaults.fd5b939d.js} +1 -1
- package/dist/{chunk-install-pkg.7dd40977.js → chunk-install-pkg.73b84ae1.js} +113 -115
- package/dist/chunk-integrations-globals.a759742a.js +29 -0
- package/dist/chunk-integrations-spy.f036df6f.js +102 -0
- package/dist/{chunk-runtime-chain.e17b859e.js → chunk-runtime-chain.6292a3de.js} +944 -901
- package/dist/{chunk-runtime-mocker.d325f149.js → chunk-runtime-mocker.ca5ecf98.js} +5 -21
- package/dist/{chunk-runtime-rpc.9e81f15b.js → chunk-runtime-rpc.8e14ae4f.js} +1 -1
- package/dist/{chunk-utils-global.46331799.js → chunk-utils-global.9b434e81.js} +42 -10
- package/dist/{chunk-utils-timers.6cfeb494.js → chunk-utils-timers.c50fec92.js} +1406 -1057
- package/dist/{chunk-vite-node-externalize.9aaddc2d.js → chunk-vite-node-externalize.4dd7260b.js} +1852 -4425
- package/dist/{chunk-vite-node-utils.3400d522.js → chunk-vite-node-utils.c160b239.js} +73 -71
- package/dist/cli.js +12 -12
- package/dist/entry.js +15 -919
- package/dist/index.d.ts +107 -31
- package/dist/index.js +8 -8
- package/dist/node.d.ts +34 -12
- package/dist/node.js +11 -11
- package/dist/spy.js +2 -102
- package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
- package/dist/vendor-entry.9dd6e6e6.js +986 -0
- package/dist/vendor-index.405e58ef.js +6291 -0
- package/dist/{vendor-index.87b2fc14.js → vendor-index.40be925a.js} +167 -152
- package/dist/worker.js +9 -6
- package/package.json +15 -16
- package/vitest.mjs +1 -1
- package/dist/chunk-integrations-globals.5686bfb8.js +0 -23
- package/dist/vendor-_commonjsHelpers.34b404ce.js +0 -7
- package/dist/vendor-index.13468339.js +0 -5707
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
1
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.c160b239.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import {
|
|
3
|
+
import { b as getWorkerState, B as isWindows, C as mergeSlashes, h as dirname, f as basename, k as resolve, D as getType, E as getAllProperties, s as slash } from './chunk-utils-global.9b434e81.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.90075174.js';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -20,22 +20,6 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
}
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
|
-
function getType(value) {
|
|
24
|
-
return Object.prototype.toString.apply(value).slice(8, -1);
|
|
25
|
-
}
|
|
26
|
-
function getAllProperties(obj) {
|
|
27
|
-
const allProps = /* @__PURE__ */ new Set();
|
|
28
|
-
let curr = obj;
|
|
29
|
-
do {
|
|
30
|
-
if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype)
|
|
31
|
-
break;
|
|
32
|
-
const props = Object.getOwnPropertyNames(curr);
|
|
33
|
-
const symbs = Object.getOwnPropertySymbols(curr);
|
|
34
|
-
props.forEach((prop) => allProps.add(prop));
|
|
35
|
-
symbs.forEach((symb) => allProps.add(symb));
|
|
36
|
-
} while (curr = Object.getPrototypeOf(curr));
|
|
37
|
-
return Array.from(allProps);
|
|
38
|
-
}
|
|
39
23
|
const _VitestMocker = class {
|
|
40
24
|
constructor(options, moduleCache, request) {
|
|
41
25
|
this.options = options;
|
|
@@ -136,8 +120,8 @@ const _VitestMocker = class {
|
|
|
136
120
|
else if (type !== "Object" && type !== "Module")
|
|
137
121
|
return value;
|
|
138
122
|
const newObj = {};
|
|
139
|
-
const
|
|
140
|
-
for (const k of
|
|
123
|
+
const properties = getAllProperties(value);
|
|
124
|
+
for (const k of properties) {
|
|
141
125
|
newObj[k] = this.mockValue(value[k]);
|
|
142
126
|
const type2 = getType(value[k]);
|
|
143
127
|
if (type2.includes("Function") && !value[k]._isMockFunction) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import require$$0 from 'tty';
|
|
3
2
|
import { isPackageExists } from 'local-pkg';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
|
|
5
5
|
var picocolors = {exports: {}};
|
|
6
6
|
|
|
@@ -63,8 +63,6 @@ let createColors = (enabled = isColorSupported) => ({
|
|
|
63
63
|
picocolors.exports = createColors();
|
|
64
64
|
picocolors.exports.createColors = createColors;
|
|
65
65
|
|
|
66
|
-
var c = picocolors.exports;
|
|
67
|
-
|
|
68
66
|
function normalizeWindowsPath(input = "") {
|
|
69
67
|
if (!input.includes("\\")) {
|
|
70
68
|
return input;
|
|
@@ -252,6 +250,19 @@ function getWorkerState() {
|
|
|
252
250
|
return globalThis.__vitest_worker__;
|
|
253
251
|
}
|
|
254
252
|
|
|
253
|
+
function getAllProperties(obj) {
|
|
254
|
+
const allProps = /* @__PURE__ */ new Set();
|
|
255
|
+
let curr = obj;
|
|
256
|
+
do {
|
|
257
|
+
if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype)
|
|
258
|
+
break;
|
|
259
|
+
const props = Object.getOwnPropertyNames(curr);
|
|
260
|
+
const symbs = Object.getOwnPropertySymbols(curr);
|
|
261
|
+
props.forEach((prop) => allProps.add(prop));
|
|
262
|
+
symbs.forEach((symb) => allProps.add(symb));
|
|
263
|
+
} while (curr = Object.getPrototypeOf(curr));
|
|
264
|
+
return Array.from(allProps);
|
|
265
|
+
}
|
|
255
266
|
function notNullish(v) {
|
|
256
267
|
return v != null;
|
|
257
268
|
}
|
|
@@ -263,6 +274,27 @@ function mergeSlashes(str) {
|
|
|
263
274
|
}
|
|
264
275
|
const noop = () => {
|
|
265
276
|
};
|
|
277
|
+
function getType(value) {
|
|
278
|
+
return Object.prototype.toString.apply(value).slice(8, -1);
|
|
279
|
+
}
|
|
280
|
+
function clone(val) {
|
|
281
|
+
let k, out, tmp;
|
|
282
|
+
if (Array.isArray(val)) {
|
|
283
|
+
out = Array(k = val.length);
|
|
284
|
+
while (k--)
|
|
285
|
+
out[k] = (tmp = val[k]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
289
|
+
out = Object.create(Object.getPrototypeOf(val));
|
|
290
|
+
const props = getAllProperties(val);
|
|
291
|
+
for (const k2 of props) {
|
|
292
|
+
out[k2] = (tmp = val[k2]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
293
|
+
}
|
|
294
|
+
return out;
|
|
295
|
+
}
|
|
296
|
+
return val;
|
|
297
|
+
}
|
|
266
298
|
function toArray(array) {
|
|
267
299
|
if (array === null || array === void 0)
|
|
268
300
|
array = [];
|
|
@@ -367,25 +399,25 @@ function resetModules() {
|
|
|
367
399
|
});
|
|
368
400
|
}
|
|
369
401
|
function getFullName(task) {
|
|
370
|
-
return getNames(task).join(
|
|
402
|
+
return getNames(task).join(picocolors.exports.dim(" > "));
|
|
371
403
|
}
|
|
372
404
|
async function ensurePackageInstalled(dependency, promptInstall = !process.env.CI && process.stdout.isTTY) {
|
|
373
405
|
if (isPackageExists(dependency))
|
|
374
406
|
return true;
|
|
375
|
-
process.stderr.write(
|
|
407
|
+
process.stderr.write(picocolors.exports.red(`${picocolors.exports.inverse(picocolors.exports.red(" MISSING DEP "))} Can not find dependency '${dependency}'
|
|
376
408
|
|
|
377
409
|
`));
|
|
378
410
|
if (!promptInstall)
|
|
379
411
|
return false;
|
|
380
|
-
const prompts = await import('./vendor-index.
|
|
412
|
+
const prompts = await import('./vendor-index.405e58ef.js').then(function (n) { return n.i; });
|
|
381
413
|
const { install } = await prompts.prompt({
|
|
382
414
|
type: "confirm",
|
|
383
415
|
name: "install",
|
|
384
|
-
message:
|
|
416
|
+
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
385
417
|
});
|
|
386
418
|
if (install) {
|
|
387
|
-
await (await import('./chunk-install-pkg.
|
|
388
|
-
process.stderr.write(
|
|
419
|
+
await (await import('./chunk-install-pkg.73b84ae1.js')).installPackage(dependency, { dev: true });
|
|
420
|
+
process.stderr.write(picocolors.exports.yellow(`
|
|
389
421
|
Package ${dependency} installed, re-run the command to start.
|
|
390
422
|
`));
|
|
391
423
|
process.exit(1);
|
|
@@ -422,4 +454,4 @@ function getCallLastIndex(code) {
|
|
|
422
454
|
return null;
|
|
423
455
|
}
|
|
424
456
|
|
|
425
|
-
export { extname as A, isWindows as B, mergeSlashes as C,
|
|
457
|
+
export { extname as A, isWindows as B, mergeSlashes as C, getType as D, getAllProperties as E, clone as F, partitionSuiteChildren as G, hasTests as H, index as a, getWorkerState as b, getNames as c, assertTypes as d, notNullish as e, basename as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, resolve as k, isAbsolute as l, relative as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, deepMerge as x, toNamespacedPath as y, ensurePackageInstalled as z };
|