vitest 4.0.0-beta.11 → 4.0.0-beta.12
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 +4 -101
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +2 -2
- package/dist/chunks/{benchmark.LXhJ0F0X.js → benchmark.DHKMYAts.js} +1 -1
- package/dist/chunks/{browser.d.Dx7DO_Ce.d.ts → browser.d.D9YV3JvA.d.ts} +1 -1
- package/dist/chunks/{cac.elvK37c9.js → cac.r1gel_VZ.js} +16 -9
- package/dist/chunks/{cli-api.C7plPyhs.js → cli-api.CpywZzJV.js} +95 -148
- package/dist/chunks/{config.d.B_LthbQq.d.ts → config.d.DGazh2r6.d.ts} +3 -1
- package/dist/chunks/{console.CiTi59Jy.js → console.CTJL2nuH.js} +3 -5
- package/dist/chunks/{coverage.CG6Uhorw.js → coverage.CiB0fs_7.js} +44 -62
- package/dist/chunks/{creator.08Gi-vCA.js → creator.DfXDsUyL.js} +6 -8
- package/dist/chunks/{global.d.BK3X7FW1.d.ts → global.d.BcFPD2LN.d.ts} +0 -13
- package/dist/chunks/{globals.BjvYA-AD.js → globals.DC4ntO86.js} +5 -5
- package/dist/chunks/{index.DIWhzsUh.js → index.Bt-upxGS.js} +6 -12
- package/dist/chunks/{index.BwBttQPf.js → index.CHrBLuEH.js} +33 -38
- package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
- package/dist/chunks/{index.AZOjjqWP.js → index.Dnl38iQ_.js} +2 -2
- package/dist/chunks/{index.BhY64fF0.js → index.uLUz1RDt.js} +1 -1
- package/dist/chunks/{inspector.CvQD-Nie.js → inspector.Br76Q2Mb.js} +1 -4
- package/dist/chunks/{moduleRunner.d.BNa-CL9e.d.ts → moduleRunner.d.CeYc7nZ0.d.ts} +1 -1
- package/dist/chunks/{node.BsdMi6DV.js → node.BwAWWjHZ.js} +2 -3
- package/dist/chunks/{plugin.d.C5phQR6o.d.ts → plugin.d.XreRXLXS.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CVzhsTvK.d.ts → reporters.d.CJVTaaWb.d.ts} +39 -3
- package/dist/chunks/{resolveSnapshotEnvironment.DQVamkje.js → resolveSnapshotEnvironment.BsJpmVZR.js} +7 -8
- package/dist/chunks/{rpc.jKGRSXIH.js → rpc.cD77ENhU.js} +12 -13
- package/dist/chunks/{setup-common.NAWRuMRP.js → setup-common.BewgbkTd.js} +5 -5
- package/dist/chunks/{startModuleRunner.oAuCu1yL.js → startModuleRunner.DPBo3mme.js} +40 -48
- package/dist/chunks/{test.KC5tH8hC.js → test.CTuWuHYH.js} +5 -5
- package/dist/chunks/{typechecker.gXq-5P3n.js → typechecker.BfOQ86_a.js} +54 -77
- package/dist/chunks/{utils.DGKhod2J.js → utils.CG9h5ccR.js} +1 -4
- package/dist/chunks/{vi.CiJ0Laa6.js → vi.B2--mG9U.js} +35 -144
- package/dist/chunks/{worker.rPGLlbkW.js → worker.DVTUM2IW.js} +11 -15
- package/dist/chunks/{worker.d.B_Fd9M_w.d.ts → worker.d.buwuBpBt.d.ts} +1 -1
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +6 -6
- package/dist/coverage.d.ts +5 -5
- package/dist/coverage.js +3 -3
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +5 -5
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/module-evaluator.js +10 -12
- package/dist/module-runner.js +2 -2
- package/dist/node.d.ts +8 -8
- package/dist/node.js +10 -10
- package/dist/reporters.d.ts +5 -5
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +6 -6
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker-base.js +30 -32
- package/dist/worker-vm.js +19 -30
- package/dist/workers/runVmTests.js +10 -10
- package/package.json +18 -19
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { chai
|
|
1
|
+
import { chai, equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters, customMatchers } from '@vitest/expect';
|
|
2
2
|
import { getCurrentTest } from '@vitest/runner';
|
|
3
3
|
import { getNames, getTestName } from '@vitest/runner/utils';
|
|
4
|
-
import { g as getWorkerState, i as isChildProcess, w as waitForImportsToResolve, r as resetModules } from './utils.
|
|
4
|
+
import { g as getWorkerState, i as isChildProcess, w as waitForImportsToResolve, r as resetModules } from './utils.CG9h5ccR.js';
|
|
5
5
|
import { getSafeTimers } from '@vitest/utils/timers';
|
|
6
|
-
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers.BFTU3MAI.js';
|
|
7
6
|
import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot';
|
|
8
7
|
import '@vitest/utils/error';
|
|
9
8
|
import { assertTypes, createSimpleStackTrace } from '@vitest/utils/helpers';
|
|
10
9
|
import { fn, spyOn, restoreAllMocks, resetAllMocks, clearAllMocks, isMockFunction } from '@vitest/spy';
|
|
11
10
|
import '@vitest/utils/offset';
|
|
12
11
|
import { parseSingleStack } from '@vitest/utils/source-map';
|
|
12
|
+
import { c as commonjsGlobal } from './_commonjsHelpers.BFTU3MAI.js';
|
|
13
13
|
import { R as RealDate, r as resetDate, m as mockDate } from './date.-jtEtIeV.js';
|
|
14
14
|
|
|
15
15
|
// these matchers are not supported because they don't make sense with poll
|
|
@@ -27,13 +27,13 @@ const unsupported = [
|
|
|
27
27
|
];
|
|
28
28
|
function createExpectPoll(expect) {
|
|
29
29
|
return function poll(fn, options = {}) {
|
|
30
|
-
const
|
|
30
|
+
const defaults = getWorkerState().config.expect?.poll ?? {}, { interval = defaults.interval ?? 50, timeout = defaults.timeout ?? 1e3, message } = options, assertion = expect(null, message).withContext({ poll: true });
|
|
31
31
|
fn = fn.bind(assertion);
|
|
32
|
-
const test = chai
|
|
32
|
+
const test = chai.util.flag(assertion, "vitest-test");
|
|
33
33
|
if (!test) throw new Error("expect.poll() must be called inside a test");
|
|
34
34
|
const proxy = new Proxy(assertion, { get(target, key, receiver) {
|
|
35
35
|
const assertionFunction = Reflect.get(target, key, receiver);
|
|
36
|
-
if (typeof assertionFunction !== "function") return assertionFunction instanceof chai
|
|
36
|
+
if (typeof assertionFunction !== "function") return assertionFunction instanceof chai.Assertion ? proxy : assertionFunction;
|
|
37
37
|
if (key === "assert") return assertionFunction;
|
|
38
38
|
if (typeof key === "string" && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`);
|
|
39
39
|
return function(...args) {
|
|
@@ -41,15 +41,15 @@ function createExpectPoll(expect) {
|
|
|
41
41
|
let intervalId, timeoutId, lastError;
|
|
42
42
|
const { setTimeout, clearTimeout } = getSafeTimers(), check = async () => {
|
|
43
43
|
try {
|
|
44
|
-
chai
|
|
44
|
+
chai.util.flag(assertion, "_name", key);
|
|
45
45
|
const obj = await fn();
|
|
46
|
-
chai
|
|
46
|
+
chai.util.flag(assertion, "object", obj), resolve(await assertionFunction.call(assertion, ...args)), clearTimeout(intervalId), clearTimeout(timeoutId);
|
|
47
47
|
} catch (err) {
|
|
48
|
-
if (lastError = err, !chai
|
|
48
|
+
if (lastError = err, !chai.util.flag(assertion, "_isLastPollAttempt")) intervalId = setTimeout(check, interval);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
timeoutId = setTimeout(() => {
|
|
52
|
-
clearTimeout(intervalId), chai
|
|
52
|
+
clearTimeout(intervalId), chai.util.flag(assertion, "_isLastPollAttempt", true);
|
|
53
53
|
const rejectWithCause = (error) => {
|
|
54
54
|
if (error.cause == null) error.cause = /* @__PURE__ */ new Error("Matcher did not succeed in time.");
|
|
55
55
|
reject(copyStackTrace$1(error, STACK_TRACE_ERROR));
|
|
@@ -60,7 +60,7 @@ function createExpectPoll(expect) {
|
|
|
60
60
|
let awaited = false;
|
|
61
61
|
test.onFinished ??= [], test.onFinished.push(() => {
|
|
62
62
|
if (!awaited) {
|
|
63
|
-
const negated = chai
|
|
63
|
+
const negated = chai.util.flag(assertion, "negate") ? "not." : "", assertionString = `expect.${chai.util.flag(assertion, "_poll.element") ? "element(locator)" : "poll(assertion)"}.${negated}${String(key)}()`, error = /* @__PURE__ */ new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:\n\nawait ${assertionString}\n`);
|
|
64
64
|
throw copyStackTrace$1(error, STACK_TRACE_ERROR);
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -89,108 +89,9 @@ function copyStackTrace$1(target, source) {
|
|
|
89
89
|
return target;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
function commonjsRequire(path) {
|
|
93
|
-
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
var chaiSubset$1 = {exports: {}};
|
|
97
|
-
|
|
98
|
-
var chaiSubset = chaiSubset$1.exports;
|
|
99
|
-
|
|
100
|
-
var hasRequiredChaiSubset;
|
|
101
|
-
|
|
102
|
-
function requireChaiSubset () {
|
|
103
|
-
if (hasRequiredChaiSubset) return chaiSubset$1.exports;
|
|
104
|
-
hasRequiredChaiSubset = 1;
|
|
105
|
-
(function (module, exports) {
|
|
106
|
-
(function() {
|
|
107
|
-
(function(chaiSubset) {
|
|
108
|
-
if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') {
|
|
109
|
-
return module.exports = chaiSubset;
|
|
110
|
-
} else {
|
|
111
|
-
return chai.use(chaiSubset);
|
|
112
|
-
}
|
|
113
|
-
})(function(chai, utils) {
|
|
114
|
-
var Assertion = chai.Assertion;
|
|
115
|
-
var assertionPrototype = Assertion.prototype;
|
|
116
|
-
|
|
117
|
-
Assertion.addMethod('containSubset', function (expected) {
|
|
118
|
-
var actual = utils.flag(this, 'object');
|
|
119
|
-
var showDiff = chai.config.showDiff;
|
|
120
|
-
|
|
121
|
-
assertionPrototype.assert.call(this,
|
|
122
|
-
compare(expected, actual),
|
|
123
|
-
'expected #{act} to contain subset #{exp}',
|
|
124
|
-
'expected #{act} to not contain subset #{exp}',
|
|
125
|
-
expected,
|
|
126
|
-
actual,
|
|
127
|
-
showDiff
|
|
128
|
-
);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
chai.assert.containSubset = function(val, exp, msg) {
|
|
132
|
-
new chai.Assertion(val, msg).to.be.containSubset(exp);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
function compare(expected, actual) {
|
|
136
|
-
if (expected === actual) {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
if (typeof(actual) !== typeof(expected)) {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
if (typeof(expected) !== 'object' || expected === null) {
|
|
143
|
-
return expected === actual;
|
|
144
|
-
}
|
|
145
|
-
if (!!expected && !actual) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (Array.isArray(expected)) {
|
|
150
|
-
if (typeof(actual.length) !== 'number') {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
var aa = Array.prototype.slice.call(actual);
|
|
154
|
-
return expected.every(function (exp) {
|
|
155
|
-
return aa.some(function (act) {
|
|
156
|
-
return compare(exp, act);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (expected instanceof Date) {
|
|
162
|
-
if (actual instanceof Date) {
|
|
163
|
-
return expected.getTime() === actual.getTime();
|
|
164
|
-
} else {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return Object.keys(expected).every(function (key) {
|
|
170
|
-
var eo = expected[key];
|
|
171
|
-
var ao = actual[key];
|
|
172
|
-
if (typeof(eo) === 'object' && eo !== null && ao !== null) {
|
|
173
|
-
return compare(eo, ao);
|
|
174
|
-
}
|
|
175
|
-
if (typeof(eo) === 'function') {
|
|
176
|
-
return eo(ao);
|
|
177
|
-
}
|
|
178
|
-
return ao === eo;
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
}).call(chaiSubset);
|
|
184
|
-
} (chaiSubset$1));
|
|
185
|
-
return chaiSubset$1.exports;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
var chaiSubsetExports = requireChaiSubset();
|
|
189
|
-
var Subset = /*@__PURE__*/getDefaultExportFromCjs(chaiSubsetExports);
|
|
190
|
-
|
|
191
92
|
function createAssertionMessage(util, assertion, hasArgs) {
|
|
192
|
-
const not = util.flag(assertion, "negate") ? "not." : "", name = `${util.flag(assertion, "_name")}(${"expected" })`, promiseName = util.flag(assertion, "promise")
|
|
193
|
-
return `expect(actual)${
|
|
93
|
+
const not = util.flag(assertion, "negate") ? "not." : "", name = `${util.flag(assertion, "_name")}(${"expected" })`, promiseName = util.flag(assertion, "promise");
|
|
94
|
+
return `expect(actual)${promiseName ? `.${promiseName}` : ""}.${not}${name}`;
|
|
194
95
|
}
|
|
195
96
|
function recordAsyncExpect(_test, promise, assertion, error) {
|
|
196
97
|
const test = _test;
|
|
@@ -206,7 +107,7 @@ function recordAsyncExpect(_test, promise, assertion, error) {
|
|
|
206
107
|
let resolved = false;
|
|
207
108
|
return test.onFinished ??= [], test.onFinished.push(() => {
|
|
208
109
|
if (!resolved) {
|
|
209
|
-
const
|
|
110
|
+
const stack = (globalThis.__vitest_worker__?.onFilterStackTrace || ((s) => s || ""))(error.stack);
|
|
210
111
|
console.warn([
|
|
211
112
|
`Promise returned by \`${assertion}\` was not awaited. `,
|
|
212
113
|
"Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ",
|
|
@@ -264,9 +165,7 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
264
165
|
return test;
|
|
265
166
|
}
|
|
266
167
|
for (const key of ["matchSnapshot", "toMatchSnapshot"]) utils.addMethod(chai.Assertion.prototype, key, function(properties, message) {
|
|
267
|
-
utils.flag(this, "_name", key);
|
|
268
|
-
const isNot = utils.flag(this, "negate");
|
|
269
|
-
if (isNot) throw new Error(`${key} cannot be used with "not"`);
|
|
168
|
+
if (utils.flag(this, "_name", key), utils.flag(this, "negate")) throw new Error(`${key} cannot be used with "not"`);
|
|
270
169
|
const expected = utils.flag(this, "object"), test = getTest(key, this);
|
|
271
170
|
if (typeof properties === "string" && typeof message === "undefined") message = properties, properties = void 0;
|
|
272
171
|
const errorMessage = utils.flag(this, "message");
|
|
@@ -280,9 +179,7 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
280
179
|
});
|
|
281
180
|
});
|
|
282
181
|
utils.addMethod(chai.Assertion.prototype, "toMatchFileSnapshot", function(file, message) {
|
|
283
|
-
utils.flag(this, "_name", "toMatchFileSnapshot");
|
|
284
|
-
const isNot = utils.flag(this, "negate");
|
|
285
|
-
if (isNot) throw new Error("toMatchFileSnapshot cannot be used with \"not\"");
|
|
182
|
+
if (utils.flag(this, "_name", "toMatchFileSnapshot"), utils.flag(this, "negate")) throw new Error("toMatchFileSnapshot cannot be used with \"not\"");
|
|
286
183
|
const error = /* @__PURE__ */ new Error("resolves"), expected = utils.flag(this, "object"), test = getTest("toMatchFileSnapshot", this), errorMessage = utils.flag(this, "message"), promise = getSnapshotClient().assertRaw({
|
|
287
184
|
received: expected,
|
|
288
185
|
message,
|
|
@@ -293,11 +190,9 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
293
190
|
});
|
|
294
191
|
return recordAsyncExpect(test, promise, createAssertionMessage(utils, this), error);
|
|
295
192
|
}), utils.addMethod(chai.Assertion.prototype, "toMatchInlineSnapshot", function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
296
|
-
utils.flag(this, "_name", "toMatchInlineSnapshot");
|
|
297
|
-
const
|
|
298
|
-
if (
|
|
299
|
-
const test = getTest("toMatchInlineSnapshot", this), isInsideEach = test.each || test.suite?.each;
|
|
300
|
-
if (isInsideEach) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
193
|
+
if (utils.flag(this, "_name", "toMatchInlineSnapshot"), utils.flag(this, "negate")) throw new Error("toMatchInlineSnapshot cannot be used with \"not\"");
|
|
194
|
+
const test = getTest("toMatchInlineSnapshot", this);
|
|
195
|
+
if (test.each || test.suite?.each) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
301
196
|
const expected = utils.flag(this, "object"), error = utils.flag(this, "error");
|
|
302
197
|
if (typeof properties === "string") message = inlineSnapshot, inlineSnapshot = properties, properties = void 0;
|
|
303
198
|
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
@@ -313,9 +208,7 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
313
208
|
...getTestNames(test)
|
|
314
209
|
});
|
|
315
210
|
}), utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingSnapshot", function(message) {
|
|
316
|
-
utils.flag(this, "_name", "toThrowErrorMatchingSnapshot");
|
|
317
|
-
const isNot = utils.flag(this, "negate");
|
|
318
|
-
if (isNot) throw new Error("toThrowErrorMatchingSnapshot cannot be used with \"not\"");
|
|
211
|
+
if (utils.flag(this, "_name", "toThrowErrorMatchingSnapshot"), utils.flag(this, "negate")) throw new Error("toThrowErrorMatchingSnapshot cannot be used with \"not\"");
|
|
319
212
|
const expected = utils.flag(this, "object"), test = getTest("toThrowErrorMatchingSnapshot", this), promise = utils.flag(this, "promise"), errorMessage = utils.flag(this, "message");
|
|
320
213
|
getSnapshotClient().assert({
|
|
321
214
|
received: getError(expected, promise),
|
|
@@ -324,10 +217,9 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
324
217
|
...getTestNames(test)
|
|
325
218
|
});
|
|
326
219
|
}), utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingInlineSnapshot", function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (isInsideEach) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
220
|
+
if (utils.flag(this, "negate")) throw new Error("toThrowErrorMatchingInlineSnapshot cannot be used with \"not\"");
|
|
221
|
+
const test = getTest("toThrowErrorMatchingInlineSnapshot", this);
|
|
222
|
+
if (test.each || test.suite?.each) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
331
223
|
const expected = utils.flag(this, "object"), error = utils.flag(this, "error"), promise = utils.flag(this, "promise"), errorMessage = utils.flag(this, "message");
|
|
332
224
|
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
333
225
|
getSnapshotClient().assert({
|
|
@@ -342,16 +234,16 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
342
234
|
}), utils.addMethod(chai.expect, "addSnapshotSerializer", addSerializer);
|
|
343
235
|
};
|
|
344
236
|
|
|
345
|
-
chai
|
|
237
|
+
chai.use(JestExtend), chai.use(JestChaiExpect), chai.use(SnapshotPlugin), chai.use(JestAsymmetricMatchers);
|
|
346
238
|
|
|
347
239
|
function createExpect(test) {
|
|
348
240
|
const expect = ((value, message) => {
|
|
349
241
|
const { assertionCalls } = getState(expect);
|
|
350
242
|
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
351
|
-
const assert = chai
|
|
243
|
+
const assert = chai.expect(value, message), _test = test || getCurrentTest();
|
|
352
244
|
return _test ? assert.withTest(_test) : assert;
|
|
353
245
|
});
|
|
354
|
-
Object.assign(expect, chai
|
|
246
|
+
Object.assign(expect, chai.expect), Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT]), expect.getState = () => getState(expect), expect.setState = (state) => setState(state, expect);
|
|
355
247
|
// @ts-expect-error global is not typed
|
|
356
248
|
const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
|
|
357
249
|
setState({
|
|
@@ -365,11 +257,11 @@ function createExpect(test) {
|
|
|
365
257
|
return getWorkerState().filepath;
|
|
366
258
|
},
|
|
367
259
|
currentTestName: test ? getTestName(test) : globalState.currentTestName
|
|
368
|
-
}, expect), expect.extend = (matchers) => chai
|
|
260
|
+
}, expect), expect.extend = (matchers) => chai.expect.extend(expect, matchers), expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters), expect.soft = (...args) => {
|
|
369
261
|
// @ts-expect-error private soft access
|
|
370
262
|
return expect(...args).withContext({ soft: true });
|
|
371
263
|
}, expect.poll = createExpectPoll(expect), expect.unreachable = (message) => {
|
|
372
|
-
chai
|
|
264
|
+
chai.assert.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
|
|
373
265
|
};
|
|
374
266
|
function assertions(expected) {
|
|
375
267
|
const errorGen = () => /* @__PURE__ */ new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
|
|
@@ -387,7 +279,7 @@ function createExpect(test) {
|
|
|
387
279
|
isExpectingAssertionsError: error
|
|
388
280
|
});
|
|
389
281
|
}
|
|
390
|
-
return chai
|
|
282
|
+
return chai.util.addMethod(expect, "assertions", assertions), chai.util.addMethod(expect, "hasAssertions", hasAssertions), expect.extend(customMatchers), expect;
|
|
391
283
|
}
|
|
392
284
|
const globalExpect = createExpect();
|
|
393
285
|
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
@@ -395,16 +287,15 @@ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
|
395
287
|
writable: true,
|
|
396
288
|
configurable: true
|
|
397
289
|
});
|
|
398
|
-
const assert = chai
|
|
399
|
-
const should = chai
|
|
290
|
+
const assert = chai.assert;
|
|
291
|
+
const should = chai.should;
|
|
400
292
|
|
|
401
293
|
/**
|
|
402
294
|
* Gives access to injected context provided from the main thread.
|
|
403
295
|
* This usually returns a value provided by `globalSetup` or an external library.
|
|
404
296
|
*/
|
|
405
297
|
function inject(key) {
|
|
406
|
-
|
|
407
|
-
return workerState.providedContext[key];
|
|
298
|
+
return getWorkerState().providedContext[key];
|
|
408
299
|
}
|
|
409
300
|
|
|
410
301
|
var fakeTimersSrc = {};
|
|
@@ -3859,10 +3750,10 @@ function _mocker() {
|
|
|
3859
3750
|
} });
|
|
3860
3751
|
}
|
|
3861
3752
|
function getImporter(name) {
|
|
3862
|
-
const
|
|
3753
|
+
const stackArray = createSimpleStackTrace({ stackTraceLimit: 5 }).split("\n"), importerStackIndex = stackArray.findLastIndex((stack) => {
|
|
3863
3754
|
return stack.includes(` at Object.${name}`) || stack.includes(`${name}@`);
|
|
3864
|
-
})
|
|
3865
|
-
return
|
|
3755
|
+
});
|
|
3756
|
+
return parseSingleStack(stackArray[importerStackIndex + 1])?.file || "";
|
|
3866
3757
|
}
|
|
3867
3758
|
|
|
3868
3759
|
export { getSnapshotClient as a, assert as b, createExpect as c, vitest as d, globalExpect as g, inject as i, should as s, vi as v };
|
|
@@ -4,11 +4,11 @@ import { readFileSync } from 'node:fs';
|
|
|
4
4
|
import { isBuiltin } from 'node:module';
|
|
5
5
|
import { pathToFileURL } from 'node:url';
|
|
6
6
|
import { resolve } from 'pathe';
|
|
7
|
-
import { b as VitestTransport } from './startModuleRunner.
|
|
8
|
-
import { e as environments } from './index.
|
|
9
|
-
import { s as setupInspect } from './inspector.
|
|
10
|
-
import { c as createRuntimeRpc, a as rpcDone } from './rpc.
|
|
11
|
-
import { i as isChildProcess } from './utils.
|
|
7
|
+
import { b as VitestTransport } from './startModuleRunner.DPBo3mme.js';
|
|
8
|
+
import { e as environments } from './index.Bt-upxGS.js';
|
|
9
|
+
import { s as setupInspect } from './inspector.Br76Q2Mb.js';
|
|
10
|
+
import { c as createRuntimeRpc, a as rpcDone } from './rpc.cD77ENhU.js';
|
|
11
|
+
import { i as isChildProcess } from './utils.CG9h5ccR.js';
|
|
12
12
|
|
|
13
13
|
function isBuiltinEnvironment(env) {
|
|
14
14
|
return env in environments;
|
|
@@ -24,13 +24,10 @@ async function createEnvironmentLoader(root, rpc) {
|
|
|
24
24
|
transport: new VitestTransport({
|
|
25
25
|
async fetchModule(id, importer, options) {
|
|
26
26
|
const result = await rpc.fetch(id, importer, "__vitest__", options);
|
|
27
|
-
if ("cached" in result) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...result
|
|
32
|
-
};
|
|
33
|
-
}
|
|
27
|
+
if ("cached" in result) return {
|
|
28
|
+
code: readFileSync(result.tmp, "utf-8"),
|
|
29
|
+
...result
|
|
30
|
+
};
|
|
34
31
|
if (isWindows && "externalize" in result)
|
|
35
32
|
// TODO: vitest returns paths for external modules, but Vite returns file://
|
|
36
33
|
// https://github.com/vitejs/vite/pull/20449
|
|
@@ -119,8 +116,7 @@ function parseRegexp(input) {
|
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
if (isChildProcess()) {
|
|
122
|
-
|
|
123
|
-
if (isProfiling)
|
|
119
|
+
if (process.execArgv.some((execArg) => execArg.startsWith("--prof") || execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof") || execArg.startsWith("--diagnostic-dir")))
|
|
124
120
|
// Work-around for nodejs/node#55094
|
|
125
121
|
process.on("SIGTERM", () => {
|
|
126
122
|
process.exit();
|
|
@@ -186,7 +182,7 @@ function createImportMetaEnvProxy() {
|
|
|
186
182
|
];
|
|
187
183
|
return new Proxy(process.env, {
|
|
188
184
|
get(_, key) {
|
|
189
|
-
|
|
185
|
+
if (typeof key === "string") return booleanKeys.includes(key) ? !!process.env[key] : process.env[key];
|
|
190
186
|
},
|
|
191
187
|
set(_, key, value) {
|
|
192
188
|
if (typeof key !== "string") return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CancelReason, File, TestAnnotation, TaskResultPack, TaskEventPack, FileSpecification, Task } from '@vitest/runner';
|
|
2
2
|
import { FetchFunctionOptions, FetchResult, EvaluatedModules } from 'vite/module-runner';
|
|
3
|
-
import { a as SerializedConfig } from './config.d.
|
|
3
|
+
import { a as SerializedConfig } from './config.d.DGazh2r6.js';
|
|
4
4
|
import { F as FetchCachedFileSystemResult, R as ResolveFunctionResult, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d.BsToaxti.js';
|
|
5
5
|
import { SnapshotResult } from '@vitest/snapshot';
|
|
6
6
|
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { c as createCLI } from './chunks/cac.
|
|
1
|
+
import { c as createCLI } from './chunks/cac.r1gel_VZ.js';
|
|
2
2
|
import '@vitest/utils/helpers';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
6
|
import './chunks/constants.D_Q9UYh-.js';
|
|
7
|
-
import './chunks/index.
|
|
7
|
+
import './chunks/index.CHrBLuEH.js';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import 'node:fs/promises';
|
|
10
|
-
import './chunks/typechecker.
|
|
10
|
+
import './chunks/typechecker.BfOQ86_a.js';
|
|
11
11
|
import 'node:os';
|
|
12
12
|
import 'node:perf_hooks';
|
|
13
13
|
import 'tinyexec';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { HookHandler, ConfigEnv, UserConfig } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.
|
|
4
|
-
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.
|
|
5
|
-
import { V as VitestPluginContext } from './chunks/plugin.d.
|
|
6
|
-
import { F as FakeTimerInstallOpts } from './chunks/config.d.
|
|
3
|
+
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.CJVTaaWb.js';
|
|
4
|
+
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.CJVTaaWb.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.XreRXLXS.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.DGazh2r6.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import './chunks/environment.d.BsToaxti.js';
|
|
10
10
|
import 'node:stream';
|
|
11
11
|
import '@vitest/mocker';
|
|
12
12
|
import '@vitest/utils/source-map';
|
|
13
|
-
import './chunks/browser.d.
|
|
14
|
-
import './chunks/worker.d.
|
|
13
|
+
import './chunks/browser.d.D9YV3JvA.js';
|
|
14
|
+
import './chunks/worker.d.buwuBpBt.js';
|
|
15
15
|
import 'vite/module-runner';
|
|
16
16
|
import '@vitest/snapshot';
|
|
17
17
|
import '@vitest/pretty-format';
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.CJVTaaWb.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
3
|
import { A as AfterSuiteRunMeta } from './chunks/environment.d.BsToaxti.js';
|
|
4
4
|
import '@vitest/runner';
|
|
@@ -6,13 +6,13 @@ import '@vitest/utils';
|
|
|
6
6
|
import 'node:stream';
|
|
7
7
|
import '@vitest/mocker';
|
|
8
8
|
import '@vitest/utils/source-map';
|
|
9
|
-
import './chunks/
|
|
10
|
-
import './chunks/worker.d.B_Fd9M_w.js';
|
|
11
|
-
import 'vite/module-runner';
|
|
12
|
-
import './chunks/config.d.B_LthbQq.js';
|
|
9
|
+
import './chunks/config.d.DGazh2r6.js';
|
|
13
10
|
import '@vitest/pretty-format';
|
|
14
11
|
import '@vitest/snapshot';
|
|
15
12
|
import '@vitest/utils/diff';
|
|
13
|
+
import './chunks/browser.d.D9YV3JvA.js';
|
|
14
|
+
import './chunks/worker.d.buwuBpBt.js';
|
|
15
|
+
import 'vite/module-runner';
|
|
16
16
|
import '@vitest/expect';
|
|
17
17
|
import 'vitest/optional-types.js';
|
|
18
18
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
package/dist/coverage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.CiB0fs_7.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:path';
|
|
4
4
|
import '@vitest/utils/helpers';
|
|
@@ -21,13 +21,13 @@ import 'node:util';
|
|
|
21
21
|
import 'vite';
|
|
22
22
|
import './chunks/constants.D_Q9UYh-.js';
|
|
23
23
|
import 'node:tty';
|
|
24
|
+
import './path.js';
|
|
24
25
|
import 'node:events';
|
|
25
26
|
import './chunks/index.Bgo3tNWt.js';
|
|
26
27
|
import 'tinypool';
|
|
27
|
-
import './chunks/typechecker.
|
|
28
|
+
import './chunks/typechecker.BfOQ86_a.js';
|
|
28
29
|
import 'node:perf_hooks';
|
|
29
30
|
import 'tinyexec';
|
|
30
|
-
import './path.js';
|
|
31
31
|
import '@vitest/runner/utils';
|
|
32
32
|
import 'node:worker_threads';
|
|
33
33
|
import './chunks/coverage.D_JHT54q.js';
|
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.Bt-upxGS.js';
|
|
2
2
|
import 'node:console';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { S as SerializedTestSpecification } from './chunks/browser.d.
|
|
2
|
-
export { B as BrowserTesterOptions } from './chunks/browser.d.
|
|
3
|
-
import './chunks/global.d.
|
|
1
|
+
import { S as SerializedTestSpecification } from './chunks/browser.d.D9YV3JvA.js';
|
|
2
|
+
export { B as BrowserTesterOptions } from './chunks/browser.d.D9YV3JvA.js';
|
|
3
|
+
import './chunks/global.d.BcFPD2LN.js';
|
|
4
4
|
import { File, TestAnnotation, TaskResultPack, TaskEventPack, TaskPopulated } from '@vitest/runner';
|
|
5
|
-
export { CancelReason,
|
|
6
|
-
import { B as BirpcReturn } from './chunks/worker.d.
|
|
7
|
-
export { C as ContextRPC, b as ContextTestEnvironment, R as RunnerRPC, a as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
8
|
-
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.
|
|
9
|
-
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.
|
|
5
|
+
export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
|
+
import { B as BirpcReturn } from './chunks/worker.d.buwuBpBt.js';
|
|
7
|
+
export { C as ContextRPC, b as ContextTestEnvironment, R as RunnerRPC, a as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.buwuBpBt.js';
|
|
8
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.DGazh2r6.js';
|
|
9
|
+
export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.DGazh2r6.js';
|
|
10
10
|
import { b as Awaitable, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/environment.d.BsToaxti.js';
|
|
11
11
|
export { A as AfterSuiteRunMeta } from './chunks/environment.d.BsToaxti.js';
|
|
12
12
|
import { ExpectStatic } from '@vitest/expect';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
3
|
-
export { a as assertType } from './chunks/index.
|
|
1
|
+
export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.B2--mG9U.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.DHKMYAts.js';
|
|
3
|
+
export { a as assertType } from './chunks/index.Dnl38iQ_.js';
|
|
4
4
|
export { expectTypeOf } from 'expect-type';
|
|
5
5
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
6
|
export { EvaluatedModules } from 'vite/module-runner';
|
|
7
7
|
export { chai } from '@vitest/expect';
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
|
-
import './chunks/utils.
|
|
9
|
+
import './chunks/utils.CG9h5ccR.js';
|
|
10
10
|
import '@vitest/utils/timers';
|
|
11
|
-
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
12
11
|
import '@vitest/snapshot';
|
|
13
12
|
import '@vitest/utils/error';
|
|
14
13
|
import '@vitest/utils/helpers';
|
|
15
14
|
import '@vitest/spy';
|
|
16
15
|
import '@vitest/utils/offset';
|
|
17
16
|
import '@vitest/utils/source-map';
|
|
17
|
+
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
18
18
|
import './chunks/date.-jtEtIeV.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'vite/module-runner';
|
|
2
|
-
export { b as VitestModuleEvaluator, a as VitestModuleEvaluatorOptions, c as createImportMetaEnvProxy, g as getDefaultRequestStubs, i as isPrimitive, u as unwrapId, w as wrapId } from './chunks/moduleRunner.d.
|
|
2
|
+
export { b as VitestModuleEvaluator, a as VitestModuleEvaluatorOptions, c as createImportMetaEnvProxy, g as getDefaultRequestStubs, i as isPrimitive, u as unwrapId, w as wrapId } from './chunks/moduleRunner.d.CeYc7nZ0.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
|
-
import './chunks/worker.d.
|
|
5
|
+
import './chunks/worker.d.buwuBpBt.js';
|
|
6
6
|
import '@vitest/runner';
|
|
7
|
-
import './chunks/config.d.
|
|
7
|
+
import './chunks/config.d.DGazh2r6.js';
|
|
8
8
|
import '@vitest/pretty-format';
|
|
9
9
|
import '@vitest/snapshot';
|
|
10
10
|
import '@vitest/utils/diff';
|
package/dist/module-evaluator.js
CHANGED
|
@@ -58,7 +58,8 @@ class VitestModuleEvaluator {
|
|
|
58
58
|
if (id in this.stubs) return this.stubs[id];
|
|
59
59
|
const file = this.convertIdToImportUrl(id), namespace = this.vm ? await this.vm.externalModulesExecutor.import(file) : await import(file);
|
|
60
60
|
if (!this.shouldInterop(file, namespace)) return namespace;
|
|
61
|
-
const { mod, defaultExport } = interopModule(namespace), { Proxy, Reflect } = this.primitives
|
|
61
|
+
const { mod, defaultExport } = interopModule(namespace), { Proxy, Reflect } = this.primitives;
|
|
62
|
+
return new Proxy(mod, {
|
|
62
63
|
get(mod, prop) {
|
|
63
64
|
return prop === "default" ? defaultExport : mod[prop] ?? defaultExport?.[prop];
|
|
64
65
|
},
|
|
@@ -75,7 +76,6 @@ class VitestModuleEvaluator {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
|
-
return proxy;
|
|
79
79
|
}
|
|
80
80
|
async runInlinedModule(context, code, module) {
|
|
81
81
|
context.__vite_ssr_import_meta__.env = this.env;
|
|
@@ -107,8 +107,8 @@ class VitestModuleEvaluator {
|
|
|
107
107
|
get exports() {
|
|
108
108
|
return cjsExports;
|
|
109
109
|
}
|
|
110
|
-
}, meta = context[ssrImportMetaKey]
|
|
111
|
-
if (
|
|
110
|
+
}, meta = context[ssrImportMetaKey];
|
|
111
|
+
if (this.options.getCurrentTestFilepath?.() === module.file) {
|
|
112
112
|
const globalNamespace = this.vm?.context || globalThis;
|
|
113
113
|
Object.defineProperty(meta, "vitest", { get: () => globalNamespace.__vitest_index__ });
|
|
114
114
|
}
|
|
@@ -133,14 +133,13 @@ class VitestModuleEvaluator {
|
|
|
133
133
|
columnOffset: -codeDefinition.length
|
|
134
134
|
}, finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
135
135
|
try {
|
|
136
|
-
|
|
137
|
-
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
138
|
-
};
|
|
139
|
-
await initModule(
|
|
136
|
+
await (this.vm ? vm.runInContext(wrappedCode, this.vm.context, options) : vm.runInThisContext(wrappedCode, options))(
|
|
140
137
|
context[ssrModuleExportsKey],
|
|
141
138
|
context[ssrImportMetaKey],
|
|
142
139
|
context[ssrImportKey],
|
|
143
|
-
|
|
140
|
+
async (dep, options) => {
|
|
141
|
+
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
142
|
+
},
|
|
144
143
|
context[ssrExportAllKey],
|
|
145
144
|
// vite 7 support, remove when vite 7+ is supported
|
|
146
145
|
context.__vite_ssr_exportName__ || ((name, getter) => Object.defineProperty(exportsObject, name, {
|
|
@@ -179,7 +178,7 @@ function createImportMetaEnvProxy() {
|
|
|
179
178
|
];
|
|
180
179
|
return new Proxy(process.env, {
|
|
181
180
|
get(_, key) {
|
|
182
|
-
|
|
181
|
+
if (typeof key === "string") return booleanKeys.includes(key) ? !!process.env[key] : process.env[key];
|
|
183
182
|
},
|
|
184
183
|
set(_, key, value) {
|
|
185
184
|
if (typeof key !== "string") return true;
|
|
@@ -248,8 +247,7 @@ function defineExport(exports, key, value) {
|
|
|
248
247
|
});
|
|
249
248
|
}
|
|
250
249
|
function isPrimitive(v) {
|
|
251
|
-
|
|
252
|
-
return !isObject || v == null;
|
|
250
|
+
return !(typeof v === "object" || typeof v === "function") || v == null;
|
|
253
251
|
}
|
|
254
252
|
function interopModule(mod) {
|
|
255
253
|
if (isPrimitive(mod)) return {
|
package/dist/module-runner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { VitestModuleEvaluator } from './module-evaluator.js';
|
|
2
|
-
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.
|
|
3
|
-
export { g as getWorkerState } from './chunks/utils.
|
|
2
|
+
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.DPBo3mme.js';
|
|
3
|
+
export { g as getWorkerState } from './chunks/utils.CG9h5ccR.js';
|
|
4
4
|
import 'node:module';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'node:vm';
|