vitest 3.2.4 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +3 -5
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.DfmxU-tU.js → base.Bj3pWTr1.js} +1 -1
- package/dist/chunks/browser.d.q8Z0P0q1.d.ts +18 -0
- package/dist/chunks/{cac.Cb-PYCCB.js → cac.D3EzDDZd.js} +8 -17
- package/dist/chunks/{cli-api.BkDphVBG.js → cli-api.Dn5gKePv.js} +7 -7
- package/dist/chunks/{config.d.D2ROskhv.d.ts → config.d.HJdfX-8k.d.ts} +1 -2
- package/dist/chunks/{coverage.DL5VHqXY.js → coverage.Cwa-XhJt.js} +56 -17
- package/dist/chunks/{defaults.B7q_naMc.js → defaults.CXFFjsi8.js} +2 -42
- package/dist/chunks/environment.d.CUq4cUgQ.d.ts +44 -0
- package/dist/chunks/{global.d.MAmajcmJ.d.ts → global.d.CVbXEflG.d.ts} +7 -29
- package/dist/chunks/{globals.DEHgCU4V.js → globals.Cxal6MLI.js} +1 -1
- package/dist/chunks/{index.CdQS2e2Q.js → index.BWf_gE5n.js} +0 -2
- package/dist/chunks/{index.VByaPkjc.js → index.CZI_8rVt.js} +223 -235
- package/dist/chunks/{index.CwejwG0H.js → index.D-VkfKhf.js} +2 -2
- package/dist/chunks/{index.BCWujgDG.js → index.TfbsX-3I.js} +1 -1
- package/dist/chunks/plugin.d.C2EcJUjo.d.ts +9 -0
- package/dist/chunks/{reporters.d.BFLkQcL6.d.ts → reporters.d.DxZg19fy.d.ts} +2213 -2208
- package/dist/chunks/{rpc.-pEldfrD.js → rpc.CsFtxqeq.js} +4 -4
- package/dist/chunks/{runBaseTests.9Ij9_de-.js → runBaseTests.BC7ZIH5L.js} +4 -4
- package/dist/chunks/{setup-common.Dd054P77.js → setup-common.D7ZqXFx-.js} +1 -1
- package/dist/chunks/{worker.d.CKwWzBSj.d.ts → worker.d.CmvJfRGs.d.ts} +1 -1
- package/dist/chunks/{worker.d.1GmBbd7G.d.ts → worker.d.DoNjFAiv.d.ts} +6 -13
- package/dist/cli.js +9 -9
- package/dist/config.cjs +2 -49
- package/dist/config.d.ts +36 -30
- package/dist/config.js +2 -8
- package/dist/coverage.d.ts +15 -9
- package/dist/coverage.js +6 -5
- package/dist/environments.d.ts +2 -3
- package/dist/execute.d.ts +3 -5
- package/dist/index.d.ts +23 -177
- package/dist/index.js +1 -1
- package/dist/node.d.ts +37 -25
- package/dist/node.js +13 -19
- package/dist/reporters.d.ts +9 -9
- package/dist/reporters.js +12 -12
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +2 -1
- package/dist/worker.js +1 -1
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +4 -4
- package/dist/workers/threads.js +1 -1
- package/dist/workers.d.ts +4 -7
- package/dist/workers.js +2 -2
- package/package.json +11 -11
- package/dist/chunks/environment.d.cL3nLXbE.d.ts +0 -119
- package/dist/chunks/vite.d.CMLlLIFP.d.ts +0 -25
- package/dist/chunks/{typechecker.DRKU1-1g.js → typechecker.CVytUJuF.js} +26 -26
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.
|
|
1
|
+
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.HJdfX-8k.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.S9RMNXIe.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
4
|
import { VitestExecutor } from './execute.js';
|
|
@@ -9,12 +9,10 @@ export { LoupeOptions, ParsedStack, StringifyOptions, format, getSafeTimers, ins
|
|
|
9
9
|
export { TraceMap, originalPositionFor } from '@vitest/utils/source-map';
|
|
10
10
|
import '@vitest/pretty-format';
|
|
11
11
|
import '@vitest/snapshot';
|
|
12
|
-
import '@vitest/snapshot/environment';
|
|
13
12
|
import 'vite-node/client';
|
|
14
13
|
import 'vite-node';
|
|
15
|
-
import './chunks/worker.d.
|
|
16
|
-
import './chunks/environment.d.
|
|
17
|
-
import 'vitest/optional-types.js';
|
|
14
|
+
import './chunks/worker.d.DoNjFAiv.js';
|
|
15
|
+
import './chunks/environment.d.CUq4cUgQ.js';
|
|
18
16
|
import 'node:vm';
|
|
19
17
|
import '@vitest/mocker';
|
|
20
18
|
import './chunks/mocker.d.BE_2ls6u.js';
|
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.D7ZqXFx-.js';
|
|
2
2
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
3
3
|
import * as spy from '@vitest/spy';
|
|
4
4
|
export { spy as SpyModule };
|
|
@@ -24,7 +24,7 @@ async function runBaseTests(method, state) {
|
|
|
24
24
|
const [executor, { run }] = await Promise.all([startViteNode({
|
|
25
25
|
state,
|
|
26
26
|
requestStubs: getDefaultRequestStubs()
|
|
27
|
-
}), import('./runBaseTests.
|
|
27
|
+
}), import('./runBaseTests.BC7ZIH5L.js')]);
|
|
28
28
|
const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
|
|
29
29
|
filepath: f,
|
|
30
30
|
testLocations: void 0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { T as TestExecutionMethod } from './worker.d.DoNjFAiv.js';
|
|
2
|
+
|
|
3
|
+
type SerializedTestSpecification = [project: {
|
|
4
|
+
name: string | undefined
|
|
5
|
+
root: string
|
|
6
|
+
}, file: string, options: {
|
|
7
|
+
pool: string
|
|
8
|
+
testLines?: number[] | undefined
|
|
9
|
+
}];
|
|
10
|
+
|
|
11
|
+
interface BrowserTesterOptions {
|
|
12
|
+
method: TestExecutionMethod;
|
|
13
|
+
files: string[];
|
|
14
|
+
providedContext: string;
|
|
15
|
+
startTime: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type { BrowserTesterOptions as B, SerializedTestSpecification as S };
|
|
@@ -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.DnKduX2e.js';
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
6
|
+
import { R as ReportersMap } from './index.CZI_8rVt.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 = "
|
|
622
|
+
var version = "4.0.0-beta.1";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -734,30 +734,21 @@ const cliOptionsConfig = {
|
|
|
734
734
|
argument: "",
|
|
735
735
|
transform: transformNestedBoolean,
|
|
736
736
|
subcommands: {
|
|
737
|
-
all: {
|
|
738
|
-
description: "Whether to include all files, including the untested ones into report",
|
|
739
|
-
default: true
|
|
740
|
-
},
|
|
741
737
|
provider: {
|
|
742
738
|
description: "Select the tool for coverage collection, available values are: \"v8\", \"istanbul\" and \"custom\"",
|
|
743
739
|
argument: "<name>"
|
|
744
740
|
},
|
|
745
741
|
enabled: { description: "Enables coverage collection. Can be overridden using the `--coverage` CLI option (default: `false`)" },
|
|
746
742
|
include: {
|
|
747
|
-
description: "Files included in coverage as glob patterns. May be specified more than once when using multiple patterns
|
|
743
|
+
description: "Files included in coverage as glob patterns. May be specified more than once when using multiple patterns. By default only files covered by tests are included.",
|
|
748
744
|
argument: "<pattern>",
|
|
749
745
|
array: true
|
|
750
746
|
},
|
|
751
747
|
exclude: {
|
|
752
|
-
description: "Files to be excluded in coverage. May be specified more than once when using multiple extensions
|
|
748
|
+
description: "Files to be excluded in coverage. May be specified more than once when using multiple extensions.",
|
|
753
749
|
argument: "<pattern>",
|
|
754
750
|
array: true
|
|
755
751
|
},
|
|
756
|
-
extension: {
|
|
757
|
-
description: "Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[\".js\", \".cjs\", \".mjs\", \".ts\", \".mts\", \".tsx\", \".jsx\", \".vue\", \".svelte\"]`)",
|
|
758
|
-
argument: "<extension>",
|
|
759
|
-
array: true
|
|
760
|
-
},
|
|
761
752
|
clean: { description: "Clean coverage results before running tests (default: true)" },
|
|
762
753
|
cleanOnRerun: { description: "Clean coverage report on watch rerun (default: true)" },
|
|
763
754
|
reportsDirectory: {
|
|
@@ -1408,11 +1399,11 @@ async function start(mode, cliFilters, options) {
|
|
|
1408
1399
|
process.title = "node (vitest)";
|
|
1409
1400
|
} catch {}
|
|
1410
1401
|
try {
|
|
1411
|
-
const { startVitest } = await import('./cli-api.
|
|
1402
|
+
const { startVitest } = await import('./cli-api.Dn5gKePv.js').then(function (n) { return n.f; });
|
|
1412
1403
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1413
1404
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1414
1405
|
} catch (e) {
|
|
1415
|
-
const { errorBanner } = await import('./index.
|
|
1406
|
+
const { errorBanner } = await import('./index.CZI_8rVt.js').then(function (n) { return n.u; });
|
|
1416
1407
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
1417
1408
|
console.error(e);
|
|
1418
1409
|
console.error("\n\n");
|
|
@@ -1433,7 +1424,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1433
1424
|
process.title = "node (vitest)";
|
|
1434
1425
|
} catch {}
|
|
1435
1426
|
try {
|
|
1436
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1427
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Dn5gKePv.js').then(function (n) { return n.f; });
|
|
1437
1428
|
const ctx = await prepareVitest(mode, {
|
|
1438
1429
|
...normalizeCliOptions(cliFilters, options),
|
|
1439
1430
|
watch: false,
|
|
@@ -1455,7 +1446,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1455
1446
|
}
|
|
1456
1447
|
await ctx.close();
|
|
1457
1448
|
} catch (e) {
|
|
1458
|
-
const { errorBanner } = await import('./index.
|
|
1449
|
+
const { errorBanner } = await import('./index.CZI_8rVt.js').then(function (n) { return n.u; });
|
|
1459
1450
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
1460
1451
|
console.error(e);
|
|
1461
1452
|
console.error("\n\n");
|
|
@@ -11,9 +11,9 @@ import { generateFileHash, limitConcurrency, createFileTask, hasFailed, getTasks
|
|
|
11
11
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
12
12
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
13
13
|
import { ViteNodeServer } from 'vite-node/server';
|
|
14
|
-
import { v as version$1 } from './cac.
|
|
14
|
+
import { v as version$1 } from './cac.D3EzDDZd.js';
|
|
15
15
|
import { c as createBirpc } from './index.B521nVV-.js';
|
|
16
|
-
import { p as parse, s as stringify, d as printError, f as formatProjectName, w as withLabel, e as errorBanner, h as divider, i as generateCodeFrame, R as ReportersMap,
|
|
16
|
+
import { p as parse, s as stringify, d as printError, f as formatProjectName, w as withLabel, e as errorBanner, h as divider, i as generateCodeFrame, R as ReportersMap, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.CZI_8rVt.js';
|
|
17
17
|
import require$$0$3 from 'events';
|
|
18
18
|
import require$$1$1 from 'https';
|
|
19
19
|
import require$$2 from 'http';
|
|
@@ -28,8 +28,8 @@ import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
|
28
28
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
29
29
|
import crypto, { createHash } from 'node:crypto';
|
|
30
30
|
import { distDir, rootDir } from '../path.js';
|
|
31
|
-
import { h as hash, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, d as isBrowserEnabled, r as resolveConfig, e as groupBy, f as getCoverageProvider, j as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.
|
|
32
|
-
import { c as convertTasksToEvents } from './typechecker.
|
|
31
|
+
import { h as hash, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, d as isBrowserEnabled, r as resolveConfig, e as groupBy, f as getCoverageProvider, j as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.Cwa-XhJt.js';
|
|
32
|
+
import { c as convertTasksToEvents } from './typechecker.CVytUJuF.js';
|
|
33
33
|
import { Console } from 'node:console';
|
|
34
34
|
import c from 'tinyrainbow';
|
|
35
35
|
import { createRequire } from 'node:module';
|
|
@@ -41,9 +41,9 @@ import pm from 'picomatch';
|
|
|
41
41
|
import { glob, isDynamicPattern } from 'tinyglobby';
|
|
42
42
|
import { normalizeRequestId, cleanUrl } from 'vite-node/utils';
|
|
43
43
|
import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
|
|
44
|
-
import { c as configDefaults } from './defaults.
|
|
44
|
+
import { c as configDefaults } from './defaults.CXFFjsi8.js';
|
|
45
45
|
import MagicString from 'magic-string';
|
|
46
|
-
import { a as BenchmarkReportsMap } from './index.
|
|
46
|
+
import { a as BenchmarkReportsMap } from './index.TfbsX-3I.js';
|
|
47
47
|
import assert$1 from 'node:assert';
|
|
48
48
|
import { serializeError } from '@vitest/utils/error';
|
|
49
49
|
import readline from 'node:readline';
|
|
@@ -10647,4 +10647,4 @@ var cliApi = /*#__PURE__*/Object.freeze({
|
|
|
10647
10647
|
startVitest: startVitest
|
|
10648
10648
|
});
|
|
10649
10649
|
|
|
10650
|
-
export { FilesNotFoundError as F, GitNotFoundError as G,
|
|
10650
|
+
export { FilesNotFoundError as F, GitNotFoundError as G, Vitest as V, VitestPlugin as a, VitestPackageInstaller as b, createVitest as c, registerConsoleShortcuts as d, createViteLogger as e, cliApi as f, isValidApiRequest as i, resolveFsAllow as r, startVitest as s };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
2
2
|
import { SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
3
|
-
import { SnapshotUpdateState } from '@vitest/snapshot';
|
|
4
|
-
import { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
3
|
+
import { SnapshotUpdateState, SnapshotEnvironment } from '@vitest/snapshot';
|
|
5
4
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -1,12 +1,14 @@
|
|
|
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
3
|
import { isAbsolute, join as join$1, dirname as dirname$1, resolve as resolve$1, relative, normalize } from 'pathe';
|
|
3
4
|
import pm from 'picomatch';
|
|
5
|
+
import { glob } from 'tinyglobby';
|
|
4
6
|
import c from 'tinyrainbow';
|
|
5
|
-
import {
|
|
7
|
+
import { slash, cleanUrl } from 'vite-node/utils';
|
|
8
|
+
import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.CXFFjsi8.js';
|
|
6
9
|
import crypto from 'node:crypto';
|
|
7
|
-
import { createDefer, shuffle, toArray } from '@vitest/utils';
|
|
10
|
+
import { createDefer, shuffle, toArray, slash as slash$1 } from '@vitest/utils';
|
|
8
11
|
import { builtinModules, createRequire } from 'node:module';
|
|
9
|
-
import path, { win32, dirname, join, resolve } from 'node:path';
|
|
10
12
|
import process$1 from 'node:process';
|
|
11
13
|
import fs$1, { writeFile, rename, stat, unlink } from 'node:fs/promises';
|
|
12
14
|
import { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1, URL as URL$1 } from 'node:url';
|
|
@@ -14,7 +16,7 @@ import assert from 'node:assert';
|
|
|
14
16
|
import v8 from 'node:v8';
|
|
15
17
|
import { format, inspect } from 'node:util';
|
|
16
18
|
import { version, mergeConfig } from 'vite';
|
|
17
|
-
import { e as extraInlineDeps, d as defaultBrowserPort, b as defaultInspectPort, a as defaultPort } from './constants.DnKduX2e.js';
|
|
19
|
+
import { c as configFiles, w as workspacesFiles, e as extraInlineDeps, d as defaultBrowserPort, b as defaultInspectPort, a as defaultPort } from './constants.DnKduX2e.js';
|
|
18
20
|
import { a as isWindows } from './env.D4Lgay0q.js';
|
|
19
21
|
import * as nodeos from 'node:os';
|
|
20
22
|
import nodeos__default from 'node:os';
|
|
@@ -22,11 +24,10 @@ import { isatty } from 'node:tty';
|
|
|
22
24
|
import EventEmitter from 'node:events';
|
|
23
25
|
import { c as createBirpc } from './index.B521nVV-.js';
|
|
24
26
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
25
|
-
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.
|
|
27
|
+
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.CVytUJuF.js';
|
|
26
28
|
import { MessageChannel } from 'node:worker_threads';
|
|
27
29
|
import { hasFailed } from '@vitest/runner/utils';
|
|
28
30
|
import { rootDir } from '../path.js';
|
|
29
|
-
import { slash } from 'vite-node/utils';
|
|
30
31
|
import { isCI, provider } from 'std-env';
|
|
31
32
|
import { r as resolveCoverageProviderModule } from './coverage.DVF1vEu8.js';
|
|
32
33
|
|
|
@@ -2450,14 +2451,6 @@ function createMethodsRPC(project, options = {}) {
|
|
|
2450
2451
|
resolveSnapshotPath(testPath) {
|
|
2451
2452
|
return ctx.snapshot.resolvePath(testPath, { config: project.serializedConfig });
|
|
2452
2453
|
},
|
|
2453
|
-
async getSourceMap(id, force) {
|
|
2454
|
-
if (force) {
|
|
2455
|
-
const mod = project.vite.moduleGraph.getModuleById(id);
|
|
2456
|
-
if (mod) project.vite.moduleGraph.invalidateModule(mod);
|
|
2457
|
-
}
|
|
2458
|
-
const r = await project.vitenode.transformRequest(id);
|
|
2459
|
-
return r?.map;
|
|
2460
|
-
},
|
|
2461
2454
|
async fetch(id, transformMode) {
|
|
2462
2455
|
const result = await project.vitenode.fetchResult(id, transformMode).catch(handleRollupError);
|
|
2463
2456
|
const code = result.code;
|
|
@@ -3652,12 +3645,19 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3652
3645
|
resolved.deps.web.transformGlobPattern ??= [];
|
|
3653
3646
|
resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => resolvePath(file, resolved.root));
|
|
3654
3647
|
resolved.globalSetup = toArray(resolved.globalSetup || []).map((file) => resolvePath(file, resolved.root));
|
|
3655
|
-
//
|
|
3648
|
+
// Add hard-coded default coverage exclusions. These cannot be overidden by user config.
|
|
3649
|
+
// Override original exclude array for cases where user re-uses same object in test.exclude.
|
|
3656
3650
|
resolved.coverage.exclude = [
|
|
3657
3651
|
...resolved.coverage.exclude,
|
|
3658
3652
|
...resolved.setupFiles.map((file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(resolved.root, file)}`),
|
|
3659
|
-
...resolved.include
|
|
3660
|
-
|
|
3653
|
+
...resolved.include,
|
|
3654
|
+
resolved.config && slash$1(resolved.config),
|
|
3655
|
+
...configFiles,
|
|
3656
|
+
...workspacesFiles,
|
|
3657
|
+
"**/virtual:*",
|
|
3658
|
+
"**/__x00__*",
|
|
3659
|
+
"**/node_modules/**"
|
|
3660
|
+
].filter((pattern) => pattern != null);
|
|
3661
3661
|
resolved.forceRerunTriggers = [...resolved.forceRerunTriggers, ...resolved.setupFiles];
|
|
3662
3662
|
resolved.server ??= {};
|
|
3663
3663
|
resolved.server.deps ??= {};
|
|
@@ -3962,6 +3962,7 @@ class BaseCoverageProvider {
|
|
|
3962
3962
|
name;
|
|
3963
3963
|
version;
|
|
3964
3964
|
options;
|
|
3965
|
+
globCache = /* @__PURE__ */ new Map();
|
|
3965
3966
|
coverageFiles = /* @__PURE__ */ new Map();
|
|
3966
3967
|
pendingPromises = [];
|
|
3967
3968
|
coverageFilesDirectory;
|
|
@@ -3989,6 +3990,44 @@ Update your dependencies and make sure the versions match.`));
|
|
|
3989
3990
|
const tempDirectory = `.tmp${shard ? `-${shard.index}-${shard.count}` : ""}`;
|
|
3990
3991
|
this.coverageFilesDirectory = resolve$1(this.options.reportsDirectory, tempDirectory);
|
|
3991
3992
|
}
|
|
3993
|
+
/**
|
|
3994
|
+
* Check if file matches `coverage.include` but not `coverage.exclude`
|
|
3995
|
+
*/
|
|
3996
|
+
isIncluded(_filename) {
|
|
3997
|
+
const filename = slash(_filename);
|
|
3998
|
+
const cacheHit = this.globCache.get(filename);
|
|
3999
|
+
if (cacheHit !== void 0) return cacheHit;
|
|
4000
|
+
// File outside project root with default allowExternal
|
|
4001
|
+
if (this.options.allowExternal === false && !filename.startsWith(this.ctx.config.root)) {
|
|
4002
|
+
this.globCache.set(filename, false);
|
|
4003
|
+
return false;
|
|
4004
|
+
}
|
|
4005
|
+
const options = {
|
|
4006
|
+
contains: true,
|
|
4007
|
+
dot: true,
|
|
4008
|
+
cwd: this.ctx.config.root,
|
|
4009
|
+
ignore: this.options.exclude
|
|
4010
|
+
};
|
|
4011
|
+
// By default `coverage.include` matches all files, except "coverage.exclude"
|
|
4012
|
+
const glob = this.options.include || "**";
|
|
4013
|
+
const included = pm.isMatch(filename, glob, options) && existsSync(cleanUrl(filename));
|
|
4014
|
+
this.globCache.set(filename, included);
|
|
4015
|
+
return included;
|
|
4016
|
+
}
|
|
4017
|
+
async getUntestedFiles(testedFiles) {
|
|
4018
|
+
if (this.options.include == null) return [];
|
|
4019
|
+
let includedFiles = await glob(this.options.include, {
|
|
4020
|
+
cwd: this.ctx.config.root,
|
|
4021
|
+
ignore: [...this.options.exclude, ...testedFiles.map((file) => slash(file))],
|
|
4022
|
+
absolute: true,
|
|
4023
|
+
dot: true,
|
|
4024
|
+
onlyFiles: true
|
|
4025
|
+
});
|
|
4026
|
+
// Run again through picomatch as tinyglobby's exclude pattern is different ({ "exclude": ["math"] } should ignore "src/math.ts")
|
|
4027
|
+
includedFiles = includedFiles.filter((file) => this.isIncluded(file));
|
|
4028
|
+
if (this.ctx.config.changed) includedFiles = (this.ctx.config.related || []).filter((file) => includedFiles.includes(file));
|
|
4029
|
+
return includedFiles.map((file) => slash(path.resolve(this.ctx.config.root, file)));
|
|
4030
|
+
}
|
|
3992
4031
|
createCoverageMap() {
|
|
3993
4032
|
throw new Error("BaseReporter's createCoverageMap was not overwritten");
|
|
3994
4033
|
}
|
|
@@ -3,13 +3,7 @@ import './env.D4Lgay0q.js';
|
|
|
3
3
|
import { isCI } from 'std-env';
|
|
4
4
|
|
|
5
5
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
6
|
-
const defaultExclude = [
|
|
7
|
-
"**/node_modules/**",
|
|
8
|
-
"**/dist/**",
|
|
9
|
-
"**/cypress/**",
|
|
10
|
-
"**/.{idea,git,cache,output,temp}/**",
|
|
11
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"
|
|
12
|
-
];
|
|
6
|
+
const defaultExclude = ["**/node_modules/**", "**/.git/**"];
|
|
13
7
|
const benchmarkConfigDefaults = {
|
|
14
8
|
include: ["**/*.{bench,benchmark}.?(c|m)[jt]s?(x)"],
|
|
15
9
|
exclude: defaultExclude,
|
|
@@ -17,34 +11,14 @@ const benchmarkConfigDefaults = {
|
|
|
17
11
|
reporters: ["default"],
|
|
18
12
|
includeSamples: false
|
|
19
13
|
};
|
|
20
|
-
const defaultCoverageExcludes = [
|
|
21
|
-
"coverage/**",
|
|
22
|
-
"dist/**",
|
|
23
|
-
"**/node_modules/**",
|
|
24
|
-
"**/[.]**",
|
|
25
|
-
"packages/*/test?(s)/**",
|
|
26
|
-
"**/*.d.ts",
|
|
27
|
-
"**/virtual:*",
|
|
28
|
-
"**/__x00__*",
|
|
29
|
-
"**/\0*",
|
|
30
|
-
"cypress/**",
|
|
31
|
-
"test?(s)/**",
|
|
32
|
-
"test?(-*).?(c|m)[jt]s?(x)",
|
|
33
|
-
"**/*{.,-}{test,spec,bench,benchmark}?(-d).?(c|m)[jt]s?(x)",
|
|
34
|
-
"**/__tests__/**",
|
|
35
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
|
|
36
|
-
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
37
|
-
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
38
|
-
];
|
|
39
14
|
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
40
15
|
const coverageConfigDefaults = {
|
|
41
16
|
provider: "v8",
|
|
42
17
|
enabled: false,
|
|
43
|
-
all: true,
|
|
44
18
|
clean: true,
|
|
45
19
|
cleanOnRerun: true,
|
|
46
20
|
reportsDirectory: "./coverage",
|
|
47
|
-
exclude:
|
|
21
|
+
exclude: [],
|
|
48
22
|
reportOnFailure: false,
|
|
49
23
|
reporter: [
|
|
50
24
|
["text", {}],
|
|
@@ -52,22 +26,8 @@ const coverageConfigDefaults = {
|
|
|
52
26
|
["clover", {}],
|
|
53
27
|
["json", {}]
|
|
54
28
|
],
|
|
55
|
-
extension: [
|
|
56
|
-
".js",
|
|
57
|
-
".cjs",
|
|
58
|
-
".mjs",
|
|
59
|
-
".ts",
|
|
60
|
-
".mts",
|
|
61
|
-
".tsx",
|
|
62
|
-
".jsx",
|
|
63
|
-
".vue",
|
|
64
|
-
".svelte",
|
|
65
|
-
".marko",
|
|
66
|
-
".astro"
|
|
67
|
-
],
|
|
68
29
|
allowExternal: false,
|
|
69
30
|
excludeAfterRemap: false,
|
|
70
|
-
ignoreEmptyLines: true,
|
|
71
31
|
processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length)
|
|
72
32
|
};
|
|
73
33
|
const fakeTimersDefaults = {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
2
|
+
type Arrayable<T> = T | Array<T>;
|
|
3
|
+
type TransformMode = "web" | "ssr";
|
|
4
|
+
interface AfterSuiteRunMeta {
|
|
5
|
+
coverage?: unknown;
|
|
6
|
+
testFiles: string[];
|
|
7
|
+
transformMode: TransformMode | "browser";
|
|
8
|
+
projectName?: string;
|
|
9
|
+
}
|
|
10
|
+
interface UserConsoleLog {
|
|
11
|
+
content: string;
|
|
12
|
+
origin?: string;
|
|
13
|
+
browser?: boolean;
|
|
14
|
+
type: "stdout" | "stderr";
|
|
15
|
+
taskId?: string;
|
|
16
|
+
time: number;
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
interface ModuleGraphData {
|
|
20
|
+
graph: Record<string, string[]>;
|
|
21
|
+
externalized: string[];
|
|
22
|
+
inlined: string[];
|
|
23
|
+
}
|
|
24
|
+
interface ProvidedContext {}
|
|
25
|
+
// These need to be compatible with Tinyrainbow's bg-colors, and CSS's background-color
|
|
26
|
+
type LabelColor = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white";
|
|
27
|
+
|
|
28
|
+
interface EnvironmentReturn {
|
|
29
|
+
teardown: (global: any) => Awaitable<void>;
|
|
30
|
+
}
|
|
31
|
+
interface VmEnvironmentReturn {
|
|
32
|
+
getVmContext: () => {
|
|
33
|
+
[key: string]: any
|
|
34
|
+
};
|
|
35
|
+
teardown: () => Awaitable<void>;
|
|
36
|
+
}
|
|
37
|
+
interface Environment {
|
|
38
|
+
name: string;
|
|
39
|
+
transformMode: "web" | "ssr";
|
|
40
|
+
setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
|
|
41
|
+
setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type { AfterSuiteRunMeta as A, Environment as E, LabelColor as L, ModuleGraphData as M, ProvidedContext as P, TransformMode as T, UserConsoleLog as U, VmEnvironmentReturn as V, EnvironmentReturn as a, Awaitable as b, Arrayable as c };
|
|
@@ -2,40 +2,20 @@ import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
|
2
2
|
import { Plugin } from '@vitest/pretty-format';
|
|
3
3
|
import { SnapshotState } from '@vitest/snapshot';
|
|
4
4
|
import { B as BenchmarkResult } from './benchmark.d.BwvBVTda.js';
|
|
5
|
-
import { U as UserConsoleLog } from './environment.d.
|
|
6
|
-
|
|
7
|
-
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
8
|
-
interface TscErrorInfo {
|
|
9
|
-
filePath: string;
|
|
10
|
-
errCode: number;
|
|
11
|
-
errMsg: string;
|
|
12
|
-
line: number;
|
|
13
|
-
column: number;
|
|
14
|
-
}
|
|
15
|
-
interface CollectLineNumbers {
|
|
16
|
-
target: number;
|
|
17
|
-
next: number;
|
|
18
|
-
prev?: number;
|
|
19
|
-
}
|
|
20
|
-
type CollectLines = { [key in keyof CollectLineNumbers] : string };
|
|
21
|
-
interface RootAndTarget {
|
|
22
|
-
root: string;
|
|
23
|
-
targetAbsPath: string;
|
|
24
|
-
}
|
|
25
|
-
type Context = RootAndTarget & {
|
|
26
|
-
rawErrsMap: RawErrsMap
|
|
27
|
-
openedDirs: Set<string>
|
|
28
|
-
lastActivePath?: string
|
|
29
|
-
};
|
|
5
|
+
import { U as UserConsoleLog } from './environment.d.CUq4cUgQ.js';
|
|
30
6
|
|
|
31
7
|
declare global {
|
|
32
8
|
// eslint-disable-next-line ts/no-namespace
|
|
33
9
|
namespace Chai {
|
|
10
|
+
interface ContainSubset {
|
|
11
|
+
(expected: any): Assertion;
|
|
12
|
+
}
|
|
34
13
|
interface Assertion {
|
|
35
|
-
containSubset:
|
|
14
|
+
containSubset: ContainSubset;
|
|
36
15
|
}
|
|
37
16
|
interface Assert {
|
|
38
|
-
|
|
17
|
+
// eslint-disable-next-line ts/method-signature-style
|
|
18
|
+
containSubset(val: any, exp: any, msg?: string): void;
|
|
39
19
|
}
|
|
40
20
|
}
|
|
41
21
|
}
|
|
@@ -132,5 +112,3 @@ declare module "@vitest/runner" {
|
|
|
132
112
|
benchmark?: BenchmarkResult;
|
|
133
113
|
}
|
|
134
114
|
}
|
|
135
|
-
|
|
136
|
-
export type { CollectLineNumbers as C, RawErrsMap as R, TscErrorInfo as T, CollectLines as a, RootAndTarget as b, Context as c };
|
|
@@ -7,8 +7,6 @@ import { assert, should } from 'chai';
|
|
|
7
7
|
|
|
8
8
|
const assertType = function assertType() {};
|
|
9
9
|
|
|
10
|
-
// TODO: deprecate <reference types="vitest" /> in favor of `<reference types="vitest/config" />`
|
|
11
|
-
|
|
12
10
|
var VitestIndex = /*#__PURE__*/Object.freeze({
|
|
13
11
|
__proto__: null,
|
|
14
12
|
afterAll: afterAll,
|