vitest 1.2.2 → 1.3.0
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 +29 -0
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +2 -1
- package/dist/chunks/{api-setup.srzH0bDf.js → api-setup.Xh60JpeM.js} +27 -64
- package/dist/chunks/{integrations-globals.J_6tnlri.js → integrations-globals.FlQVNhQx.js} +6 -6
- package/dist/chunks/{runtime-runBaseTests.QReNMrJA.js → runtime-runBaseTests.0UwIvo_U.js} +9 -9
- package/dist/cli-wrapper.js +1 -1
- package/dist/cli.js +1314 -69
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +3 -3
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +74 -78
- package/dist/index.js +7 -7
- package/dist/node.d.ts +3 -3
- package/dist/node.js +21 -21
- package/dist/{reporters-1evA5lom.d.ts → reporters-QGe8gs4b.d.ts} +146 -55
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +20 -6
- package/dist/runners.d.ts +6 -6
- package/dist/runners.js +10 -10
- package/dist/{suite-ghspeorC.d.ts → suite-xGC-mxBC.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/vendor/{base.Rmxiv35Y.js → base.RpormaJz.js} +2 -2
- package/dist/vendor/{base.QYERqzkH.js → base.knFzp7G3.js} +1 -1
- package/dist/vendor/{benchmark.IlKmJkUU.js → benchmark.eeqk2rd8.js} +1 -1
- package/dist/vendor/{node.Zme77R4t.js → cli-api.RIYLcWhB.js} +1510 -3639
- package/dist/vendor/{constants.i1PoEnhr.js → constants.K-Wf1PUy.js} +3 -1
- package/dist/vendor/{execute.TxmaEFIQ.js → execute.aFSzc0Da.js} +23 -12
- package/dist/vendor/{index.cAUulNDf.js → index.8bPxjt7g.js} +6 -1
- package/dist/vendor/{index.RDKo8czB.js → index.CKbXK54q.js} +7 -3
- package/dist/vendor/{environments.sU0TD7wX.js → index.GVFv9dZ0.js} +3 -0
- package/dist/vendor/index.QcWmThJv.js +4927 -0
- package/dist/vendor/{index.rJjbcrrp.js → index.ir9i0ywP.js} +1 -1
- package/dist/vendor/{index.LgG0iblq.js → index.n-Ib4UWN.js} +4 -3
- package/dist/vendor/{rpc.w4v8oCkK.js → rpc.joBhAkyK.js} +10 -1
- package/dist/vendor/setup-common.NSpEdAQm.js +45 -0
- package/dist/vendor/{vi.PPwhENHF.js → vi.-Nr_x6dl.js} +2 -1
- package/dist/vendor/{vm.jVxKtN5R.js → vm.UmCkcXp-.js} +25 -8
- package/dist/worker.js +5 -10
- package/dist/workers/forks.js +3 -3
- package/dist/workers/runVmTests.js +13 -9
- package/dist/workers/threads.js +3 -3
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +8 -8
- package/globals.d.ts +2 -0
- package/jsdom.d.ts +6 -0
- package/package.json +24 -21
- package/dist/vendor/reporters.cA9x-5v-.js +0 -2664
- package/dist/vendor/setup-common.C2iBd0K0.js +0 -29
|
@@ -23,4 +23,4 @@ function removeUndefinedValues(obj) {
|
|
|
23
23
|
return obj;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export {
|
|
26
|
+
export { isNode as a, removeUndefinedValues as b, isWindows as c, isRunningInBenchmark as i, relativePath as r };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
import { b as bench } from './benchmark.
|
|
1
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
2
|
+
import { b as bench } from './benchmark.eeqk2rd8.js';
|
|
3
3
|
import { i as isFirstRun, a as runOnce } from './run-once.Olz_Zkd8.js';
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.-Nr_x6dl.js';
|
|
5
5
|
import { g as getWorkerState } from './global.CkGT_TMy.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
@@ -117,6 +117,7 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
|
|
|
117
117
|
isWatchMode: isWatchMode,
|
|
118
118
|
it: it,
|
|
119
119
|
onTestFailed: onTestFailed,
|
|
120
|
+
onTestFinished: onTestFinished,
|
|
120
121
|
runOnce: runOnce,
|
|
121
122
|
should: should,
|
|
122
123
|
suite: suite,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSafeTimers } from '@vitest/utils';
|
|
2
|
-
import { c as createBirpc } from './index.
|
|
2
|
+
import { c as createBirpc } from './index.8bPxjt7g.js';
|
|
3
3
|
import { g as getWorkerState } from './global.CkGT_TMy.js';
|
|
4
4
|
|
|
5
5
|
const { get } = Reflect;
|
|
@@ -51,6 +51,15 @@ function createRuntimeRpc(options) {
|
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
|
|
54
|
+
onTimeoutError(functionName, args) {
|
|
55
|
+
var _a;
|
|
56
|
+
let message = `[vitest-worker]: Timeout calling "${functionName}"`;
|
|
57
|
+
if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId")
|
|
58
|
+
message += ` with "${JSON.stringify(args)}"`;
|
|
59
|
+
if (functionName === "onUnhandledError")
|
|
60
|
+
message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
|
|
61
|
+
throw new Error(message);
|
|
62
|
+
},
|
|
54
63
|
...options
|
|
55
64
|
}
|
|
56
65
|
));
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { setSafeTimers } from '@vitest/utils';
|
|
2
|
+
import { addSerializer } from '@vitest/snapshot';
|
|
3
|
+
import { r as resetRunOnceCounter } from './run-once.Olz_Zkd8.js';
|
|
4
|
+
|
|
5
|
+
let globalSetup = false;
|
|
6
|
+
async function setupCommonEnv(config) {
|
|
7
|
+
resetRunOnceCounter();
|
|
8
|
+
setupDefines(config.defines);
|
|
9
|
+
if (globalSetup)
|
|
10
|
+
return;
|
|
11
|
+
globalSetup = true;
|
|
12
|
+
setSafeTimers();
|
|
13
|
+
if (config.globals)
|
|
14
|
+
(await import('../chunks/integrations-globals.FlQVNhQx.js')).registerApiGlobally();
|
|
15
|
+
}
|
|
16
|
+
function setupDefines(defines) {
|
|
17
|
+
for (const key in defines)
|
|
18
|
+
globalThis[key] = defines[key];
|
|
19
|
+
}
|
|
20
|
+
async function loadDiffConfig(config, executor) {
|
|
21
|
+
if (typeof config.diff !== "string")
|
|
22
|
+
return;
|
|
23
|
+
const diffModule = await executor.executeId(config.diff);
|
|
24
|
+
if (diffModule && typeof diffModule.default === "object" && diffModule.default != null)
|
|
25
|
+
return diffModule.default;
|
|
26
|
+
else
|
|
27
|
+
throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
|
|
28
|
+
}
|
|
29
|
+
async function loadSnapshotSerializers(config, executor) {
|
|
30
|
+
const files = config.snapshotSerializers;
|
|
31
|
+
const snapshotSerializers = await Promise.all(
|
|
32
|
+
files.map(async (file) => {
|
|
33
|
+
const mo = await executor.executeId(file);
|
|
34
|
+
if (!mo || typeof mo.default !== "object" || mo.default === null)
|
|
35
|
+
throw new Error(`invalid snapshot serializer file ${file}. Must export a default object`);
|
|
36
|
+
const config2 = mo.default;
|
|
37
|
+
if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function")
|
|
38
|
+
throw new Error(`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`);
|
|
39
|
+
return config2;
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
snapshotSerializers.forEach((serializer) => addSerializer(serializer));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { loadSnapshotSerializers as a, loadDiffConfig as l, setupCommonEnv as s };
|
|
@@ -9,7 +9,7 @@ import { g as getFullName } from './tasks.IknbGB2n.js';
|
|
|
9
9
|
import { g as getWorkerState, a as getCurrentEnvironment } from './global.CkGT_TMy.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.
|
|
12
|
+
import { i as isChildProcess } from './base.knFzp7G3.js';
|
|
13
13
|
import { R as RealDate, r as resetDate, m as mockDate } from './date.Ns1pGd_X.js';
|
|
14
14
|
import { spyOn, fn, isMockFunction, mocks } from '@vitest/spy';
|
|
15
15
|
|
|
@@ -3450,6 +3450,7 @@ function createVitest() {
|
|
|
3450
3450
|
async importMock(path) {
|
|
3451
3451
|
return _mocker.importMock(path, getImporter());
|
|
3452
3452
|
},
|
|
3453
|
+
// this is typed in the interface so it's not necessary to type it here
|
|
3453
3454
|
mocked(item, _options = {}) {
|
|
3454
3455
|
return item;
|
|
3455
3456
|
},
|
|
@@ -2,14 +2,14 @@ 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
4
|
import { createCustomConsole } from '../chunks/runtime-console.Iloo9fIt.js';
|
|
5
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
5
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.aFSzc0Da.js';
|
|
6
6
|
import { distDir } from '../path.js';
|
|
7
7
|
import { dirname as dirname$1 } from 'node:path';
|
|
8
|
-
import { statSync, readFileSync } from 'node:fs';
|
|
8
|
+
import { statSync, existsSync, 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
|
-
import './index.
|
|
12
|
+
import './index.ir9i0ywP.js';
|
|
13
13
|
import { p as provideWorkerState } from './global.CkGT_TMy.js';
|
|
14
14
|
|
|
15
15
|
const _require = createRequire(import.meta.url);
|
|
@@ -300,6 +300,14 @@ class EsmExecutor {
|
|
|
300
300
|
this.moduleCache.set(fileUrl, m);
|
|
301
301
|
return m;
|
|
302
302
|
}
|
|
303
|
+
async createWebAssemblyModule(fileUrl, code) {
|
|
304
|
+
const cached = this.moduleCache.get(fileUrl);
|
|
305
|
+
if (cached)
|
|
306
|
+
return cached;
|
|
307
|
+
const m = this.loadWebAssemblyModule(code, fileUrl);
|
|
308
|
+
this.moduleCache.set(fileUrl, m);
|
|
309
|
+
return m;
|
|
310
|
+
}
|
|
303
311
|
async loadWebAssemblyModule(source, identifier) {
|
|
304
312
|
const cached = this.moduleCache.get(identifier);
|
|
305
313
|
if (cached)
|
|
@@ -310,20 +318,20 @@ class EsmExecutor {
|
|
|
310
318
|
const moduleLookup = {};
|
|
311
319
|
for (const { module } of imports) {
|
|
312
320
|
if (moduleLookup[module] === void 0) {
|
|
313
|
-
|
|
321
|
+
moduleLookup[module] = await this.executor.resolveModule(
|
|
314
322
|
module,
|
|
315
323
|
identifier
|
|
316
324
|
);
|
|
317
|
-
moduleLookup[module] = await this.evaluateModule(resolvedModule);
|
|
318
325
|
}
|
|
319
326
|
}
|
|
320
327
|
const syntheticModule = new SyntheticModule$1(
|
|
321
328
|
exports.map(({ name }) => name),
|
|
322
|
-
() => {
|
|
329
|
+
async () => {
|
|
323
330
|
const importsObject = {};
|
|
324
331
|
for (const { module, name } of imports) {
|
|
325
332
|
if (!importsObject[module])
|
|
326
333
|
importsObject[module] = {};
|
|
334
|
+
await this.evaluateModule(moduleLookup[module]);
|
|
327
335
|
importsObject[module][name] = moduleLookup[module].namespace[name];
|
|
328
336
|
}
|
|
329
337
|
const wasmInstance = new WebAssembly.Instance(
|
|
@@ -357,7 +365,7 @@ class EsmExecutor {
|
|
|
357
365
|
throw new Error("Missing data URI encoding");
|
|
358
366
|
if (encoding !== "base64")
|
|
359
367
|
throw new Error(`Invalid data URI encoding: ${encoding}`);
|
|
360
|
-
const module =
|
|
368
|
+
const module = this.loadWebAssemblyModule(
|
|
361
369
|
Buffer.from(match.groups.code, "base64"),
|
|
362
370
|
identifier
|
|
363
371
|
);
|
|
@@ -587,6 +595,8 @@ class ExternalModulesExecutor {
|
|
|
587
595
|
type = "module";
|
|
588
596
|
} else if (extension === ".cjs") {
|
|
589
597
|
type = "commonjs";
|
|
598
|
+
} else if (extension === ".wasm") {
|
|
599
|
+
type = "wasm";
|
|
590
600
|
} else {
|
|
591
601
|
const pkgData = this.findNearestPackageData(normalize(pathUrl));
|
|
592
602
|
type = pkgData.type === "module" ? "module" : "commonjs";
|
|
@@ -595,6 +605,11 @@ class ExternalModulesExecutor {
|
|
|
595
605
|
}
|
|
596
606
|
async createModule(identifier) {
|
|
597
607
|
const { type, url, path } = this.getModuleInformation(identifier);
|
|
608
|
+
if ((type === "module" || type === "commonjs" || type === "wasm") && !existsSync(path)) {
|
|
609
|
+
const error = new Error(`Cannot find module '${path}'`);
|
|
610
|
+
error.code = "ERR_MODULE_NOT_FOUND";
|
|
611
|
+
throw error;
|
|
612
|
+
}
|
|
598
613
|
switch (type) {
|
|
599
614
|
case "data":
|
|
600
615
|
return this.esm.createDataModule(identifier);
|
|
@@ -604,6 +619,8 @@ class ExternalModulesExecutor {
|
|
|
604
619
|
}
|
|
605
620
|
case "vite":
|
|
606
621
|
return await this.vite.createViteModule(url);
|
|
622
|
+
case "wasm":
|
|
623
|
+
return await this.esm.createWebAssemblyModule(url, this.fs.readBuffer(path));
|
|
607
624
|
case "module":
|
|
608
625
|
return await this.esm.createEsModule(url, this.fs.readFile(path));
|
|
609
626
|
case "commonjs": {
|
|
@@ -674,7 +691,7 @@ async function runVmTests(state) {
|
|
|
674
691
|
provideWorkerState(context, state);
|
|
675
692
|
context.process = process;
|
|
676
693
|
context.global = context;
|
|
677
|
-
context.console = createCustomConsole(state);
|
|
694
|
+
context.console = state.config.disableConsoleIntercept ? console : createCustomConsole(state);
|
|
678
695
|
context.setImmediate = setImmediate;
|
|
679
696
|
context.clearImmediate = clearImmediate;
|
|
680
697
|
const stubs = getDefaultRequestStubs(context);
|
package/dist/worker.js
CHANGED
|
@@ -2,13 +2,13 @@ import { pathToFileURL } from 'node:url';
|
|
|
2
2
|
import { workerId } from 'tinypool';
|
|
3
3
|
import { ViteNodeRunner, ModuleCacheMap } from 'vite-node/client';
|
|
4
4
|
import { resolve, normalize } from 'pathe';
|
|
5
|
-
import { e as environments } from './vendor/
|
|
6
|
-
import { i as isChildProcess, s as setProcessTitle } from './vendor/base.
|
|
5
|
+
import { e as environments } from './vendor/index.GVFv9dZ0.js';
|
|
6
|
+
import { i as isChildProcess, s as setProcessTitle } from './vendor/base.knFzp7G3.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
|
-
import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.
|
|
8
|
+
import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.joBhAkyK.js';
|
|
9
9
|
import 'node:console';
|
|
10
10
|
import '@vitest/utils';
|
|
11
|
-
import './vendor/index.
|
|
11
|
+
import './vendor/index.8bPxjt7g.js';
|
|
12
12
|
import './vendor/global.CkGT_TMy.js';
|
|
13
13
|
|
|
14
14
|
function isBuiltinEnvironment(env) {
|
|
@@ -80,7 +80,6 @@ async function run(ctx) {
|
|
|
80
80
|
const inspectorCleanup = setupInspect(ctx.config);
|
|
81
81
|
process.env.VITEST_WORKER_ID = String(ctx.workerId);
|
|
82
82
|
process.env.VITEST_POOL_ID = String(workerId);
|
|
83
|
-
let state = null;
|
|
84
83
|
try {
|
|
85
84
|
if (ctx.worker[0] === ".")
|
|
86
85
|
throw new Error(`Path to the test runner cannot be relative, received "${ctx.worker}"`);
|
|
@@ -96,7 +95,7 @@ async function run(ctx) {
|
|
|
96
95
|
const environment = await loadEnvironment(ctx, rpc);
|
|
97
96
|
if (ctx.environment.transformMode)
|
|
98
97
|
environment.transformMode = ctx.environment.transformMode;
|
|
99
|
-
state = {
|
|
98
|
+
const state = {
|
|
100
99
|
ctx,
|
|
101
100
|
// here we create a new one, workers can reassign this if they need to keep it non-isolated
|
|
102
101
|
moduleCache: new ModuleCacheMap(),
|
|
@@ -118,10 +117,6 @@ async function run(ctx) {
|
|
|
118
117
|
await rpcDone().catch(() => {
|
|
119
118
|
});
|
|
120
119
|
inspectorCleanup();
|
|
121
|
-
if (state) {
|
|
122
|
-
state.environment = null;
|
|
123
|
-
state = null;
|
|
124
|
-
}
|
|
125
120
|
}
|
|
126
121
|
}
|
|
127
122
|
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapForksConfig } from '../vendor/utils.GbToHGHI.js';
|
|
3
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
3
|
+
import { r as runBaseTests } from '../vendor/base.RpormaJz.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
6
|
import '../vendor/global.CkGT_TMy.js';
|
|
7
|
-
import '../vendor/execute.
|
|
7
|
+
import '../vendor/execute.aFSzc0Da.js';
|
|
8
8
|
import 'node:vm';
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'vite-node/utils';
|
|
@@ -12,7 +12,7 @@ import 'pathe';
|
|
|
12
12
|
import '@vitest/utils/error';
|
|
13
13
|
import '../path.js';
|
|
14
14
|
import 'node:fs';
|
|
15
|
-
import '../vendor/base.
|
|
15
|
+
import '../vendor/base.knFzp7G3.js';
|
|
16
16
|
|
|
17
17
|
class ForksBaseWorker {
|
|
18
18
|
getRpcOptions() {
|
|
@@ -5,31 +5,32 @@ import timers from 'node:timers';
|
|
|
5
5
|
import { performance } from 'node:perf_hooks';
|
|
6
6
|
import { startTests } from '@vitest/runner';
|
|
7
7
|
import { setupColors, createColors } from '@vitest/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
+
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.CKbXK54q.js';
|
|
9
10
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
|
|
10
11
|
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
|
|
11
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
12
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
12
|
+
import { V as VitestIndex } from '../vendor/index.n-Ib4UWN.js';
|
|
13
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.NSpEdAQm.js';
|
|
13
14
|
import 'chai';
|
|
14
15
|
import '@vitest/snapshot/environment';
|
|
15
16
|
import 'pathe';
|
|
16
17
|
import '../path.js';
|
|
17
18
|
import 'node:url';
|
|
18
|
-
import '../vendor/rpc.
|
|
19
|
-
import '../vendor/index.
|
|
20
|
-
import '../vendor/benchmark.
|
|
19
|
+
import '../vendor/rpc.joBhAkyK.js';
|
|
20
|
+
import '../vendor/index.8bPxjt7g.js';
|
|
21
|
+
import '../vendor/benchmark.eeqk2rd8.js';
|
|
21
22
|
import '@vitest/runner/utils';
|
|
22
|
-
import '../vendor/index.
|
|
23
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
23
24
|
import 'std-env';
|
|
24
25
|
import '../vendor/run-once.Olz_Zkd8.js';
|
|
25
|
-
import '../vendor/vi.
|
|
26
|
+
import '../vendor/vi.-Nr_x6dl.js';
|
|
26
27
|
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
27
28
|
import '@vitest/expect';
|
|
28
29
|
import '@vitest/snapshot';
|
|
29
30
|
import '@vitest/utils/error';
|
|
30
31
|
import '../vendor/tasks.IknbGB2n.js';
|
|
31
32
|
import '@vitest/utils/source-map';
|
|
32
|
-
import '../vendor/base.
|
|
33
|
+
import '../vendor/base.knFzp7G3.js';
|
|
33
34
|
import '../vendor/date.Ns1pGd_X.js';
|
|
34
35
|
import '@vitest/spy';
|
|
35
36
|
|
|
@@ -53,6 +54,9 @@ async function run(files, config, executor) {
|
|
|
53
54
|
util,
|
|
54
55
|
timers
|
|
55
56
|
};
|
|
57
|
+
installSourcemapsSupport({
|
|
58
|
+
getSourceMap: (source) => workerState.moduleCache.getSourceMap(source)
|
|
59
|
+
});
|
|
56
60
|
await startCoverageInsideWorker(config.coverage, executor);
|
|
57
61
|
if (config.chaiConfig)
|
|
58
62
|
setupChaiConfig(config.chaiConfig);
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
1
|
+
import { r as runBaseTests } from '../vendor/base.RpormaJz.js';
|
|
2
2
|
import { a as createThreadsRpcOptions } from '../vendor/utils.GbToHGHI.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
4
|
import '../vendor/global.CkGT_TMy.js';
|
|
5
|
-
import '../vendor/execute.
|
|
5
|
+
import '../vendor/execute.aFSzc0Da.js';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'vite-node/utils';
|
|
@@ -11,7 +11,7 @@ import '@vitest/utils/error';
|
|
|
11
11
|
import '../path.js';
|
|
12
12
|
import 'node:fs';
|
|
13
13
|
import '@vitest/utils';
|
|
14
|
-
import '../vendor/base.
|
|
14
|
+
import '../vendor/base.knFzp7G3.js';
|
|
15
15
|
|
|
16
16
|
class ThreadsBaseWorker {
|
|
17
17
|
getRpcOptions(ctx) {
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapForksConfig } from '../vendor/utils.GbToHGHI.js';
|
|
3
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
3
|
+
import { r as runVmTests } from '../vendor/vm.UmCkcXp-.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'node:vm';
|
|
6
6
|
import 'node:url';
|
|
@@ -10,16 +10,16 @@ import 'node:stream';
|
|
|
10
10
|
import 'node:console';
|
|
11
11
|
import 'node:path';
|
|
12
12
|
import '../vendor/date.Ns1pGd_X.js';
|
|
13
|
-
import '../vendor/execute.
|
|
13
|
+
import '../vendor/execute.aFSzc0Da.js';
|
|
14
14
|
import 'vite-node/client';
|
|
15
15
|
import 'vite-node/utils';
|
|
16
16
|
import '@vitest/utils/error';
|
|
17
17
|
import '../path.js';
|
|
18
18
|
import 'node:fs';
|
|
19
|
-
import '../vendor/base.
|
|
19
|
+
import '../vendor/base.knFzp7G3.js';
|
|
20
20
|
import 'node:module';
|
|
21
21
|
import 'vite-node/constants';
|
|
22
|
-
import '../vendor/index.
|
|
22
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
23
23
|
import 'std-env';
|
|
24
24
|
import '@vitest/runner/utils';
|
|
25
25
|
import '../vendor/global.CkGT_TMy.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as createThreadsRpcOptions } from '../vendor/utils.GbToHGHI.js';
|
|
2
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
2
|
+
import { r as runVmTests } from '../vendor/vm.UmCkcXp-.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import 'node:vm';
|
|
5
5
|
import 'node:url';
|
|
@@ -9,16 +9,16 @@ import 'node:stream';
|
|
|
9
9
|
import 'node:console';
|
|
10
10
|
import 'node:path';
|
|
11
11
|
import '../vendor/date.Ns1pGd_X.js';
|
|
12
|
-
import '../vendor/execute.
|
|
12
|
+
import '../vendor/execute.aFSzc0Da.js';
|
|
13
13
|
import 'vite-node/client';
|
|
14
14
|
import 'vite-node/utils';
|
|
15
15
|
import '@vitest/utils/error';
|
|
16
16
|
import '../path.js';
|
|
17
17
|
import 'node:fs';
|
|
18
|
-
import '../vendor/base.
|
|
18
|
+
import '../vendor/base.knFzp7G3.js';
|
|
19
19
|
import 'node:module';
|
|
20
20
|
import 'vite-node/constants';
|
|
21
|
-
import '../vendor/index.
|
|
21
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
22
22
|
import 'std-env';
|
|
23
23
|
import '@vitest/runner/utils';
|
|
24
24
|
import '../vendor/global.CkGT_TMy.js';
|
package/dist/workers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v8 from 'v8';
|
|
2
|
-
import { n as BirpcOptions, f as RuntimeRPC, o as ContextRPC, p as WorkerGlobalState, q as WorkerContext, R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { n as BirpcOptions, f as RuntimeRPC, o as ContextRPC, p as WorkerGlobalState, q as WorkerContext, R as ResolvedConfig } from './reporters-QGe8gs4b.js';
|
|
3
3
|
import { Awaitable } from '@vitest/utils';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|
|
@@ -17,8 +17,8 @@ import 'chai';
|
|
|
17
17
|
|
|
18
18
|
type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, 'on' | 'post' | 'serialize' | 'deserialize'>;
|
|
19
19
|
interface VitestWorker {
|
|
20
|
-
getRpcOptions(ctx: ContextRPC)
|
|
21
|
-
runTests(state: WorkerGlobalState)
|
|
20
|
+
getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions;
|
|
21
|
+
runTests: (state: WorkerGlobalState) => Awaitable<unknown>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
declare function createThreadsRpcOptions({ port }: WorkerContext): WorkerRpcOptions;
|
package/dist/workers.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapForksConfig } from './vendor/utils.GbToHGHI.js';
|
|
2
2
|
export { p as provideWorkerState } from './vendor/global.CkGT_TMy.js';
|
|
3
3
|
export { run as runVitestWorker } from './worker.js';
|
|
4
|
-
export { r as runVmTests } from './vendor/vm.
|
|
5
|
-
export { r as runBaseTests } from './vendor/base.
|
|
4
|
+
export { r as runVmTests } from './vendor/vm.UmCkcXp-.js';
|
|
5
|
+
export { r as runBaseTests } from './vendor/base.RpormaJz.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
|
9
9
|
import 'vite-node/client';
|
|
10
10
|
import 'pathe';
|
|
11
|
-
import './vendor/
|
|
11
|
+
import './vendor/index.GVFv9dZ0.js';
|
|
12
12
|
import 'node:console';
|
|
13
|
-
import './vendor/base.
|
|
13
|
+
import './vendor/base.knFzp7G3.js';
|
|
14
14
|
import 'node:module';
|
|
15
|
-
import './vendor/rpc.
|
|
16
|
-
import './vendor/index.
|
|
15
|
+
import './vendor/rpc.joBhAkyK.js';
|
|
16
|
+
import './vendor/index.8bPxjt7g.js';
|
|
17
17
|
import 'node:vm';
|
|
18
18
|
import './chunks/runtime-console.Iloo9fIt.js';
|
|
19
19
|
import 'node:stream';
|
|
20
20
|
import 'node:path';
|
|
21
21
|
import './vendor/date.Ns1pGd_X.js';
|
|
22
|
-
import './vendor/execute.
|
|
22
|
+
import './vendor/execute.aFSzc0Da.js';
|
|
23
23
|
import 'vite-node/utils';
|
|
24
24
|
import '@vitest/utils/error';
|
|
25
25
|
import './path.js';
|
|
26
26
|
import 'node:fs';
|
|
27
27
|
import 'vite-node/constants';
|
|
28
|
-
import './vendor/index.
|
|
28
|
+
import './vendor/index.ir9i0ywP.js';
|
|
29
29
|
import 'std-env';
|
|
30
30
|
import '@vitest/runner/utils';
|
package/globals.d.ts
CHANGED
|
@@ -13,5 +13,7 @@ declare global {
|
|
|
13
13
|
const afterAll: typeof import('vitest')['afterAll']
|
|
14
14
|
const beforeEach: typeof import('vitest')['beforeEach']
|
|
15
15
|
const afterEach: typeof import('vitest')['afterEach']
|
|
16
|
+
const onTestFailed: typeof import('vitest')['onTestFailed']
|
|
17
|
+
const onTestFinished: typeof import('vitest')['onTestFinished']
|
|
16
18
|
}
|
|
17
19
|
export {}
|
package/jsdom.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
"./globals": {
|
|
39
39
|
"types": "./globals.d.ts"
|
|
40
40
|
},
|
|
41
|
+
"./jsdom": {
|
|
42
|
+
"types": "./jsdom.d.ts"
|
|
43
|
+
},
|
|
41
44
|
"./importMeta": {
|
|
42
45
|
"types": "./importMeta.d.ts"
|
|
43
46
|
},
|
|
@@ -110,34 +113,33 @@
|
|
|
110
113
|
"peerDependencies": {
|
|
111
114
|
"@edge-runtime/vm": "*",
|
|
112
115
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
113
|
-
"@vitest/browser": "^1.0.0",
|
|
114
|
-
"@vitest/ui": "^1.0.0",
|
|
115
116
|
"happy-dom": "*",
|
|
116
|
-
"jsdom": "*"
|
|
117
|
+
"jsdom": "*",
|
|
118
|
+
"@vitest/browser": "1.3.0",
|
|
119
|
+
"@vitest/ui": "1.3.0"
|
|
117
120
|
},
|
|
118
121
|
"peerDependenciesMeta": {
|
|
119
|
-
"@
|
|
122
|
+
"@edge-runtime/vm": {
|
|
120
123
|
"optional": true
|
|
121
124
|
},
|
|
122
|
-
"@
|
|
125
|
+
"@types/node": {
|
|
123
126
|
"optional": true
|
|
124
127
|
},
|
|
125
128
|
"@vitest/browser": {
|
|
126
129
|
"optional": true
|
|
127
130
|
},
|
|
128
|
-
"
|
|
131
|
+
"@vitest/ui": {
|
|
129
132
|
"optional": true
|
|
130
133
|
},
|
|
131
|
-
"
|
|
134
|
+
"happy-dom": {
|
|
132
135
|
"optional": true
|
|
133
136
|
},
|
|
134
|
-
"
|
|
137
|
+
"jsdom": {
|
|
135
138
|
"optional": true
|
|
136
139
|
}
|
|
137
140
|
},
|
|
138
141
|
"dependencies": {
|
|
139
142
|
"acorn-walk": "^8.3.2",
|
|
140
|
-
"cac": "^6.7.14",
|
|
141
143
|
"chai": "^4.3.10",
|
|
142
144
|
"debug": "^4.3.4",
|
|
143
145
|
"execa": "^8.0.1",
|
|
@@ -146,22 +148,22 @@
|
|
|
146
148
|
"pathe": "^1.1.1",
|
|
147
149
|
"picocolors": "^1.0.0",
|
|
148
150
|
"std-env": "^3.5.0",
|
|
149
|
-
"strip-literal": "^
|
|
151
|
+
"strip-literal": "^2.0.0",
|
|
150
152
|
"tinybench": "^2.5.1",
|
|
151
153
|
"tinypool": "^0.8.2",
|
|
152
154
|
"vite": "^5.0.0",
|
|
153
155
|
"why-is-node-running": "^2.2.2",
|
|
154
|
-
"@vitest/expect": "1.
|
|
155
|
-
"@vitest/
|
|
156
|
-
"@vitest/
|
|
157
|
-
"@vitest/
|
|
158
|
-
"
|
|
159
|
-
"
|
|
156
|
+
"@vitest/expect": "1.3.0",
|
|
157
|
+
"@vitest/runner": "1.3.0",
|
|
158
|
+
"@vitest/spy": "1.3.0",
|
|
159
|
+
"@vitest/snapshot": "1.3.0",
|
|
160
|
+
"vite-node": "1.3.0",
|
|
161
|
+
"@vitest/utils": "1.3.0"
|
|
160
162
|
},
|
|
161
163
|
"devDependencies": {
|
|
162
164
|
"@ampproject/remapping": "^2.2.1",
|
|
163
165
|
"@antfu/install-pkg": "^0.3.1",
|
|
164
|
-
"@edge-runtime/vm": "^3.1.
|
|
166
|
+
"@edge-runtime/vm": "^3.1.8",
|
|
165
167
|
"@sinonjs/fake-timers": "11.1.0",
|
|
166
168
|
"@types/estree": "^1.0.5",
|
|
167
169
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
@@ -171,7 +173,8 @@
|
|
|
171
173
|
"@types/node": "^20.11.5",
|
|
172
174
|
"@types/prompts": "^2.4.9",
|
|
173
175
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
174
|
-
"birpc": "0.2.
|
|
176
|
+
"birpc": "0.2.15",
|
|
177
|
+
"cac": "^6.7.14",
|
|
175
178
|
"chai-subset": "^1.6.0",
|
|
176
179
|
"cli-truncate": "^4.0.0",
|
|
177
180
|
"expect-type": "^0.17.3",
|
|
@@ -179,8 +182,8 @@
|
|
|
179
182
|
"find-up": "^6.3.0",
|
|
180
183
|
"flatted": "^3.2.9",
|
|
181
184
|
"get-tsconfig": "^4.7.2",
|
|
182
|
-
"happy-dom": "^
|
|
183
|
-
"jsdom": "^
|
|
185
|
+
"happy-dom": "^13.3.8",
|
|
186
|
+
"jsdom": "^24.0.0",
|
|
184
187
|
"log-update": "^5.0.1",
|
|
185
188
|
"micromatch": "^4.0.5",
|
|
186
189
|
"p-limit": "^5.0.0",
|