vitest 1.6.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +172 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +4 -4
- package/dist/chunks/{environments-node.vcoXCoKs.js → environments-node.39w4gmlF.js} +2 -2
- package/dist/chunks/{install-pkg.LE8oaA1t.js → install-pkg.DNUmWFkO.js} +2 -2
- package/dist/chunks/integrations-globals.B5Jl0grA.js +31 -0
- package/dist/chunks/{runtime-console.EO5ha7qv.js → runtime-console.CUES-L8X.js} +9 -9
- package/dist/chunks/{runtime-runBaseTests.oAvMKtQC.js → runtime-runBaseTests._dXkRAZc.js} +18 -18
- package/dist/cli.js +3 -3
- package/dist/config.cjs +1 -2
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -2
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +2 -2
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +769 -21
- package/dist/index.js +12 -12
- package/dist/node.d.ts +2 -2
- package/dist/node.js +20 -21
- package/dist/{reporters-yx5ZTtEV.d.ts → reporters-MGvT5U9f.d.ts} +28 -31
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +10 -11
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +17 -18
- package/dist/snapshot.js +3 -3
- package/dist/{suite-IbNSsUWN.d.ts → suite-8WAe-urM.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +4 -4
- package/dist/vendor/{base.Ybri3C14.js → base.VFkIJ66g.js} +3 -3
- package/dist/vendor/{base.5NT-gWu5.js → base._gnK9Slw.js} +1 -2
- package/dist/vendor/{benchmark.yGkUTKnC.js → benchmark.BNLebNi5.js} +1 -1
- package/dist/vendor/{cac.EdDItJD-.js → cac.DzKZaJu2.js} +5 -6
- package/dist/vendor/{cli-api.E07AF1Yq.js → cli-api.DTeni0Qq.js} +3060 -361
- package/dist/vendor/{execute.fL3szUAI.js → execute.CLLNVNnK.js} +1 -1
- package/dist/vendor/{index.DpVgvm2P.js → index.BfoZyXD1.js} +5 -5
- package/dist/vendor/{index.8bPxjt7g.js → index.BpSiYbpB.js} +5 -1
- package/dist/vendor/{index.Q04MCqDO.js → index.CRxYS9H3.js} +414 -113
- package/dist/vendor/{index.dI9lHwVn.js → index.CmILuxzC.js} +8 -6
- package/dist/vendor/{index.xL8XjTLv.js → index.DP-km6lF.js} +1 -1
- package/dist/vendor/{index.SMVOaj7F.js → index._7XLd8Kd.js} +2 -2
- package/dist/vendor/{rpc.joBhAkyK.js → rpc.DRDE9Pu1.js} +2 -2
- package/dist/vendor/{run-once.Olz_Zkd8.js → run-once.DLomgGUH.js} +1 -1
- package/dist/vendor/{setup-common.8nJLd4ay.js → setup-common.XeoZAW8t.js} +2 -2
- package/dist/vendor/{tasks.IknbGB2n.js → tasks.WC7M-K-v.js} +4 -1
- package/dist/vendor/{utils.dEtNIEgr.js → utils.D5gGkwyH.js} +1 -1
- package/dist/vendor/{vi.YFlodzP_.js → vi.ClD3hi7L.js} +23 -10
- package/dist/vendor/{vm.QEE48c0T.js → vm.Bi3bljci.js} +47 -59
- package/dist/worker.js +6 -6
- package/dist/workers/forks.js +5 -5
- package/dist/workers/runVmTests.js +17 -17
- package/dist/workers/threads.js +5 -5
- package/dist/workers/vmForks.js +8 -8
- package/dist/workers/vmThreads.js +8 -8
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +13 -13
- package/package.json +29 -29
- package/vitest.mjs +1 -1
- package/dist/chunks/integrations-globals.kw4co3rx.js +0 -31
- package/dist/cli-wrapper.js +0 -119
- /package/dist/chunks/{node-git.Hw101KjS.js → node-git.CCI8evVZ.js} +0 -0
- /package/dist/vendor/{_commonjsHelpers.jjO7Zipk.js → _commonjsHelpers.BFTU3MAI.js} +0 -0
- /package/dist/vendor/{constants.5J7I254_.js → constants.5SOfHUj0.js} +0 -0
- /package/dist/vendor/{coverage.E7sG1b3r.js → coverage.ChSqD-qS.js} +0 -0
- /package/dist/vendor/{date.Ns1pGd_X.js → date.BKM1wewY.js} +0 -0
- /package/dist/vendor/{env.AtSIuHFg.js → env.bmJgw1qP.js} +0 -0
- /package/dist/vendor/{global.CkGT_TMy.js → global.7bFbnyXl.js} +0 -0
- /package/dist/vendor/{index.GVFv9dZ0.js → index.DeR1hhfY.js} +0 -0
- /package/dist/vendor/{inspector.IgLX3ur5.js → inspector.hPQncR7V.js} +0 -0
- /package/dist/vendor/{utils.0uYuCbzo.js → utils.CUjzkRH7.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
2
|
-
import { b as bench } from './benchmark.
|
|
3
|
-
import { i as isFirstRun, a as runOnce } from './run-once.
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
5
|
-
import { g as getWorkerState } from './global.
|
|
2
|
+
import { b as bench } from './benchmark.BNLebNi5.js';
|
|
3
|
+
import { i as isFirstRun, a as runOnce } from './run-once.DLomgGUH.js';
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.ClD3hi7L.js';
|
|
5
|
+
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
8
8
|
|
|
@@ -61,7 +61,7 @@ var dist = {};
|
|
|
61
61
|
'branded',
|
|
62
62
|
];
|
|
63
63
|
const obj = {
|
|
64
|
-
/* eslint-disable
|
|
64
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
65
65
|
toBeAny: fn,
|
|
66
66
|
toBeUnknown: fn,
|
|
67
67
|
toBeNever: fn,
|
|
@@ -80,9 +80,11 @@ var dist = {};
|
|
|
80
80
|
toEqualTypeOf: fn,
|
|
81
81
|
toBeCallableWith: fn,
|
|
82
82
|
toBeConstructibleWith: fn,
|
|
83
|
-
/* eslint-enable
|
|
83
|
+
/* eslint-enable @typescript-eslint/no-unsafe-assignment */
|
|
84
84
|
extract: exports.expectTypeOf,
|
|
85
85
|
exclude: exports.expectTypeOf,
|
|
86
|
+
pick: exports.expectTypeOf,
|
|
87
|
+
omit: exports.expectTypeOf,
|
|
86
88
|
toHaveProperty: exports.expectTypeOf,
|
|
87
89
|
parameter: exports.expectTypeOf,
|
|
88
90
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { relative } from 'pathe';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
3
|
import '@vitest/utils';
|
|
4
|
-
import { g as getWorkerState } from './global.
|
|
5
|
-
import './env.
|
|
4
|
+
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
5
|
+
import './env.bmJgw1qP.js';
|
|
6
6
|
|
|
7
7
|
function getRunMode() {
|
|
8
8
|
return getWorkerState().config.mode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSafeTimers } from '@vitest/utils';
|
|
2
|
-
import { c as createBirpc } from './index.
|
|
3
|
-
import { g as getWorkerState } from './global.
|
|
2
|
+
import { c as createBirpc } from './index.BpSiYbpB.js';
|
|
3
|
+
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
4
4
|
|
|
5
5
|
const { get } = Reflect;
|
|
6
6
|
function withSafeTimers(fn) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setSafeTimers } from '@vitest/utils';
|
|
2
2
|
import { addSerializer } from '@vitest/snapshot';
|
|
3
|
-
import { r as resetRunOnceCounter } from './run-once.
|
|
3
|
+
import { r as resetRunOnceCounter } from './run-once.DLomgGUH.js';
|
|
4
4
|
|
|
5
5
|
let globalSetup = false;
|
|
6
6
|
async function setupCommonEnv(config) {
|
|
@@ -12,7 +12,7 @@ async function setupCommonEnv(config) {
|
|
|
12
12
|
globalSetup = true;
|
|
13
13
|
setSafeTimers();
|
|
14
14
|
if (config.globals)
|
|
15
|
-
(await import('../chunks/integrations-globals.
|
|
15
|
+
(await import('../chunks/integrations-globals.B5Jl0grA.js')).registerApiGlobally();
|
|
16
16
|
}
|
|
17
17
|
function setupDefines(defines) {
|
|
18
18
|
for (const key in defines)
|
|
@@ -10,5 +10,8 @@ function hasFailedSnapshot(suite) {
|
|
|
10
10
|
function getFullName(task, separator = " > ") {
|
|
11
11
|
return getNames(task).join(separator);
|
|
12
12
|
}
|
|
13
|
+
function getTestName(task, separator = " > ") {
|
|
14
|
+
return getNames(task).slice(1).join(separator);
|
|
15
|
+
}
|
|
13
16
|
|
|
14
|
-
export { getFullName as g, hasFailedSnapshot as h };
|
|
17
|
+
export { getFullName as a, getTestName as g, hasFailedSnapshot as h };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as chai$1 from 'chai';
|
|
2
|
-
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.
|
|
2
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
3
3
|
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT as GLOBAL_EXPECT$1, ASYMMETRIC_MATCHERS_OBJECT as ASYMMETRIC_MATCHERS_OBJECT$1, getState, setState, addCustomEqualityTesters } from '@vitest/expect';
|
|
4
4
|
import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot';
|
|
5
5
|
import { getNames } from '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils/error';
|
|
7
7
|
import { getCurrentTest } from '@vitest/runner';
|
|
8
|
-
import { g as
|
|
9
|
-
import { g as getWorkerState, a as getCurrentEnvironment } from './global.
|
|
8
|
+
import { g as getTestName } from './tasks.WC7M-K-v.js';
|
|
9
|
+
import { g as getWorkerState, a as getCurrentEnvironment } from './global.7bFbnyXl.js';
|
|
10
10
|
import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
|
|
11
11
|
import { parseSingleStack } from '@vitest/utils/source-map';
|
|
12
|
-
import { i as isChildProcess } from './base.
|
|
13
|
-
import { R as RealDate, r as resetDate, m as mockDate } from './date.
|
|
12
|
+
import { i as isChildProcess } from './base._gnK9Slw.js';
|
|
13
|
+
import { R as RealDate, r as resetDate, m as mockDate } from './date.BKM1wewY.js';
|
|
14
14
|
import { spyOn, fn, isMockFunction, mocks } from '@vitest/spy';
|
|
15
15
|
|
|
16
16
|
function resetModules(modules, resetMocks = false) {
|
|
@@ -208,11 +208,10 @@ function getError(expected, promise) {
|
|
|
208
208
|
}
|
|
209
209
|
const SnapshotPlugin = (chai, utils) => {
|
|
210
210
|
const getTestNames = (test) => {
|
|
211
|
-
var _a;
|
|
212
211
|
if (!test)
|
|
213
212
|
return {};
|
|
214
213
|
return {
|
|
215
|
-
filepath:
|
|
214
|
+
filepath: test.file.filepath,
|
|
216
215
|
name: getNames(test).slice(1).join(" > ")
|
|
217
216
|
};
|
|
218
217
|
};
|
|
@@ -361,7 +360,6 @@ chai$1.use(SnapshotPlugin);
|
|
|
361
360
|
chai$1.use(JestAsymmetricMatchers);
|
|
362
361
|
|
|
363
362
|
function createExpect(test) {
|
|
364
|
-
var _a;
|
|
365
363
|
const expect = (value, message) => {
|
|
366
364
|
const { assertionCalls } = getState(expect);
|
|
367
365
|
setState({ assertionCalls: assertionCalls + 1, soft: false }, expect);
|
|
@@ -377,6 +375,7 @@ function createExpect(test) {
|
|
|
377
375
|
expect.getState = () => getState(expect);
|
|
378
376
|
expect.setState = (state) => setState(state, expect);
|
|
379
377
|
const globalState = getState(globalThis[GLOBAL_EXPECT$1]) || {};
|
|
378
|
+
const testPath = getTestFile(test);
|
|
380
379
|
setState({
|
|
381
380
|
// this should also add "snapshotState" that is added conditionally
|
|
382
381
|
...globalState,
|
|
@@ -386,8 +385,8 @@ function createExpect(test) {
|
|
|
386
385
|
expectedAssertionsNumber: null,
|
|
387
386
|
expectedAssertionsNumberErrorGen: null,
|
|
388
387
|
environment: getCurrentEnvironment(),
|
|
389
|
-
testPath
|
|
390
|
-
currentTestName: test ?
|
|
388
|
+
testPath,
|
|
389
|
+
currentTestName: test ? getTestName(test) : globalState.currentTestName
|
|
391
390
|
}, expect);
|
|
392
391
|
expect.extend = (matchers) => chai$1.expect.extend(expect, matchers);
|
|
393
392
|
expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters);
|
|
@@ -423,6 +422,12 @@ function createExpect(test) {
|
|
|
423
422
|
chai$1.util.addMethod(expect, "hasAssertions", hasAssertions);
|
|
424
423
|
return expect;
|
|
425
424
|
}
|
|
425
|
+
function getTestFile(test) {
|
|
426
|
+
if (test)
|
|
427
|
+
return test.file.filepath;
|
|
428
|
+
const state = getWorkerState();
|
|
429
|
+
return state.filepath;
|
|
430
|
+
}
|
|
426
431
|
const globalExpect = createExpect();
|
|
427
432
|
Object.defineProperty(globalThis, GLOBAL_EXPECT$1, {
|
|
428
433
|
value: globalExpect,
|
|
@@ -3434,6 +3439,8 @@ function createVitest() {
|
|
|
3434
3439
|
return factory();
|
|
3435
3440
|
},
|
|
3436
3441
|
mock(path, factory) {
|
|
3442
|
+
if (typeof path !== "string")
|
|
3443
|
+
throw new Error(`vi.mock() expects a string path, but received a ${typeof path}`);
|
|
3437
3444
|
const importer = getImporter();
|
|
3438
3445
|
_mocker.queueMock(
|
|
3439
3446
|
path,
|
|
@@ -3443,9 +3450,13 @@ function createVitest() {
|
|
|
3443
3450
|
);
|
|
3444
3451
|
},
|
|
3445
3452
|
unmock(path) {
|
|
3453
|
+
if (typeof path !== "string")
|
|
3454
|
+
throw new Error(`vi.unmock() expects a string path, but received a ${typeof path}`);
|
|
3446
3455
|
_mocker.queueUnmock(path, getImporter());
|
|
3447
3456
|
},
|
|
3448
3457
|
doMock(path, factory) {
|
|
3458
|
+
if (typeof path !== "string")
|
|
3459
|
+
throw new Error(`vi.doMock() expects a string path, but received a ${typeof path}`);
|
|
3449
3460
|
const importer = getImporter();
|
|
3450
3461
|
_mocker.queueMock(
|
|
3451
3462
|
path,
|
|
@@ -3455,6 +3466,8 @@ function createVitest() {
|
|
|
3455
3466
|
);
|
|
3456
3467
|
},
|
|
3457
3468
|
doUnmock(path) {
|
|
3469
|
+
if (typeof path !== "string")
|
|
3470
|
+
throw new Error(`vi.doUnmock() expects a string path, but received a ${typeof path}`);
|
|
3458
3471
|
_mocker.queueUnmock(path, getImporter());
|
|
3459
3472
|
},
|
|
3460
3473
|
async importActual(path) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import vm, { isContext } from 'node:vm';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
|
|
4
|
-
import { createCustomConsole } from '../chunks/runtime-console.
|
|
5
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
4
|
+
import { createCustomConsole } from '../chunks/runtime-console.CUES-L8X.js';
|
|
5
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.CLLNVNnK.js';
|
|
6
6
|
import { distDir } from '../path.js';
|
|
7
7
|
import { dirname as dirname$1 } from 'node:path';
|
|
8
|
-
import { statSync, existsSync, readFileSync } from 'node:fs';
|
|
8
|
+
import { statSync, existsSync, promises, readFileSync } from 'node:fs';
|
|
9
9
|
import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData } from 'vite-node/utils';
|
|
10
10
|
import { createRequire, Module } from 'node:module';
|
|
11
11
|
import { CSS_LANGS_RE, KNOWN_ASSET_RE } from 'vite-node/constants';
|
|
12
12
|
import '@vitest/runner/utils';
|
|
13
13
|
import '@vitest/utils';
|
|
14
|
-
import { p as provideWorkerState } from './global.
|
|
15
|
-
import './env.
|
|
14
|
+
import { p as provideWorkerState } from './global.7bFbnyXl.js';
|
|
15
|
+
import './env.bmJgw1qP.js';
|
|
16
16
|
|
|
17
17
|
const _require = createRequire(import.meta.url);
|
|
18
18
|
const requiresCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -245,24 +245,14 @@ const SyntheticModule$1 = vm.SyntheticModule;
|
|
|
245
245
|
const SourceTextModule = vm.SourceTextModule;
|
|
246
246
|
|
|
247
247
|
var __defProp$1 = Object.defineProperty;
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
251
|
-
return value;
|
|
252
|
-
};
|
|
253
|
-
var __accessCheck$1 = (obj, member, msg) => {
|
|
254
|
-
if (!member.has(obj))
|
|
255
|
-
throw TypeError("Cannot " + msg);
|
|
256
|
-
};
|
|
257
|
-
var __privateGet$1 = (obj, member, getter) => {
|
|
258
|
-
__accessCheck$1(obj, member, "read from private field");
|
|
259
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
260
|
-
};
|
|
261
|
-
var __privateAdd$1 = (obj, member, value) => {
|
|
262
|
-
if (member.has(obj))
|
|
263
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
264
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
248
|
+
var __typeError$1 = (msg) => {
|
|
249
|
+
throw TypeError(msg);
|
|
265
250
|
};
|
|
251
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
252
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
253
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
254
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
255
|
+
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
266
256
|
var _httpIp;
|
|
267
257
|
const dataURIRegex = /^data:(?<mime>text\/javascript|application\/json|application\/wasm)(?:;(?<encoding>charset=utf-8|base64))?,(?<code>.*)$/;
|
|
268
258
|
class EsmExecutor {
|
|
@@ -286,12 +276,17 @@ class EsmExecutor {
|
|
|
286
276
|
await m.evaluate();
|
|
287
277
|
return m;
|
|
288
278
|
}
|
|
289
|
-
async createEsModule(
|
|
290
|
-
const cached = this.moduleCache.get(
|
|
279
|
+
async createEsModule(fileURL, getCode) {
|
|
280
|
+
const cached = this.moduleCache.get(fileURL);
|
|
291
281
|
if (cached)
|
|
292
282
|
return cached;
|
|
283
|
+
const promise = this.loadEsModule(fileURL, getCode);
|
|
284
|
+
this.moduleCache.set(fileURL, promise);
|
|
285
|
+
return promise;
|
|
286
|
+
}
|
|
287
|
+
async loadEsModule(fileURL, getCode) {
|
|
293
288
|
const code = await getCode();
|
|
294
|
-
if (
|
|
289
|
+
if (fileURL.endsWith(".json")) {
|
|
295
290
|
const m2 = new SyntheticModule$1(
|
|
296
291
|
["default"],
|
|
297
292
|
() => {
|
|
@@ -299,13 +294,13 @@ class EsmExecutor {
|
|
|
299
294
|
m2.setExport("default", result);
|
|
300
295
|
}
|
|
301
296
|
);
|
|
302
|
-
this.moduleCache.set(
|
|
297
|
+
this.moduleCache.set(fileURL, m2);
|
|
303
298
|
return m2;
|
|
304
299
|
}
|
|
305
300
|
const m = new SourceTextModule(
|
|
306
301
|
code,
|
|
307
302
|
{
|
|
308
|
-
identifier:
|
|
303
|
+
identifier: fileURL,
|
|
309
304
|
context: this.context,
|
|
310
305
|
importModuleDynamically: this.executor.importModuleDynamically,
|
|
311
306
|
initializeImportMeta: (meta, mod) => {
|
|
@@ -321,7 +316,7 @@ class EsmExecutor {
|
|
|
321
316
|
}
|
|
322
317
|
}
|
|
323
318
|
);
|
|
324
|
-
this.moduleCache.set(
|
|
319
|
+
this.moduleCache.set(fileURL, m);
|
|
325
320
|
return m;
|
|
326
321
|
}
|
|
327
322
|
async createWebAssemblyModule(fileUrl, getCode) {
|
|
@@ -523,29 +518,15 @@ class ViteExecutor {
|
|
|
523
518
|
}
|
|
524
519
|
|
|
525
520
|
var __defProp = Object.defineProperty;
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
529
|
-
return value;
|
|
530
|
-
};
|
|
531
|
-
var __accessCheck = (obj, member, msg) => {
|
|
532
|
-
if (!member.has(obj))
|
|
533
|
-
throw TypeError("Cannot " + msg);
|
|
534
|
-
};
|
|
535
|
-
var __privateGet = (obj, member, getter) => {
|
|
536
|
-
__accessCheck(obj, member, "read from private field");
|
|
537
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
538
|
-
};
|
|
539
|
-
var __privateAdd = (obj, member, value) => {
|
|
540
|
-
if (member.has(obj))
|
|
541
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
542
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
543
|
-
};
|
|
544
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
545
|
-
__accessCheck(obj, member, "write to private field");
|
|
546
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
547
|
-
return value;
|
|
521
|
+
var __typeError = (msg) => {
|
|
522
|
+
throw TypeError(msg);
|
|
548
523
|
};
|
|
524
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
525
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
526
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
527
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
528
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
529
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
549
530
|
var _networkSupported;
|
|
550
531
|
const SyntheticModule = vm.SyntheticModule;
|
|
551
532
|
const nativeResolve = import.meta.resolve;
|
|
@@ -562,7 +543,7 @@ class ExternalModulesExecutor {
|
|
|
562
543
|
// dynamic import can be used in both ESM and CJS, so we have it in the executor
|
|
563
544
|
__publicField(this, "importModuleDynamically", async (specifier, referencer) => {
|
|
564
545
|
const module = await this.resolveModule(specifier, referencer.identifier);
|
|
565
|
-
return this.esm.evaluateModule(module);
|
|
546
|
+
return await this.esm.evaluateModule(module);
|
|
566
547
|
});
|
|
567
548
|
__publicField(this, "resolveModule", async (specifier, referencer) => {
|
|
568
549
|
let identifier = this.resolve(specifier, referencer);
|
|
@@ -699,7 +680,7 @@ class ExternalModulesExecutor {
|
|
|
699
680
|
}
|
|
700
681
|
switch (type) {
|
|
701
682
|
case "data":
|
|
702
|
-
return this.esm.createDataModule(identifier);
|
|
683
|
+
return await this.esm.createDataModule(identifier);
|
|
703
684
|
case "builtin": {
|
|
704
685
|
const exports = this.require(identifier);
|
|
705
686
|
return this.wrapCoreSynteticModule(identifier, exports);
|
|
@@ -709,14 +690,13 @@ class ExternalModulesExecutor {
|
|
|
709
690
|
case "wasm":
|
|
710
691
|
return await this.esm.createWebAssemblyModule(url, () => this.fs.readBuffer(path));
|
|
711
692
|
case "module":
|
|
712
|
-
return await this.esm.createEsModule(url, () => this.fs.
|
|
693
|
+
return await this.esm.createEsModule(url, () => this.fs.readFileAsync(path));
|
|
713
694
|
case "commonjs": {
|
|
714
695
|
const exports = this.require(path);
|
|
715
696
|
return this.wrapCommonJsSynteticModule(identifier, exports);
|
|
716
697
|
}
|
|
717
|
-
case "network":
|
|
718
|
-
return this.esm.createNetworkModule(url);
|
|
719
|
-
}
|
|
698
|
+
case "network":
|
|
699
|
+
return await this.esm.createNetworkModule(url);
|
|
720
700
|
default: {
|
|
721
701
|
const _deadend = type;
|
|
722
702
|
return _deadend;
|
|
@@ -741,9 +721,17 @@ _networkSupported = new WeakMap();
|
|
|
741
721
|
class FileMap {
|
|
742
722
|
fsCache = /* @__PURE__ */ new Map();
|
|
743
723
|
fsBufferCache = /* @__PURE__ */ new Map();
|
|
724
|
+
async readFileAsync(path) {
|
|
725
|
+
const cached = this.fsCache.get(path);
|
|
726
|
+
if (cached != null)
|
|
727
|
+
return cached;
|
|
728
|
+
const source = await promises.readFile(path, "utf-8");
|
|
729
|
+
this.fsCache.set(path, source);
|
|
730
|
+
return source;
|
|
731
|
+
}
|
|
744
732
|
readFile(path) {
|
|
745
733
|
const cached = this.fsCache.get(path);
|
|
746
|
-
if (cached)
|
|
734
|
+
if (cached != null)
|
|
747
735
|
return cached;
|
|
748
736
|
const source = readFileSync(path, "utf-8");
|
|
749
737
|
this.fsCache.set(path, source);
|
|
@@ -751,7 +739,7 @@ class FileMap {
|
|
|
751
739
|
}
|
|
752
740
|
readBuffer(path) {
|
|
753
741
|
const cached = this.fsBufferCache.get(path);
|
|
754
|
-
if (cached)
|
|
742
|
+
if (cached != null)
|
|
755
743
|
return cached;
|
|
756
744
|
const buffer = readFileSync(path);
|
|
757
745
|
this.fsBufferCache.set(path, buffer);
|
|
@@ -783,7 +771,7 @@ async function runVmTests(state) {
|
|
|
783
771
|
provideWorkerState(context, state);
|
|
784
772
|
context.process = process;
|
|
785
773
|
context.global = context;
|
|
786
|
-
context.console = state.config.disableConsoleIntercept ? console : createCustomConsole();
|
|
774
|
+
context.console = state.config.disableConsoleIntercept ? console : createCustomConsole(state);
|
|
787
775
|
context.setImmediate = setImmediate;
|
|
788
776
|
context.clearImmediate = clearImmediate;
|
|
789
777
|
const stubs = getDefaultRequestStubs(context);
|
package/dist/worker.js
CHANGED
|
@@ -3,15 +3,15 @@ import { workerId } from 'tinypool';
|
|
|
3
3
|
import { ViteNodeRunner, ModuleCacheMap } from 'vite-node/client';
|
|
4
4
|
import { readFileSync } from 'node:fs';
|
|
5
5
|
import { resolve, normalize } from 'pathe';
|
|
6
|
-
import { e as environments } from './vendor/index.
|
|
7
|
-
import { i as isChildProcess, s as setProcessTitle } from './vendor/base.
|
|
8
|
-
import { s as setupInspect } from './vendor/inspector.
|
|
9
|
-
import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.
|
|
6
|
+
import { e as environments } from './vendor/index.DeR1hhfY.js';
|
|
7
|
+
import { i as isChildProcess, s as setProcessTitle } from './vendor/base._gnK9Slw.js';
|
|
8
|
+
import { s as setupInspect } from './vendor/inspector.hPQncR7V.js';
|
|
9
|
+
import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.DRDE9Pu1.js';
|
|
10
10
|
import 'node:console';
|
|
11
11
|
import '@vitest/utils';
|
|
12
12
|
import 'node:module';
|
|
13
|
-
import './vendor/index.
|
|
14
|
-
import './vendor/global.
|
|
13
|
+
import './vendor/index.BpSiYbpB.js';
|
|
14
|
+
import './vendor/global.7bFbnyXl.js';
|
|
15
15
|
|
|
16
16
|
function isBuiltinEnvironment(env) {
|
|
17
17
|
return env in environments;
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.
|
|
3
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
2
|
+
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.CUjzkRH7.js';
|
|
3
|
+
import { r as runBaseTests } from '../vendor/base.VFkIJ66g.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
|
-
import '../vendor/global.
|
|
7
|
-
import '../vendor/execute.
|
|
6
|
+
import '../vendor/global.7bFbnyXl.js';
|
|
7
|
+
import '../vendor/execute.CLLNVNnK.js';
|
|
8
8
|
import 'node:vm';
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'node:fs';
|
|
@@ -12,7 +12,7 @@ import 'vite-node/utils';
|
|
|
12
12
|
import 'pathe';
|
|
13
13
|
import '@vitest/utils/error';
|
|
14
14
|
import '../path.js';
|
|
15
|
-
import '../vendor/base.
|
|
15
|
+
import '../vendor/base._gnK9Slw.js';
|
|
16
16
|
|
|
17
17
|
class ForksBaseWorker {
|
|
18
18
|
getRpcOptions() {
|
|
@@ -6,33 +6,33 @@ import { performance } from 'node:perf_hooks';
|
|
|
6
6
|
import { startTests } from '@vitest/runner';
|
|
7
7
|
import { setupColors, createColors } from '@vitest/utils';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
-
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.
|
|
10
|
-
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.
|
|
11
|
-
import { g as getWorkerState } from '../vendor/global.
|
|
12
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
13
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
14
|
-
import { c as closeInspector } from '../vendor/inspector.
|
|
9
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.BfoZyXD1.js';
|
|
10
|
+
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.ChSqD-qS.js';
|
|
11
|
+
import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
|
|
12
|
+
import { V as VitestIndex } from '../vendor/index.CmILuxzC.js';
|
|
13
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.XeoZAW8t.js';
|
|
14
|
+
import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
|
|
15
15
|
import 'chai';
|
|
16
16
|
import 'pathe';
|
|
17
17
|
import '../path.js';
|
|
18
18
|
import 'node:url';
|
|
19
|
-
import '../vendor/rpc.
|
|
20
|
-
import '../vendor/index.
|
|
21
|
-
import '../vendor/benchmark.
|
|
19
|
+
import '../vendor/rpc.DRDE9Pu1.js';
|
|
20
|
+
import '../vendor/index.BpSiYbpB.js';
|
|
21
|
+
import '../vendor/benchmark.BNLebNi5.js';
|
|
22
22
|
import '@vitest/runner/utils';
|
|
23
|
-
import '../vendor/index.
|
|
24
|
-
import '../vendor/env.
|
|
23
|
+
import '../vendor/index._7XLd8Kd.js';
|
|
24
|
+
import '../vendor/env.bmJgw1qP.js';
|
|
25
25
|
import 'std-env';
|
|
26
|
-
import '../vendor/run-once.
|
|
27
|
-
import '../vendor/vi.
|
|
28
|
-
import '../vendor/_commonjsHelpers.
|
|
26
|
+
import '../vendor/run-once.DLomgGUH.js';
|
|
27
|
+
import '../vendor/vi.ClD3hi7L.js';
|
|
28
|
+
import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
29
29
|
import '@vitest/expect';
|
|
30
30
|
import '@vitest/snapshot';
|
|
31
31
|
import '@vitest/utils/error';
|
|
32
|
-
import '../vendor/tasks.
|
|
32
|
+
import '../vendor/tasks.WC7M-K-v.js';
|
|
33
33
|
import '@vitest/utils/source-map';
|
|
34
|
-
import '../vendor/base.
|
|
35
|
-
import '../vendor/date.
|
|
34
|
+
import '../vendor/base._gnK9Slw.js';
|
|
35
|
+
import '../vendor/date.BKM1wewY.js';
|
|
36
36
|
import '@vitest/spy';
|
|
37
37
|
|
|
38
38
|
async function run(files, config, executor) {
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
2
|
-
import { a as createThreadsRpcOptions } from '../vendor/utils.
|
|
1
|
+
import { r as runBaseTests } from '../vendor/base.VFkIJ66g.js';
|
|
2
|
+
import { a as createThreadsRpcOptions } from '../vendor/utils.CUjzkRH7.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
|
-
import '../vendor/global.
|
|
5
|
-
import '../vendor/execute.
|
|
4
|
+
import '../vendor/global.7bFbnyXl.js';
|
|
5
|
+
import '../vendor/execute.CLLNVNnK.js';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:fs';
|
|
@@ -11,7 +11,7 @@ import 'pathe';
|
|
|
11
11
|
import '@vitest/utils/error';
|
|
12
12
|
import '../path.js';
|
|
13
13
|
import '@vitest/utils';
|
|
14
|
-
import '../vendor/base.
|
|
14
|
+
import '../vendor/base._gnK9Slw.js';
|
|
15
15
|
|
|
16
16
|
class ThreadsBaseWorker {
|
|
17
17
|
getRpcOptions(ctx) {
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.
|
|
3
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
2
|
+
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.CUjzkRH7.js';
|
|
3
|
+
import { r as runVmTests } from '../vendor/vm.Bi3bljci.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'node:vm';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import 'pathe';
|
|
8
|
-
import '../chunks/runtime-console.
|
|
8
|
+
import '../chunks/runtime-console.CUES-L8X.js';
|
|
9
9
|
import 'node:stream';
|
|
10
10
|
import 'node:console';
|
|
11
11
|
import 'node:path';
|
|
12
|
-
import '../vendor/date.
|
|
12
|
+
import '../vendor/date.BKM1wewY.js';
|
|
13
13
|
import '@vitest/runner/utils';
|
|
14
|
-
import '../vendor/global.
|
|
15
|
-
import '../vendor/env.
|
|
14
|
+
import '../vendor/global.7bFbnyXl.js';
|
|
15
|
+
import '../vendor/env.bmJgw1qP.js';
|
|
16
16
|
import 'std-env';
|
|
17
|
-
import '../vendor/execute.
|
|
17
|
+
import '../vendor/execute.CLLNVNnK.js';
|
|
18
18
|
import 'node:fs';
|
|
19
19
|
import 'vite-node/client';
|
|
20
20
|
import 'vite-node/utils';
|
|
21
21
|
import '@vitest/utils/error';
|
|
22
22
|
import '../path.js';
|
|
23
|
-
import '../vendor/base.
|
|
23
|
+
import '../vendor/base._gnK9Slw.js';
|
|
24
24
|
import 'node:module';
|
|
25
25
|
import 'vite-node/constants';
|
|
26
26
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { a as createThreadsRpcOptions } from '../vendor/utils.
|
|
2
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
1
|
+
import { a as createThreadsRpcOptions } from '../vendor/utils.CUjzkRH7.js';
|
|
2
|
+
import { r as runVmTests } from '../vendor/vm.Bi3bljci.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import 'node:vm';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'pathe';
|
|
7
|
-
import '../chunks/runtime-console.
|
|
7
|
+
import '../chunks/runtime-console.CUES-L8X.js';
|
|
8
8
|
import 'node:stream';
|
|
9
9
|
import 'node:console';
|
|
10
10
|
import 'node:path';
|
|
11
|
-
import '../vendor/date.
|
|
11
|
+
import '../vendor/date.BKM1wewY.js';
|
|
12
12
|
import '@vitest/runner/utils';
|
|
13
|
-
import '../vendor/global.
|
|
14
|
-
import '../vendor/env.
|
|
13
|
+
import '../vendor/global.7bFbnyXl.js';
|
|
14
|
+
import '../vendor/env.bmJgw1qP.js';
|
|
15
15
|
import 'std-env';
|
|
16
|
-
import '../vendor/execute.
|
|
16
|
+
import '../vendor/execute.CLLNVNnK.js';
|
|
17
17
|
import 'node:fs';
|
|
18
18
|
import 'vite-node/client';
|
|
19
19
|
import 'vite-node/utils';
|
|
20
20
|
import '@vitest/utils/error';
|
|
21
21
|
import '../path.js';
|
|
22
|
-
import '../vendor/base.
|
|
22
|
+
import '../vendor/base._gnK9Slw.js';
|
|
23
23
|
import 'node:module';
|
|
24
24
|
import 'vite-node/constants';
|
|
25
25
|
|
package/dist/workers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v8 from 'v8';
|
|
2
|
-
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-MGvT5U9f.js';
|
|
3
3
|
import { Awaitable } from '@vitest/utils';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|