vitest 0.31.0 → 0.31.2
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 +1 -2
- package/dist/browser.js +1 -1
- package/dist/child.js +2 -2
- package/dist/{chunk-api-setup.df3106cd.js → chunk-api-setup.3854747a.js} +1 -1
- package/dist/{chunk-install-pkg.e0e70dba.js → chunk-install-pkg.4207d842.js} +2 -2
- package/dist/{chunk-integrations-globals.88c8a0cf.js → chunk-integrations-globals.51b8ecab.js} +2 -2
- package/dist/cli.js +19 -3
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +10 -14
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +1 -2
- package/dist/entry.js +4 -3
- package/dist/environments.d.ts +1 -2
- package/dist/index.d.ts +5 -7
- package/dist/index.js +3 -3
- package/dist/node.d.ts +5 -3
- package/dist/node.js +3 -3
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +1 -1
- package/dist/{types-b7007192.d.ts → types-73d6349f.d.ts} +43 -21
- package/dist/{vendor-cli-api.de0530cb.js → vendor-cli-api.35332ab3.js} +193 -82
- package/dist/{vendor-execute.a08cff9c.js → vendor-execute.132a3e09.js} +15 -3
- package/dist/{vendor-index.7dcbfa46.js → vendor-index.5037f2c0.js} +35 -14
- package/dist/{vendor-index.b0b501c8.js → vendor-index.c8d81526.js} +1 -1
- package/dist/{vendor-setup.common.266b69fb.js → vendor-setup.common.3c71d21d.js} +1 -1
- package/dist/{vendor-vi.458e47b1.js → vendor-vi.c6384282.js} +11 -3
- package/dist/worker.js +2 -2
- package/package.json +17 -17
package/dist/browser.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule } from './types-
|
|
2
|
+
import { a as ResolvedConfig, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule } from './types-73d6349f.js';
|
|
3
3
|
import '@vitest/snapshot';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
|
6
|
-
import '@vitest/runner/types';
|
|
7
6
|
import '@vitest/runner/utils';
|
|
8
7
|
import '@vitest/utils';
|
|
9
8
|
import 'tinybench';
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
export { s as setupCommonEnv } from './vendor-setup.common.
|
|
2
|
+
export { s as setupCommonEnv } from './vendor-setup.common.3c71d21d.js';
|
|
3
3
|
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.c8fd34c3.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import './vendor-run-once.69ce7172.js';
|
package/dist/child.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
|
-
import { c as createBirpc } from './vendor-index.
|
|
2
|
+
import { c as createBirpc } from './vendor-index.5037f2c0.js';
|
|
3
3
|
import { parseRegexp } from '@vitest/utils';
|
|
4
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.
|
|
4
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.132a3e09.js';
|
|
5
5
|
import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
|
|
6
6
|
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
|
|
7
7
|
import 'node:url';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises, existsSync } from 'node:fs';
|
|
2
2
|
import { dirname } from 'pathe';
|
|
3
|
-
import { c as createBirpc, i as isPrimitive } from './vendor-index.
|
|
3
|
+
import { c as createBirpc, i as isPrimitive } from './vendor-index.5037f2c0.js';
|
|
4
4
|
import require$$0$2 from 'stream';
|
|
5
5
|
import require$$0 from 'zlib';
|
|
6
6
|
import require$$0$1 from 'buffer';
|
|
@@ -3,7 +3,7 @@ import p from 'path';
|
|
|
3
3
|
import require$$0$1 from 'util';
|
|
4
4
|
import require$$0$3 from 'child_process';
|
|
5
5
|
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.c1e09929.js';
|
|
6
|
-
import { o as onetime$1 } from './vendor-cli-api.
|
|
6
|
+
import { o as onetime$1 } from './vendor-cli-api.35332ab3.js';
|
|
7
7
|
import require$$0$2 from 'os';
|
|
8
8
|
import 'node:buffer';
|
|
9
9
|
import 'node:path';
|
|
@@ -37,7 +37,7 @@ import '@vitest/snapshot/manager';
|
|
|
37
37
|
import 'vite-node/server';
|
|
38
38
|
import './vendor-paths.84fc7a99.js';
|
|
39
39
|
import 'node:v8';
|
|
40
|
-
import './vendor-index.
|
|
40
|
+
import './vendor-index.5037f2c0.js';
|
|
41
41
|
import 'node:worker_threads';
|
|
42
42
|
import 'tinypool';
|
|
43
43
|
import 'node:perf_hooks';
|
package/dist/{chunk-integrations-globals.88c8a0cf.js → chunk-integrations-globals.51b8ecab.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { g as globalApis } from './vendor-constants.538d9b49.js';
|
|
2
|
-
import { i as index } from './vendor-index.
|
|
2
|
+
import { i as index } from './vendor-index.c8d81526.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import './vendor-vi.
|
|
4
|
+
import './vendor-vi.c6384282.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import './vendor-index.fad2598b.js';
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { v as version, s as startVitest, d as divider } from './vendor-cli-api.
|
|
4
|
+
import { v as version, s as startVitest, d as divider } from './vendor-cli-api.35332ab3.js';
|
|
5
5
|
import './vendor-constants.538d9b49.js';
|
|
6
6
|
import './vendor-coverage.c8fd34c3.js';
|
|
7
7
|
import './vendor-index.75f2b63d.js';
|
|
@@ -31,7 +31,7 @@ import 'vite-node/server';
|
|
|
31
31
|
import './vendor-paths.84fc7a99.js';
|
|
32
32
|
import 'node:v8';
|
|
33
33
|
import 'node:child_process';
|
|
34
|
-
import './vendor-index.
|
|
34
|
+
import './vendor-index.5037f2c0.js';
|
|
35
35
|
import 'node:worker_threads';
|
|
36
36
|
import 'node:os';
|
|
37
37
|
import 'tinypool';
|
|
@@ -63,7 +63,23 @@ cli.command("dev [...filters]").action(watch);
|
|
|
63
63
|
cli.command("bench [...filters]").action(benchmark);
|
|
64
64
|
cli.command("typecheck [...filters]").action(typecheck);
|
|
65
65
|
cli.command("[...filters]").action((filters, options) => start("test", filters, options));
|
|
66
|
-
|
|
66
|
+
try {
|
|
67
|
+
cli.parse();
|
|
68
|
+
} catch (originalError) {
|
|
69
|
+
const fullArguments = cli.rawArgs.join(" ");
|
|
70
|
+
const conflictingArgs = [];
|
|
71
|
+
for (const arg of cli.rawArgs) {
|
|
72
|
+
if (arg.startsWith("--") && !arg.includes(".") && fullArguments.includes(`${arg}.`)) {
|
|
73
|
+
const dotArgs = cli.rawArgs.filter((rawArg) => rawArg.startsWith(arg) && rawArg.includes("."));
|
|
74
|
+
conflictingArgs.push({ arg, dotArgs });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (conflictingArgs.length === 0)
|
|
78
|
+
throw originalError;
|
|
79
|
+
const error = conflictingArgs.map(({ arg, dotArgs }) => `A boolean argument "${arg}" was used with dot notation arguments "${dotArgs.join(" ")}".
|
|
80
|
+
Please specify the "${arg}" argument with dot notation as well: "${arg}.enabled"`).join("\n");
|
|
81
|
+
throw new Error(error);
|
|
82
|
+
}
|
|
67
83
|
async function runRelated(relatedFiles, argv) {
|
|
68
84
|
argv.related = relatedFiles;
|
|
69
85
|
argv.passWithNoTests ?? (argv.passWithNoTests = true);
|
package/dist/config.cjs
CHANGED
|
@@ -29,6 +29,7 @@ const coverageConfigDefaults = {
|
|
|
29
29
|
cleanOnRerun: true,
|
|
30
30
|
reportsDirectory: "./coverage",
|
|
31
31
|
exclude: defaultCoverageExcludes,
|
|
32
|
+
reportOnFailure: true,
|
|
32
33
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
33
34
|
// default extensions used by c8, plus '.vue' and '.svelte'
|
|
34
35
|
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
|
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { UserConfig as UserConfig$
|
|
2
|
-
export { ConfigEnv, mergeConfig } from 'vite';
|
|
3
|
-
import { a0 as ResolvedCoverageOptions, q as UserConfig
|
|
1
|
+
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
|
+
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
|
|
3
|
+
import { a0 as ResolvedCoverageOptions, q as UserConfig, a3 as CoverageC8Options, a4 as CustomProviderOptions, a2 as CoverageIstanbulOptions, ag as HtmlOptions, ah as FileOptions, ai as CloverOptions, aj as CoberturaOptions, ak as HtmlSpaOptions, al as LcovOptions, am as LcovOnlyOptions, an as TeamcityOptions, ao as TextOptions, ap as ProjectOptions, F as FakeTimerInstallOpts, P as ProjectConfig } from './types-73d6349f.js';
|
|
4
4
|
import '@vitest/snapshot';
|
|
5
5
|
import '@vitest/expect';
|
|
6
6
|
import '@vitest/runner';
|
|
7
|
-
import '@vitest/runner/types';
|
|
8
7
|
import '@vitest/runner/utils';
|
|
9
8
|
import '@vitest/utils';
|
|
10
9
|
import 'tinybench';
|
|
@@ -57,7 +56,7 @@ declare const config: {
|
|
|
57
56
|
provider: "c8";
|
|
58
57
|
} & CoverageC8Options) | ({
|
|
59
58
|
provider: "istanbul";
|
|
60
|
-
} & CoverageIstanbulOptions), "exclude" | "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "extension">> & {
|
|
59
|
+
} & CoverageIstanbulOptions), "exclude" | "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "extension" | "reportOnFailure">> & {
|
|
61
60
|
reporter: (["html", Partial<HtmlOptions>] | ["none", {}] | ["json", Partial<FileOptions>] | ["clover", Partial<CloverOptions>] | ["cobertura", Partial<CoberturaOptions>] | ["html-spa", Partial<HtmlSpaOptions>] | ["json-summary", Partial<FileOptions>] | ["lcov", Partial<LcovOptions>] | ["lcovonly", Partial<LcovOnlyOptions>] | ["teamcity", Partial<TeamcityOptions>] | ["text", Partial<TextOptions>] | ["text-lcov", Partial<ProjectOptions>] | ["text-summary", Partial<FileOptions>])[];
|
|
62
61
|
};
|
|
63
62
|
fakeTimers: FakeTimerInstallOpts;
|
|
@@ -70,17 +69,14 @@ declare const config: {
|
|
|
70
69
|
};
|
|
71
70
|
slowTestThreshold: number;
|
|
72
71
|
};
|
|
73
|
-
declare const configDefaults: Required<Pick<UserConfig
|
|
72
|
+
declare const configDefaults: Required<Pick<UserConfig, keyof typeof config>>;
|
|
74
73
|
|
|
75
|
-
interface
|
|
76
|
-
test?:
|
|
77
|
-
}
|
|
78
|
-
interface UserWorkspaceConfig extends UserConfig$2 {
|
|
79
|
-
test?: ProjectConfig | undefined;
|
|
74
|
+
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
75
|
+
test?: ProjectConfig;
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
83
|
-
type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
78
|
+
type UserConfigFn = (env: ConfigEnv) => UserConfig$1 | Promise<UserConfig$1>;
|
|
79
|
+
type UserConfigExport = UserConfig$1 | Promise<UserConfig$1> | UserConfigFn;
|
|
84
80
|
type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
|
|
85
81
|
type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
86
82
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
@@ -91,4 +87,4 @@ declare function defineWorkspace(config: (string | (UserProjectConfigExport & {
|
|
|
91
87
|
extends?: string | undefined;
|
|
92
88
|
}))[];
|
|
93
89
|
|
|
94
|
-
export {
|
|
90
|
+
export { UserConfigExport, UserConfigFn, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, configDefaults, coverageConfigDefaults, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace };
|
package/dist/config.js
CHANGED
|
@@ -27,6 +27,7 @@ const coverageConfigDefaults = {
|
|
|
27
27
|
cleanOnRerun: true,
|
|
28
28
|
reportsDirectory: "./coverage",
|
|
29
29
|
exclude: defaultCoverageExcludes,
|
|
30
|
+
reportOnFailure: true,
|
|
30
31
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
31
32
|
// default extensions used by c8, plus '.vue' and '.svelte'
|
|
32
33
|
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a1 as BaseCoverageOptions, a0 as ResolvedCoverageOptions } from './types-
|
|
1
|
+
import { a1 as BaseCoverageOptions, a0 as ResolvedCoverageOptions } from './types-73d6349f.js';
|
|
2
2
|
import '@vitest/snapshot';
|
|
3
3
|
import '@vitest/expect';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|
|
6
|
-
import '@vitest/runner/types';
|
|
7
6
|
import '@vitest/runner/utils';
|
|
8
7
|
import '@vitest/utils';
|
|
9
8
|
import 'tinybench';
|
package/dist/entry.js
CHANGED
|
@@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import { startTests } from '@vitest/runner';
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
4
|
import { c as resetModules } from './vendor-index.fad2598b.js';
|
|
5
|
-
import { R as RealDate, d as globalExpect, s as setupChaiConfig, v as vi } from './vendor-vi.
|
|
5
|
+
import { R as RealDate, d as globalExpect, s as setupChaiConfig, v as vi } from './vendor-vi.c6384282.js';
|
|
6
6
|
import { d as distDir } from './vendor-paths.84fc7a99.js';
|
|
7
7
|
import { a as startCoverageInsideWorker, t as takeCoverageInsideWorker, s as stopCoverageInsideWorker } from './vendor-coverage.c8fd34c3.js';
|
|
8
8
|
import { createRequire } from 'node:module';
|
|
@@ -12,8 +12,8 @@ import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
|
12
12
|
import { e as environments } from './vendor-index.75f2b63d.js';
|
|
13
13
|
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
14
14
|
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
15
|
-
import { i as index } from './vendor-index.
|
|
16
|
-
import { s as setupCommonEnv } from './vendor-setup.common.
|
|
15
|
+
import { i as index } from './vendor-index.c8d81526.js';
|
|
16
|
+
import { s as setupCommonEnv } from './vendor-setup.common.3c71d21d.js';
|
|
17
17
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
18
18
|
import 'std-env';
|
|
19
19
|
import '@vitest/runner/utils';
|
|
@@ -56,6 +56,7 @@ async function setupGlobalEnv(config) {
|
|
|
56
56
|
_require.extensions[".css"] = () => ({});
|
|
57
57
|
_require.extensions[".scss"] = () => ({});
|
|
58
58
|
_require.extensions[".sass"] = () => ({});
|
|
59
|
+
_require.extensions[".less"] = () => ({});
|
|
59
60
|
installSourcemapsSupport({
|
|
60
61
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
61
62
|
});
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Q as Environment } from './types-
|
|
1
|
+
import { Q as Environment } from './types-73d6349f.js';
|
|
2
2
|
import '@vitest/snapshot';
|
|
3
3
|
import '@vitest/expect';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|
|
6
|
-
import '@vitest/runner/types';
|
|
7
6
|
import '@vitest/runner/utils';
|
|
8
7
|
import '@vitest/utils';
|
|
9
8
|
import 'tinybench';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { CancelReason } from '@vitest/runner';
|
|
2
|
-
export { SequenceHooks, SequenceSetupFiles, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
3
|
-
import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, A as AfterSuiteRunMeta, U as UserConsoleLog, a as ResolvedConfig, b as ModuleGraphData, c as Reporter } from './types-
|
|
4
|
-
export { n as ApiConfig, G as ArgumentsType, D as Arrayable, z as Awaitable, a1 as BaseCoverageOptions, a8 as BenchFunction, a6 as Benchmark, a7 as BenchmarkResult, a5 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, K as Constructable, j as Context, v as ContextRPC, u as ContextTestEnvironment, a3 as CoverageC8Options, a2 as CoverageIstanbulOptions, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule, _ as CoverageReporter, a4 as CustomProviderOptions, Q as Environment, E as EnvironmentOptions, O as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, L as ModuleCache, H as MutableArray, N as Nullable, S as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, Y as ReportContext, x as ResolveIdFunction, a0 as ResolvedCoverageOptions, i as RootAndTarget, t as RunnerRPC, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, w as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, y as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-
|
|
1
|
+
import { File, TaskResultPack, CancelReason } from '@vitest/runner';
|
|
2
|
+
export { DoneCallback, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
3
|
+
import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, A as AfterSuiteRunMeta, U as UserConsoleLog, a as ResolvedConfig, b as ModuleGraphData, c as Reporter } from './types-73d6349f.js';
|
|
4
|
+
export { n as ApiConfig, G as ArgumentsType, D as Arrayable, z as Awaitable, a1 as BaseCoverageOptions, a8 as BenchFunction, a6 as Benchmark, a7 as BenchmarkResult, a5 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, K as Constructable, j as Context, v as ContextRPC, u as ContextTestEnvironment, a3 as CoverageC8Options, a2 as CoverageIstanbulOptions, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule, _ as CoverageReporter, a4 as CustomProviderOptions, Q as Environment, E as EnvironmentOptions, O as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, L as ModuleCache, H as MutableArray, N as Nullable, S as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, Y as ReportContext, x as ResolveIdFunction, a0 as ResolvedCoverageOptions, i as RootAndTarget, t as RunnerRPC, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, w as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, y as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-73d6349f.js';
|
|
5
5
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
|
|
6
6
|
export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
|
|
7
7
|
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
8
|
-
import { File, TaskResultPack } from '@vitest/runner/types';
|
|
9
|
-
export { DoneCallback, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions } from '@vitest/runner/types';
|
|
10
8
|
import { SnapshotResult } from '@vitest/snapshot';
|
|
11
9
|
export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
|
|
12
10
|
export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
|
|
@@ -328,7 +326,7 @@ interface VitestUtils {
|
|
|
328
326
|
declare const vitest: VitestUtils;
|
|
329
327
|
declare const vi: VitestUtils;
|
|
330
328
|
|
|
331
|
-
declare function getRunningMode(): "
|
|
329
|
+
declare function getRunningMode(): "run" | "watch";
|
|
332
330
|
declare function isWatchMode(): boolean;
|
|
333
331
|
|
|
334
332
|
interface TransformResultWithSource extends TransformResult {
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.
|
|
2
|
+
export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.c6384282.js';
|
|
3
3
|
export { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
|
|
4
|
-
import { d as dist } from './vendor-index.
|
|
5
|
-
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.
|
|
4
|
+
import { d as dist } from './vendor-index.c8d81526.js';
|
|
5
|
+
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.c8d81526.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
|
8
8
|
export { assert, should } from 'chai';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { o as VitestRunMode, q as UserConfig, w as Vitest, a9 as MockFactory, aa as MockMap, ab as TestSequencer, ac as WorkspaceSpec } from './types-
|
|
2
|
-
export { af as TestSequencerConstructor, ad as VitestWorkspace, ae as startVitest } from './types-
|
|
1
|
+
import { o as VitestRunMode, q as UserConfig, w as Vitest, a9 as MockFactory, aa as MockMap, ab as TestSequencer, ac as WorkspaceSpec } from './types-73d6349f.js';
|
|
2
|
+
export { af as TestSequencerConstructor, ad as VitestWorkspace, ae as startVitest } from './types-73d6349f.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
5
5
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
6
6
|
import '@vitest/snapshot';
|
|
7
7
|
import '@vitest/expect';
|
|
8
8
|
import '@vitest/runner';
|
|
9
|
-
import '@vitest/runner/types';
|
|
10
9
|
import '@vitest/runner/utils';
|
|
11
10
|
import '@vitest/utils';
|
|
12
11
|
import 'tinybench';
|
|
@@ -29,7 +28,9 @@ declare class VitestMocker {
|
|
|
29
28
|
private get root();
|
|
30
29
|
private get mockMap();
|
|
31
30
|
private get moduleCache();
|
|
31
|
+
private get moduleDirectories();
|
|
32
32
|
private deleteCachedItem;
|
|
33
|
+
private isAModuleDirectory;
|
|
33
34
|
getSuiteFilepath(): string;
|
|
34
35
|
getMocks(): {
|
|
35
36
|
[x: string]: string | MockFactory | null;
|
|
@@ -53,6 +54,7 @@ declare class VitestMocker {
|
|
|
53
54
|
|
|
54
55
|
interface ExecuteOptions extends ViteNodeRunnerOptions {
|
|
55
56
|
mockMap: MockMap;
|
|
57
|
+
moduleDirectories?: string[];
|
|
56
58
|
}
|
|
57
59
|
declare class VitestExecutor extends ViteNodeRunner {
|
|
58
60
|
options: ExecuteOptions;
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './vendor-cli-api.
|
|
2
|
-
export { V as VitestExecutor } from './vendor-execute.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './vendor-cli-api.35332ab3.js';
|
|
2
|
+
export { V as VitestExecutor } from './vendor-execute.132a3e09.js';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import './vendor-constants.538d9b49.js';
|
|
5
5
|
import './vendor-coverage.c8fd34c3.js';
|
|
@@ -31,7 +31,7 @@ import 'vite-node/server';
|
|
|
31
31
|
import './vendor-paths.84fc7a99.js';
|
|
32
32
|
import 'node:v8';
|
|
33
33
|
import 'node:child_process';
|
|
34
|
-
import './vendor-index.
|
|
34
|
+
import './vendor-index.5037f2c0.js';
|
|
35
35
|
import 'node:worker_threads';
|
|
36
36
|
import 'node:os';
|
|
37
37
|
import 'tinypool';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, TestContext } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-73d6349f.js';
|
|
3
3
|
import '@vitest/snapshot';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
|
6
|
-
import '@vitest/runner/types';
|
|
7
6
|
import '@vitest/runner/utils';
|
|
8
7
|
import '@vitest/utils';
|
|
9
8
|
import 'tinybench';
|
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.c6384282.js';
|
|
3
3
|
import './vendor-index.fad2598b.js';
|
|
4
4
|
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
5
5
|
import { g as getFullName } from './vendor-tasks.042d6084.js';
|
|
@@ -2,11 +2,10 @@ import { SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/sna
|
|
|
2
2
|
import { ExpectStatic } from '@vitest/expect';
|
|
3
3
|
import { ViteDevServer, UserConfig as UserConfig$1, TransformResult as TransformResult$1, CommonServerOptions, AliasOptions, DepOptimizationConfig } from 'vite';
|
|
4
4
|
import * as _vitest_runner from '@vitest/runner';
|
|
5
|
-
import {
|
|
6
|
-
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
5
|
+
import { File, Test as Test$1, Suite, TaskResultPack, Task, CancelReason, TaskCustom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
7
6
|
import { ParsedStack, ErrorWithDiff, ChainableFunction } from '@vitest/runner/utils';
|
|
8
7
|
import { Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
9
|
-
import { Task as Task$
|
|
8
|
+
import { Task as Task$1, TaskResult, Bench, Options } from 'tinybench';
|
|
10
9
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
11
10
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
12
11
|
import { ViteNodeServer } from 'vite-node/server';
|
|
@@ -213,10 +212,11 @@ declare class Typechecker {
|
|
|
213
212
|
private _onParseEnd?;
|
|
214
213
|
private _onWatcherRerun?;
|
|
215
214
|
private _result;
|
|
215
|
+
private _output;
|
|
216
216
|
private _tests;
|
|
217
217
|
private tempConfigPath?;
|
|
218
218
|
private allowJs?;
|
|
219
|
-
private process
|
|
219
|
+
private process?;
|
|
220
220
|
constructor(ctx: WorkspaceProject, files: string[]);
|
|
221
221
|
onParseStart(fn: Callback): void;
|
|
222
222
|
onParseEnd(fn: Callback<[ErrorsCache]>): void;
|
|
@@ -237,6 +237,8 @@ declare class Typechecker {
|
|
|
237
237
|
stop(): Promise<void>;
|
|
238
238
|
protected ensurePackageInstalled(root: string, checker: string): Promise<void>;
|
|
239
239
|
prepare(): Promise<void>;
|
|
240
|
+
getExitCode(): number | false;
|
|
241
|
+
getOutput(): string;
|
|
240
242
|
start(): Promise<void>;
|
|
241
243
|
getResult(): ErrorsCache;
|
|
242
244
|
getTestFiles(): File[];
|
|
@@ -268,7 +270,7 @@ declare class WorkspaceProject {
|
|
|
268
270
|
globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
|
|
269
271
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
270
272
|
isInSourceTestFile(code: string): boolean;
|
|
271
|
-
filterFiles(testFiles: string[], filters
|
|
273
|
+
filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
|
|
272
274
|
initBrowserServer(options: UserConfig): Promise<void>;
|
|
273
275
|
setServer(options: UserConfig, server: ViteDevServer, params?: InitializeServerOptions): Promise<void>;
|
|
274
276
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
@@ -287,11 +289,12 @@ interface BrowserProvider {
|
|
|
287
289
|
getSupportedBrowsers(): readonly string[];
|
|
288
290
|
initialize(ctx: WorkspaceProject, options: BrowserProviderOptions): Awaitable$1<void>;
|
|
289
291
|
openPage(url: string): Awaitable$1<void>;
|
|
292
|
+
catchError(cb: (error: Error) => Awaitable$1<void>): () => Awaitable$1<void>;
|
|
290
293
|
close(): Awaitable$1<void>;
|
|
291
294
|
}
|
|
292
295
|
interface BrowserConfigOptions {
|
|
293
296
|
/**
|
|
294
|
-
* if running tests in the
|
|
297
|
+
* if running tests in the browser should be the default
|
|
295
298
|
*
|
|
296
299
|
* @default false
|
|
297
300
|
*/
|
|
@@ -433,7 +436,7 @@ interface CliOptions extends UserConfig {
|
|
|
433
436
|
*
|
|
434
437
|
* Returns a Vitest instance if initialized successfully.
|
|
435
438
|
*/
|
|
436
|
-
declare function startVitest(mode: VitestRunMode, cliFilters
|
|
439
|
+
declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1): Promise<Vitest | undefined>;
|
|
437
440
|
|
|
438
441
|
type FileStatsCache = Pick<Stats, 'size'>;
|
|
439
442
|
declare class FilesStatsCache {
|
|
@@ -694,9 +697,9 @@ declare class TapReporter implements Reporter {
|
|
|
694
697
|
protected ctx: Vitest;
|
|
695
698
|
private logger;
|
|
696
699
|
onInit(ctx: Vitest): void;
|
|
697
|
-
static getComment(task: Task
|
|
700
|
+
static getComment(task: Task): string;
|
|
698
701
|
private logErrorDetails;
|
|
699
|
-
protected logTasks(tasks: Task
|
|
702
|
+
protected logTasks(tasks: Task[]): void;
|
|
700
703
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
701
704
|
}
|
|
702
705
|
|
|
@@ -706,11 +709,12 @@ declare class JUnitReporter implements Reporter {
|
|
|
706
709
|
private baseLog;
|
|
707
710
|
private logger;
|
|
708
711
|
private _timeStart;
|
|
712
|
+
private fileFd?;
|
|
709
713
|
onInit(ctx: Vitest): Promise<void>;
|
|
710
714
|
writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
|
|
711
715
|
writeErrorDetails(error: ErrorWithDiff): Promise<void>;
|
|
712
|
-
writeLogs(task: Task
|
|
713
|
-
writeTasks(tasks: Task
|
|
716
|
+
writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
|
|
717
|
+
writeTasks(tasks: Task[], filename: string): Promise<void>;
|
|
714
718
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
715
719
|
}
|
|
716
720
|
|
|
@@ -783,7 +787,7 @@ declare const ReportersMap: {
|
|
|
783
787
|
};
|
|
784
788
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
785
789
|
|
|
786
|
-
declare function createExpect(test?: Test$
|
|
790
|
+
declare function createExpect(test?: Test$1): ExpectStatic;
|
|
787
791
|
declare const globalExpect: ExpectStatic;
|
|
788
792
|
|
|
789
793
|
declare function setupChaiConfig(config: ChaiConfig): void;
|
|
@@ -870,17 +874,19 @@ interface LinkMapper {
|
|
|
870
874
|
assetPath(node: Node, name: string): string;
|
|
871
875
|
}
|
|
872
876
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
+
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
878
|
+
type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
879
|
+
type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
880
|
+
type BirpcFn<T> = PromisifyFn<T> & {
|
|
877
881
|
/**
|
|
878
882
|
* Send event without asking for response
|
|
879
883
|
*/
|
|
880
884
|
asEvent(...args: ArgumentsType<T>): void;
|
|
881
885
|
};
|
|
882
|
-
|
|
886
|
+
type BirpcReturn<RemoteFunctions, LocalFunctions = {}> = {
|
|
883
887
|
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
888
|
+
} & {
|
|
889
|
+
$functions: LocalFunctions;
|
|
884
890
|
};
|
|
885
891
|
|
|
886
892
|
interface RuntimeRPC {
|
|
@@ -926,7 +932,7 @@ interface WorkerGlobalState {
|
|
|
926
932
|
ctx: WorkerContext;
|
|
927
933
|
config: ResolvedConfig;
|
|
928
934
|
rpc: BirpcReturn<RuntimeRPC>;
|
|
929
|
-
current?: Test$
|
|
935
|
+
current?: Test$1;
|
|
930
936
|
filepath?: string;
|
|
931
937
|
environmentTeardownRun?: boolean;
|
|
932
938
|
onCancel: Promise<CancelReason>;
|
|
@@ -983,7 +989,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
|
|
|
983
989
|
provider?: T;
|
|
984
990
|
} & (CoverageC8Options));
|
|
985
991
|
/** Fields that have default values. Internally these will always be defined. */
|
|
986
|
-
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension';
|
|
992
|
+
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure';
|
|
987
993
|
type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
988
994
|
reporter: CoverageReporterWithOptions[];
|
|
989
995
|
};
|
|
@@ -1093,6 +1099,12 @@ interface BaseCoverageOptions {
|
|
|
1093
1099
|
* @default false
|
|
1094
1100
|
*/
|
|
1095
1101
|
thresholdAutoUpdate?: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Generate coverage report even when tests fail.
|
|
1104
|
+
*
|
|
1105
|
+
* @default true
|
|
1106
|
+
*/
|
|
1107
|
+
reportOnFailure?: boolean;
|
|
1096
1108
|
}
|
|
1097
1109
|
interface CoverageIstanbulOptions extends BaseCoverageOptions {
|
|
1098
1110
|
/**
|
|
@@ -1245,7 +1257,7 @@ interface BenchmarkUserOptions {
|
|
|
1245
1257
|
interface Benchmark extends TaskCustom {
|
|
1246
1258
|
meta: {
|
|
1247
1259
|
benchmark: true;
|
|
1248
|
-
task?: Task$
|
|
1260
|
+
task?: Task$1;
|
|
1249
1261
|
result?: TaskResult;
|
|
1250
1262
|
};
|
|
1251
1263
|
}
|
|
@@ -1354,6 +1366,12 @@ interface DepsOptions {
|
|
|
1354
1366
|
* @default false
|
|
1355
1367
|
*/
|
|
1356
1368
|
registerNodeLoader?: boolean;
|
|
1369
|
+
/**
|
|
1370
|
+
* A list of directories relative to the config file that should be treated as module directories.
|
|
1371
|
+
*
|
|
1372
|
+
* @default ['node_modules']
|
|
1373
|
+
*/
|
|
1374
|
+
moduleDirectories?: string[];
|
|
1357
1375
|
}
|
|
1358
1376
|
interface InlineConfig {
|
|
1359
1377
|
/**
|
|
@@ -1852,7 +1870,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1852
1870
|
}
|
|
1853
1871
|
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'maxThreads' | 'minThreads' | 'useAtomics' | 'teardownTimeout' | 'silent' | 'watchExclude' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage'> & {
|
|
1854
1872
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
1855
|
-
deps?: Omit<DepsOptions, 'registerNodeLoader'>;
|
|
1873
|
+
deps?: Omit<DepsOptions, 'registerNodeLoader' | 'moduleDirectories'>;
|
|
1856
1874
|
};
|
|
1857
1875
|
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
1858
1876
|
sequence?: {
|
|
@@ -1900,6 +1918,10 @@ declare module '@vitest/runner' {
|
|
|
1900
1918
|
interface TestContext {
|
|
1901
1919
|
expect: ExpectStatic;
|
|
1902
1920
|
}
|
|
1921
|
+
interface TaskMeta {
|
|
1922
|
+
typecheck?: boolean;
|
|
1923
|
+
benchmark?: boolean;
|
|
1924
|
+
}
|
|
1903
1925
|
interface File {
|
|
1904
1926
|
prepareDuration?: number;
|
|
1905
1927
|
environmentLoad?: number;
|