vitest 4.0.0-beta.7 → 4.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +5 -5
- package/dist/browser.js +4 -4
- package/dist/chunks/{runBaseTests.D6sfuWBM.js → base.CA5N8Af0.js} +55 -26
- package/dist/chunks/{benchmark.UW6Ezvxy.js → benchmark.CJUa-Hsa.js} +1 -1
- package/dist/chunks/{browser.d.DOMmqJQx.d.ts → browser.d.DtfyY9yS.d.ts} +1 -1
- package/dist/chunks/{cac.Dsn7ixFt.js → cac.Dt7e1TIu.js} +6 -25
- package/dist/chunks/{cli-api.DfGJyldU.js → cli-api.eAzsLIxz.js} +88 -209
- package/dist/chunks/{config.d._GBBbReY.d.ts → config.d.DacWrqWe.d.ts} +1 -0
- package/dist/chunks/{console.B0quX7yH.js → console.7h5kHUIf.js} +1 -1
- package/dist/chunks/{coverage.Dvxug1RM.js → coverage.CDRAMTt7.js} +25 -56
- package/dist/chunks/{globals.lgsmH00r.js → globals.CJrTTbxC.js} +5 -6
- package/dist/chunks/{index.C3EbxYwt.js → index.BIP7prJq.js} +7 -3
- package/dist/chunks/{index.D2B6d2vv.js → index.BjKEiSn0.js} +1 -1
- package/dist/chunks/{index.AR8aAkCC.js → index.C832ioot.js} +5 -6
- package/dist/chunks/{moduleRunner.d.CX4DuqOx.d.ts → moduleRunner.d.DxTLreRD.d.ts} +4 -1
- package/dist/chunks/{node.BOqcT2jW.js → node.CyipiPvJ.js} +1 -1
- package/dist/chunks/{plugin.d.vcD4xbMS.d.ts → plugin.d.CIk0YiKb.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BC86JJdB.d.ts → reporters.d.DmP-iHLr.d.ts} +451 -561
- package/dist/chunks/{index.CsFXYRkW.js → resolveSnapshotEnvironment.Bvv2zr69.js} +16 -21
- package/dist/chunks/{rpc.RpPylpp0.js → rpc.BKr6mtxz.js} +1 -1
- package/dist/chunks/{setup-common.hLGRxhC8.js → setup-common.B7I37Tji.js} +4 -4
- package/dist/chunks/{startModuleRunner.C8TW8zTN.js → startModuleRunner.BDRvKSdz.js} +7 -2
- package/dist/chunks/test.BAlBebnP.js +214 -0
- package/dist/chunks/{typechecker.DSo_maXz.js → typechecker.DB-fIMaH.js} +44 -1
- package/dist/chunks/{utils.C7__0Iv5.js → utils.D2R2NiOH.js} +1 -10
- package/dist/chunks/{vi.BfdOiD4j.js → vi.BB37KeLx.js} +16 -16
- package/dist/chunks/{vm.BHBje7cC.js → vm.CjLTDaST.js} +12 -7
- package/dist/chunks/{worker.d.DYlqbejz.d.ts → worker.d.B2r4Ln6p.d.ts} +1 -1
- package/dist/chunks/{worker.d.BKu8cnnX.d.ts → worker.d.DJ6qxO2w.d.ts} +1 -1
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +10 -10
- package/dist/coverage.d.ts +8 -8
- package/dist/coverage.js +2 -2
- package/dist/index.d.ts +11 -12
- package/dist/index.js +5 -8
- package/dist/module-evaluator.d.ts +4 -3
- package/dist/module-evaluator.js +3 -3
- package/dist/module-runner.js +2 -2
- package/dist/node.d.ts +23 -14
- package/dist/node.js +8 -8
- package/dist/reporters.d.ts +8 -8
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +11 -215
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +2 -3
- package/dist/workers/forks.js +27 -4
- package/dist/workers/runVmTests.js +18 -19
- package/dist/workers/threads.js +27 -4
- 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 +26 -8
- package/package.json +10 -14
- package/dist/chunks/base.BXI97p6t.js +0 -39
|
@@ -4,7 +4,7 @@ import { Writable } from 'node:stream';
|
|
|
4
4
|
import { getSafeTimers } from '@vitest/utils';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
6
|
import { R as RealDate } from './date.-jtEtIeV.js';
|
|
7
|
-
import { g as getWorkerState } from './utils.
|
|
7
|
+
import { g as getWorkerState } from './utils.D2R2NiOH.js';
|
|
8
8
|
|
|
9
9
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
10
10
|
function getTaskIdByStack(root) {
|
|
@@ -23,7 +23,7 @@ import { isatty } from 'node:tty';
|
|
|
23
23
|
import EventEmitter from 'node:events';
|
|
24
24
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
25
25
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
26
|
-
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.
|
|
26
|
+
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.DB-fIMaH.js';
|
|
27
27
|
import { MessageChannel } from 'node:worker_threads';
|
|
28
28
|
import { hasFailed } from '@vitest/runner/utils';
|
|
29
29
|
import { rootDir } from '../path.js';
|
|
@@ -2685,8 +2685,8 @@ function createChildProcessChannel$1(project, collect = false) {
|
|
|
2685
2685
|
};
|
|
2686
2686
|
return channel;
|
|
2687
2687
|
}
|
|
2688
|
-
function createForksPool(vitest, { execArgv, env }) {
|
|
2689
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), poolOptions = vitest.config.poolOptions?.forks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ??
|
|
2688
|
+
function createForksPool(vitest, { execArgv, env }, specifications) {
|
|
2689
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.forks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, worker = resolve(vitest.distPath, "workers/forks.js"), options = {
|
|
2690
2690
|
runtime: "child_process",
|
|
2691
2691
|
filename: resolve(vitest.distPath, "worker.js"),
|
|
2692
2692
|
teardown: "teardown",
|
|
@@ -2732,7 +2732,7 @@ function createForksPool(vitest, { execArgv, env }) {
|
|
|
2732
2732
|
vitest.onCancel(() => pool.cancelPendingTasks());
|
|
2733
2733
|
const configs = /* @__PURE__ */ new WeakMap(), getConfig = (project) => {
|
|
2734
2734
|
if (configs.has(project)) return configs.get(project);
|
|
2735
|
-
const _config = project.
|
|
2735
|
+
const _config = project.serializedConfig, config = wrapSerializableConfig(_config);
|
|
2736
2736
|
return configs.set(project, config), config;
|
|
2737
2737
|
}, singleFork = specs.filter((spec) => spec.project.config.poolOptions?.forks?.singleFork), multipleForks = specs.filter((spec) => !spec.project.config.poolOptions?.forks?.singleFork);
|
|
2738
2738
|
if (multipleForks.length) {
|
|
@@ -2792,8 +2792,8 @@ function createWorkerChannel$1(project, collect) {
|
|
|
2792
2792
|
onClose
|
|
2793
2793
|
};
|
|
2794
2794
|
}
|
|
2795
|
-
function createThreadsPool(vitest, { execArgv, env }) {
|
|
2796
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), poolOptions = vitest.config.poolOptions?.threads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ??
|
|
2795
|
+
function createThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
2796
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.threads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, worker = resolve(vitest.distPath, "workers/threads.js"), options = {
|
|
2797
2797
|
filename: resolve(vitest.distPath, "worker.js"),
|
|
2798
2798
|
teardown: "teardown",
|
|
2799
2799
|
useAtomics: poolOptions.useAtomics ?? false,
|
|
@@ -3051,8 +3051,8 @@ function createChildProcessChannel(project, collect) {
|
|
|
3051
3051
|
};
|
|
3052
3052
|
return { channel };
|
|
3053
3053
|
}
|
|
3054
|
-
function createVmForksPool(vitest, { execArgv, env }) {
|
|
3055
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), poolOptions = vitest.config.poolOptions?.vmForks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ??
|
|
3054
|
+
function createVmForksPool(vitest, { execArgv, env }, specifications) {
|
|
3055
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.vmForks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, worker = resolve(vitest.distPath, "workers/vmForks.js"), options = {
|
|
3056
3056
|
runtime: "child_process",
|
|
3057
3057
|
filename: resolve(vitest.distPath, "worker.js"),
|
|
3058
3058
|
maxThreads,
|
|
@@ -3146,8 +3146,8 @@ function createWorkerChannel(project, collect) {
|
|
|
3146
3146
|
onClose
|
|
3147
3147
|
};
|
|
3148
3148
|
}
|
|
3149
|
-
function createVmThreadsPool(vitest, { execArgv, env }) {
|
|
3150
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), poolOptions = vitest.config.poolOptions?.vmThreads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ??
|
|
3149
|
+
function createVmThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
3150
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.vmThreads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, worker = resolve(vitest.distPath, "workers/vmThreads.js"), options = {
|
|
3151
3151
|
filename: resolve(vitest.distPath, "worker.js"),
|
|
3152
3152
|
useAtomics: poolOptions.useAtomics ?? false,
|
|
3153
3153
|
maxThreads,
|
|
@@ -3294,14 +3294,14 @@ function createPool(ctx) {
|
|
|
3294
3294
|
});
|
|
3295
3295
|
}
|
|
3296
3296
|
const groupedSpecifications = {}, groups = /* @__PURE__ */ new Set(), factories = {
|
|
3297
|
-
vmThreads: () => createVmThreadsPool(ctx, options),
|
|
3298
|
-
vmForks: () => createVmForksPool(ctx, options),
|
|
3299
|
-
threads: () => createThreadsPool(ctx, options),
|
|
3300
|
-
forks: () => createForksPool(ctx, options),
|
|
3297
|
+
vmThreads: (specs) => createVmThreadsPool(ctx, options, specs),
|
|
3298
|
+
vmForks: (specs) => createVmForksPool(ctx, options, specs),
|
|
3299
|
+
threads: (specs) => createThreadsPool(ctx, options, specs),
|
|
3300
|
+
forks: (specs) => createForksPool(ctx, options, specs),
|
|
3301
3301
|
typescript: () => createTypecheckPool(ctx)
|
|
3302
3302
|
};
|
|
3303
3303
|
for (const spec of files) {
|
|
3304
|
-
const group = spec
|
|
3304
|
+
const group = spec.project.config.sequence.groupOrder ?? 0;
|
|
3305
3305
|
groups.add(group), groupedSpecifications[group] ??= [], groupedSpecifications[group].push(spec);
|
|
3306
3306
|
}
|
|
3307
3307
|
const Sequencer = ctx.config.sequence.sequencer, sequencer = new Sequencer(ctx);
|
|
@@ -3324,7 +3324,7 @@ function createPool(ctx) {
|
|
|
3324
3324
|
typescript: []
|
|
3325
3325
|
};
|
|
3326
3326
|
specifications.forEach((specification) => {
|
|
3327
|
-
const pool = specification
|
|
3327
|
+
const pool = specification.pool;
|
|
3328
3328
|
filesByPool[pool] ??= [], filesByPool[pool].push(specification);
|
|
3329
3329
|
}), await Promise.all(Object.entries(filesByPool).map(async (entry) => {
|
|
3330
3330
|
const [pool, files] = entry;
|
|
@@ -3332,7 +3332,7 @@ function createPool(ctx) {
|
|
|
3332
3332
|
const specs = await sortSpecs(files);
|
|
3333
3333
|
if (pool in factories) {
|
|
3334
3334
|
const factory = factories[pool];
|
|
3335
|
-
return pools[pool] ??= factory(), pools[pool][method](specs, invalidate);
|
|
3335
|
+
return pools[pool] ??= factory(specs), pools[pool][method](specs, invalidate);
|
|
3336
3336
|
}
|
|
3337
3337
|
if (pool === "browser") return pools.browser ??= await getBrowserPool(), pools.browser[method](specs, invalidate);
|
|
3338
3338
|
const poolHandler = await getCustomPool(pool);
|
|
@@ -3463,8 +3463,9 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3463
3463
|
if (resolved.standalone && !resolved.watch) throw new Error(`Vitest standalone mode requires --watch`);
|
|
3464
3464
|
if (resolved.mergeReports && resolved.watch) throw new Error(`Cannot merge reports with --watch enabled`);
|
|
3465
3465
|
if (resolved.maxWorkers) resolved.maxWorkers = resolveInlineWorkerOption(resolved.maxWorkers);
|
|
3466
|
-
if (resolved.
|
|
3467
|
-
|
|
3466
|
+
if (resolved.fileParallelism ??= mode !== "benchmark", !resolved.fileParallelism)
|
|
3467
|
+
// ignore user config, parallelism cannot be implemented without limiting workers
|
|
3468
|
+
resolved.maxWorkers = 1;
|
|
3468
3469
|
if (resolved.maxConcurrency === 0) logger.console.warn(c.yellow(`The option "maxConcurrency" cannot be set to 0. Using default value ${configDefaults.maxConcurrency} instead.`)), resolved.maxConcurrency = configDefaults.maxConcurrency;
|
|
3469
3470
|
if (resolved.inspect || resolved.inspectBrk) {
|
|
3470
3471
|
const isSingleThread = resolved.pool === "threads" && resolved.poolOptions?.threads?.singleThread, isSingleFork = resolved.pool === "forks" && resolved.poolOptions?.forks?.singleFork;
|
|
@@ -3553,17 +3554,6 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3553
3554
|
maxThreads: Number.parseInt(process.env.VITEST_MAX_THREADS)
|
|
3554
3555
|
}
|
|
3555
3556
|
};
|
|
3556
|
-
if (process.env.VITEST_MIN_THREADS) resolved.poolOptions = {
|
|
3557
|
-
...resolved.poolOptions,
|
|
3558
|
-
threads: {
|
|
3559
|
-
...resolved.poolOptions?.threads,
|
|
3560
|
-
minThreads: Number.parseInt(process.env.VITEST_MIN_THREADS)
|
|
3561
|
-
},
|
|
3562
|
-
vmThreads: {
|
|
3563
|
-
...resolved.poolOptions?.vmThreads,
|
|
3564
|
-
minThreads: Number.parseInt(process.env.VITEST_MIN_THREADS)
|
|
3565
|
-
}
|
|
3566
|
-
};
|
|
3567
3557
|
if (process.env.VITEST_MAX_FORKS) resolved.poolOptions = {
|
|
3568
3558
|
...resolved.poolOptions,
|
|
3569
3559
|
forks: {
|
|
@@ -3575,30 +3565,9 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3575
3565
|
maxForks: Number.parseInt(process.env.VITEST_MAX_FORKS)
|
|
3576
3566
|
}
|
|
3577
3567
|
};
|
|
3578
|
-
|
|
3579
|
-
...resolved.poolOptions,
|
|
3580
|
-
forks: {
|
|
3581
|
-
...resolved.poolOptions?.forks,
|
|
3582
|
-
minForks: Number.parseInt(process.env.VITEST_MIN_FORKS)
|
|
3583
|
-
},
|
|
3584
|
-
vmForks: {
|
|
3585
|
-
...resolved.poolOptions?.vmForks,
|
|
3586
|
-
minForks: Number.parseInt(process.env.VITEST_MIN_FORKS)
|
|
3587
|
-
}
|
|
3588
|
-
};
|
|
3589
|
-
const poolThreadsOptions = [
|
|
3590
|
-
["threads", "minThreads"],
|
|
3591
|
-
["threads", "maxThreads"],
|
|
3592
|
-
["vmThreads", "minThreads"],
|
|
3593
|
-
["vmThreads", "maxThreads"]
|
|
3594
|
-
];
|
|
3568
|
+
const poolThreadsOptions = [["threads", "maxThreads"], ["vmThreads", "maxThreads"]];
|
|
3595
3569
|
for (const [poolOptionKey, workerOptionKey] of poolThreadsOptions) if (resolved.poolOptions?.[poolOptionKey]?.[workerOptionKey]) resolved.poolOptions[poolOptionKey][workerOptionKey] = resolveInlineWorkerOption(resolved.poolOptions[poolOptionKey][workerOptionKey]);
|
|
3596
|
-
const poolForksOptions = [
|
|
3597
|
-
["forks", "minForks"],
|
|
3598
|
-
["forks", "maxForks"],
|
|
3599
|
-
["vmForks", "minForks"],
|
|
3600
|
-
["vmForks", "maxForks"]
|
|
3601
|
-
];
|
|
3570
|
+
const poolForksOptions = [["forks", "maxForks"], ["vmForks", "maxForks"]];
|
|
3602
3571
|
for (const [poolOptionKey, workerOptionKey] of poolForksOptions) if (resolved.poolOptions?.[poolOptionKey]?.[workerOptionKey]) resolved.poolOptions[poolOptionKey][workerOptionKey] = resolveInlineWorkerOption(resolved.poolOptions[poolOptionKey][workerOptionKey]);
|
|
3603
3572
|
if (!builtinPools.includes(resolved.pool)) resolved.pool = resolvePath(resolved.pool, resolved.root);
|
|
3604
3573
|
if (mode === "benchmark") {
|
|
@@ -3749,7 +3718,7 @@ class BaseCoverageProvider {
|
|
|
3749
3718
|
if (this.ctx = ctx, ctx.version !== this.version) ctx.logger.warn(c.yellow(`Loaded ${c.inverse(c.yellow(` vitest@${ctx.version} `))} and ${c.inverse(c.yellow(` @vitest/coverage-${this.name}@${this.version} `))}.
|
|
3750
3719
|
Running mixed versions is not supported and may lead into bugs
|
|
3751
3720
|
Update your dependencies and make sure the versions match.`));
|
|
3752
|
-
const config = ctx.
|
|
3721
|
+
const config = ctx._coverageOptions;
|
|
3753
3722
|
this.options = {
|
|
3754
3723
|
...coverageConfigDefaults,
|
|
3755
3724
|
...config,
|
|
@@ -3872,8 +3841,8 @@ Update your dependencies and make sure the versions match.`));
|
|
|
3872
3841
|
async reportThresholds(coverageMap, allTestsRun) {
|
|
3873
3842
|
const resolvedThresholds = this.resolveThresholds(coverageMap);
|
|
3874
3843
|
if (this.checkThresholds(resolvedThresholds), this.options.thresholds?.autoUpdate && allTestsRun) {
|
|
3875
|
-
if (!this.ctx.
|
|
3876
|
-
const configFilePath = this.ctx.
|
|
3844
|
+
if (!this.ctx.vite.config.configFile) throw new Error("Missing configurationFile. The \"coverage.thresholds.autoUpdate\" can only be enabled when configuration file is used.");
|
|
3845
|
+
const configFilePath = this.ctx.vite.config.configFile, configModule = await this.parseConfigModule(configFilePath);
|
|
3877
3846
|
await this.updateThresholds({
|
|
3878
3847
|
thresholds: resolvedThresholds,
|
|
3879
3848
|
configurationFile: configModule,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.D_Q9UYh-.js';
|
|
2
|
-
import {
|
|
3
|
-
import './vi.
|
|
2
|
+
import { i as index } from './index.C832ioot.js';
|
|
3
|
+
import './vi.BB37KeLx.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
|
-
import '
|
|
8
|
-
import './utils.C7__0Iv5.js';
|
|
7
|
+
import './utils.D2R2NiOH.js';
|
|
9
8
|
import '@vitest/utils';
|
|
10
9
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
11
10
|
import '@vitest/snapshot';
|
|
@@ -13,14 +12,14 @@ import '@vitest/utils/error';
|
|
|
13
12
|
import '@vitest/spy';
|
|
14
13
|
import '@vitest/utils/source-map';
|
|
15
14
|
import './date.-jtEtIeV.js';
|
|
16
|
-
import './benchmark.
|
|
15
|
+
import './benchmark.CJUa-Hsa.js';
|
|
17
16
|
import 'expect-type';
|
|
18
17
|
import 'vite/module-runner';
|
|
19
18
|
|
|
20
19
|
function registerApiGlobally() {
|
|
21
20
|
globalApis.forEach((api) => {
|
|
22
21
|
// @ts-expect-error I know what I am doing :P
|
|
23
|
-
globalThis[api] =
|
|
22
|
+
globalThis[api] = index[api];
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync, promises } from 'node:fs';
|
|
2
2
|
import { mkdir, writeFile, readdir, stat, readFile } from 'node:fs/promises';
|
|
3
3
|
import { resolve, dirname, isAbsolute, relative, basename, normalize } from 'pathe';
|
|
4
|
-
import { g as getOutputFile, h as hasFailedSnapshot, T as TypeCheckError } from './typechecker.
|
|
4
|
+
import { g as getOutputFile, h as hasFailedSnapshot, T as TypeCheckError } from './typechecker.DB-fIMaH.js';
|
|
5
5
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
6
6
|
import { getTestName, getFullName, hasFailed, getTests, getSuites, getTasks } from '@vitest/runner/utils';
|
|
7
7
|
import { slash, toArray, isPrimitive, inspect, positionToOffset, lineSplitRE } from '@vitest/utils';
|
|
@@ -1156,9 +1156,13 @@ function printErrorInner(error, project, options) {
|
|
|
1156
1156
|
return;
|
|
1157
1157
|
}
|
|
1158
1158
|
const stacks = options.parseErrorStacktrace(e), nearest = error instanceof TypeCheckError ? error.stacks[0] : stacks.find((stack) => {
|
|
1159
|
+
// we are checking that this module was processed by us at one point
|
|
1159
1160
|
try {
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1161
|
+
const environments = [...Object.values(project._vite?.environments || {}), ...Object.values(project.browser?.vite.environments || {})], hasResult = environments.some((environment) => {
|
|
1162
|
+
const modules = environment.moduleGraph.getModulesByFile(stack.file);
|
|
1163
|
+
return [...modules?.values() || []].some((module) => !!module.transformResult);
|
|
1164
|
+
});
|
|
1165
|
+
return hasResult && existsSync(stack.file);
|
|
1162
1166
|
} catch {
|
|
1163
1167
|
return false;
|
|
1164
1168
|
}
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import { getTasks, getFullName, getTests } from '@vitest/runner/utils';
|
|
3
3
|
import * as pathe from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
|
-
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.
|
|
5
|
+
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.BIP7prJq.js';
|
|
6
6
|
import { stripVTControlCharacters } from 'node:util';
|
|
7
7
|
import { notNullish } from '@vitest/utils';
|
|
8
8
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { c as createExpect,
|
|
2
|
-
import { b as bench } from './benchmark.
|
|
1
|
+
import { b as assert, c as createExpect, g as globalExpect, i as inject, s as should, v as vi, d as vitest } from './vi.BB37KeLx.js';
|
|
2
|
+
import { b as bench } from './benchmark.CJUa-Hsa.js';
|
|
3
3
|
import { expectTypeOf } from 'expect-type';
|
|
4
4
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
5
5
|
import { EvaluatedModules } from 'vite/module-runner';
|
|
6
|
-
import
|
|
7
|
-
import { assert, should } from 'chai';
|
|
6
|
+
import { chai } from '@vitest/expect';
|
|
8
7
|
|
|
9
8
|
const assertType = function assertType() {};
|
|
10
9
|
|
|
11
|
-
var
|
|
10
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
12
11
|
__proto__: null,
|
|
13
12
|
EvaluatedModules: EvaluatedModules,
|
|
14
13
|
afterAll: afterAll,
|
|
@@ -34,4 +33,4 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
|
|
|
34
33
|
vitest: vitest
|
|
35
34
|
});
|
|
36
35
|
|
|
37
|
-
export {
|
|
36
|
+
export { assertType as a, index as i };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as _vitest_spy from '@vitest/spy';
|
|
1
2
|
import vm from 'node:vm';
|
|
2
3
|
import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode, FetchFunction, ModuleRunner, EvaluatedModules } from 'vite/module-runner';
|
|
3
|
-
import { R as RuntimeRPC, W as WorkerGlobalState } from './worker.d.
|
|
4
|
+
import { R as RuntimeRPC, W as WorkerGlobalState } from './worker.d.B2r4Ln6p.js';
|
|
4
5
|
import { R as ResolveFunctionResult } from './environment.d.2fYMoz3o.js';
|
|
5
6
|
import { MockedModule, MockedModuleType } from '@vitest/mocker';
|
|
6
7
|
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './mocker.d.BE_2ls6u.js';
|
|
@@ -116,6 +117,7 @@ interface MockContext {
|
|
|
116
117
|
}
|
|
117
118
|
interface VitestMockerOptions {
|
|
118
119
|
context?: vm.Context;
|
|
120
|
+
spyModule?: typeof _vitest_spy;
|
|
119
121
|
root: string;
|
|
120
122
|
moduleDirectories: string[];
|
|
121
123
|
resolveId: (id: string, importer?: string) => Promise<{
|
|
@@ -192,6 +194,7 @@ interface VitestModuleRunnerOptions {
|
|
|
192
194
|
getWorkerState: () => WorkerGlobalState;
|
|
193
195
|
mocker?: VitestMocker;
|
|
194
196
|
vm?: VitestVmOptions;
|
|
197
|
+
spyModule?: typeof _vitest_spy;
|
|
195
198
|
}
|
|
196
199
|
interface VitestVmOptions {
|
|
197
200
|
context: vm.Context;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
2
|
-
import { g as getWorkerState } from './utils.
|
|
2
|
+
import { g as getWorkerState } from './utils.D2R2NiOH.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
|
|
5
5
|
class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
|