vitest 4.0.0-beta.17 → 4.0.0-beta.18
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.js +1 -1
- package/dist/chunks/{cac.BO_6jvrs.js → cac.DYnuYoJK.js} +7 -7
- package/dist/chunks/{cli-api.BvCJGado.js → cli-api.xhe4uqTX.js} +15 -7
- package/dist/chunks/{coverage.3htTSxXZ.js → coverage.Ds84cgzV.js} +85 -43
- package/dist/chunks/{creator.Daoa5_gR.js → creator.DucAaYBz.js} +1 -1
- package/dist/chunks/{global.d.D1pbKXir.d.ts → global.d.RTA0rbJI.d.ts} +1 -0
- package/dist/chunks/{globals.DC4ntO86.js → globals.CwYe1aG7.js} +2 -2
- package/dist/chunks/{index.Dnl38iQ_.js → index.Bcjk8TKX.js} +1 -1
- package/dist/chunks/{index.Bt-upxGS.js → index.CbWINfS7.js} +29 -4
- package/dist/chunks/{index.DehVUBn4.js → index.D2gVI9Ck.js} +1 -1
- package/dist/chunks/{index.01uBqPwR.js → index.eEkl9h8v.js} +1 -1
- package/dist/chunks/{plugin.d.CqKwuCSa.d.ts → plugin.d.XtKKWlOO.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DAyr7w3M.d.ts → reporters.d.BJ_OuJGZ.d.ts} +45 -14
- package/dist/chunks/{resolveSnapshotEnvironment.BsJpmVZR.js → resolveSnapshotEnvironment.tw2a5ux8.js} +2 -2
- package/dist/chunks/{setup-common.BewgbkTd.js → setup-common.DgXU7Yho.js} +1 -1
- package/dist/chunks/{test.CTuWuHYH.js → test.C3RPt8JR.js} +1 -1
- package/dist/chunks/{vi.B2--mG9U.js → vi.BZvkKVkM.js} +1 -1
- package/dist/chunks/{worker.DVTUM2IW.js → worker.CdzokOSx.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +3 -3
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +1 -1
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/node.d.ts +4 -4
- package/dist/node.js +7 -7
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +2 -2
- package/dist/runners.js +2 -2
- package/dist/worker-base.js +7 -7
- package/dist/worker-vm.js +2 -2
- package/dist/workers/runVmTests.js +5 -5
- package/package.json +13 -13
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.
|
|
1
|
+
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.DgXU7Yho.js';
|
|
2
2
|
export { collectTests, startTests } from '@vitest/runner';
|
|
3
3
|
import * as spyModule from '@vitest/spy';
|
|
4
4
|
export { spyModule as SpyModule };
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
5
|
import { a as defaultPort, d as defaultBrowserPort } from './constants.D_Q9UYh-.js';
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
6
|
+
import { R as ReportersMap } from './index.D2gVI9Ck.js';
|
|
7
7
|
|
|
8
8
|
function toArr(any) {
|
|
9
9
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "4.0.0-beta.
|
|
622
|
+
var version = "4.0.0-beta.18";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -1341,22 +1341,22 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
async function start(mode, cliFilters, options) {
|
|
1343
1343
|
try {
|
|
1344
|
-
const { startVitest } = await import('./cli-api.
|
|
1344
|
+
const { startVitest } = await import('./cli-api.xhe4uqTX.js').then(function (n) { return n.h; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1345
1345
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1346
1346
|
} catch (e) {
|
|
1347
|
-
const { errorBanner } = await import('./index.
|
|
1347
|
+
const { errorBanner } = await import('./index.D2gVI9Ck.js').then(function (n) { return n.u; });
|
|
1348
1348
|
if (console.error(`\n${errorBanner("Startup Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1349
1349
|
process.exit();
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
1352
|
async function init(project) {
|
|
1353
1353
|
if (project !== "browser") console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project.")), process.exit(1);
|
|
1354
|
-
const { create } = await import('./creator.
|
|
1354
|
+
const { create } = await import('./creator.DucAaYBz.js');
|
|
1355
1355
|
await create();
|
|
1356
1356
|
}
|
|
1357
1357
|
async function collect(mode, cliFilters, options) {
|
|
1358
1358
|
try {
|
|
1359
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1359
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.xhe4uqTX.js').then(function (n) { return n.h; }), ctx = await prepareVitest(mode, {
|
|
1360
1360
|
...normalizeCliOptions(cliFilters, options),
|
|
1361
1361
|
watch: false,
|
|
1362
1362
|
run: true
|
|
@@ -1374,7 +1374,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
await ctx.close();
|
|
1376
1376
|
} catch (e) {
|
|
1377
|
-
const { errorBanner } = await import('./index.
|
|
1377
|
+
const { errorBanner } = await import('./index.D2gVI9Ck.js').then(function (n) { return n.u; });
|
|
1378
1378
|
if (console.error(`\n${errorBanner("Collect Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1379
1379
|
process.exit();
|
|
1380
1380
|
}
|
|
@@ -10,7 +10,7 @@ import { A as API_PATH, c as configFiles, d as defaultBrowserPort, a as defaultP
|
|
|
10
10
|
import nodeos__default, { tmpdir } from 'node:os';
|
|
11
11
|
import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, hasFailed, getTasks, isTestCase } from '@vitest/runner/utils';
|
|
12
12
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
13
|
-
import { v as version$1 } from './cac.
|
|
13
|
+
import { v as version$1 } from './cac.DYnuYoJK.js';
|
|
14
14
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
15
15
|
import { p as parse, s as stringify, b as TraceMap, o as originalPositionFor, c as ancestor, d as createDefinesScript, e as convertTasksToEvents } from './typechecker.DsKAhua5.js';
|
|
16
16
|
import require$$0$3 from 'events';
|
|
@@ -26,17 +26,17 @@ import require$$0$1 from 'buffer';
|
|
|
26
26
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
27
27
|
import crypto, { createHash } from 'node:crypto';
|
|
28
28
|
import { distDir, rootDir } from '../path.js';
|
|
29
|
-
import { d as createDebugger, h as hash, e as createFetchModuleFunction, n as normalizeResolvedIdToUrl, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, f as isBrowserEnabled, r as resolveConfig, j as groupBy, k as getCoverageProvider, l as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.
|
|
29
|
+
import { d as createDebugger, h as hash, e as createFetchModuleFunction, n as normalizeResolvedIdToUrl, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, f as isBrowserEnabled, r as resolveConfig, j as groupBy, k as getCoverageProvider, l as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.Ds84cgzV.js';
|
|
30
30
|
import { VitestModuleEvaluator } from '#module-evaluator';
|
|
31
31
|
import { ModuleRunner } from 'vite/module-runner';
|
|
32
32
|
import { Console } from 'node:console';
|
|
33
33
|
import c from 'tinyrainbow';
|
|
34
34
|
import { highlight } from '@vitest/utils/highlight';
|
|
35
|
-
import { p as printError, f as formatProjectName, w as withLabel, e as errorBanner, d as divider, h as generateCodeFrame, R as ReportersMap, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.
|
|
35
|
+
import { p as printError, f as formatProjectName, w as withLabel, e as errorBanner, d as divider, h as generateCodeFrame, R as ReportersMap, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.D2gVI9Ck.js';
|
|
36
36
|
import { createRequire, builtinModules, isBuiltin } from 'node:module';
|
|
37
37
|
import url, { pathToFileURL } from 'node:url';
|
|
38
38
|
import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
|
|
39
|
-
import { rm, mkdir, copyFile } from 'node:fs/promises';
|
|
39
|
+
import { rm, writeFile, mkdir, copyFile } from 'node:fs/promises';
|
|
40
40
|
import pm from 'picomatch';
|
|
41
41
|
import { glob, isDynamicPattern } from 'tinyglobby';
|
|
42
42
|
import MagicString from 'magic-string';
|
|
@@ -45,7 +45,7 @@ import { c as configDefaults } from './defaults.CXFFjsi8.js';
|
|
|
45
45
|
import { KNOWN_ASSET_RE } from '@vitest/utils/constants';
|
|
46
46
|
import { findNearestPackageData } from '@vitest/utils/resolver';
|
|
47
47
|
import * as esModuleLexer from 'es-module-lexer';
|
|
48
|
-
import { a as BenchmarkReportsMap } from './index.
|
|
48
|
+
import { a as BenchmarkReportsMap } from './index.eEkl9h8v.js';
|
|
49
49
|
import assert$1 from 'node:assert';
|
|
50
50
|
import { serializeValue } from '@vitest/utils/serialize';
|
|
51
51
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
@@ -7112,7 +7112,6 @@ async function createViteServer(inlineConfig) {
|
|
|
7112
7112
|
class TestProject {
|
|
7113
7113
|
/**
|
|
7114
7114
|
* The global Vitest instance.
|
|
7115
|
-
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
7116
7115
|
*/
|
|
7117
7116
|
vitest;
|
|
7118
7117
|
/**
|
|
@@ -8208,6 +8207,7 @@ class StateManager {
|
|
|
8208
8207
|
reportedTasksMap = /* @__PURE__ */ new WeakMap();
|
|
8209
8208
|
blobs;
|
|
8210
8209
|
transformTime = 0;
|
|
8210
|
+
metadata = {};
|
|
8211
8211
|
onUnhandledError;
|
|
8212
8212
|
/** @internal */
|
|
8213
8213
|
_data = {
|
|
@@ -8825,7 +8825,15 @@ class TestRun {
|
|
|
8825
8825
|
// specification won't have the File task if they were filtered by the --shard command
|
|
8826
8826
|
const modules = specifications.map((spec) => spec.testModule).filter((s) => s != null), state = this.vitest.isCancelling ? "interrupted" : this.hasFailed(modules) ? "failed" : "passed";
|
|
8827
8827
|
if (state !== "passed") process.exitCode = 1;
|
|
8828
|
-
await this.vitest.report("onTestRunEnd", modules, [...errors], state)
|
|
8828
|
+
for (const project in await this.vitest.report("onTestRunEnd", modules, [...errors], state), this.vitest.state.metadata) {
|
|
8829
|
+
const meta = this.vitest.state.metadata[project];
|
|
8830
|
+
if (!meta?.dumpDir) continue;
|
|
8831
|
+
const path = resolve(meta.dumpDir, "vitest-metadata.json");
|
|
8832
|
+
meta.outline = {
|
|
8833
|
+
externalized: Object.keys(meta.externalized).length,
|
|
8834
|
+
inlined: Object.keys(meta.tmps).length
|
|
8835
|
+
}, await writeFile(path, JSON.stringify(meta, null, 2), "utf-8"), this.vitest.logger.log(`Metadata written to ${path}`);
|
|
8836
|
+
}
|
|
8829
8837
|
}
|
|
8830
8838
|
hasFailed(modules) {
|
|
8831
8839
|
return modules.length ? modules.some((m) => !m.ok()) : !this.vitest.config.passWithNoTests;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs, { statSync, realpathSync, promises as promises$1, mkdirSync, existsSync, readdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import path, { win32, dirname, join, resolve } from 'node:path';
|
|
2
|
+
import path, { win32, dirname, join, resolve as resolve$1 } from 'node:path';
|
|
3
3
|
import { createDefer, isExternalUrl, unwrapId, nanoid, withTrailingSlash as withTrailingSlash$1, cleanUrl, wrapId, slash, shuffle, toArray } from '@vitest/utils/helpers';
|
|
4
|
-
import { isAbsolute, join as join$1, dirname as dirname$1, resolve
|
|
4
|
+
import { isAbsolute, join as join$1, dirname as dirname$1, resolve, relative, normalize } from 'pathe';
|
|
5
5
|
import pm from 'picomatch';
|
|
6
6
|
import { glob } from 'tinyglobby';
|
|
7
7
|
import c from 'tinyrainbow';
|
|
@@ -9,7 +9,7 @@ import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigD
|
|
|
9
9
|
import crypto from 'node:crypto';
|
|
10
10
|
import { builtinModules, createRequire } from 'node:module';
|
|
11
11
|
import process$1 from 'node:process';
|
|
12
|
-
import fs$1, { writeFile, rename, stat, unlink } from 'node:fs/promises';
|
|
12
|
+
import fs$1, { writeFile, rename, stat, unlink, readFile as readFile$1 } from 'node:fs/promises';
|
|
13
13
|
import { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1, URL as URL$1 } from 'node:url';
|
|
14
14
|
import assert from 'node:assert';
|
|
15
15
|
import v8 from 'node:v8';
|
|
@@ -2602,7 +2602,7 @@ async function groupFilesByEnv(files) {
|
|
|
2602
2602
|
}
|
|
2603
2603
|
|
|
2604
2604
|
const created = /* @__PURE__ */ new Set(), promises = /* @__PURE__ */ new Map();
|
|
2605
|
-
function createFetchModuleFunction(resolver, cacheFs = false, tmpDir = join$1(tmpdir(), nanoid())) {
|
|
2605
|
+
function createFetchModuleFunction(resolver, cacheFs = false, tmpDir = join$1(tmpdir(), nanoid()), dump) {
|
|
2606
2606
|
const cachedFsResults = /* @__PURE__ */ new Map();
|
|
2607
2607
|
return async (url, importer, environment, options) => {
|
|
2608
2608
|
// We are copy pasting Vite's externalization logic from `fetchModule` because
|
|
@@ -2637,10 +2637,35 @@ function createFetchModuleFunction(resolver, cacheFs = false, tmpDir = join$1(tm
|
|
|
2637
2637
|
type: "module"
|
|
2638
2638
|
};
|
|
2639
2639
|
}
|
|
2640
|
-
|
|
2640
|
+
let moduleRunnerModule;
|
|
2641
|
+
if (dump?.dumpFolder && dump.readFromDump) {
|
|
2642
|
+
const path = resolve(dump?.dumpFolder, url.replace(/[^\w+]/g, "-"));
|
|
2643
|
+
if (existsSync(path)) {
|
|
2644
|
+
const code = await readFile$1(path, "utf-8"), matchIndex = code.lastIndexOf("\n//");
|
|
2645
|
+
if (matchIndex !== -1) {
|
|
2646
|
+
const { id, file } = JSON.parse(code.slice(matchIndex + 4));
|
|
2647
|
+
moduleRunnerModule = {
|
|
2648
|
+
code,
|
|
2649
|
+
id,
|
|
2650
|
+
url,
|
|
2651
|
+
file,
|
|
2652
|
+
invalidate: false
|
|
2653
|
+
};
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
if (!moduleRunnerModule) moduleRunnerModule = await fetchModule(environment, url, importer, {
|
|
2641
2658
|
...options,
|
|
2642
2659
|
inlineSourceMap: false
|
|
2643
|
-
}).catch(handleRollupError)
|
|
2660
|
+
}).catch(handleRollupError);
|
|
2661
|
+
const result = processResultSource(environment, moduleRunnerModule);
|
|
2662
|
+
if (dump?.dumpFolder && "code" in result) {
|
|
2663
|
+
const path = resolve(dump?.dumpFolder, result.url.replace(/[^\w+]/g, "-"));
|
|
2664
|
+
await writeFile(path, `${result.code}\n// ${JSON.stringify({
|
|
2665
|
+
id: result.id,
|
|
2666
|
+
file: result.file
|
|
2667
|
+
})}`, "utf-8");
|
|
2668
|
+
}
|
|
2644
2669
|
if (!cacheFs || !("code" in result)) return result;
|
|
2645
2670
|
const code = result.code;
|
|
2646
2671
|
// to avoid serialising large chunks of code,
|
|
@@ -2760,17 +2785,30 @@ function normalizeResolvedIdToUrl(environment, resolvedId) {
|
|
|
2760
2785
|
}
|
|
2761
2786
|
|
|
2762
2787
|
function createMethodsRPC(project, options = {}) {
|
|
2763
|
-
const
|
|
2788
|
+
const vitest = project.vitest, cacheFs = options.cacheFs ?? false;
|
|
2789
|
+
if (project.vitest.state.metadata[project.name] ??= {
|
|
2790
|
+
externalized: {},
|
|
2791
|
+
duration: {},
|
|
2792
|
+
tmps: {}
|
|
2793
|
+
}, project.config.dumpDir && !existsSync(project.config.dumpDir)) mkdirSync(project.config.dumpDir, { recursive: true });
|
|
2794
|
+
project.vitest.state.metadata[project.name].dumpDir = project.config.dumpDir;
|
|
2795
|
+
const fetch = createFetchModuleFunction(project._resolver, cacheFs, project.tmpDir, {
|
|
2796
|
+
dumpFolder: project.config.dumpDir,
|
|
2797
|
+
readFromDump: project.config.server.debug?.load ?? process.env.VITEST_DEBUG_LOAD_DUMP != null
|
|
2798
|
+
});
|
|
2764
2799
|
return {
|
|
2765
2800
|
async fetch(url, importer, environmentName, options) {
|
|
2766
2801
|
const environment = project.vite.environments[environmentName];
|
|
2767
2802
|
if (!environment) throw new Error(`The environment ${environmentName} was not defined in the Vite config.`);
|
|
2768
2803
|
const start = performance.now();
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
project.vitest.state.
|
|
2773
|
-
|
|
2804
|
+
return await fetch(url, importer, environment, options).then((result) => {
|
|
2805
|
+
const duration = performance.now() - start;
|
|
2806
|
+
project.vitest.state.transformTime += duration;
|
|
2807
|
+
const metadata = project.vitest.state.metadata[project.name];
|
|
2808
|
+
if ("externalize" in result) metadata.externalized[url] = result.externalize;
|
|
2809
|
+
if ("tmp" in result) metadata.tmps[url] = result.tmp;
|
|
2810
|
+
return metadata.duration[url] ??= [], metadata.duration[url].push(duration), result;
|
|
2811
|
+
});
|
|
2774
2812
|
},
|
|
2775
2813
|
async resolve(id, importer, environmentName) {
|
|
2776
2814
|
const environment = project.vite.environments[environmentName];
|
|
@@ -2783,10 +2821,10 @@ function createMethodsRPC(project, options = {}) {
|
|
|
2783
2821
|
} : null;
|
|
2784
2822
|
},
|
|
2785
2823
|
snapshotSaved(snapshot) {
|
|
2786
|
-
|
|
2824
|
+
vitest.snapshot.add(snapshot);
|
|
2787
2825
|
},
|
|
2788
2826
|
resolveSnapshotPath(testPath) {
|
|
2789
|
-
return
|
|
2827
|
+
return vitest.snapshot.resolvePath(testPath, { config: project.serializedConfig });
|
|
2790
2828
|
},
|
|
2791
2829
|
async transform(id) {
|
|
2792
2830
|
const environment = project.vite.environments.__vitest_vm__;
|
|
@@ -2795,35 +2833,35 @@ function createMethodsRPC(project, options = {}) {
|
|
|
2795
2833
|
return { code: (await environment.transformRequest(url).catch(handleRollupError))?.code };
|
|
2796
2834
|
},
|
|
2797
2835
|
async onQueued(file) {
|
|
2798
|
-
if (options.collect)
|
|
2799
|
-
else await
|
|
2836
|
+
if (options.collect) vitest.state.collectFiles(project, [file]);
|
|
2837
|
+
else await vitest._testRun.enqueued(project, file);
|
|
2800
2838
|
},
|
|
2801
2839
|
async onCollected(files) {
|
|
2802
|
-
if (options.collect)
|
|
2803
|
-
else await
|
|
2840
|
+
if (options.collect) vitest.state.collectFiles(project, files);
|
|
2841
|
+
else await vitest._testRun.collected(project, files);
|
|
2804
2842
|
},
|
|
2805
2843
|
onAfterSuiteRun(meta) {
|
|
2806
|
-
|
|
2844
|
+
vitest.coverageProvider?.onAfterSuiteRun(meta);
|
|
2807
2845
|
},
|
|
2808
2846
|
async onTaskAnnotate(testId, annotation) {
|
|
2809
|
-
return
|
|
2847
|
+
return vitest._testRun.annotate(testId, annotation);
|
|
2810
2848
|
},
|
|
2811
2849
|
async onTaskUpdate(packs, events) {
|
|
2812
|
-
if (options.collect)
|
|
2813
|
-
else await
|
|
2850
|
+
if (options.collect) vitest.state.updateTasks(packs);
|
|
2851
|
+
else await vitest._testRun.updated(packs, events);
|
|
2814
2852
|
},
|
|
2815
2853
|
async onUserConsoleLog(log) {
|
|
2816
|
-
if (options.collect)
|
|
2817
|
-
else await
|
|
2854
|
+
if (options.collect) vitest.state.updateUserLog(log);
|
|
2855
|
+
else await vitest._testRun.log(log);
|
|
2818
2856
|
},
|
|
2819
2857
|
onUnhandledError(err, type) {
|
|
2820
|
-
|
|
2858
|
+
vitest.state.catchError(err, type);
|
|
2821
2859
|
},
|
|
2822
2860
|
onCancel(reason) {
|
|
2823
|
-
|
|
2861
|
+
vitest.cancelCurrentRun(reason);
|
|
2824
2862
|
},
|
|
2825
2863
|
getCountOfFailedTests() {
|
|
2826
|
-
return
|
|
2864
|
+
return vitest.state.getCountOfFailedTests();
|
|
2827
2865
|
}
|
|
2828
2866
|
};
|
|
2829
2867
|
}
|
|
@@ -2868,7 +2906,7 @@ function createChildProcessChannel$1(project, collect = false) {
|
|
|
2868
2906
|
function createForksPool(vitest, { execArgv, env }, specifications) {
|
|
2869
2907
|
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, options = {
|
|
2870
2908
|
runtime: "child_process",
|
|
2871
|
-
filename: resolve(vitest.distPath, "worker-base.js"),
|
|
2909
|
+
filename: resolve$1(vitest.distPath, "worker-base.js"),
|
|
2872
2910
|
teardown: "teardown",
|
|
2873
2911
|
maxThreads,
|
|
2874
2912
|
minThreads,
|
|
@@ -2971,7 +3009,7 @@ function createWorkerChannel$1(project, collect) {
|
|
|
2971
3009
|
}
|
|
2972
3010
|
function createThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
2973
3011
|
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, options = {
|
|
2974
|
-
filename: resolve(vitest.distPath, "worker-base.js"),
|
|
3012
|
+
filename: resolve$1(vitest.distPath, "worker-base.js"),
|
|
2975
3013
|
teardown: "teardown",
|
|
2976
3014
|
useAtomics: poolOptions.useAtomics ?? false,
|
|
2977
3015
|
maxThreads,
|
|
@@ -3222,7 +3260,7 @@ function createChildProcessChannel(project, collect) {
|
|
|
3222
3260
|
function createVmForksPool(vitest, { execArgv, env }, specifications) {
|
|
3223
3261
|
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, options = {
|
|
3224
3262
|
runtime: "child_process",
|
|
3225
|
-
filename: resolve(vitest.distPath, "worker-vm.js"),
|
|
3263
|
+
filename: resolve$1(vitest.distPath, "worker-vm.js"),
|
|
3226
3264
|
maxThreads,
|
|
3227
3265
|
minThreads,
|
|
3228
3266
|
env,
|
|
@@ -3311,7 +3349,7 @@ function createWorkerChannel(project, collect) {
|
|
|
3311
3349
|
}
|
|
3312
3350
|
function createVmThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
3313
3351
|
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, options = {
|
|
3314
|
-
filename: resolve(vitest.distPath, "worker-vm.js"),
|
|
3352
|
+
filename: resolve$1(vitest.distPath, "worker-vm.js"),
|
|
3315
3353
|
useAtomics: poolOptions.useAtomics ?? false,
|
|
3316
3354
|
maxThreads,
|
|
3317
3355
|
minThreads,
|
|
@@ -3380,7 +3418,7 @@ function getMemoryLimit(config) {
|
|
|
3380
3418
|
return typeof memory === "number" ? stringToBytes(limit, config.watch ? memory / 2 : memory) : typeof limit === "number" && limit > 1 || typeof limit === "string" && limit.at(-1) !== "%" ? stringToBytes(limit) : null;
|
|
3381
3419
|
}
|
|
3382
3420
|
|
|
3383
|
-
const suppressWarningsPath = resolve
|
|
3421
|
+
const suppressWarningsPath = resolve(rootDir, "./suppress-warnings.cjs");
|
|
3384
3422
|
const builtinPools = [
|
|
3385
3423
|
"forks",
|
|
3386
3424
|
"threads",
|
|
@@ -3519,7 +3557,7 @@ class BaseSequencer {
|
|
|
3519
3557
|
async shard(files) {
|
|
3520
3558
|
const { config } = this.ctx, { index, count } = config.shard, [shardStart, shardEnd] = this.calculateShardRange(files.length, index, count);
|
|
3521
3559
|
return [...files].map((spec) => {
|
|
3522
|
-
const specPath = resolve
|
|
3560
|
+
const specPath = resolve(slash(config.root), slash(spec.moduleId))?.slice(config.root.length);
|
|
3523
3561
|
return {
|
|
3524
3562
|
spec,
|
|
3525
3563
|
hash: hash("sha1", specPath, "hex")
|
|
@@ -3560,7 +3598,7 @@ class RandomSequencer extends BaseSequencer {
|
|
|
3560
3598
|
}
|
|
3561
3599
|
|
|
3562
3600
|
function resolvePath(path, root) {
|
|
3563
|
-
return normalize(/* @__PURE__ */ resolveModule(path, { paths: [root] }) ?? resolve
|
|
3601
|
+
return normalize(/* @__PURE__ */ resolveModule(path, { paths: [root] }) ?? resolve(root, path));
|
|
3564
3602
|
}
|
|
3565
3603
|
function parseInspector(inspect) {
|
|
3566
3604
|
if (typeof inspect === "boolean" || inspect === void 0) return {};
|
|
@@ -3691,7 +3729,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3691
3729
|
}
|
|
3692
3730
|
}
|
|
3693
3731
|
if (resolved.coverage.reporter = resolveCoverageReporters(resolved.coverage.reporter), resolved.coverage.enabled && resolved.coverage.reportsDirectory) {
|
|
3694
|
-
const reportsDirectory = resolve
|
|
3732
|
+
const reportsDirectory = resolve(resolved.root, resolved.coverage.reportsDirectory);
|
|
3695
3733
|
if (reportsDirectory === resolved.root || reportsDirectory === process.cwd()) throw new Error(`You cannot set "coverage.reportsDirectory" as ${reportsDirectory}. Vitest needs to be able to remove this directory before test run`);
|
|
3696
3734
|
}
|
|
3697
3735
|
if (resolved.coverage.enabled && resolved.coverage.provider === "custom" && resolved.coverage.customProviderModule) resolved.coverage.customProviderModule = resolvePath(resolved.coverage.customProviderModule, resolved.root);
|
|
@@ -3714,7 +3752,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3714
3752
|
"**/node_modules/**"
|
|
3715
3753
|
].filter((pattern) => pattern != null), resolved.forceRerunTriggers = [...resolved.forceRerunTriggers, ...resolved.setupFiles], resolved.cliExclude) resolved.exclude.push(...resolved.cliExclude);
|
|
3716
3754
|
if (resolved.runner) resolved.runner = resolvePath(resolved.runner, resolved.root);
|
|
3717
|
-
if (resolved.attachmentsDir = resolve
|
|
3755
|
+
if (resolved.attachmentsDir = resolve(resolved.root, resolved.attachmentsDir ?? ".vitest-attachments"), resolved.snapshotEnvironment) resolved.snapshotEnvironment = resolvePath(resolved.snapshotEnvironment, resolved.root);
|
|
3718
3756
|
if (resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0, resolved.snapshotFormat && "plugins" in resolved.snapshotFormat) {
|
|
3719
3757
|
// TODO: support it via separate config (like DiffOptions) or via `Function.toString()`
|
|
3720
3758
|
if (resolved.snapshotFormat.plugins = [], typeof resolved.snapshotFormat.compareKeys === "function") throw new TypeError(`"snapshotFormat.compareKeys" function is not supported.`);
|
|
@@ -3769,7 +3807,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3769
3807
|
if (resolved.api = {
|
|
3770
3808
|
...resolveApiServerConfig(options, defaultPort),
|
|
3771
3809
|
token: crypto.randomUUID()
|
|
3772
|
-
}, options.related) resolved.related = toArray(options.related).map((file) => resolve
|
|
3810
|
+
}, options.related) resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
|
|
3773
3811
|
/*
|
|
3774
3812
|
* Reporters can be defined in many different ways:
|
|
3775
3813
|
* { reporter: 'json' }
|
|
@@ -3799,7 +3837,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3799
3837
|
// @ts-expect-error "reporter" is from CLI, should be absolute to the running directory
|
|
3800
3838
|
// it is passed down as "vitest --reporter ../reporter.js"
|
|
3801
3839
|
const reportersFromCLI = resolved.reporter, cliReporters = toArray(reportersFromCLI || []).map((reporter) => {
|
|
3802
|
-
return /^\.\.?\//.test(reporter) ? resolve
|
|
3840
|
+
return /^\.\.?\//.test(reporter) ? resolve(process.cwd(), reporter) : reporter;
|
|
3803
3841
|
});
|
|
3804
3842
|
if (cliReporters.length) resolved.reporters = Array.from(new Set(toArray(cliReporters))).filter(Boolean).map((reporter) => [reporter, {}]);
|
|
3805
3843
|
}
|
|
@@ -3825,7 +3863,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3825
3863
|
...configDefaults.typecheck,
|
|
3826
3864
|
...resolved.typecheck
|
|
3827
3865
|
}, resolved.typecheck ??= {}, resolved.typecheck.enabled ??= false, resolved.typecheck.enabled) logger.console.warn(c.yellow("Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
|
|
3828
|
-
if (resolved.browser.enabled ??= false, resolved.browser.headless ??= isCI, resolved.browser.isolate ??= true, resolved.browser.fileParallelism ??= options.fileParallelism ?? mode !== "benchmark", resolved.browser.ui ??= resolved.browser.headless === true ? false : !isCI, resolved.browser.commands ??= {}, resolved.browser.screenshotDirectory) resolved.browser.screenshotDirectory = resolve
|
|
3866
|
+
if (resolved.browser.enabled ??= false, resolved.browser.headless ??= isCI, resolved.browser.isolate ??= true, resolved.browser.fileParallelism ??= options.fileParallelism ?? mode !== "benchmark", resolved.browser.ui ??= resolved.browser.headless === true ? false : !isCI, resolved.browser.commands ??= {}, resolved.browser.screenshotDirectory) resolved.browser.screenshotDirectory = resolve(resolved.root, resolved.browser.screenshotDirectory);
|
|
3829
3867
|
if (resolved.browser.viewport ??= {}, resolved.browser.viewport.width ??= 414, resolved.browser.viewport.height ??= 896, resolved.browser.locators ??= {}, resolved.browser.locators.testIdAttribute ??= "data-testid", typeof resolved.browser.provider === "string") {
|
|
3830
3868
|
const source = `@vitest/browser-${resolved.browser.provider}`;
|
|
3831
3869
|
throw new TypeError(`The \`browser.provider\` configuration was changed to accept a factory instead of a string. Add an import of "${resolved.browser.provider}" from "${source}" instead. See: https://vitest.dev/guide/browser/config#provider`);
|
|
@@ -3848,7 +3886,11 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3848
3886
|
if (toArray(resolved.reporters).some((reporter) => {
|
|
3849
3887
|
return Array.isArray(reporter) ? reporter[0] === "html" : false;
|
|
3850
3888
|
})) resolved.includeTaskLocation ??= true;
|
|
3851
|
-
|
|
3889
|
+
if (resolved.server ??= {}, resolved.server.deps ??= {}, resolved.server.debug?.dump || process.env.VITEST_DEBUG_DUMP) {
|
|
3890
|
+
const userFolder = resolved.server.debug?.dump || process.env.VITEST_DEBUG_DUMP;
|
|
3891
|
+
resolved.dumpDir = resolve(resolved.root, typeof userFolder === "string" && userFolder !== "true" ? userFolder : ".vitest-dump", resolved.name || "root");
|
|
3892
|
+
}
|
|
3893
|
+
return resolved.testTimeout ??= resolved.browser.enabled ? 15e3 : 5e3, resolved.hookTimeout ??= resolved.browser.enabled ? 3e4 : 1e4, resolved;
|
|
3852
3894
|
}
|
|
3853
3895
|
function isBrowserEnabled(config) {
|
|
3854
3896
|
return Boolean(config.browser?.enabled);
|
|
@@ -3913,7 +3955,7 @@ Update your dependencies and make sure the versions match.`));
|
|
|
3913
3955
|
...coverageConfigDefaults,
|
|
3914
3956
|
...config,
|
|
3915
3957
|
provider: this.name,
|
|
3916
|
-
reportsDirectory: resolve
|
|
3958
|
+
reportsDirectory: resolve(ctx.config.root, config.reportsDirectory || coverageConfigDefaults.reportsDirectory),
|
|
3917
3959
|
reporter: resolveCoverageReporters(config.reporter || coverageConfigDefaults.reporter),
|
|
3918
3960
|
thresholds: config.thresholds && {
|
|
3919
3961
|
...config.thresholds,
|
|
@@ -3925,7 +3967,7 @@ Update your dependencies and make sure the versions match.`));
|
|
|
3925
3967
|
};
|
|
3926
3968
|
const shard = this.ctx.config.shard, tempDirectory = `.tmp${shard ? `-${shard.index}-${shard.count}` : ""}`;
|
|
3927
3969
|
// If --project filter is set pick only roots of resolved projects
|
|
3928
|
-
this.coverageFilesDirectory = resolve
|
|
3970
|
+
this.coverageFilesDirectory = resolve(this.options.reportsDirectory, tempDirectory), this.roots = ctx.config.project?.length ? [...new Set(ctx.projects.map((project) => project.config.root))] : [ctx.config.root];
|
|
3929
3971
|
}
|
|
3930
3972
|
/**
|
|
3931
3973
|
* Check if file matches `coverage.include` but not `coverage.exclude`
|
|
@@ -3993,7 +4035,7 @@ Update your dependencies and make sure the versions match.`));
|
|
|
3993
4035
|
if (!coverage) return;
|
|
3994
4036
|
let entry = this.coverageFiles.get(projectName || DEFAULT_PROJECT);
|
|
3995
4037
|
if (!entry) entry = {}, this.coverageFiles.set(projectName || DEFAULT_PROJECT, entry);
|
|
3996
|
-
const testFilenames = testFiles.join(), filename = resolve
|
|
4038
|
+
const testFilenames = testFiles.join(), filename = resolve(this.coverageFilesDirectory, `coverage-${uniqueId++}.json`);
|
|
3997
4039
|
// If there's a result from previous run, overwrite it
|
|
3998
4040
|
entry[environment] ??= {}, entry[environment][testFilenames] = filename;
|
|
3999
4041
|
const promise = promises$1.writeFile(filename, JSON.stringify(coverage), "utf-8");
|
|
@@ -39,7 +39,7 @@ import { render } from '@testing-library/jsx'
|
|
|
39
39
|
import HelloWorld from './HelloWorld.jsx'
|
|
40
40
|
|
|
41
41
|
test('renders name', async () => {
|
|
42
|
-
const { getByText } = render(<HelloWorld name="Vitest" />)
|
|
42
|
+
const { getByText } = await render(<HelloWorld name="Vitest" />)
|
|
43
43
|
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
|
|
44
44
|
})
|
|
45
45
|
`
|
|
@@ -23,6 +23,7 @@ declare module "@vitest/expect" {
|
|
|
23
23
|
message?: string;
|
|
24
24
|
}
|
|
25
25
|
interface ExpectStatic {
|
|
26
|
+
assert: Chai.AssertStatic;
|
|
26
27
|
unreachable: (message?: string) => never;
|
|
27
28
|
soft: <T>(actual: T, message?: string) => Assertion<T>;
|
|
28
29
|
poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.D_Q9UYh-.js';
|
|
2
|
-
import { i as index } from './index.
|
|
3
|
-
import './vi.
|
|
2
|
+
import { i as index } from './index.Bcjk8TKX.js';
|
|
3
|
+
import './vi.BZvkKVkM.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
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.
|
|
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.BZvkKVkM.js';
|
|
2
2
|
import { b as bench } from './benchmark.DHKMYAts.js';
|
|
3
3
|
import { expectTypeOf } from 'expect-type';
|
|
4
4
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
@@ -391,7 +391,7 @@ var jsdom = {
|
|
|
391
391
|
userAgent,
|
|
392
392
|
...restOptions
|
|
393
393
|
});
|
|
394
|
-
const clearWindowErrors = catchWindowErrors(dom.window);
|
|
394
|
+
const clearAddEventListenerPatch = patchAddEventListener(dom.window), clearWindowErrors = catchWindowErrors(dom.window);
|
|
395
395
|
dom.window.Buffer = Buffer, dom.window.jsdom = dom;
|
|
396
396
|
for (const name of [
|
|
397
397
|
"structuredClone",
|
|
@@ -422,7 +422,7 @@ var jsdom = {
|
|
|
422
422
|
return dom.getInternalVMContext();
|
|
423
423
|
},
|
|
424
424
|
teardown() {
|
|
425
|
-
clearWindowErrors(), dom.window.close(), dom = void 0;
|
|
425
|
+
clearAddEventListenerPatch(), clearWindowErrors(), dom.window.close(), dom = void 0;
|
|
426
426
|
}
|
|
427
427
|
};
|
|
428
428
|
},
|
|
@@ -438,12 +438,37 @@ var jsdom = {
|
|
|
438
438
|
contentType,
|
|
439
439
|
userAgent,
|
|
440
440
|
...restOptions
|
|
441
|
-
}), { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true }), clearWindowErrors = catchWindowErrors(global);
|
|
441
|
+
}), clearAddEventListenerPatch = patchAddEventListener(dom.window), { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true }), clearWindowErrors = catchWindowErrors(global);
|
|
442
442
|
return global.jsdom = dom, { teardown(global) {
|
|
443
|
-
clearWindowErrors(), dom.window.close(), delete global.jsdom, keys.forEach((key) => delete global[key]), originals.forEach((v, k) => global[k] = v);
|
|
443
|
+
clearAddEventListenerPatch(), clearWindowErrors(), dom.window.close(), delete global.jsdom, keys.forEach((key) => delete global[key]), originals.forEach((v, k) => global[k] = v);
|
|
444
444
|
} };
|
|
445
445
|
}
|
|
446
446
|
};
|
|
447
|
+
function patchAddEventListener(window) {
|
|
448
|
+
const JSDOMAbortSignal = window.AbortSignal, JSDOMAbortController = window.AbortController, originalAddEventListener = window.EventTarget.prototype.addEventListener;
|
|
449
|
+
return window.EventTarget.prototype.addEventListener = function addEventListener(type, callback, options) {
|
|
450
|
+
if (typeof options === "object" && options.signal != null) {
|
|
451
|
+
const { signal,...otherOptions } = options;
|
|
452
|
+
// - this happens because AbortSignal is provided by Node.js,
|
|
453
|
+
// but jsdom APIs require jsdom's AbortSignal, while Node APIs
|
|
454
|
+
// (like fetch and Request) require a Node.js AbortSignal
|
|
455
|
+
// - disable narrow typing with "as any" because we need it later
|
|
456
|
+
if (!(signal instanceof JSDOMAbortSignal)) {
|
|
457
|
+
const jsdomCompatOptions = Object.create(null);
|
|
458
|
+
Object.assign(jsdomCompatOptions, otherOptions);
|
|
459
|
+
// use jsdom-native abort controller instead and forward the
|
|
460
|
+
// previous one with `addEventListener`
|
|
461
|
+
const jsdomAbortController = new JSDOMAbortController();
|
|
462
|
+
return signal.addEventListener("abort", () => {
|
|
463
|
+
jsdomAbortController.abort(signal.reason);
|
|
464
|
+
}), jsdomCompatOptions.signal = jsdomAbortController.signal, originalAddEventListener.call(this, type, callback, jsdomCompatOptions);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return originalAddEventListener.call(this, type, callback, options);
|
|
468
|
+
}, () => {
|
|
469
|
+
window.EventTarget.prototype.addEventListener = originalAddEventListener;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
447
472
|
|
|
448
473
|
// some globals we do not want, either because deprecated or we set it ourselves
|
|
449
474
|
const denyList = new Set([
|
|
@@ -1255,7 +1255,7 @@ class GithubActionsReporter {
|
|
|
1255
1255
|
this.ctx = ctx;
|
|
1256
1256
|
}
|
|
1257
1257
|
onTestCaseAnnotate(testCase, annotation) {
|
|
1258
|
-
if (!annotation.location) return;
|
|
1258
|
+
if (!annotation.location || this.options.displayAnnotations === false) return;
|
|
1259
1259
|
const type = getTitle(annotation.type), formatted = formatMessage({
|
|
1260
1260
|
command: getType(annotation.type),
|
|
1261
1261
|
properties: {
|
|
@@ -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, s as separator } from './index.
|
|
5
|
+
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName, s as separator } from './index.D2gVI9Ck.js';
|
|
6
6
|
import { stripVTControlCharacters } from 'node:util';
|
|
7
7
|
import { notNullish } from '@vitest/utils/helpers';
|
|
8
8
|
|
|
@@ -609,7 +609,6 @@ declare class TestProject {
|
|
|
609
609
|
options?: InitializeProjectOptions | undefined;
|
|
610
610
|
/**
|
|
611
611
|
* The global Vitest instance.
|
|
612
|
-
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
613
612
|
*/
|
|
614
613
|
readonly vitest: Vitest;
|
|
615
614
|
/**
|
|
@@ -1556,6 +1555,16 @@ declare class StateManager {
|
|
|
1556
1555
|
reportedTasksMap: WeakMap<Task, TestModule | TestCase | TestSuite>;
|
|
1557
1556
|
blobs?: MergedBlobs;
|
|
1558
1557
|
transformTime: number;
|
|
1558
|
+
metadata: Record<string, {
|
|
1559
|
+
externalized: Record<string, string>;
|
|
1560
|
+
duration: Record<string, number[]>;
|
|
1561
|
+
tmps: Record<string, string>;
|
|
1562
|
+
dumpDir?: string;
|
|
1563
|
+
outline?: {
|
|
1564
|
+
externalized: number;
|
|
1565
|
+
inlined: number;
|
|
1566
|
+
};
|
|
1567
|
+
}>;
|
|
1559
1568
|
onUnhandledError?: OnUnhandledErrorCallback;
|
|
1560
1569
|
constructor(options: {
|
|
1561
1570
|
onUnhandledError?: OnUnhandledErrorCallback;
|
|
@@ -2034,6 +2043,22 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
2034
2043
|
onInit(ctx: Vitest): void;
|
|
2035
2044
|
}
|
|
2036
2045
|
|
|
2046
|
+
interface GithubActionsReporterOptions {
|
|
2047
|
+
onWritePath?: (path: string) => string;
|
|
2048
|
+
/**
|
|
2049
|
+
* @default true
|
|
2050
|
+
*/
|
|
2051
|
+
displayAnnotations?: boolean;
|
|
2052
|
+
}
|
|
2053
|
+
declare class GithubActionsReporter implements Reporter {
|
|
2054
|
+
ctx: Vitest;
|
|
2055
|
+
options: GithubActionsReporterOptions;
|
|
2056
|
+
constructor(options?: GithubActionsReporterOptions);
|
|
2057
|
+
onInit(ctx: Vitest): void;
|
|
2058
|
+
onTestCaseAnnotate(testCase: TestCase, annotation: TestAnnotation): void;
|
|
2059
|
+
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>): void;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2037
2062
|
interface HTMLOptions {
|
|
2038
2063
|
outputFile?: string;
|
|
2039
2064
|
}
|
|
@@ -2151,18 +2176,6 @@ declare class DotReporter extends BaseReporter {
|
|
|
2151
2176
|
private createSummary;
|
|
2152
2177
|
}
|
|
2153
2178
|
|
|
2154
|
-
interface GithubActionsReporterOptions {
|
|
2155
|
-
onWritePath?: (path: string) => string;
|
|
2156
|
-
}
|
|
2157
|
-
declare class GithubActionsReporter implements Reporter {
|
|
2158
|
-
ctx: Vitest;
|
|
2159
|
-
options: GithubActionsReporterOptions;
|
|
2160
|
-
constructor(options?: GithubActionsReporterOptions);
|
|
2161
|
-
onInit(ctx: Vitest): void;
|
|
2162
|
-
onTestCaseAnnotate(testCase: TestCase, annotation: TestAnnotation): void;
|
|
2163
|
-
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>): void;
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
2179
|
declare class HangingProcessReporter implements Reporter {
|
|
2167
2180
|
whyRunning: (() => void) | undefined;
|
|
2168
2181
|
onInit(): void;
|
|
@@ -2256,6 +2269,7 @@ interface BuiltinReporterOptions {
|
|
|
2256
2269
|
"junit": JUnitOptions;
|
|
2257
2270
|
"hanging-process": never;
|
|
2258
2271
|
"html": HTMLOptions;
|
|
2272
|
+
"github-actions": GithubActionsReporterOptions;
|
|
2259
2273
|
}
|
|
2260
2274
|
|
|
2261
2275
|
interface TestSequencer {
|
|
@@ -2489,6 +2503,23 @@ interface InlineConfig {
|
|
|
2489
2503
|
deps?: DepsOptions;
|
|
2490
2504
|
server?: {
|
|
2491
2505
|
deps?: ServerDepsOptions;
|
|
2506
|
+
debug?: {
|
|
2507
|
+
/**
|
|
2508
|
+
* The folder where Vitest stores the contents of transformed
|
|
2509
|
+
* test files that can be inspected manually.
|
|
2510
|
+
*
|
|
2511
|
+
* If `true`, Vitest dumps the files in `.vitest-dump` folder relative to the root of the project.
|
|
2512
|
+
*
|
|
2513
|
+
* You can also use `VITEST_DEBUG_DUMP` env variable to enable this.
|
|
2514
|
+
*/
|
|
2515
|
+
dump?: string | true;
|
|
2516
|
+
/**
|
|
2517
|
+
* If dump is enabled, should Vitest load the files from there instead of transforming them.
|
|
2518
|
+
*
|
|
2519
|
+
* You can also use `VITEST_DEBUG_LOAD_DUMP` env variable to enable this.
|
|
2520
|
+
*/
|
|
2521
|
+
load?: boolean;
|
|
2522
|
+
};
|
|
2492
2523
|
};
|
|
2493
2524
|
/**
|
|
2494
2525
|
* Base directory to scan for the test files
|
|
@@ -2683,7 +2714,6 @@ interface InlineConfig {
|
|
|
2683
2714
|
ui?: boolean;
|
|
2684
2715
|
/**
|
|
2685
2716
|
* options for test in a browser environment
|
|
2686
|
-
* @experimental
|
|
2687
2717
|
*
|
|
2688
2718
|
* @default false
|
|
2689
2719
|
*/
|
|
@@ -3115,6 +3145,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
3115
3145
|
};
|
|
3116
3146
|
runner?: string;
|
|
3117
3147
|
maxWorkers: number;
|
|
3148
|
+
dumpDir?: string;
|
|
3118
3149
|
}
|
|
3119
3150
|
type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "maxWorkers" | "fileParallelism" | "watchTriggerPatterns";
|
|
3120
3151
|
interface ServerDepsOptions {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { chai } from '@vitest/expect';
|
|
2
|
-
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.
|
|
2
|
+
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.DgXU7Yho.js';
|
|
3
3
|
import { r as rpc } from './rpc.cD77ENhU.js';
|
|
4
4
|
import { g as getWorkerState } from './utils.CG9h5ccR.js';
|
|
5
|
-
import { V as VitestTestRunner, N as NodeBenchmarkRunner } from './test.
|
|
5
|
+
import { V as VitestTestRunner, N as NodeBenchmarkRunner } from './test.C3RPt8JR.js';
|
|
6
6
|
|
|
7
7
|
function setupChaiConfig(config) {
|
|
8
8
|
Object.assign(chai.config, config);
|
|
@@ -18,7 +18,7 @@ async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
|
18
18
|
|
|
19
19
|
let globalSetup = false;
|
|
20
20
|
async function setupCommonEnv(config) {
|
|
21
|
-
if (setupDefines(config), setupEnv(config.env), !globalSetup && (globalSetup = true, setSafeTimers(), config.globals)) (await import('./globals.
|
|
21
|
+
if (setupDefines(config), setupEnv(config.env), !globalSetup && (globalSetup = true, setSafeTimers(), config.globals)) (await import('./globals.CwYe1aG7.js')).registerApiGlobally();
|
|
22
22
|
}
|
|
23
23
|
function setupDefines(config) {
|
|
24
24
|
for (const key in config.defines) globalThis[key] = config.defines[key];
|
|
@@ -7,7 +7,7 @@ import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
|
7
7
|
import { getTests, getNames, getTestName } from '@vitest/runner/utils';
|
|
8
8
|
import { processError } from '@vitest/utils/error';
|
|
9
9
|
import { normalize } from 'pathe';
|
|
10
|
-
import { a as getSnapshotClient, i as inject, c as createExpect, v as vi } from './vi.
|
|
10
|
+
import { a as getSnapshotClient, i as inject, c as createExpect, v as vi } from './vi.BZvkKVkM.js';
|
|
11
11
|
import { r as rpc } from './rpc.cD77ENhU.js';
|
|
12
12
|
|
|
13
13
|
function createBenchmarkResult(name) {
|
|
@@ -257,7 +257,7 @@ function createExpect(test) {
|
|
|
257
257
|
return getWorkerState().filepath;
|
|
258
258
|
},
|
|
259
259
|
currentTestName: test ? getTestName(test) : globalState.currentTestName
|
|
260
|
-
}, expect), expect.extend = (matchers) => chai.expect.extend(expect, matchers), expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters), expect.soft = (...args) => {
|
|
260
|
+
}, expect), expect.assert = chai.assert, expect.extend = (matchers) => chai.expect.extend(expect, matchers), expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters), expect.soft = (...args) => {
|
|
261
261
|
// @ts-expect-error private soft access
|
|
262
262
|
return expect(...args).withContext({ soft: true });
|
|
263
263
|
}, expect.poll = createExpectPoll(expect), expect.unreachable = (message) => {
|
|
@@ -5,7 +5,7 @@ import { isBuiltin } from 'node:module';
|
|
|
5
5
|
import { pathToFileURL } from 'node:url';
|
|
6
6
|
import { resolve } from 'pathe';
|
|
7
7
|
import { b as VitestTransport } from './startModuleRunner.DPBo3mme.js';
|
|
8
|
-
import { e as environments } from './index.
|
|
8
|
+
import { e as environments } from './index.CbWINfS7.js';
|
|
9
9
|
import { s as setupInspect } from './inspector.Br76Q2Mb.js';
|
|
10
10
|
import { c as createRuntimeRpc, a as rpcDone } from './rpc.cD77ENhU.js';
|
|
11
11
|
import { i as isChildProcess } from './utils.CG9h5ccR.js';
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as createCLI } from './chunks/cac.
|
|
1
|
+
import { c as createCLI } from './chunks/cac.DYnuYoJK.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.D2gVI9Ck.js';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import 'node:fs/promises';
|
|
10
10
|
import './chunks/typechecker.DsKAhua5.js';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.
|
|
3
|
+
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.BJ_OuJGZ.js';
|
|
4
|
+
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.BJ_OuJGZ.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.XtKKWlOO.js';
|
|
6
6
|
import { F as FakeTimerInstallOpts } from './chunks/config.d.C4PpNy7v.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
8
|
import '@vitest/utils';
|
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.BJ_OuJGZ.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
3
|
import { A as AfterSuiteRunMeta } from './chunks/worker.d.DSgBAZPX.js';
|
|
4
4
|
import '@vitest/runner';
|
package/dist/coverage.js
CHANGED
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.CbWINfS7.js';
|
|
2
2
|
import 'node:console';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SerializedTestSpecification } from './chunks/browser.d.CCG7W26I.js';
|
|
2
2
|
export { B as BrowserTesterOptions } from './chunks/browser.d.CCG7W26I.js';
|
|
3
|
-
import './chunks/global.d.
|
|
3
|
+
import './chunks/global.d.RTA0rbJI.js';
|
|
4
4
|
import { File, TestAnnotation, TaskResultPack, TaskEventPack, TaskPopulated } from '@vitest/runner';
|
|
5
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
6
|
import { Awaitable } from '@vitest/utils';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.
|
|
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.BZvkKVkM.js';
|
|
2
2
|
export { b as bench } from './chunks/benchmark.DHKMYAts.js';
|
|
3
|
-
export { a as assertType } from './chunks/index.
|
|
3
|
+
export { a as assertType } from './chunks/index.Bcjk8TKX.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';
|
package/dist/node.d.ts
CHANGED
|
@@ -3,17 +3,17 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
|
|
|
3
3
|
export { vite as Vite };
|
|
4
4
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
5
5
|
import { IncomingMessage } from 'node:http';
|
|
6
|
-
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as Pool, l as TestSequencer, L as Logger } from './chunks/reporters.d.
|
|
7
|
-
export { ao as BaseCoverageOptions, G as BenchmarkUserOptions, K as BrowserBuiltinProvider, N as BrowserCommand, Q as BrowserCommandContext, X as BrowserConfigOptions, Y as BrowserInstanceOption, Z as BrowserModuleMocker, $ as BrowserOrchestrator, a0 as BrowserProvider, a1 as BrowserProviderOption, a2 as BrowserScript, a3 as BrowserServerFactory, a4 as BrowserServerOptions, a5 as BrowserServerState, a6 as BrowserServerStateSession, ad as BuiltinEnvironment, a7 as CDPSession, ae as CSSModuleScopeStrategy, ap as CoverageIstanbulOptions, aq as CoverageOptions, ar as CoverageProvider, as as CoverageProviderModule, at as CoverageReporter, c as CoverageV8Options, au as CustomProviderOptions, af as DepsOptimizationOptions, ag as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, o as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a8 as ParentProjectBrowser, ah as PoolOptions, a9 as ProjectBrowser, ai as ProjectConfig, b as ReportContext, aw as ReportedHookContext, ax as Reporter, ak as ResolveSnapshotPathHandler, al as ResolveSnapshotPathHandlerContext, aa as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aj as ResolvedProjectConfig, S as SerializedTestProject, p as TaskOptions, q as TestCase, r as TestCollection, s as TestDiagnostic, t as TestModule, u as TestModuleState, v as TestResult, w as TestResultFailed, x as TestResultPassed, y as TestResultSkipped, ay as TestRunEndReason, av as TestRunResult, F as TestSequencerConstructor, z as TestState, B as TestSuite, D as TestSuiteState, ab as ToMatchScreenshotComparators, ac as ToMatchScreenshotOptions, am as TypecheckConfig, U as UserWorkspaceConfig, an as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, _ as _BrowserNames, E as experimental_getRunnerTask } from './chunks/reporters.d.
|
|
6
|
+
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as Pool, l as TestSequencer, L as Logger } from './chunks/reporters.d.BJ_OuJGZ.js';
|
|
7
|
+
export { ao as BaseCoverageOptions, G as BenchmarkUserOptions, K as BrowserBuiltinProvider, N as BrowserCommand, Q as BrowserCommandContext, X as BrowserConfigOptions, Y as BrowserInstanceOption, Z as BrowserModuleMocker, $ as BrowserOrchestrator, a0 as BrowserProvider, a1 as BrowserProviderOption, a2 as BrowserScript, a3 as BrowserServerFactory, a4 as BrowserServerOptions, a5 as BrowserServerState, a6 as BrowserServerStateSession, ad as BuiltinEnvironment, a7 as CDPSession, ae as CSSModuleScopeStrategy, ap as CoverageIstanbulOptions, aq as CoverageOptions, ar as CoverageProvider, as as CoverageProviderModule, at as CoverageReporter, c as CoverageV8Options, au as CustomProviderOptions, af as DepsOptimizationOptions, ag as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, o as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a8 as ParentProjectBrowser, ah as PoolOptions, a9 as ProjectBrowser, ai as ProjectConfig, b as ReportContext, aw as ReportedHookContext, ax as Reporter, ak as ResolveSnapshotPathHandler, al as ResolveSnapshotPathHandlerContext, aa as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aj as ResolvedProjectConfig, S as SerializedTestProject, p as TaskOptions, q as TestCase, r as TestCollection, s as TestDiagnostic, t as TestModule, u as TestModuleState, v as TestResult, w as TestResultFailed, x as TestResultPassed, y as TestResultSkipped, ay as TestRunEndReason, av as TestRunResult, F as TestSequencerConstructor, z as TestState, B as TestSuite, D as TestSuiteState, ab as ToMatchScreenshotComparators, ac as ToMatchScreenshotOptions, am as TypecheckConfig, U as UserWorkspaceConfig, an as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, _ as _BrowserNames, E as experimental_getRunnerTask } from './chunks/reporters.d.BJ_OuJGZ.js';
|
|
8
8
|
import { Awaitable } from '@vitest/utils';
|
|
9
9
|
export { SerializedError } from '@vitest/utils';
|
|
10
10
|
import { a as RuntimeRPC, C as ContextRPC } from './chunks/worker.d.DSgBAZPX.js';
|
|
11
11
|
export { T as TestExecutionType } from './chunks/worker.d.DSgBAZPX.js';
|
|
12
12
|
import { Writable } from 'node:stream';
|
|
13
|
-
export { V as VitestPluginContext } from './chunks/plugin.d.
|
|
13
|
+
export { V as VitestPluginContext } from './chunks/plugin.d.XtKKWlOO.js';
|
|
14
14
|
import { MessagePort } from 'node:worker_threads';
|
|
15
15
|
import { Debugger } from 'debug';
|
|
16
|
-
import './chunks/global.d.
|
|
16
|
+
import './chunks/global.d.RTA0rbJI.js';
|
|
17
17
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
18
18
|
export { b as RuntimeConfig } from './chunks/config.d.C4PpNy7v.js';
|
|
19
19
|
export { generateFileHash } from '@vitest/runner/utils';
|
package/dist/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
|
|
3
3
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
4
|
-
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.
|
|
5
|
-
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, g as createViteLogger, c as createVitest, e as escapeTestName, d as experimental_getRunnerTask, i as isValidApiRequest, f as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { b as BaseSequencer, d as createDebugger, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.xhe4uqTX.js';
|
|
5
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, g as createViteLogger, c as createVitest, e as escapeTestName, d as experimental_getRunnerTask, i as isValidApiRequest, f as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.xhe4uqTX.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.DYnuYoJK.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.Ds84cgzV.js';
|
|
8
|
+
export { b as BaseSequencer, d as createDebugger, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.Ds84cgzV.js';
|
|
9
9
|
import { slash, deepClone } from '@vitest/utils/helpers';
|
|
10
10
|
import { a as any } from './chunks/index.Dc3xnDvT.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
|
@@ -38,7 +38,7 @@ import 'vite/module-runner';
|
|
|
38
38
|
import 'node:console';
|
|
39
39
|
import 'tinyrainbow';
|
|
40
40
|
import '@vitest/utils/highlight';
|
|
41
|
-
import './chunks/index.
|
|
41
|
+
import './chunks/index.D2gVI9Ck.js';
|
|
42
42
|
import 'node:fs/promises';
|
|
43
43
|
import '@vitest/utils/source-map';
|
|
44
44
|
import './chunks/env.D4Lgay0q.js';
|
|
@@ -57,7 +57,7 @@ import './chunks/defaults.CXFFjsi8.js';
|
|
|
57
57
|
import '@vitest/utils/constants';
|
|
58
58
|
import '@vitest/utils/resolver';
|
|
59
59
|
import 'es-module-lexer';
|
|
60
|
-
import './chunks/index.
|
|
60
|
+
import './chunks/index.eEkl9h8v.js';
|
|
61
61
|
import 'node:assert';
|
|
62
62
|
import '@vitest/utils/serialize';
|
|
63
63
|
import 'node:readline';
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aM as BaseReporter, aN as BenchmarkBuiltinReporters, az as BenchmarkReporter, aA as BenchmarkReportsMap, aO as BuiltinReporterOptions, aP as BuiltinReporters, aB as DefaultReporter, aC as DotReporter, aD as GithubActionsReporter, aE as HangingProcessReporter, aG as JUnitReporter, aQ as JsonAssertionResult, aF as JsonReporter, aR as JsonTestResult, aS as JsonTestResults, aw as ReportedHookContext, ax as Reporter, aH as ReportersMap, aI as TapFlatReporter, aJ as TapReporter, ay as TestRunEndReason, aK as VerboseBenchmarkReporter, aL as VerboseReporter } from './chunks/reporters.d.
|
|
1
|
+
export { aM as BaseReporter, aN as BenchmarkBuiltinReporters, az as BenchmarkReporter, aA as BenchmarkReportsMap, aO as BuiltinReporterOptions, aP as BuiltinReporters, aB as DefaultReporter, aC as DotReporter, aD as GithubActionsReporter, aE as HangingProcessReporter, aG as JUnitReporter, aQ as JsonAssertionResult, aF as JsonReporter, aR as JsonTestResult, aS as JsonTestResults, aw as ReportedHookContext, ax as Reporter, aH as ReportersMap, aI as TapFlatReporter, aJ as TapReporter, ay as TestRunEndReason, aK as VerboseBenchmarkReporter, aL as VerboseReporter } from './chunks/reporters.d.BJ_OuJGZ.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import './chunks/worker.d.DSgBAZPX.js';
|
package/dist/reporters.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.
|
|
2
|
-
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.
|
|
1
|
+
export { D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.D2gVI9Ck.js';
|
|
2
|
+
export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.eEkl9h8v.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import './chunks/typechecker.DsKAhua5.js';
|
package/dist/runners.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { N as NodeBenchmarkRunner, V as VitestTestRunner } from './chunks/test.
|
|
1
|
+
export { N as NodeBenchmarkRunner, V as VitestTestRunner } from './chunks/test.C3RPt8JR.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils/helpers';
|
|
4
4
|
import '@vitest/utils/timers';
|
|
@@ -8,7 +8,7 @@ import './chunks/utils.CG9h5ccR.js';
|
|
|
8
8
|
import '@vitest/expect';
|
|
9
9
|
import '@vitest/utils/error';
|
|
10
10
|
import 'pathe';
|
|
11
|
-
import './chunks/vi.
|
|
11
|
+
import './chunks/vi.BZvkKVkM.js';
|
|
12
12
|
import '@vitest/snapshot';
|
|
13
13
|
import '@vitest/spy';
|
|
14
14
|
import '@vitest/utils/offset';
|
package/dist/worker-base.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig, a as createThreadsRpcOptions, e as execute, t as teardown$1 } from './chunks/worker.
|
|
1
|
+
import { c as createForksRpcOptions, u as unwrapSerializableConfig, a as createThreadsRpcOptions, e as execute, t as teardown$1 } from './chunks/worker.CdzokOSx.js';
|
|
2
2
|
import v8 from 'node:v8';
|
|
3
3
|
import { runInThisContext } from 'node:vm';
|
|
4
4
|
import * as spyModule from '@vitest/spy';
|
|
@@ -6,9 +6,9 @@ import { EvaluatedModules } from 'vite/module-runner';
|
|
|
6
6
|
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './chunks/startModuleRunner.DPBo3mme.js';
|
|
7
7
|
import { performance } from 'node:perf_hooks';
|
|
8
8
|
import { startTests, collectTests } from '@vitest/runner';
|
|
9
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './chunks/resolveSnapshotEnvironment.
|
|
10
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './chunks/setup-common.
|
|
11
|
-
import { g as globalExpect, v as vi } from './chunks/vi.
|
|
9
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './chunks/resolveSnapshotEnvironment.tw2a5ux8.js';
|
|
10
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './chunks/setup-common.DgXU7Yho.js';
|
|
11
|
+
import { g as globalExpect, v as vi } from './chunks/vi.BZvkKVkM.js';
|
|
12
12
|
import { c as closeInspector } from './chunks/inspector.Br76Q2Mb.js';
|
|
13
13
|
import { createRequire } from 'node:module';
|
|
14
14
|
import timers from 'node:timers';
|
|
@@ -16,13 +16,13 @@ import timersPromises from 'node:timers/promises';
|
|
|
16
16
|
import util from 'node:util';
|
|
17
17
|
import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
|
|
18
18
|
import { getSafeTimers } from '@vitest/utils/timers';
|
|
19
|
-
import { i as index } from './chunks/index.
|
|
19
|
+
import { i as index } from './chunks/index.Bcjk8TKX.js';
|
|
20
20
|
import { g as getWorkerState, r as resetModules, p as provideWorkerState } from './chunks/utils.CG9h5ccR.js';
|
|
21
21
|
import '@vitest/utils/source-map';
|
|
22
22
|
import 'node:fs';
|
|
23
23
|
import 'node:url';
|
|
24
24
|
import 'pathe';
|
|
25
|
-
import './chunks/index.
|
|
25
|
+
import './chunks/index.CbWINfS7.js';
|
|
26
26
|
import 'node:console';
|
|
27
27
|
import './chunks/rpc.cD77ENhU.js';
|
|
28
28
|
import './chunks/index.Bgo3tNWt.js';
|
|
@@ -33,7 +33,7 @@ import '@vitest/utils/serialize';
|
|
|
33
33
|
import './module-evaluator.js';
|
|
34
34
|
import '@vitest/mocker';
|
|
35
35
|
import '@vitest/expect';
|
|
36
|
-
import './chunks/test.
|
|
36
|
+
import './chunks/test.C3RPt8JR.js';
|
|
37
37
|
import './chunks/benchmark.DHKMYAts.js';
|
|
38
38
|
import '@vitest/runner/utils';
|
|
39
39
|
import '@vitest/utils/error';
|
package/dist/worker-vm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig, a as createThreadsRpcOptions, e as execute, t as teardown$1 } from './chunks/worker.
|
|
1
|
+
import { c as createForksRpcOptions, u as unwrapSerializableConfig, a as createThreadsRpcOptions, e as execute, t as teardown$1 } from './chunks/worker.CdzokOSx.js';
|
|
2
2
|
import v8 from 'node:v8';
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
4
|
import vm, { isContext, runInContext } from 'node:vm';
|
|
@@ -16,7 +16,7 @@ import { s as startVitestModuleRunner, c as createNodeImportMeta, a as VITEST_VM
|
|
|
16
16
|
import { p as provideWorkerState } from './chunks/utils.CG9h5ccR.js';
|
|
17
17
|
import '@vitest/utils/source-map';
|
|
18
18
|
import 'vite/module-runner';
|
|
19
|
-
import './chunks/index.
|
|
19
|
+
import './chunks/index.CbWINfS7.js';
|
|
20
20
|
import 'node:console';
|
|
21
21
|
import './chunks/inspector.Br76Q2Mb.js';
|
|
22
22
|
import './chunks/rpc.cD77ENhU.js';
|
|
@@ -5,17 +5,17 @@ import timersPromises from 'node:timers/promises';
|
|
|
5
5
|
import util from 'node:util';
|
|
6
6
|
import { startTests, collectTests } from '@vitest/runner';
|
|
7
7
|
import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
|
|
8
|
-
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/resolveSnapshotEnvironment.
|
|
9
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/setup-common.
|
|
10
|
-
import { i as index } from '../chunks/index.
|
|
8
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/resolveSnapshotEnvironment.tw2a5ux8.js';
|
|
9
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/setup-common.DgXU7Yho.js';
|
|
10
|
+
import { i as index } from '../chunks/index.Bcjk8TKX.js';
|
|
11
11
|
import { c as closeInspector } from '../chunks/inspector.Br76Q2Mb.js';
|
|
12
12
|
import { g as getWorkerState } from '../chunks/utils.CG9h5ccR.js';
|
|
13
|
-
import { g as globalExpect } from '../chunks/vi.
|
|
13
|
+
import { g as globalExpect } from '../chunks/vi.BZvkKVkM.js';
|
|
14
14
|
import '@vitest/expect';
|
|
15
15
|
import '../chunks/rpc.cD77ENhU.js';
|
|
16
16
|
import '@vitest/utils/timers';
|
|
17
17
|
import '../chunks/index.Bgo3tNWt.js';
|
|
18
|
-
import '../chunks/test.
|
|
18
|
+
import '../chunks/test.C3RPt8JR.js';
|
|
19
19
|
import '@vitest/utils/helpers';
|
|
20
20
|
import '../chunks/benchmark.DHKMYAts.js';
|
|
21
21
|
import '@vitest/runner/utils';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.18",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
"@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
|
|
131
131
|
"happy-dom": "*",
|
|
132
132
|
"jsdom": "*",
|
|
133
|
-
"@vitest/browser-playwright": "4.0.0-beta.
|
|
134
|
-
"@vitest/
|
|
135
|
-
"@vitest/browser-
|
|
136
|
-
"@vitest/
|
|
133
|
+
"@vitest/browser-playwright": "4.0.0-beta.18",
|
|
134
|
+
"@vitest/ui": "4.0.0-beta.18",
|
|
135
|
+
"@vitest/browser-preview": "4.0.0-beta.18",
|
|
136
|
+
"@vitest/browser-webdriverio": "4.0.0-beta.18"
|
|
137
137
|
},
|
|
138
138
|
"peerDependenciesMeta": {
|
|
139
139
|
"@edge-runtime/vm": {
|
|
@@ -179,13 +179,13 @@
|
|
|
179
179
|
"tinyrainbow": "^3.0.3",
|
|
180
180
|
"vite": "^6.0.0 || ^7.0.0",
|
|
181
181
|
"why-is-node-running": "^2.3.0",
|
|
182
|
-
"@vitest/expect": "4.0.0-beta.
|
|
183
|
-
"@vitest/mocker": "4.0.0-beta.
|
|
184
|
-
"@vitest/pretty-format": "4.0.0-beta.
|
|
185
|
-
"@vitest/
|
|
186
|
-
"@vitest/
|
|
187
|
-
"@vitest/
|
|
188
|
-
"@vitest/utils": "4.0.0-beta.
|
|
182
|
+
"@vitest/expect": "4.0.0-beta.18",
|
|
183
|
+
"@vitest/mocker": "4.0.0-beta.18",
|
|
184
|
+
"@vitest/pretty-format": "4.0.0-beta.18",
|
|
185
|
+
"@vitest/spy": "4.0.0-beta.18",
|
|
186
|
+
"@vitest/runner": "4.0.0-beta.18",
|
|
187
|
+
"@vitest/snapshot": "4.0.0-beta.18",
|
|
188
|
+
"@vitest/utils": "4.0.0-beta.18"
|
|
189
189
|
},
|
|
190
190
|
"devDependencies": {
|
|
191
191
|
"@antfu/install-pkg": "^1.1.0",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
"cac": "^6.7.14",
|
|
207
207
|
"empathic": "^2.0.0",
|
|
208
208
|
"flatted": "^3.3.3",
|
|
209
|
-
"happy-dom": "^
|
|
209
|
+
"happy-dom": "^20.0.0",
|
|
210
210
|
"jsdom": "^26.1.0",
|
|
211
211
|
"local-pkg": "^1.1.2",
|
|
212
212
|
"mime": "^4.1.0",
|