vitest 3.0.5 → 3.0.7
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 +20 -304
- package/dist/browser.d.ts +8 -14
- package/dist/browser.js +2 -2
- package/dist/chunks/{base.wKnmhRYd.js → base.BgUWWWYp.js} +5 -3
- package/dist/chunks/{cac.B_eDEFh6.js → cac.87F_onld.js} +24 -24
- package/dist/chunks/{cli-api.az_rB_xZ.js → cli-api.BZbq1zTX.js} +3273 -3050
- package/dist/chunks/{console.BxE0RUCr.js → console.CN7AiMGV.js} +3 -3
- package/dist/chunks/{coverage.BWeNbfBa.js → coverage.DnNIv-kJ.js} +1 -1
- package/dist/chunks/{creator.fUJbheb8.js → creator.2CFRE1Yx.js} +5 -5
- package/dist/chunks/{execute.PoofJYS5.js → execute.Bhwls1-Z.js} +17 -5
- package/dist/chunks/{globals.BSNBk3vE.js → globals.BCtI_nQG.js} +2 -2
- package/dist/chunks/{index.TH3f4LSA.js → index.68735LiX.js} +2 -2
- package/dist/chunks/{index.Bf4FgyZN.js → index.B8haHJlQ.js} +1 -1
- package/dist/chunks/{index.C2XSkjNu.js → index.BmFFzXX_.js} +3 -3
- package/dist/chunks/{index.NxxmQyK2.js → index.Bw6JxgX8.js} +3 -3
- package/dist/chunks/{index.vId0fl99.js → index.C1f-_gvH.js} +86 -45
- package/dist/chunks/{index.B57_6XMC.js → index.DBIGubLC.js} +8 -8
- package/dist/chunks/{index.cYxyd29h.js → index.K90BXFOx.js} +12 -12
- package/dist/chunks/{inspector.CU9GlB9I.js → inspector.DKLceBVD.js} +1 -1
- package/dist/chunks/{reporters.6vxQttCV.d.ts → reporters.QZ837uWx.d.ts} +75 -61
- package/dist/chunks/{resolveConfig.BT-MMQUD.js → resolveConfig.BbcK25zb.js} +20 -22
- package/dist/chunks/{rpc.Bf456uf4.js → rpc.TVf73xOu.js} +1 -1
- package/dist/chunks/{runBaseTests.Ba8jtu6O.js → runBaseTests.9XCQcSZC.js} +9 -9
- package/dist/chunks/{setup-common.jLbIuaww.js → setup-common.wObu9a36.js} +1 -1
- package/dist/chunks/{suite.BJU7kdY9.d.ts → suite.qtkXWc6R.d.ts} +1 -1
- package/dist/chunks/{typechecker.CdcjdhoT.js → typechecker.cZ0LjdSi.js} +7 -7
- package/dist/chunks/{utils.DJWL04yX.js → utils.bLM2atbD.js} +3 -3
- package/dist/chunks/{vi.CjhMlMwf.js → vi.DT3m61kS.js} +29 -23
- package/dist/chunks/{vite.Cu7NWuBa.d.ts → vite.vM3UZq1q.d.ts} +1 -1
- package/dist/chunks/{vm.DXDoSHPT.js → vm.6kNys9FN.js} +7 -5
- package/dist/chunks/{worker.B1y96qmv.d.ts → worker.B2JXutr8.d.ts} +1 -1
- package/dist/chunks/{worker.CIpff8Eg.d.ts → worker.DaAIyCKm.d.ts} +2 -1
- package/dist/cli.js +1 -1
- package/dist/config.cjs +3 -4
- package/dist/config.d.ts +23 -26
- package/dist/config.js +3 -4
- package/dist/coverage.d.ts +3 -3
- package/dist/coverage.js +9 -9
- package/dist/environments.d.ts +2 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +6 -6
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +2 -2
- package/dist/node.d.ts +13 -13
- package/dist/node.js +15 -16
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +3 -3
- package/dist/runners.js +4 -4
- package/dist/suite.d.ts +1 -1
- package/dist/worker.js +6 -5
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +8 -8
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +5 -5
- package/dist/workers/vmThreads.js +5 -5
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +8 -8
- package/package.json +20 -20
|
@@ -155,8 +155,8 @@ function formatProjectName(name, suffix = " ") {
|
|
|
155
155
|
return `|${name}|${suffix}`;
|
|
156
156
|
}
|
|
157
157
|
const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
|
|
158
|
-
const colors = [c.
|
|
159
|
-
return c.
|
|
158
|
+
const colors = [c.bgYellow, c.bgCyan, c.bgGreen, c.bgMagenta];
|
|
159
|
+
return c.black(colors[index % colors.length](` ${name} `)) + suffix;
|
|
160
160
|
}
|
|
161
161
|
function withLabel(color, label, message) {
|
|
162
162
|
return `${c.bold(c.inverse(c[color](` ${label} `)))} ${message ? c[color](message) : ""}`;
|
|
@@ -195,4 +195,4 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
195
195
|
withLabel: withLabel
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
-
export { F_POINTER as F, formatProjectName as a, taskFail as b,
|
|
198
|
+
export { F_POINTER as F, formatProjectName as a, taskFail as b, F_CHECK as c, divider as d, F_RIGHT as e, formatTimeString as f, getStateSymbol as g, getStateString as h, formatTime as i, countTestErrors as j, F_TREE_NODE_END as k, F_TREE_NODE_MIDDLE as l, padSummaryTitle as p, renderSnapshotSummary as r, truncateString as t, utils as u, withLabel as w };
|
|
@@ -2,14 +2,14 @@ import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, J
|
|
|
2
2
|
import { getCurrentTest } from '@vitest/runner';
|
|
3
3
|
import { getNames, getTestName } from '@vitest/runner/utils';
|
|
4
4
|
import * as chai$1 from 'chai';
|
|
5
|
-
import { g as getWorkerState, a as getCurrentEnvironment, i as isChildProcess,
|
|
5
|
+
import { g as getWorkerState, a as getCurrentEnvironment, i as isChildProcess, w as waitForImportsToResolve, r as resetModules } from './utils.C8RiOc4B.js';
|
|
6
6
|
import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
|
|
7
7
|
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers.BFTU3MAI.js';
|
|
8
8
|
import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot';
|
|
9
9
|
import '@vitest/utils/error';
|
|
10
10
|
import { parseSingleStack } from '@vitest/utils/source-map';
|
|
11
11
|
import { R as RealDate, r as resetDate, m as mockDate } from './date.W2xKR2qe.js';
|
|
12
|
-
import { spyOn,
|
|
12
|
+
import { fn, spyOn, mocks, isMockFunction } from '@vitest/spy';
|
|
13
13
|
|
|
14
14
|
const unsupported = [
|
|
15
15
|
// .poll is meant to retry matchers until they succeed, and
|
|
@@ -138,7 +138,7 @@ await ${assertionString}
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
function copyStackTrace$1(target, source) {
|
|
141
|
-
if (source.stack !==
|
|
141
|
+
if (source.stack !== void 0) {
|
|
142
142
|
target.stack = source.stack.replace(source.message, target.message);
|
|
143
143
|
}
|
|
144
144
|
return target;
|
|
@@ -353,7 +353,7 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
353
353
|
const test = getTest(key, this);
|
|
354
354
|
if (typeof properties === "string" && typeof message === "undefined") {
|
|
355
355
|
message = properties;
|
|
356
|
-
properties =
|
|
356
|
+
properties = void 0;
|
|
357
357
|
}
|
|
358
358
|
const errorMessage = utils.flag(this, "message");
|
|
359
359
|
getSnapshotClient().assert({
|
|
@@ -419,7 +419,7 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
419
419
|
if (typeof properties === "string") {
|
|
420
420
|
message = inlineSnapshot;
|
|
421
421
|
inlineSnapshot = properties;
|
|
422
|
-
properties =
|
|
422
|
+
properties = void 0;
|
|
423
423
|
}
|
|
424
424
|
if (inlineSnapshot) {
|
|
425
425
|
inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
@@ -3684,6 +3684,12 @@ var fakeTimersSrcExports = requireFakeTimersSrc();
|
|
|
3684
3684
|
class FakeTimers {
|
|
3685
3685
|
_global;
|
|
3686
3686
|
_clock;
|
|
3687
|
+
// | _fakingTime | _fakingDate |
|
|
3688
|
+
// +-------------+-------------+
|
|
3689
|
+
// | false | falsy | initial
|
|
3690
|
+
// | false | truethy | vi.setSystemTime called first (for mocking only Date without fake timers)
|
|
3691
|
+
// | true | falsy | vi.useFakeTimers called first
|
|
3692
|
+
// | true | truethy | unreachable
|
|
3687
3693
|
_fakingTime;
|
|
3688
3694
|
_fakingDate;
|
|
3689
3695
|
_fakeTimers;
|
|
@@ -3694,7 +3700,7 @@ class FakeTimers {
|
|
|
3694
3700
|
config
|
|
3695
3701
|
}) {
|
|
3696
3702
|
this._userConfig = config;
|
|
3697
|
-
this._fakingDate =
|
|
3703
|
+
this._fakingDate = null;
|
|
3698
3704
|
this._fakingTime = false;
|
|
3699
3705
|
this._fakeTimers = fakeTimersSrcExports.withGlobal(global);
|
|
3700
3706
|
this._global = global;
|
|
@@ -3772,7 +3778,7 @@ class FakeTimers {
|
|
|
3772
3778
|
useRealTimers() {
|
|
3773
3779
|
if (this._fakingDate) {
|
|
3774
3780
|
resetDate();
|
|
3775
|
-
this._fakingDate =
|
|
3781
|
+
this._fakingDate = null;
|
|
3776
3782
|
}
|
|
3777
3783
|
if (this._fakingTime) {
|
|
3778
3784
|
this._clock.uninstall();
|
|
@@ -3787,7 +3793,7 @@ class FakeTimers {
|
|
|
3787
3793
|
}
|
|
3788
3794
|
if (!this._fakingTime) {
|
|
3789
3795
|
const toFake = Object.keys(this._fakeTimers.timers).filter(
|
|
3790
|
-
(timer) => timer !== "nextTick"
|
|
3796
|
+
(timer) => timer !== "nextTick" && timer !== "queueMicrotask"
|
|
3791
3797
|
);
|
|
3792
3798
|
if (this._userConfig?.toFake?.includes("nextTick") && isChildProcess()) {
|
|
3793
3799
|
throw new Error(
|
|
@@ -3811,13 +3817,17 @@ class FakeTimers {
|
|
|
3811
3817
|
}
|
|
3812
3818
|
}
|
|
3813
3819
|
setSystemTime(now) {
|
|
3820
|
+
const date = typeof now === "undefined" || now instanceof Date ? now : new Date(now);
|
|
3814
3821
|
if (this._fakingTime) {
|
|
3815
|
-
this._clock.setSystemTime(
|
|
3822
|
+
this._clock.setSystemTime(date);
|
|
3816
3823
|
} else {
|
|
3817
|
-
|
|
3818
|
-
this._fakingDate
|
|
3824
|
+
this._fakingDate = date ?? new Date(this.getRealSystemTime());
|
|
3825
|
+
mockDate(this._fakingDate);
|
|
3819
3826
|
}
|
|
3820
3827
|
}
|
|
3828
|
+
getMockedSystemTime() {
|
|
3829
|
+
return this._fakingTime ? new Date(this._clock.now) : this._fakingDate;
|
|
3830
|
+
}
|
|
3821
3831
|
getRealSystemTime() {
|
|
3822
3832
|
return this._now();
|
|
3823
3833
|
}
|
|
@@ -3844,7 +3854,7 @@ class FakeTimers {
|
|
|
3844
3854
|
}
|
|
3845
3855
|
|
|
3846
3856
|
function copyStackTrace(target, source) {
|
|
3847
|
-
if (source.stack !==
|
|
3857
|
+
if (source.stack !== void 0) {
|
|
3848
3858
|
target.stack = source.stack.replace(source.message, target.message);
|
|
3849
3859
|
}
|
|
3850
3860
|
return target;
|
|
@@ -3988,7 +3998,6 @@ function waitUntil(callback, options = {}) {
|
|
|
3988
3998
|
}
|
|
3989
3999
|
|
|
3990
4000
|
function createVitest() {
|
|
3991
|
-
let _mockedDate = null;
|
|
3992
4001
|
let _config = null;
|
|
3993
4002
|
const workerState = getWorkerState();
|
|
3994
4003
|
let _timers;
|
|
@@ -4021,7 +4030,6 @@ function createVitest() {
|
|
|
4021
4030
|
},
|
|
4022
4031
|
useRealTimers() {
|
|
4023
4032
|
timers().useRealTimers();
|
|
4024
|
-
_mockedDate = null;
|
|
4025
4033
|
return utils;
|
|
4026
4034
|
},
|
|
4027
4035
|
runOnlyPendingTimers() {
|
|
@@ -4068,13 +4076,11 @@ function createVitest() {
|
|
|
4068
4076
|
return timers().getTimerCount();
|
|
4069
4077
|
},
|
|
4070
4078
|
setSystemTime(time) {
|
|
4071
|
-
|
|
4072
|
-
_mockedDate = date;
|
|
4073
|
-
timers().setSystemTime(date);
|
|
4079
|
+
timers().setSystemTime(time);
|
|
4074
4080
|
return utils;
|
|
4075
4081
|
},
|
|
4076
4082
|
getMockedSystemTime() {
|
|
4077
|
-
return
|
|
4083
|
+
return timers().getMockedSystemTime();
|
|
4078
4084
|
},
|
|
4079
4085
|
getRealSystemTime() {
|
|
4080
4086
|
return timers().getRealSystemTime();
|
|
@@ -4164,15 +4170,15 @@ function createVitest() {
|
|
|
4164
4170
|
return isMockFunction(fn2);
|
|
4165
4171
|
},
|
|
4166
4172
|
clearAllMocks() {
|
|
4167
|
-
mocks.forEach((spy) => spy.mockClear());
|
|
4173
|
+
[...mocks].reverse().forEach((spy) => spy.mockClear());
|
|
4168
4174
|
return utils;
|
|
4169
4175
|
},
|
|
4170
4176
|
resetAllMocks() {
|
|
4171
|
-
mocks.forEach((spy) => spy.mockReset());
|
|
4177
|
+
[...mocks].reverse().forEach((spy) => spy.mockReset());
|
|
4172
4178
|
return utils;
|
|
4173
4179
|
},
|
|
4174
4180
|
restoreAllMocks() {
|
|
4175
|
-
mocks.forEach((spy) => spy.mockRestore());
|
|
4181
|
+
[...mocks].reverse().forEach((spy) => spy.mockRestore());
|
|
4176
4182
|
return utils;
|
|
4177
4183
|
},
|
|
4178
4184
|
stubGlobal(name, value) {
|
|
@@ -4196,7 +4202,7 @@ function createVitest() {
|
|
|
4196
4202
|
}
|
|
4197
4203
|
if (_envBooleans.includes(name)) {
|
|
4198
4204
|
process.env[name] = value ? "1" : "";
|
|
4199
|
-
} else if (value ===
|
|
4205
|
+
} else if (value === void 0) {
|
|
4200
4206
|
delete process.env[name];
|
|
4201
4207
|
} else {
|
|
4202
4208
|
process.env[name] = String(value);
|
|
@@ -4216,7 +4222,7 @@ function createVitest() {
|
|
|
4216
4222
|
},
|
|
4217
4223
|
unstubAllEnvs() {
|
|
4218
4224
|
_stubsEnv.forEach((original, name) => {
|
|
4219
|
-
if (original ===
|
|
4225
|
+
if (original === void 0) {
|
|
4220
4226
|
delete process.env[name];
|
|
4221
4227
|
} else {
|
|
4222
4228
|
process.env[name] = original;
|
|
@@ -2,8 +2,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
2
2
|
import vm, { isContext } from 'node:vm';
|
|
3
3
|
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
|
|
4
4
|
import { distDir } from '../path.js';
|
|
5
|
-
import { createCustomConsole } from './console.
|
|
6
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
5
|
+
import { createCustomConsole } from './console.CN7AiMGV.js';
|
|
6
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.Bhwls1-Z.js';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { dirname as dirname$1 } from 'node:path';
|
|
9
9
|
import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData } from 'vite-node/utils';
|
|
@@ -120,6 +120,8 @@ class CommonjsExecutor {
|
|
|
120
120
|
static enableCompileCache = Module.enableCompileCache;
|
|
121
121
|
static getCompileCacheDir = Module.getCompileCacheDir;
|
|
122
122
|
static flushCompileCache = Module.flushCompileCache;
|
|
123
|
+
static stripTypeScriptTypes = Module.stripTypeScriptTypes;
|
|
124
|
+
static findPackageJSON = Module.findPackageJSON;
|
|
123
125
|
static Module = Module$1;
|
|
124
126
|
};
|
|
125
127
|
this.extensions[".js"] = this.requireJs;
|
|
@@ -151,7 +153,7 @@ class CommonjsExecutor {
|
|
|
151
153
|
},
|
|
152
154
|
configurable: true
|
|
153
155
|
});
|
|
154
|
-
require.main =
|
|
156
|
+
require.main = void 0;
|
|
155
157
|
require.cache = this.publicRequireCache;
|
|
156
158
|
return require;
|
|
157
159
|
};
|
|
@@ -353,7 +355,7 @@ class EsmExecutor {
|
|
|
353
355
|
const imports = WebAssembly.Module.imports(wasmModule);
|
|
354
356
|
const moduleLookup = {};
|
|
355
357
|
for (const { module } of imports) {
|
|
356
|
-
if (moduleLookup[module] ===
|
|
358
|
+
if (moduleLookup[module] === void 0) {
|
|
357
359
|
moduleLookup[module] = await this.executor.resolveModule(
|
|
358
360
|
module,
|
|
359
361
|
identifier
|
|
@@ -832,7 +834,7 @@ async function runVmTests(method, state) {
|
|
|
832
834
|
entryFile
|
|
833
835
|
);
|
|
834
836
|
const fileSpecs = ctx.files.map(
|
|
835
|
-
(f) => typeof f === "string" ? { filepath: f, testLocations:
|
|
837
|
+
(f) => typeof f === "string" ? { filepath: f, testLocations: void 0 } : f
|
|
836
838
|
);
|
|
837
839
|
try {
|
|
838
840
|
await run(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { File, TaskResultPack, TaskEventPack, CancelReason, FileSpecification, Task } from '@vitest/runner';
|
|
2
|
-
import { ViteNodeResolveId, ModuleCacheMap } from 'vite-node';
|
|
2
|
+
import { ViteNodeResolveId, ModuleCacheMap, ModuleExecutionInfo } from 'vite-node';
|
|
3
3
|
import { S as SerializedConfig } from './config.BRtC-JeT.js';
|
|
4
4
|
import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d8YfPkTm.js';
|
|
5
5
|
import { SnapshotResult } from '@vitest/snapshot';
|
|
@@ -144,6 +144,7 @@ interface WorkerGlobalState {
|
|
|
144
144
|
environmentTeardownRun?: boolean;
|
|
145
145
|
onCancel: Promise<CancelReason>;
|
|
146
146
|
moduleCache: ModuleCacheMap;
|
|
147
|
+
moduleExecutionInfo?: ModuleExecutionInfo;
|
|
147
148
|
providedContext: Record<string, any>;
|
|
148
149
|
durations: {
|
|
149
150
|
environment: number;
|
package/dist/cli.js
CHANGED
package/dist/config.cjs
CHANGED
|
@@ -13,7 +13,7 @@ const extraInlineDeps = [
|
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
|
|
16
|
-
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !==
|
|
16
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
|
|
17
17
|
(isNode || isDeno) && process.platform === "win32";
|
|
18
18
|
(isNode || isDeno) && process.stdout?.isTTY && !stdEnv.isCI;
|
|
19
19
|
|
|
@@ -84,7 +84,7 @@ const fakeTimersDefaults = {
|
|
|
84
84
|
loopLimit: 1e4,
|
|
85
85
|
shouldClearNativeTimers: true
|
|
86
86
|
};
|
|
87
|
-
const
|
|
87
|
+
const configDefaults = Object.freeze({
|
|
88
88
|
allowOnly: !stdEnv.isCI,
|
|
89
89
|
isolate: true,
|
|
90
90
|
watch: !stdEnv.isCI,
|
|
@@ -122,8 +122,7 @@ const config = {
|
|
|
122
122
|
},
|
|
123
123
|
slowTestThreshold: 300,
|
|
124
124
|
disableConsoleIntercept: false
|
|
125
|
-
};
|
|
126
|
-
const configDefaults = Object.freeze(config);
|
|
125
|
+
});
|
|
127
126
|
|
|
128
127
|
function defineConfig(config) {
|
|
129
128
|
return config;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import {
|
|
4
|
-
export { W as WorkspaceProjectConfiguration } from './chunks/reporters.
|
|
5
|
-
import './chunks/vite.
|
|
3
|
+
import { d as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, e as UserProjectConfigFn, f as UserProjectConfigExport, T as TestProjectConfiguration } from './chunks/reporters.QZ837uWx.js';
|
|
4
|
+
export { W as WorkspaceProjectConfiguration } from './chunks/reporters.QZ837uWx.js';
|
|
5
|
+
import './chunks/vite.vM3UZq1q.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.BRtC-JeT.js';
|
|
6
7
|
import '@vitest/runner';
|
|
7
8
|
import './chunks/environment.d8YfPkTm.js';
|
|
8
9
|
import '@vitest/utils';
|
|
9
10
|
import 'node:stream';
|
|
10
11
|
import '@vitest/utils/source-map';
|
|
11
|
-
import './chunks/config.BRtC-JeT.js';
|
|
12
12
|
import '@vitest/pretty-format';
|
|
13
13
|
import '@vitest/snapshot';
|
|
14
|
-
import '@vitest/snapshot/environment';
|
|
15
14
|
import '@vitest/utils/diff';
|
|
16
15
|
import 'vite-node';
|
|
17
16
|
import 'chai';
|
|
@@ -20,6 +19,7 @@ import '@vitest/runner/utils';
|
|
|
20
19
|
import 'tinybench';
|
|
21
20
|
import '@vitest/snapshot/manager';
|
|
22
21
|
import 'node:fs';
|
|
22
|
+
import '@vitest/snapshot/environment';
|
|
23
23
|
|
|
24
24
|
declare const defaultBrowserPort = 63315;
|
|
25
25
|
declare const extraInlineDeps: RegExp[];
|
|
@@ -29,45 +29,42 @@ declare const defaultExclude: string[];
|
|
|
29
29
|
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
30
30
|
declare const configDefaults: Readonly<{
|
|
31
31
|
allowOnly: boolean;
|
|
32
|
-
isolate:
|
|
32
|
+
isolate: boolean;
|
|
33
33
|
watch: boolean;
|
|
34
|
-
globals:
|
|
35
|
-
environment:
|
|
36
|
-
pool:
|
|
37
|
-
clearMocks:
|
|
38
|
-
restoreMocks:
|
|
39
|
-
mockReset:
|
|
40
|
-
unstubGlobals:
|
|
41
|
-
unstubEnvs:
|
|
34
|
+
globals: boolean;
|
|
35
|
+
environment: 'node';
|
|
36
|
+
pool: 'forks';
|
|
37
|
+
clearMocks: boolean;
|
|
38
|
+
restoreMocks: boolean;
|
|
39
|
+
mockReset: boolean;
|
|
40
|
+
unstubGlobals: boolean;
|
|
41
|
+
unstubEnvs: boolean;
|
|
42
42
|
include: string[];
|
|
43
43
|
exclude: string[];
|
|
44
44
|
teardownTimeout: number;
|
|
45
45
|
forceRerunTriggers: string[];
|
|
46
|
-
update:
|
|
46
|
+
update: boolean;
|
|
47
47
|
reporters: never[];
|
|
48
|
-
silent:
|
|
49
|
-
hideSkippedTests:
|
|
50
|
-
api:
|
|
51
|
-
ui:
|
|
48
|
+
silent: boolean;
|
|
49
|
+
hideSkippedTests: boolean;
|
|
50
|
+
api: boolean;
|
|
51
|
+
ui: boolean;
|
|
52
52
|
uiBase: string;
|
|
53
53
|
open: boolean;
|
|
54
54
|
css: {
|
|
55
55
|
include: never[];
|
|
56
56
|
};
|
|
57
57
|
coverage: CoverageV8Options;
|
|
58
|
-
fakeTimers:
|
|
59
|
-
loopLimit: number;
|
|
60
|
-
shouldClearNativeTimers: true;
|
|
61
|
-
};
|
|
58
|
+
fakeTimers: FakeTimerInstallOpts;
|
|
62
59
|
maxConcurrency: number;
|
|
63
|
-
dangerouslyIgnoreUnhandledErrors:
|
|
60
|
+
dangerouslyIgnoreUnhandledErrors: boolean;
|
|
64
61
|
typecheck: {
|
|
65
|
-
checker:
|
|
62
|
+
checker: 'tsc';
|
|
66
63
|
include: string[];
|
|
67
64
|
exclude: string[];
|
|
68
65
|
};
|
|
69
66
|
slowTestThreshold: number;
|
|
70
|
-
disableConsoleIntercept:
|
|
67
|
+
disableConsoleIntercept: boolean;
|
|
71
68
|
}>;
|
|
72
69
|
|
|
73
70
|
/**
|
package/dist/config.js
CHANGED
|
@@ -11,7 +11,7 @@ const extraInlineDeps = [
|
|
|
11
11
|
];
|
|
12
12
|
|
|
13
13
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
|
|
14
|
-
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !==
|
|
14
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
|
|
15
15
|
(isNode || isDeno) && process.platform === "win32";
|
|
16
16
|
(isNode || isDeno) && process.stdout?.isTTY && !isCI;
|
|
17
17
|
|
|
@@ -82,7 +82,7 @@ const fakeTimersDefaults = {
|
|
|
82
82
|
loopLimit: 1e4,
|
|
83
83
|
shouldClearNativeTimers: true
|
|
84
84
|
};
|
|
85
|
-
const
|
|
85
|
+
const configDefaults = Object.freeze({
|
|
86
86
|
allowOnly: !isCI,
|
|
87
87
|
isolate: true,
|
|
88
88
|
watch: !isCI,
|
|
@@ -120,8 +120,7 @@ const config = {
|
|
|
120
120
|
},
|
|
121
121
|
slowTestThreshold: 300,
|
|
122
122
|
disableConsoleIntercept: false
|
|
123
|
-
};
|
|
124
|
-
const configDefaults = Object.freeze(config);
|
|
123
|
+
});
|
|
125
124
|
|
|
126
125
|
function defineConfig(config) {
|
|
127
126
|
return config;
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.QZ837uWx.js';
|
|
2
|
+
import { TransformResult } from 'vite';
|
|
3
3
|
import { A as AfterSuiteRunMeta } from './chunks/environment.d8YfPkTm.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
@@ -96,7 +96,7 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<'ista
|
|
|
96
96
|
mergeReports(coverageMaps: unknown[]): Promise<void>;
|
|
97
97
|
hasTerminalReporter(reporters: ResolvedCoverageOptions['reporter']): boolean;
|
|
98
98
|
toSlices<T>(array: T[], size: number): T[][];
|
|
99
|
-
createUncoveredFileTransformer(ctx: Vitest): (filename: string) => Promise<
|
|
99
|
+
createUncoveredFileTransformer(ctx: Vitest): (filename: string) => Promise<TransformResult | null | undefined>;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export { BaseCoverageProvider };
|
package/dist/coverage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, promises, readdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { r as resolveCoverageReporters, c as coverageConfigDefaults, m as mm } from './chunks/resolveConfig.BbcK25zb.js';
|
|
3
3
|
import { resolve, relative } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
5
|
import 'node:crypto';
|
|
@@ -14,7 +14,7 @@ import 'node:v8';
|
|
|
14
14
|
import 'node:util';
|
|
15
15
|
import './chunks/constants.fzPh7AOq.js';
|
|
16
16
|
import 'node:os';
|
|
17
|
-
import './chunks/typechecker.
|
|
17
|
+
import './chunks/typechecker.cZ0LjdSi.js';
|
|
18
18
|
import 'std-env';
|
|
19
19
|
import 'node:perf_hooks';
|
|
20
20
|
import '@vitest/utils/source-map';
|
|
@@ -27,7 +27,7 @@ import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
|
27
27
|
import 'util';
|
|
28
28
|
import 'path';
|
|
29
29
|
import 'node:events';
|
|
30
|
-
import './chunks/index.
|
|
30
|
+
import './chunks/index.68735LiX.js';
|
|
31
31
|
import 'tinypool';
|
|
32
32
|
import 'node:worker_threads';
|
|
33
33
|
import './path.js';
|
|
@@ -262,7 +262,7 @@ Update your dependencies and make sure the versions match.`
|
|
|
262
262
|
*/
|
|
263
263
|
checkThresholds(allThresholds) {
|
|
264
264
|
for (const { coverageMap, thresholds, name } of allThresholds) {
|
|
265
|
-
if (thresholds.branches ===
|
|
265
|
+
if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0) {
|
|
266
266
|
continue;
|
|
267
267
|
}
|
|
268
268
|
const summaries = this.options.thresholds?.perFile ? coverageMap.files().map((file) => ({
|
|
@@ -272,7 +272,7 @@ Update your dependencies and make sure the versions match.`
|
|
|
272
272
|
for (const { summary, file } of summaries) {
|
|
273
273
|
for (const thresholdKey of THRESHOLD_KEYS) {
|
|
274
274
|
const threshold = thresholds[thresholdKey];
|
|
275
|
-
if (threshold ===
|
|
275
|
+
if (threshold === void 0) {
|
|
276
276
|
continue;
|
|
277
277
|
}
|
|
278
278
|
if (threshold >= 0) {
|
|
@@ -414,10 +414,10 @@ function resolveGlobThresholds(thresholds) {
|
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
return {
|
|
417
|
-
lines: "lines" in thresholds && typeof thresholds.lines === "number" ? thresholds.lines :
|
|
418
|
-
branches: "branches" in thresholds && typeof thresholds.branches === "number" ? thresholds.branches :
|
|
419
|
-
functions: "functions" in thresholds && typeof thresholds.functions === "number" ? thresholds.functions :
|
|
420
|
-
statements: "statements" in thresholds && typeof thresholds.statements === "number" ? thresholds.statements :
|
|
417
|
+
lines: "lines" in thresholds && typeof thresholds.lines === "number" ? thresholds.lines : void 0,
|
|
418
|
+
branches: "branches" in thresholds && typeof thresholds.branches === "number" ? thresholds.branches : void 0,
|
|
419
|
+
functions: "functions" in thresholds && typeof thresholds.functions === "number" ? thresholds.functions : void 0,
|
|
420
|
+
statements: "statements" in thresholds && typeof thresholds.statements === "number" ? thresholds.statements : void 0
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
423
|
function assertConfigurationModule(config) {
|
package/dist/environments.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { E as Environment } from './chunks/environment.d8YfPkTm.js';
|
|
|
2
2
|
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d8YfPkTm.js';
|
|
3
3
|
|
|
4
4
|
declare const environments: {
|
|
5
|
-
node: Environment;
|
|
6
|
-
jsdom: Environment;
|
|
5
|
+
'node': Environment;
|
|
6
|
+
'jsdom': Environment;
|
|
7
7
|
'happy-dom': Environment;
|
|
8
8
|
'edge-runtime': Environment;
|
|
9
9
|
};
|
package/dist/environments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.K90BXFOx.js';
|
|
2
2
|
import 'node:console';
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
2
|
-
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
|
-
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.
|
|
2
|
+
import { ViteNodeRunner, ModuleExecutionInfo } from 'vite-node/client';
|
|
3
|
+
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.DaAIyCKm.js';
|
|
4
4
|
import vm from 'node:vm';
|
|
5
|
-
import
|
|
6
|
-
import { MockedModuleType } from '@vitest/mocker';
|
|
5
|
+
import { MockedModule, MockedModuleType } from '@vitest/mocker';
|
|
7
6
|
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.cRtM890J.js';
|
|
8
7
|
import '@vitest/runner';
|
|
9
8
|
import './chunks/config.BRtC-JeT.js';
|
|
@@ -18,7 +17,7 @@ declare class FileMap {
|
|
|
18
17
|
private fsBufferCache;
|
|
19
18
|
readFileAsync(path: string): Promise<string>;
|
|
20
19
|
readFile(path: string): string;
|
|
21
|
-
readBuffer(path: string): Buffer
|
|
20
|
+
readBuffer(path: string): Buffer;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
interface ModuleEvaluateOptions {
|
|
@@ -102,7 +101,7 @@ declare class VitestMocker {
|
|
|
102
101
|
private callFunctionMock;
|
|
103
102
|
getMockContext(): MockContext;
|
|
104
103
|
getMockPath(dep: string): string;
|
|
105
|
-
getDependencyMock(id: string):
|
|
104
|
+
getDependencyMock(id: string): MockedModule | undefined;
|
|
106
105
|
normalizePath(path: string): string;
|
|
107
106
|
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
108
107
|
mockObject(object: Record<string | symbol, any>, mockExports?: Record<string | symbol, any>, behavior?: MockedModuleType): Record<string | symbol, any>;
|
|
@@ -133,6 +132,7 @@ declare class VitestExecutor extends ViteNodeRunner {
|
|
|
133
132
|
Symbol: typeof Symbol;
|
|
134
133
|
};
|
|
135
134
|
get state(): WorkerGlobalState;
|
|
135
|
+
get moduleExecutionInfo(): ModuleExecutionInfo | undefined;
|
|
136
136
|
shouldResolveId(id: string, _importee?: string | undefined): boolean;
|
|
137
137
|
originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
|
|
138
138
|
resolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
|
package/dist/execute.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { File as File$1, TaskResultPack as TaskResultPack$1, TaskEventPack, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
|
|
2
2
|
export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
3
|
-
import { S as SerializedTestSpecification,
|
|
4
|
-
import { W as WorkerContext$1 } from './chunks/worker.
|
|
3
|
+
import { S as SerializedTestSpecification, c as CoverageProvider$1, a as ReportContext$1, g as CoverageProviderModule$1, h as CoverageReporter$1, i as CoverageProviderName, j as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, k as CoverageIstanbulOptions$1, d as CoverageV8Options$1, l as CustomProviderOptions$1, m as Reporter$1, V as Vitest$1, n as BrowserScript$1, o as BrowserConfigOptions$1, p as BuiltinEnvironment$1, q as VitestEnvironment$1, P as Pool$1, r as PoolOptions$1, s as CSSModuleScopeStrategy$1, A as ApiConfig$1, t as VitestRunMode$1, D as DepsOptimizationOptions$1, u as TransformModePatterns$1, I as InlineConfig$1, v as TypecheckConfig$1, w as UserConfig$1, x as ResolvedConfig$1, y as ProjectConfig$1, U as UserWorkspaceConfig$1, z as BenchmarkUserOptions$1 } from './chunks/reporters.QZ837uWx.js';
|
|
4
|
+
import { W as WorkerContext$1 } from './chunks/worker.B2JXutr8.js';
|
|
5
5
|
import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/global.CnI8_G5V.js';
|
|
6
|
-
import {
|
|
6
|
+
import { b as Awaitable$1, U as UserConsoleLog, M as ModuleGraphData, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.d8YfPkTm.js';
|
|
7
7
|
export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d8YfPkTm.js';
|
|
8
|
-
import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.
|
|
9
|
-
export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.
|
|
10
|
-
import './chunks/vite.
|
|
8
|
+
import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.DaAIyCKm.js';
|
|
9
|
+
export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.DaAIyCKm.js';
|
|
10
|
+
import './chunks/vite.vM3UZq1q.js';
|
|
11
11
|
import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.BRtC-JeT.js';
|
|
12
12
|
export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.BRtC-JeT.js';
|
|
13
13
|
import { ExpectStatic } from '@vitest/expect';
|
|
@@ -15,7 +15,7 @@ export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStati
|
|
|
15
15
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
16
16
|
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
|
|
17
17
|
import { M as MockFactoryWithHelper, a as MockOptions } from './chunks/mocker.cRtM890J.js';
|
|
18
|
-
export { b as bench } from './chunks/suite.
|
|
18
|
+
export { b as bench } from './chunks/suite.qtkXWc6R.js';
|
|
19
19
|
export { a as BenchFunction, b as Benchmark, c as BenchmarkAPI, B as BenchmarkResult } from './chunks/benchmark.CFFwLv-O.js';
|
|
20
20
|
export { ExpectTypeOf, expectTypeOf } from 'expect-type';
|
|
21
21
|
export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
|
|
@@ -112,7 +112,7 @@ declare function runOnce<T>(fn: () => T, key?: string): T;
|
|
|
112
112
|
*/
|
|
113
113
|
declare function isFirstRun(): boolean;
|
|
114
114
|
|
|
115
|
-
declare function getRunningMode():
|
|
115
|
+
declare function getRunningMode(): 'watch' | 'run';
|
|
116
116
|
declare function isWatchMode(): boolean;
|
|
117
117
|
|
|
118
118
|
type WaitForCallback<T> = () => T | Promise<T>;
|
|
@@ -203,7 +203,7 @@ interface VitestUtils {
|
|
|
203
203
|
*/
|
|
204
204
|
setSystemTime: (time: number | string | Date) => VitestUtils;
|
|
205
205
|
/**
|
|
206
|
-
* Returns mocked current date
|
|
206
|
+
* Returns mocked current date. If date is not mocked the method will return `null`.
|
|
207
207
|
*/
|
|
208
208
|
getMockedSystemTime: () => Date | null;
|
|
209
209
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.
|
|
1
|
+
export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.DT3m61kS.js';
|
|
2
2
|
export { i as isFirstRun, a as runOnce } from './chunks/run-once.2ogXb3JV.js';
|
|
3
|
-
export { a as assertType, g as getRunningMode, i as isWatchMode } from './chunks/index.
|
|
3
|
+
export { a as assertType, g as getRunningMode, i as isWatchMode } from './chunks/index.B8haHJlQ.js';
|
|
4
4
|
export { b as bench } from './chunks/benchmark.Cdu9hjj4.js';
|
|
5
5
|
export { expectTypeOf } from 'expect-type';
|
|
6
6
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|