vitest 5.1.0 → 5.1.2
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/browser.d.ts +6 -5
- package/dist/browser.js +7 -7
- package/dist/chunks/{base.Cof-UHJf.js → base.DCg6Jh4N.js} +12 -12
- package/dist/chunks/{browser.d.C7tWgUvw.d.ts → browser.d.B-QwH_F6.d.ts} +3 -3
- package/dist/chunks/{cac.BYbt0aJp.js → cac.DnNTZKhD.js} +15 -10
- package/dist/chunks/{cli-api.COfZo8lK.js → cli-api.9v9AxcPO.js} +444 -161
- package/dist/chunks/{config.d.B3YV4t0O.d.ts → config.d.BpJq6tRA.d.ts} +7 -1
- package/dist/chunks/{console.CQZ877Hi.js → console.DdxlsSsm.js} +4 -4
- package/dist/chunks/{creator.DHWmytIK.js → creator.B-BIoERb.js} +13 -11
- package/dist/chunks/{display.BlTmubjj.js → display.Cj2h2zsY.js} +1 -1
- package/dist/chunks/{doctor.B-oPbwps.js → doctor.DBFXC86z.js} +1 -1
- package/dist/chunks/{environment.d.BFQtFKdZ.d.ts → environment.d.rlpAM-ON.d.ts} +1 -1
- package/dist/chunks/{globals.ZKtKSkEf.js → globals.Cz5RAf6U.js} +10 -10
- package/dist/chunks/{index.Di8au7q4.js → index.6pLw0FLK.js} +220 -91
- package/dist/chunks/{index.w_oBZ9N8.js → index.BSqmIH9v.js} +3 -3
- package/dist/chunks/{index.Bi0NXYPf.js → index.C7Nn66Gy.js} +21 -9
- package/dist/chunks/{index.DmDMHCg8.js → index.CAmut2NG.js} +25 -1
- package/dist/chunks/{index.CZzC1gGg.js → index.D5jWOaqm.js} +35 -22
- package/dist/chunks/{index.D0heQG4v.js → index.Or9psEGe.js} +1 -1
- package/dist/chunks/{init-forks.BaDXQSD8.js → init-forks.q4IoGYZe.js} +7 -1
- package/dist/chunks/{init-threads.ZX_Vov0z.js → init-threads.Bf1Frg9S.js} +1 -1
- package/dist/chunks/{init.CO4AB7HZ.js → init.dGO4K2C0.js} +16 -8
- package/dist/chunks/{inspector.CvyFGlXm.js → inspector.D6o1NPo1.js} +12 -1
- package/dist/chunks/{modules.BJuCwlRJ.js → moduleSourceMap.Dp1WduWi.js} +31 -1
- package/dist/chunks/{native.upB-V0CK.js → native.D5q1ylZC.js} +2 -1
- package/dist/chunks/{nativeModuleMocker.Dh5azSB4.js → nativeModuleMocker.ihb3q7Cg.js} +4 -2
- package/dist/chunks/{plugin.d.LRFSN46m.d.ts → plugin.d.Bx2wJglX.d.ts} +58 -75
- package/dist/chunks/{plugins.DPQHVT0p.js → plugins.BPruPOR8.js} +1 -1
- package/dist/chunks/{rawSnapshot.DqSiqIEx.js → rawSnapshot.DvoRLRNr.js} +2 -2
- package/dist/chunks/{rpc.Uhkwr2NM.js → rpc.CNYWPa97.js} +3 -19
- package/dist/chunks/{rpc.d.3FOhdFx8.d.ts → rpc.d.DHfuwqP0.d.ts} +2 -2
- package/dist/chunks/{run.CjdgFZiW.js → run.zBhXlcZQ.js} +113 -49
- package/dist/chunks/{setup-common.CqAQCXzx.js → setup-common.kEGtNVHG.js} +3 -3
- package/dist/chunks/{source-map.DakdQc29.js → source-map.DPHGMWvM.js} +3 -1
- package/dist/chunks/{source-map.d.BkG8YK_3.d.ts → source-map.d.xB6_75fl.d.ts} +2 -1
- package/dist/chunks/{spy.DDMXghXv.js → spy.BO0hTE3G.js} +76 -53
- package/dist/chunks/{task-utils.d.D-gFPNFi.d.ts → task-utils.d.DgSjIb7r.d.ts} +1 -1
- package/dist/chunks/{utils.BBk_icFG.js → utils.sAsh2ClK.js} +2 -6
- package/dist/chunks/{vm.b4MbCAJQ.js → vm.DNr3Eju_.js} +4 -4
- package/dist/chunks/{worker.d.CyJRpyfZ.d.ts → worker.d.BigfbIsH.d.ts} +3 -3
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +8 -8
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/module-evaluator.js +1 -1
- package/dist/node.d.ts +11 -10
- package/dist/node.js +18 -15
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.js +5 -3
- package/dist/spy.js +1 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +19 -18
- package/dist/workers/forks.js +20 -19
- package/dist/workers/runVmTests.js +14 -14
- package/dist/workers/threads.js +20 -19
- package/dist/workers/vmForks.js +14 -13
- package/dist/workers/vmThreads.js +14 -13
- package/dist/workers/watchdog.js +20 -0
- package/package.json +21 -21
- /package/dist/chunks/{index.BoyTG_B7.js → dist.BoyTG_B7.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as setSafeTimers } from './source-map.
|
|
2
|
-
import { a as addSerializer } from './plugins.
|
|
1
|
+
import { s as setSafeTimers } from './source-map.DPHGMWvM.js';
|
|
2
|
+
import { a as addSerializer } from './plugins.BPruPOR8.js';
|
|
3
3
|
|
|
4
4
|
let globalSetup = false;
|
|
5
5
|
async function setupCommonEnv(config) {
|
|
@@ -7,7 +7,7 @@ async function setupCommonEnv(config) {
|
|
|
7
7
|
if (globalSetup) return;
|
|
8
8
|
globalSetup = true;
|
|
9
9
|
setSafeTimers();
|
|
10
|
-
if (config.globals) (await import('./globals.
|
|
10
|
+
if (config.globals) (await import('./globals.Cz5RAf6U.js')).registerApiGlobally();
|
|
11
11
|
}
|
|
12
12
|
function setupDefines(config) {
|
|
13
13
|
for (const key in config.defines) globalThis[key] = config.defines[key];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from './index.
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './index.Or9psEGe.js';
|
|
2
2
|
import { p as isPrimitive, q as notNullish, r as resolve$1 } from './pathe.M-eThtNZ.zq3TM4NT.js';
|
|
3
3
|
|
|
4
4
|
var build = {};
|
|
@@ -1758,6 +1758,7 @@ class DecodedMap {
|
|
|
1758
1758
|
_decoded;
|
|
1759
1759
|
_decodedMemo;
|
|
1760
1760
|
url;
|
|
1761
|
+
file;
|
|
1761
1762
|
version;
|
|
1762
1763
|
names = [];
|
|
1763
1764
|
resolvedSources;
|
|
@@ -1769,6 +1770,7 @@ class DecodedMap {
|
|
|
1769
1770
|
this._encoded = mappings || "";
|
|
1770
1771
|
this._decodedMemo = memoizedState();
|
|
1771
1772
|
this.url = from;
|
|
1773
|
+
this.file = from;
|
|
1772
1774
|
this.resolvedSources = (sources || []).map((s) => resolve$1(from, "..", s || ""));
|
|
1773
1775
|
}
|
|
1774
1776
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TestError, P as ParsedStack } from './config.d.
|
|
1
|
+
import { T as TestError, P as ParsedStack } from './config.d.BpJq6tRA.js';
|
|
2
2
|
|
|
3
3
|
interface RuntimeCoverageModuleLoader {
|
|
4
4
|
import: (id: string) => Promise<{
|
|
@@ -73,6 +73,7 @@ declare class DecodedMap {
|
|
|
73
73
|
_decoded: undefined | number[][][];
|
|
74
74
|
_decodedMemo: Stats;
|
|
75
75
|
url: string;
|
|
76
|
+
file: string;
|
|
76
77
|
version: number;
|
|
77
78
|
names: string[];
|
|
78
79
|
resolvedSources: string[];
|
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
// Tests can spy on these globals, and mocks call them internally.
|
|
2
|
+
// `Promise` is not here because zone.js replaces it after Vitest loads.
|
|
3
|
+
const { bind, call } = Function.prototype;
|
|
4
|
+
const uncurryThis = bind.bind(call);
|
|
5
|
+
const ReflectApply = Reflect.apply;
|
|
6
|
+
const ReflectConstruct = Reflect.construct;
|
|
7
|
+
const ReflectDeleteProperty = Reflect.deleteProperty;
|
|
8
|
+
const ReflectOwnKeys = Reflect.ownKeys;
|
|
9
|
+
const ObjectDefineProperty = Object.defineProperty;
|
|
10
|
+
const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
11
|
+
const ObjectGetPrototypeOf = Object.getPrototypeOf;
|
|
12
|
+
const ObjectSetPrototypeOf = Object.setPrototypeOf;
|
|
13
|
+
const WeakRef = globalThis.WeakRef;
|
|
14
|
+
const ArrayPrototypeAt = uncurryThis(Array.prototype.at);
|
|
15
|
+
const ArrayPrototypePush = uncurryThis(Array.prototype.push);
|
|
16
|
+
const ArrayPrototypeShift = uncurryThis(Array.prototype.shift);
|
|
17
|
+
const SetPrototypeAdd = uncurryThis(Set.prototype.add);
|
|
18
|
+
const SetPrototypeClear = uncurryThis(Set.prototype.clear);
|
|
19
|
+
const SetPrototypeDelete = uncurryThis(Set.prototype.delete);
|
|
20
|
+
const SetPrototypeHas = uncurryThis(Set.prototype.has);
|
|
21
|
+
const WeakMapPrototypeGet = uncurryThis(WeakMap.prototype.get);
|
|
22
|
+
const WeakMapPrototypeSet = uncurryThis(WeakMap.prototype.set);
|
|
23
|
+
const WeakRefPrototypeDeref = uncurryThis(WeakRef.prototype.deref);
|
|
24
|
+
const FinalizationRegistryPrototypeRegister = uncurryThis(FinalizationRegistry.prototype.register);
|
|
25
|
+
const StringPrototypeIncludes = uncurryThis(String.prototype.includes);
|
|
26
|
+
|
|
1
27
|
function isMockFunction(fn) {
|
|
2
28
|
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
|
|
3
29
|
}
|
|
@@ -9,38 +35,36 @@ const DIRTY_MOCK_STATES = /* @__PURE__ */ new Set();
|
|
|
9
35
|
// Mocks whose implementation, once-queue or name changed since their last
|
|
10
36
|
// `mockReset()`, so `resetAllMocks()` only visits mocks that are not already reset
|
|
11
37
|
const DIRTY_MOCK_CONFIGS = /* @__PURE__ */ new Set();
|
|
12
|
-
// a test may spy on `Set.prototype.add`, and the spy itself marks mocks dirty
|
|
13
|
-
const addToSet = Set.prototype.add;
|
|
14
38
|
const MOCK_REFS = /* @__PURE__ */ new WeakMap();
|
|
15
39
|
const MOCK_FINALIZER = new FinalizationRegistry((ref) => {
|
|
16
|
-
DIRTY_MOCK_STATES
|
|
17
|
-
DIRTY_MOCK_CONFIGS
|
|
40
|
+
SetPrototypeDelete(DIRTY_MOCK_STATES, ref);
|
|
41
|
+
SetPrototypeDelete(DIRTY_MOCK_CONFIGS, ref);
|
|
18
42
|
});
|
|
19
43
|
const MOCK_CONFIGS = /* @__PURE__ */ new WeakMap();
|
|
20
44
|
const MOCKS_BY_STATE = /* @__PURE__ */ new WeakMap();
|
|
21
45
|
function markDirty(set, mock) {
|
|
22
|
-
let ref = MOCK_REFS
|
|
46
|
+
let ref = WeakMapPrototypeGet(MOCK_REFS, mock);
|
|
23
47
|
if (!ref) {
|
|
24
48
|
ref = new WeakRef(mock);
|
|
25
|
-
MOCK_REFS
|
|
26
|
-
MOCK_FINALIZER
|
|
49
|
+
WeakMapPrototypeSet(MOCK_REFS, mock, ref);
|
|
50
|
+
FinalizationRegistryPrototypeRegister(MOCK_FINALIZER, mock, ref);
|
|
27
51
|
}
|
|
28
|
-
|
|
52
|
+
SetPrototypeAdd(set, ref);
|
|
29
53
|
}
|
|
30
54
|
function unmarkDirty(set, mock) {
|
|
31
|
-
const ref = MOCK_REFS
|
|
32
|
-
if (ref) set
|
|
55
|
+
const ref = WeakMapPrototypeGet(MOCK_REFS, mock);
|
|
56
|
+
if (ref) SetPrototypeDelete(set, ref);
|
|
33
57
|
}
|
|
34
58
|
function forEachDirty(set, fn) {
|
|
35
59
|
for (const ref of set) {
|
|
36
|
-
const mock = ref
|
|
60
|
+
const mock = WeakRefPrototypeDeref(ref);
|
|
37
61
|
if (mock) fn(mock);
|
|
38
|
-
else set
|
|
62
|
+
else SetPrototypeDelete(set, ref);
|
|
39
63
|
}
|
|
40
64
|
}
|
|
41
65
|
function createMockInstance(options = {}) {
|
|
42
66
|
const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;
|
|
43
|
-
if (restore) MOCK_RESTORE
|
|
67
|
+
if (restore) SetPrototypeAdd(MOCK_RESTORE, restore);
|
|
44
68
|
const config = getDefaultConfig(originalImplementation);
|
|
45
69
|
const state = getDefaultState();
|
|
46
70
|
const mock = createMock({
|
|
@@ -49,7 +73,7 @@ function createMockInstance(options = {}) {
|
|
|
49
73
|
...options
|
|
50
74
|
});
|
|
51
75
|
const mockLength = (mockImplementation || originalImplementation)?.length ?? 0;
|
|
52
|
-
|
|
76
|
+
ObjectDefineProperty(mock, "length", {
|
|
53
77
|
writable: true,
|
|
54
78
|
enumerable: false,
|
|
55
79
|
value: mockLength,
|
|
@@ -59,8 +83,8 @@ function createMockInstance(options = {}) {
|
|
|
59
83
|
// this is used by `vi.spyOn()` for better debugging.
|
|
60
84
|
// when `vi.fn()` is called, we just use the default string
|
|
61
85
|
if (resetToMockName) config.mockName = mock.name || "vi.fn()";
|
|
62
|
-
MOCK_CONFIGS
|
|
63
|
-
MOCKS_BY_STATE
|
|
86
|
+
WeakMapPrototypeSet(MOCK_CONFIGS, mock, config);
|
|
87
|
+
WeakMapPrototypeSet(MOCKS_BY_STATE, state, mock);
|
|
64
88
|
mock._isMockFunction = true;
|
|
65
89
|
mock.getMockImplementation = () => {
|
|
66
90
|
// Jest only returns `config.mockImplementation` here,
|
|
@@ -74,7 +98,7 @@ function createMockInstance(options = {}) {
|
|
|
74
98
|
const updateMockPrototype = () => {
|
|
75
99
|
if (!options.prototypeMembers?.length) reparentMockPrototype(mock, config.onceMockImplementations[0] || config.mockImplementation || originalImplementation);
|
|
76
100
|
};
|
|
77
|
-
|
|
101
|
+
ObjectDefineProperty(mock, "mock", {
|
|
78
102
|
configurable: false,
|
|
79
103
|
enumerable: true,
|
|
80
104
|
writable: false,
|
|
@@ -88,7 +112,7 @@ function createMockInstance(options = {}) {
|
|
|
88
112
|
};
|
|
89
113
|
mock.mockImplementationOnce = function mockImplementationOnce(implementation) {
|
|
90
114
|
markDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
91
|
-
config.onceMockImplementations
|
|
115
|
+
ArrayPrototypePush(config.onceMockImplementations, implementation);
|
|
92
116
|
updateMockPrototype();
|
|
93
117
|
return mock;
|
|
94
118
|
};
|
|
@@ -254,13 +278,13 @@ function spyOn(object, key, accessor) {
|
|
|
254
278
|
};
|
|
255
279
|
if (accessType !== "value") delete desc.writable;
|
|
256
280
|
desc[accessType] = cb;
|
|
257
|
-
|
|
281
|
+
ObjectDefineProperty(object, key, desc);
|
|
258
282
|
};
|
|
259
283
|
const restore = () => {
|
|
260
284
|
// if method is defined on the prototype, we can just remove it from
|
|
261
285
|
// the current object instead of redefining a copy of it
|
|
262
|
-
if (originalDescriptorObject !== object)
|
|
263
|
-
else if (originalDescriptor && !original)
|
|
286
|
+
if (originalDescriptorObject !== object) ReflectDeleteProperty(object, key);
|
|
287
|
+
else if (originalDescriptor && !original) ObjectDefineProperty(object, key, originalDescriptor);
|
|
264
288
|
else reassign(original);
|
|
265
289
|
};
|
|
266
290
|
const mock = createMockInstance({
|
|
@@ -271,19 +295,19 @@ function spyOn(object, key, accessor) {
|
|
|
271
295
|
try {
|
|
272
296
|
reassign(ssr ? () => mock : mock);
|
|
273
297
|
} catch (error) {
|
|
274
|
-
if (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === "Module" && (error.message
|
|
298
|
+
if (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === "Module" && (StringPrototypeIncludes(error.message, "Cannot redefine property") || StringPrototypeIncludes(error.message, "Cannot replace module namespace") || StringPrototypeIncludes(error.message, "can't redefine non-configurable property"))) throw new TypeError(`Cannot spy on export "${String(key)}". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/mocking/modules#mocking-a-module`, { cause: error });
|
|
275
299
|
throw error;
|
|
276
300
|
}
|
|
277
301
|
return mock;
|
|
278
302
|
}
|
|
279
303
|
function getDescriptor(obj, method) {
|
|
280
|
-
const objDescriptor =
|
|
304
|
+
const objDescriptor = ObjectGetOwnPropertyDescriptor(obj, method);
|
|
281
305
|
if (objDescriptor) return [obj, objDescriptor];
|
|
282
|
-
let currentProto =
|
|
306
|
+
let currentProto = ObjectGetPrototypeOf(obj);
|
|
283
307
|
while (currentProto !== null) {
|
|
284
|
-
const descriptor =
|
|
308
|
+
const descriptor = ObjectGetOwnPropertyDescriptor(currentProto, method);
|
|
285
309
|
if (descriptor) return [currentProto, descriptor];
|
|
286
|
-
currentProto =
|
|
310
|
+
currentProto = ObjectGetPrototypeOf(currentProto);
|
|
287
311
|
}
|
|
288
312
|
}
|
|
289
313
|
function assert(condition, message) {
|
|
@@ -295,7 +319,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
|
|
|
295
319
|
const pseudoOriginal = mockImplementation;
|
|
296
320
|
const name = mockName || original?.name || "Mock";
|
|
297
321
|
const noopImplementation = function() {};
|
|
298
|
-
const prototypeMock = prototypeState && MOCKS_BY_STATE
|
|
322
|
+
const prototypeMock = prototypeState && WeakMapPrototypeGet(MOCKS_BY_STATE, prototypeState);
|
|
299
323
|
const namedObject = {
|
|
300
324
|
// to keep the name of the function intact
|
|
301
325
|
[name]: function(...args) {
|
|
@@ -316,7 +340,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
|
|
|
316
340
|
const context = new.target ? void 0 : this;
|
|
317
341
|
const [instanceIndex, instancePrototypeIndex] = registerInstance(context, state, prototypeState);
|
|
318
342
|
const [contextIndex, contextPrototypeIndex] = registerContext(context, state, prototypeState);
|
|
319
|
-
const implementation = config.onceMockImplementations
|
|
343
|
+
const implementation = ArrayPrototypeShift(config.onceMockImplementations) || config.mockImplementation || prototypeConfig && ArrayPrototypeShift(prototypeConfig.onceMockImplementations) || prototypeConfig?.mockImplementation || original || noopImplementation;
|
|
320
344
|
let returnValue;
|
|
321
345
|
let thrownValue;
|
|
322
346
|
let didThrow = false;
|
|
@@ -330,7 +354,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
|
|
|
330
354
|
mock,
|
|
331
355
|
implementation === noopImplementation ? void 0 : implementation
|
|
332
356
|
);
|
|
333
|
-
returnValue =
|
|
357
|
+
returnValue = ReflectConstruct(implementation, args, new.target);
|
|
334
358
|
// jest calls this before the implementation, but we have to resolve this _after_
|
|
335
359
|
// because we cannot do it before the `Reflect.construct` called the custom implementation.
|
|
336
360
|
// fortunately, the constructor is always an empty function because `prototypeMethods`
|
|
@@ -342,7 +366,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
|
|
|
342
366
|
if (prototypeMock !== mock.prototype[prop]) continue;
|
|
343
367
|
const isMock = isMockFunction(prototypeMock);
|
|
344
368
|
const prototypeState = isMock ? prototypeMock.mock : void 0;
|
|
345
|
-
const prototypeConfig = isMock ? MOCK_CONFIGS
|
|
369
|
+
const prototypeConfig = isMock ? WeakMapPrototypeGet(MOCK_CONFIGS, prototypeMock) : void 0;
|
|
346
370
|
returnValue[prop] = createMockInstance({
|
|
347
371
|
originalImplementation: keepMembersImplementation ? prototypeConfig?.mockOriginal : void 0,
|
|
348
372
|
prototypeState,
|
|
@@ -350,11 +374,11 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
|
|
|
350
374
|
keepMembersImplementation
|
|
351
375
|
});
|
|
352
376
|
}
|
|
353
|
-
} else returnValue = implementation
|
|
377
|
+
} else returnValue = ReflectApply(implementation, this, args);
|
|
354
378
|
} catch (error) {
|
|
355
379
|
thrownValue = error;
|
|
356
380
|
didThrow = true;
|
|
357
|
-
if (error instanceof TypeError && error.message
|
|
381
|
+
if (error instanceof TypeError && StringPrototypeIncludes(error.message, "is not a constructor")) console.warn(`[vitest] The ${namedObject[name].getMockName()} mock did not use 'function' or 'class' in its implementation, see https://vitest.dev/api/vi#vi-spyon for examples.`);
|
|
358
382
|
throw error;
|
|
359
383
|
} finally {
|
|
360
384
|
if (didThrow) {
|
|
@@ -401,36 +425,36 @@ function reparentMockPrototype(mock, implementation) {
|
|
|
401
425
|
// function) reverts the chain to `Object.prototype`, the parent every mock
|
|
402
426
|
// is created with
|
|
403
427
|
const parent = implementation?.prototype ?? Object.prototype;
|
|
404
|
-
if (mockPrototype !== parent &&
|
|
428
|
+
if (mockPrototype !== parent && ObjectGetPrototypeOf(mockPrototype) !== parent) ObjectSetPrototypeOf(mockPrototype, parent);
|
|
405
429
|
}
|
|
406
430
|
function registerCalls(args, state, prototypeState) {
|
|
407
|
-
state.calls
|
|
408
|
-
prototypeState
|
|
431
|
+
ArrayPrototypePush(state.calls, args);
|
|
432
|
+
if (prototypeState) ArrayPrototypePush(prototypeState.calls, args);
|
|
409
433
|
}
|
|
410
434
|
function registerInvocationOrder(order, state, prototypeState) {
|
|
411
|
-
state.invocationCallOrder
|
|
412
|
-
prototypeState
|
|
435
|
+
ArrayPrototypePush(state.invocationCallOrder, order);
|
|
436
|
+
if (prototypeState) ArrayPrototypePush(prototypeState.invocationCallOrder, order);
|
|
413
437
|
}
|
|
414
438
|
function registerResult(result, state, prototypeState) {
|
|
415
|
-
state.results
|
|
416
|
-
prototypeState
|
|
439
|
+
ArrayPrototypePush(state.results, result);
|
|
440
|
+
if (prototypeState) ArrayPrototypePush(prototypeState.results, result);
|
|
417
441
|
}
|
|
418
442
|
function registerSettledResult(result, state, prototypeState) {
|
|
419
|
-
state.settledResults
|
|
420
|
-
prototypeState
|
|
443
|
+
ArrayPrototypePush(state.settledResults, result);
|
|
444
|
+
if (prototypeState) ArrayPrototypePush(prototypeState.settledResults, result);
|
|
421
445
|
}
|
|
422
446
|
function registerInstance(instance, state, prototypeState) {
|
|
423
|
-
return [state.instances
|
|
447
|
+
return [ArrayPrototypePush(state.instances, instance), prototypeState && ArrayPrototypePush(prototypeState.instances, instance)];
|
|
424
448
|
}
|
|
425
449
|
function registerContext(context, state, prototypeState) {
|
|
426
|
-
return [state.contexts
|
|
450
|
+
return [ArrayPrototypePush(state.contexts, context), prototypeState && ArrayPrototypePush(prototypeState.contexts, context)];
|
|
427
451
|
}
|
|
428
452
|
function copyOriginalStaticProperties(mock, original) {
|
|
429
453
|
const { properties, descriptors } = getAllProperties(original);
|
|
430
454
|
for (const key of properties) {
|
|
431
455
|
const descriptor = descriptors[key];
|
|
432
456
|
if (getDescriptor(mock, key)) continue;
|
|
433
|
-
|
|
457
|
+
ObjectDefineProperty(mock, key, descriptor);
|
|
434
458
|
}
|
|
435
459
|
}
|
|
436
460
|
const ignoreProperties = /* @__PURE__ */ new Set([
|
|
@@ -440,16 +464,15 @@ const ignoreProperties = /* @__PURE__ */ new Set([
|
|
|
440
464
|
Symbol.for("nodejs.util.promisify.custom")
|
|
441
465
|
]);
|
|
442
466
|
function getAllProperties(original) {
|
|
443
|
-
const properties =
|
|
467
|
+
const properties = [];
|
|
444
468
|
const descriptors = {};
|
|
445
469
|
while (original && original !== Object.prototype && original !== Function.prototype) {
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
descriptors[prop] = Object.getOwnPropertyDescriptor(original, prop);
|
|
470
|
+
for (const prop of ReflectOwnKeys(original)) {
|
|
471
|
+
if (descriptors[prop] || SetPrototypeHas(ignoreProperties, prop)) continue;
|
|
472
|
+
ArrayPrototypePush(properties, prop);
|
|
473
|
+
descriptors[prop] = ObjectGetOwnPropertyDescriptor(original, prop);
|
|
451
474
|
}
|
|
452
|
-
original =
|
|
475
|
+
original = ObjectGetPrototypeOf(original);
|
|
453
476
|
}
|
|
454
477
|
return {
|
|
455
478
|
properties,
|
|
@@ -473,14 +496,14 @@ function getDefaultState() {
|
|
|
473
496
|
settledResults: [],
|
|
474
497
|
results: [],
|
|
475
498
|
get lastCall() {
|
|
476
|
-
return state.calls
|
|
499
|
+
return ArrayPrototypeAt(state.calls, -1);
|
|
477
500
|
}
|
|
478
501
|
};
|
|
479
502
|
return state;
|
|
480
503
|
}
|
|
481
504
|
function restoreAllMocks() {
|
|
482
505
|
for (const restore of MOCK_RESTORE) restore();
|
|
483
|
-
MOCK_RESTORE
|
|
506
|
+
SetPrototypeClear(MOCK_RESTORE);
|
|
484
507
|
}
|
|
485
508
|
function clearAllMocks() {
|
|
486
509
|
forEachDirty(DIRTY_MOCK_STATES, (mock) => mock.mockClear());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="chai" />
|
|
2
|
-
import { bq as SnapshotState, n as Test, br as PromisifyAssertion, bs as Tester, bt as Plugin, ae as BenchResult, a as File } from './config.d.
|
|
2
|
+
import { bq as SnapshotState, n as Test, br as PromisifyAssertion, bs as Tester, bt as Plugin, ae as BenchResult, a as File } from './config.d.BpJq6tRA.js';
|
|
3
3
|
|
|
4
4
|
interface SnapshotMatcher<
|
|
5
5
|
R extends void | Promise<void>,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from 'node:util';
|
|
2
|
-
import { t as truncateString$1 } from './display.
|
|
2
|
+
import { t as truncateString$1 } from './display.Cj2h2zsY.js';
|
|
3
3
|
import { i as isAbsolute, a as relative, d as dirname, b as basename, s as slash } from './pathe.M-eThtNZ.zq3TM4NT.js';
|
|
4
4
|
import { $ } from './tinyrainbow.Do8I1XRG.js';
|
|
5
5
|
|
|
@@ -87,9 +87,6 @@ function renderSnapshotSummary(rootDir, snapshots) {
|
|
|
87
87
|
}
|
|
88
88
|
return summary;
|
|
89
89
|
}
|
|
90
|
-
function countTestErrors(tasks) {
|
|
91
|
-
return tasks.reduce((c, i) => c + (i.result?.errors?.length || 0), 0);
|
|
92
|
-
}
|
|
93
90
|
function getStateString(tasks, name = "tests", showTotal = true) {
|
|
94
91
|
if (tasks.length === 0) return $.dim(`no ${name}`);
|
|
95
92
|
const passed = tasks.reduce((acc, i) => {
|
|
@@ -166,7 +163,6 @@ function noun(count, singular, plural) {
|
|
|
166
163
|
|
|
167
164
|
var utils = /*#__PURE__*/Object.freeze({
|
|
168
165
|
__proto__: null,
|
|
169
|
-
countTestErrors: countTestErrors,
|
|
170
166
|
divider: divider,
|
|
171
167
|
errorBanner: errorBanner,
|
|
172
168
|
formatProjectName: formatProjectName,
|
|
@@ -184,4 +180,4 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
184
180
|
withLabel: withLabel
|
|
185
181
|
});
|
|
186
182
|
|
|
187
|
-
export { F_TREE_NODE_MIDDLE as F, F_TREE_NODE_END as a, F_CHECK as b, F_POINTER as c, F_DOWN_RIGHT as d, formatProjectName as e, formatTimeString as f, getStateSymbol as g, getStateString as h, formatTime as i,
|
|
183
|
+
export { F_TREE_NODE_MIDDLE as F, F_TREE_NODE_END as a, F_CHECK as b, F_POINTER as c, F_DOWN_RIGHT as d, formatProjectName as e, formatTimeString as f, getStateSymbol as g, getStateString as h, formatTime as i, errorBanner as j, divider as k, F_RIGHT as l, getCols as m, noun as n, truncateString as o, padSummaryTitle as p, renderSnapshotSummary as r, separator as s, taskFail as t, utils as u, withLabel as w };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
2
2
|
import v8 from 'node:v8';
|
|
3
3
|
import vm, { isContext, runInContext } from 'node:vm';
|
|
4
|
-
import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.
|
|
4
|
+
import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.dGO4K2C0.js';
|
|
5
5
|
import { distDir } from '../path.js';
|
|
6
|
-
import { createCustomConsole } from './console.
|
|
6
|
+
import { createCustomConsole } from './console.DdxlsSsm.js';
|
|
7
7
|
import fs__default from 'node:fs';
|
|
8
8
|
import { createRequire, Module, isBuiltin } from 'node:module';
|
|
9
9
|
import { d as dirname, k as extname, b as basename, C as CSS_LANGS_RE, l as KNOWN_ASSET_RE, t as toArray, m as splitFileAndPostfix, n as normalize, o as isBareImport, r as resolve } from './pathe.M-eThtNZ.zq3TM4NT.js';
|
|
10
10
|
import { l as lookupPackageScopeType } from './resolver.BzpmeQeT.js';
|
|
11
11
|
import { initSync, parse } from 'es-module-lexer';
|
|
12
12
|
import { dirname as dirname$1 } from 'node:path';
|
|
13
|
-
import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.
|
|
13
|
+
import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.C7Nn66Gy.js';
|
|
14
14
|
import { getDefaultRequestStubs } from '../module-evaluator.js';
|
|
15
|
-
import { b as setupEnv } from './setup-common.
|
|
15
|
+
import { b as setupEnv } from './setup-common.kEGtNVHG.js';
|
|
16
16
|
import { p as provideWorkerState } from './utils.DYj33du9.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EvaluatedModules } from 'vite/module-runner';
|
|
2
|
-
import { F as FileSpecification, b as SerializedConfig, Y as Task, Z as CancelReason } from './config.d.
|
|
3
|
-
import { a as RuntimeRPC, R as RunnerRPC, G as GetterTracker } from './rpc.d.
|
|
4
|
-
import { E as Environment } from './environment.d.
|
|
2
|
+
import { F as FileSpecification, b as SerializedConfig, Y as Task, Z as CancelReason } from './config.d.BpJq6tRA.js';
|
|
3
|
+
import { a as RuntimeRPC, R as RunnerRPC, G as GetterTracker } from './rpc.d.DHfuwqP0.js';
|
|
4
|
+
import { E as Environment } from './environment.d.rlpAM-ON.js';
|
|
5
5
|
|
|
6
6
|
//#region src/messages.d.ts
|
|
7
7
|
declare const TYPE_REQUEST: "q";
|
package/dist/cli.js
CHANGED
package/dist/config.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { HookHandler, UserConfig, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { F as FieldsWithDefaultValues, U as UserWorkspaceConfig, a as UserProjectConfigFn, b as UserProjectConfigExport } from './chunks/plugin.d.
|
|
3
|
+
import { F as FieldsWithDefaultValues, U as UserWorkspaceConfig, a as UserProjectConfigFn, b as UserProjectConfigExport } from './chunks/plugin.d.Bx2wJglX.js';
|
|
4
4
|
import { InlineConfig, ResolvedConfig, VitestPluginContext, CoverageOptions } from './node.js';
|
|
5
|
-
export { T as TestProjectConfiguration, c as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/plugin.d.
|
|
5
|
+
export { T as TestProjectConfiguration, c as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/plugin.d.Bx2wJglX.js';
|
|
6
6
|
import { FakeTimersConfig } from './index.js';
|
|
7
|
-
export { g as TestTagDefinition } from './chunks/config.d.
|
|
7
|
+
export { g as TestTagDefinition } from './chunks/config.d.BpJq6tRA.js';
|
|
8
8
|
import 'node:stream';
|
|
9
|
-
import './chunks/browser.d.
|
|
10
|
-
import './chunks/rpc.d.
|
|
9
|
+
import './chunks/browser.d.B-QwH_F6.js';
|
|
10
|
+
import './chunks/rpc.d.DHfuwqP0.js';
|
|
11
11
|
import 'vite/module-runner';
|
|
12
|
-
import './chunks/worker.d.
|
|
13
|
-
import './chunks/environment.d.
|
|
12
|
+
import './chunks/worker.d.BigfbIsH.js';
|
|
13
|
+
import './chunks/environment.d.rlpAM-ON.js';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import 'vitest/optional-types.js';
|
|
16
16
|
import '@vitest/mocker';
|
|
17
|
-
import './chunks/source-map.d.
|
|
17
|
+
import './chunks/source-map.d.xB6_75fl.js';
|
|
18
18
|
import 'vitest/browser';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:console';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/// <reference types="chai" />
|
|
2
|
-
import { a as File, A as Awaitable, h as TestAnnotation, j as TestArtifact, k as TaskResultPack, l as TaskEventPack, U as UserConsoleLog, m as SerializedRootConfig, L as LabelColor, M as ModuleGraphData, n as Test, o as TaskPopulated, E as ExpectStatic, p as ProvidedContext, q as MatcherState, r as SyncExpectationResult, t as AsyncExpectationResult, u as DomainSnapshotAdapter, v as ExpectationResult, w as Procedure, x as Mock, e as FakeTimersConfig, y as TemporalTimelike, z as spyOn, B as fn, C as MaybeMockedDeep, G as MaybeMocked, H as MaybePartiallyMocked, I as MaybePartiallyMockedDeep, J as MockInstance, R as RuntimeOptions, K as TestAPI, N as SuiteCollector, O as SuiteAPI, Q as Suite, W as SuiteHooks, V as VitestRunner, b as SerializedConfig, X as VitestRunnerImportSource, Y as Task, Z as CancelReason, $ as TestTryOptions, a0 as TestContext, a1 as ImportDuration, a2 as createChainable } from './chunks/config.d.
|
|
3
|
-
export { a3 as AfterSuiteRunMeta, a4 as Assertion, a5 as AsymmetricMatchersContaining, a6 as BaselineData, a7 as Bench, a8 as BenchFn, a9 as BenchFnOptions, aa as BenchFromSource, ab as BenchOptions, ac as BenchRegistration, ad as BenchRegistrationInput, ae as BenchResult, af as BenchRunOptions, ag as BenchStorage, ah as BenchmarkGroup, ai as BenchmarkProvider, aj as BrowserTraceArtifact, ak as DeeplyAllowMatchers, D as DiffOptions, al as DomainMatchResult, am as FailureScreenshotArtifact, an as JestAssertion, ao as Matcher, ap as Matchers, aq as MatchersObject, ar as MockContext, as as MockResult, at as MockResultIncomplete, au as MockResultReturn, av as MockResultThrow, aw as MockSettledResult, ax as MockSettledResultFulfilled, ay as MockSettledResultIncomplete, az as MockSettledResultRejected, aA as Mocked, aB as MockedClass, aC as MockedFunction, aD as MockedObject, aE as OnTestFailedHandler, aF as OnTestFinishedHandler, P as ParsedStack, aG as RunMode, aH as RunnerTaskBase, aI as RunnerTaskResult, aJ as RunnerTaskResultAttempt, aK as RuntimeConfig, S as SerializedCoverageConfig, aL as SerializedError, aM as SnapshotData, aN as SnapshotMatchOptions, aO as SnapshotResult, aP as SnapshotSerializer, aQ as SnapshotStateOptions, aR as SnapshotSummary, aS as SnapshotUpdateState, aT as SuiteFactory, aU as SuiteOptions, aV as TaskCustomOptions, aW as TaskMeta, aX as TaskState, aY as TestAnnotationArtifact, aZ as TestAnnotationLocation, a_ as TestArtifactBase, a$ as TestArtifactLocation, b0 as TestArtifactRegistry, b1 as TestAttachment, b2 as TestBenchmark, b3 as TestBenchmarkTask, T as TestError, b4 as TestFunction, b5 as TestOptions, g as TestTagDefinition, b6 as TestTags, b7 as UncheckedSnapshot, b8 as VisualRegressionArtifact, b9 as afterAll, ba as afterEach, bb as aroundAll, bc as aroundEach, bd as beforeAll, be as beforeEach, bf as onTestFailed, bg as onTestFinished } from './chunks/config.d.
|
|
4
|
-
import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.
|
|
5
|
-
export { B as BrowserTesterOptions } from './chunks/browser.d.
|
|
6
|
-
import { c as createFileTask } from './chunks/task-utils.d.
|
|
7
|
-
import { B as BirpcReturn } from './chunks/worker.d.
|
|
8
|
-
export { C as ContextRPC, a as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
2
|
+
import { a as File, A as Awaitable, h as TestAnnotation, j as TestArtifact, k as TaskResultPack, l as TaskEventPack, U as UserConsoleLog, m as SerializedRootConfig, L as LabelColor, M as ModuleGraphData, n as Test, o as TaskPopulated, E as ExpectStatic, p as ProvidedContext, q as MatcherState, r as SyncExpectationResult, t as AsyncExpectationResult, u as DomainSnapshotAdapter, v as ExpectationResult, w as Procedure, x as Mock, e as FakeTimersConfig, y as TemporalTimelike, z as spyOn, B as fn, C as MaybeMockedDeep, G as MaybeMocked, H as MaybePartiallyMocked, I as MaybePartiallyMockedDeep, J as MockInstance, R as RuntimeOptions, K as TestAPI, N as SuiteCollector, O as SuiteAPI, Q as Suite, W as SuiteHooks, V as VitestRunner, b as SerializedConfig, X as VitestRunnerImportSource, Y as Task, Z as CancelReason, $ as TestTryOptions, a0 as TestContext, a1 as ImportDuration, a2 as createChainable } from './chunks/config.d.BpJq6tRA.js';
|
|
3
|
+
export { a3 as AfterSuiteRunMeta, a4 as Assertion, a5 as AsymmetricMatchersContaining, a6 as BaselineData, a7 as Bench, a8 as BenchFn, a9 as BenchFnOptions, aa as BenchFromSource, ab as BenchOptions, ac as BenchRegistration, ad as BenchRegistrationInput, ae as BenchResult, af as BenchRunOptions, ag as BenchStorage, ah as BenchmarkGroup, ai as BenchmarkProvider, aj as BrowserTraceArtifact, ak as DeeplyAllowMatchers, D as DiffOptions, al as DomainMatchResult, am as FailureScreenshotArtifact, an as JestAssertion, ao as Matcher, ap as Matchers, aq as MatchersObject, ar as MockContext, as as MockResult, at as MockResultIncomplete, au as MockResultReturn, av as MockResultThrow, aw as MockSettledResult, ax as MockSettledResultFulfilled, ay as MockSettledResultIncomplete, az as MockSettledResultRejected, aA as Mocked, aB as MockedClass, aC as MockedFunction, aD as MockedObject, aE as OnTestFailedHandler, aF as OnTestFinishedHandler, P as ParsedStack, aG as RunMode, aH as RunnerTaskBase, aI as RunnerTaskResult, aJ as RunnerTaskResultAttempt, aK as RuntimeConfig, S as SerializedCoverageConfig, aL as SerializedError, aM as SnapshotData, aN as SnapshotMatchOptions, aO as SnapshotResult, aP as SnapshotSerializer, aQ as SnapshotStateOptions, aR as SnapshotSummary, aS as SnapshotUpdateState, aT as SuiteFactory, aU as SuiteOptions, aV as TaskCustomOptions, aW as TaskMeta, aX as TaskState, aY as TestAnnotationArtifact, aZ as TestAnnotationLocation, a_ as TestArtifactBase, a$ as TestArtifactLocation, b0 as TestArtifactRegistry, b1 as TestAttachment, b2 as TestBenchmark, b3 as TestBenchmarkTask, T as TestError, b4 as TestFunction, b5 as TestOptions, g as TestTagDefinition, b6 as TestTags, b7 as UncheckedSnapshot, b8 as VisualRegressionArtifact, b9 as afterAll, ba as afterEach, bb as aroundAll, bc as aroundEach, bd as beforeAll, be as beforeEach, bf as onTestFailed, bg as onTestFinished } from './chunks/config.d.BpJq6tRA.js';
|
|
4
|
+
import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.B-QwH_F6.js';
|
|
5
|
+
export { B as BrowserTesterOptions } from './chunks/browser.d.B-QwH_F6.js';
|
|
6
|
+
import { c as createFileTask } from './chunks/task-utils.d.DgSjIb7r.js';
|
|
7
|
+
import { B as BirpcReturn } from './chunks/worker.d.BigfbIsH.js';
|
|
8
|
+
export { C as ContextRPC, a as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.BigfbIsH.js';
|
|
9
9
|
import { Disposable } from 'vitest/optional-runtime-types.js';
|
|
10
10
|
import { ModuleMockFactoryWithHelper, ModuleMockOptions } from '@vitest/mocker';
|
|
11
11
|
export { V as EvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
|
|
12
|
-
import { T as Traces } from './chunks/rpc.d.
|
|
13
|
-
export { R as RunnerRPC, a as RuntimeRPC } from './chunks/rpc.d.
|
|
12
|
+
import { T as Traces } from './chunks/rpc.d.DHfuwqP0.js';
|
|
13
|
+
export { R as RunnerRPC, a as RuntimeRPC } from './chunks/rpc.d.DHfuwqP0.js';
|
|
14
14
|
export { ExpectTypeOf, expectTypeOf } from 'expect-type';
|
|
15
15
|
export { BenchOptions as BenchCompareOptions } from 'tinybench';
|
|
16
16
|
import * as chai from 'chai';
|
|
17
17
|
export { chai };
|
|
18
18
|
import 'vite/module-runner';
|
|
19
|
-
import './chunks/environment.d.
|
|
19
|
+
import './chunks/environment.d.rlpAM-ON.js';
|
|
20
20
|
|
|
21
21
|
interface SourceMap {
|
|
22
22
|
file: string;
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.
|
|
2
|
-
export { V as EvaluatedModules } from './chunks/
|
|
3
|
-
export {
|
|
1
|
+
export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.D5jWOaqm.js';
|
|
2
|
+
export { V as EvaluatedModules } from './chunks/index.CAmut2NG.js';
|
|
3
|
+
export { l as afterAll, n as afterEach, o as aroundAll, q as aroundEach, t as beforeAll, u as beforeEach, v as describe, w as it, x as onTestFailed, y as onTestFinished, e as recordArtifact, z as suite, A as test } from './chunks/run.zBhXlcZQ.js';
|
|
4
4
|
export { expectTypeOf } from 'expect-type';
|
|
5
5
|
import * as chai from 'chai';
|
|
6
6
|
export { chai };
|
|
7
7
|
import './chunks/utils.DYj33du9.js';
|
|
8
|
-
import './chunks/source-map.
|
|
9
|
-
import './chunks/index.
|
|
8
|
+
import './chunks/source-map.DPHGMWvM.js';
|
|
9
|
+
import './chunks/index.Or9psEGe.js';
|
|
10
10
|
import './chunks/tinyrainbow.Do8I1XRG.js';
|
|
11
11
|
import './chunks/pathe.M-eThtNZ.zq3TM4NT.js';
|
|
12
|
-
import './chunks/spy.
|
|
13
|
-
import './chunks/display.
|
|
12
|
+
import './chunks/spy.BO0hTE3G.js';
|
|
13
|
+
import './chunks/display.Cj2h2zsY.js';
|
|
14
14
|
import './task-utils.js';
|
|
15
|
-
import './chunks/plugins.
|
|
16
|
-
import './chunks/rawSnapshot.
|
|
15
|
+
import './chunks/plugins.BPruPOR8.js';
|
|
16
|
+
import './chunks/rawSnapshot.DvoRLRNr.js';
|
|
17
17
|
import './chunks/offset.Dy-5Fdfn.js';
|
|
18
18
|
import 'tinybench';
|
|
19
|
+
import './chunks/rpc.CNYWPa97.js';
|
|
19
20
|
import 'vite/module-runner';
|
|
20
|
-
import './chunks/index.DmDMHCg8.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode } from 'vite/module-runner';
|
|
2
|
-
import { G as GetterTracker } from './chunks/rpc.d.
|
|
2
|
+
import { G as GetterTracker } from './chunks/rpc.d.DHfuwqP0.js';
|
|
3
3
|
import { RuntimeRPC } from './index.js';
|
|
4
4
|
import { EvaluatedModules as VitestEvaluatedModules } from './index.js';
|
|
5
5
|
import vm from 'node:vm';
|
|
6
|
-
import './chunks/config.d.
|
|
6
|
+
import './chunks/config.d.BpJq6tRA.js';
|
|
7
7
|
import 'vitest/optional-runtime-types.js';
|
|
8
8
|
import 'tinybench';
|
|
9
9
|
|
|
@@ -174,7 +174,7 @@ declare class VitestModuleEvaluator implements ModuleEvaluator {
|
|
|
174
174
|
private debug;
|
|
175
175
|
private _otel;
|
|
176
176
|
private _evaluatedModules?;
|
|
177
|
-
constructor(vmOptions?: VitestVmOptions | undefined
|
|
177
|
+
constructor(options?: VitestModuleEvaluatorOptions, vmOptions?: VitestVmOptions | undefined);
|
|
178
178
|
private convertIdToImportUrl;
|
|
179
179
|
runExternalModule(id: string): Promise<any>;
|
|
180
180
|
runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
|
package/dist/module-evaluator.js
CHANGED
|
@@ -63,7 +63,7 @@ class VitestModuleEvaluator {
|
|
|
63
63
|
debug = new ModuleDebug();
|
|
64
64
|
_otel;
|
|
65
65
|
_evaluatedModules;
|
|
66
|
-
constructor(
|
|
66
|
+
constructor(options = {}, vmOptions) {
|
|
67
67
|
this.options = options;
|
|
68
68
|
this._otel = options.traces || new Traces({ enabled: false });
|
|
69
69
|
this.env = options.metaEnv ?? createImportMetaEnvProxy();
|