vitest 0.31.1 → 0.31.3
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.86042fed.js → chunk-api-setup.3854747a.js} +1 -1
- package/dist/{chunk-install-pkg.d1609923.js → chunk-install-pkg.1ed93fe7.js} +3 -3
- package/dist/{chunk-integrations-globals.88c8a0cf.js → chunk-integrations-globals.6a234998.js} +3 -3
- package/dist/cli.js +3 -3
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +2 -3
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +1 -2
- package/dist/entry.js +5 -4
- package/dist/environments.d.ts +1 -2
- package/dist/index.d.ts +4 -6
- package/dist/index.js +4 -4
- package/dist/loader.js +0 -1
- package/dist/node.d.ts +5 -3
- package/dist/node.js +4 -4
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +2 -2
- package/dist/{types-ad1c3f45.d.ts → types-fe79687a.d.ts} +34 -16
- package/dist/{vendor-cli-api.d608f86b.js → vendor-cli-api.0726b980.js} +140 -68
- package/dist/{vendor-execute.3e144152.js → vendor-execute.132a3e09.js} +15 -3
- package/dist/{vendor-index.3982ff76.js → vendor-index.5037f2c0.js} +2 -1
- package/dist/{vendor-index.b0b501c8.js → vendor-index.f81f6285.js} +1 -1
- package/dist/{vendor-setup.common.266b69fb.js → vendor-setup.common.823a1300.js} +1 -1
- package/dist/{vendor-tasks.042d6084.js → vendor-tasks.f9d75aed.js} +1 -1
- package/dist/{vendor-vi.458e47b1.js → vendor-vi.23b98fa1.js} +12 -4
- package/dist/worker.js +2 -2
- package/package.json +8 -8
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-fe79687a.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.823a1300.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.0726b980.js';
|
|
7
7
|
import require$$0$2 from 'os';
|
|
8
8
|
import 'node:buffer';
|
|
9
9
|
import 'node:path';
|
|
@@ -37,11 +37,11 @@ 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';
|
|
44
|
-
import './vendor-tasks.
|
|
44
|
+
import './vendor-tasks.f9d75aed.js';
|
|
45
45
|
import 'node:module';
|
|
46
46
|
import 'node:crypto';
|
|
47
47
|
import 'node:fs/promises';
|
package/dist/{chunk-integrations-globals.88c8a0cf.js → chunk-integrations-globals.6a234998.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.f81f6285.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import './vendor-vi.
|
|
4
|
+
import './vendor-vi.23b98fa1.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import './vendor-index.fad2598b.js';
|
|
@@ -12,7 +12,7 @@ import 'chai';
|
|
|
12
12
|
import './vendor-_commonjsHelpers.76cdd49e.js';
|
|
13
13
|
import '@vitest/expect';
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
|
-
import './vendor-tasks.
|
|
15
|
+
import './vendor-tasks.f9d75aed.js';
|
|
16
16
|
import 'util';
|
|
17
17
|
import '@vitest/spy';
|
|
18
18
|
import './vendor-run-once.69ce7172.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.0726b980.js';
|
|
5
5
|
import './vendor-constants.538d9b49.js';
|
|
6
6
|
import './vendor-coverage.c8fd34c3.js';
|
|
7
7
|
import './vendor-index.75f2b63d.js';
|
|
@@ -31,12 +31,12 @@ 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';
|
|
38
38
|
import 'node:perf_hooks';
|
|
39
|
-
import './vendor-tasks.
|
|
39
|
+
import './vendor-tasks.f9d75aed.js';
|
|
40
40
|
import 'node:module';
|
|
41
41
|
import 'node:crypto';
|
|
42
42
|
import './vendor-index.c1e09929.js';
|
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
1
|
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
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-
|
|
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-fe79687a.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;
|
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-fe79687a.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.23b98fa1.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.f81f6285.js';
|
|
16
|
+
import { s as setupCommonEnv } from './vendor-setup.common.823a1300.js';
|
|
17
17
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
18
18
|
import 'std-env';
|
|
19
19
|
import '@vitest/runner/utils';
|
|
@@ -21,7 +21,7 @@ import 'chai';
|
|
|
21
21
|
import './vendor-_commonjsHelpers.76cdd49e.js';
|
|
22
22
|
import '@vitest/expect';
|
|
23
23
|
import '@vitest/snapshot';
|
|
24
|
-
import './vendor-tasks.
|
|
24
|
+
import './vendor-tasks.f9d75aed.js';
|
|
25
25
|
import 'util';
|
|
26
26
|
import '@vitest/spy';
|
|
27
27
|
import 'node:url';
|
|
@@ -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-fe79687a.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-fe79687a.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-fe79687a.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';
|
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.23b98fa1.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.f81f6285.js';
|
|
5
|
+
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.f81f6285.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
|
8
8
|
export { assert, should } from 'chai';
|
|
@@ -15,7 +15,7 @@ import './vendor-global.6795f91f.js';
|
|
|
15
15
|
import './vendor-_commonjsHelpers.76cdd49e.js';
|
|
16
16
|
import '@vitest/expect';
|
|
17
17
|
import '@vitest/snapshot';
|
|
18
|
-
import './vendor-tasks.
|
|
18
|
+
import './vendor-tasks.f9d75aed.js';
|
|
19
19
|
import 'util';
|
|
20
20
|
import '@vitest/spy';
|
|
21
21
|
|
package/dist/loader.js
CHANGED
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-fe79687a.js';
|
|
2
|
+
export { af as TestSequencerConstructor, ad as VitestWorkspace, ae as startVitest } from './types-fe79687a.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.0726b980.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,12 +31,12 @@ 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';
|
|
38
38
|
import 'node:perf_hooks';
|
|
39
|
-
import './vendor-tasks.
|
|
39
|
+
import './vendor-tasks.f9d75aed.js';
|
|
40
40
|
import 'node:module';
|
|
41
41
|
import 'node:crypto';
|
|
42
42
|
import './vendor-index.c1e09929.js';
|
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-fe79687a.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,8 +1,8 @@
|
|
|
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.23b98fa1.js';
|
|
3
3
|
import './vendor-index.fad2598b.js';
|
|
4
4
|
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
5
|
-
import { g as getFullName } from './vendor-tasks.
|
|
5
|
+
import { g as getFullName } from './vendor-tasks.f9d75aed.js';
|
|
6
6
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
7
7
|
import { getNames } from '@vitest/runner/utils';
|
|
8
8
|
import { performance } from 'node:perf_hooks';
|
|
@@ -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[];
|
|
@@ -569,8 +571,8 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
569
571
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
570
572
|
shouldLog(log: UserConsoleLog): boolean;
|
|
571
573
|
onServerRestart(reason?: string): void;
|
|
572
|
-
reportSummary(files: File[]): Promise<void>;
|
|
573
|
-
reportTestSummary(files: File[]): Promise<void>;
|
|
574
|
+
reportSummary(files: File[], errors: unknown[]): Promise<void>;
|
|
575
|
+
reportTestSummary(files: File[], errors: unknown[]): Promise<void>;
|
|
574
576
|
private printErrorsSummary;
|
|
575
577
|
reportBenchmarkSummary(files: File[]): Promise<void>;
|
|
576
578
|
private printTaskErrors;
|
|
@@ -579,7 +581,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
579
581
|
|
|
580
582
|
declare class BasicReporter extends BaseReporter {
|
|
581
583
|
isTTY: boolean;
|
|
582
|
-
reportSummary(files: File[]): Promise<void>;
|
|
584
|
+
reportSummary(files: File[], errors: unknown[]): Promise<void>;
|
|
583
585
|
}
|
|
584
586
|
|
|
585
587
|
type Awaitable<T> = T | PromiseLike<T>;
|
|
@@ -695,9 +697,9 @@ declare class TapReporter implements Reporter {
|
|
|
695
697
|
protected ctx: Vitest;
|
|
696
698
|
private logger;
|
|
697
699
|
onInit(ctx: Vitest): void;
|
|
698
|
-
static getComment(task: Task
|
|
700
|
+
static getComment(task: Task): string;
|
|
699
701
|
private logErrorDetails;
|
|
700
|
-
protected logTasks(tasks: Task
|
|
702
|
+
protected logTasks(tasks: Task[]): void;
|
|
701
703
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
702
704
|
}
|
|
703
705
|
|
|
@@ -711,8 +713,8 @@ declare class JUnitReporter implements Reporter {
|
|
|
711
713
|
onInit(ctx: Vitest): Promise<void>;
|
|
712
714
|
writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
|
|
713
715
|
writeErrorDetails(error: ErrorWithDiff): Promise<void>;
|
|
714
|
-
writeLogs(task: Task
|
|
715
|
-
writeTasks(tasks: Task
|
|
716
|
+
writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
|
|
717
|
+
writeTasks(tasks: Task[], filename: string): Promise<void>;
|
|
716
718
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
717
719
|
}
|
|
718
720
|
|
|
@@ -785,7 +787,7 @@ declare const ReportersMap: {
|
|
|
785
787
|
};
|
|
786
788
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
787
789
|
|
|
788
|
-
declare function createExpect(test?: Test$
|
|
790
|
+
declare function createExpect(test?: Test$1): ExpectStatic;
|
|
789
791
|
declare const globalExpect: ExpectStatic;
|
|
790
792
|
|
|
791
793
|
declare function setupChaiConfig(config: ChaiConfig): void;
|
|
@@ -930,7 +932,7 @@ interface WorkerGlobalState {
|
|
|
930
932
|
ctx: WorkerContext;
|
|
931
933
|
config: ResolvedConfig;
|
|
932
934
|
rpc: BirpcReturn<RuntimeRPC>;
|
|
933
|
-
current?: Test$
|
|
935
|
+
current?: Test$1;
|
|
934
936
|
filepath?: string;
|
|
935
937
|
environmentTeardownRun?: boolean;
|
|
936
938
|
onCancel: Promise<CancelReason>;
|
|
@@ -987,7 +989,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
|
|
|
987
989
|
provider?: T;
|
|
988
990
|
} & (CoverageC8Options));
|
|
989
991
|
/** Fields that have default values. Internally these will always be defined. */
|
|
990
|
-
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension';
|
|
992
|
+
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure';
|
|
991
993
|
type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
992
994
|
reporter: CoverageReporterWithOptions[];
|
|
993
995
|
};
|
|
@@ -1097,6 +1099,12 @@ interface BaseCoverageOptions {
|
|
|
1097
1099
|
* @default false
|
|
1098
1100
|
*/
|
|
1099
1101
|
thresholdAutoUpdate?: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Generate coverage report even when tests fail.
|
|
1104
|
+
*
|
|
1105
|
+
* @default true
|
|
1106
|
+
*/
|
|
1107
|
+
reportOnFailure?: boolean;
|
|
1100
1108
|
}
|
|
1101
1109
|
interface CoverageIstanbulOptions extends BaseCoverageOptions {
|
|
1102
1110
|
/**
|
|
@@ -1249,7 +1257,7 @@ interface BenchmarkUserOptions {
|
|
|
1249
1257
|
interface Benchmark extends TaskCustom {
|
|
1250
1258
|
meta: {
|
|
1251
1259
|
benchmark: true;
|
|
1252
|
-
task?: Task$
|
|
1260
|
+
task?: Task$1;
|
|
1253
1261
|
result?: TaskResult;
|
|
1254
1262
|
};
|
|
1255
1263
|
}
|
|
@@ -1358,6 +1366,12 @@ interface DepsOptions {
|
|
|
1358
1366
|
* @default false
|
|
1359
1367
|
*/
|
|
1360
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[];
|
|
1361
1375
|
}
|
|
1362
1376
|
interface InlineConfig {
|
|
1363
1377
|
/**
|
|
@@ -1856,7 +1870,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1856
1870
|
}
|
|
1857
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'> & {
|
|
1858
1872
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
1859
|
-
deps?: Omit<DepsOptions, 'registerNodeLoader'>;
|
|
1873
|
+
deps?: Omit<DepsOptions, 'registerNodeLoader' | 'moduleDirectories'>;
|
|
1860
1874
|
};
|
|
1861
1875
|
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
1862
1876
|
sequence?: {
|
|
@@ -1904,6 +1918,10 @@ declare module '@vitest/runner' {
|
|
|
1904
1918
|
interface TestContext {
|
|
1905
1919
|
expect: ExpectStatic;
|
|
1906
1920
|
}
|
|
1921
|
+
interface TaskMeta {
|
|
1922
|
+
typecheck?: boolean;
|
|
1923
|
+
benchmark?: boolean;
|
|
1924
|
+
}
|
|
1907
1925
|
interface File {
|
|
1908
1926
|
prepareDuration?: number;
|
|
1909
1927
|
environmentLoad?: number;
|
|
@@ -25,13 +25,13 @@ import { ViteNodeServer } from 'vite-node/server';
|
|
|
25
25
|
import { d as distDir, r as rootDir } from './vendor-paths.84fc7a99.js';
|
|
26
26
|
import v8 from 'node:v8';
|
|
27
27
|
import { fork } from 'node:child_process';
|
|
28
|
-
import { g as groupBy, a as getEnvironmentTransformMode, c as createBirpc, A as AggregateErrorPonyfill, s as slash$1, t as toArray, i as isPrimitive, d as deepMerge, n as noop$1, b as stdout } from './vendor-index.
|
|
28
|
+
import { g as groupBy, a as getEnvironmentTransformMode, c as createBirpc, A as AggregateErrorPonyfill, s as slash$1, t as toArray, i as isPrimitive, d as deepMerge, n as noop$1, b as stdout } from './vendor-index.5037f2c0.js';
|
|
29
29
|
import { MessageChannel } from 'node:worker_threads';
|
|
30
30
|
import { cpus, hostname } from 'node:os';
|
|
31
31
|
import Tinypool from 'tinypool';
|
|
32
32
|
import { createDefer, getSafeTimers, notNullish, parseErrorStacktrace, shuffle, stringify as stringify$5, positionToOffset, lineSplitRE } from '@vitest/utils';
|
|
33
33
|
import { performance } from 'node:perf_hooks';
|
|
34
|
-
import { g as getFullName, h as hasFailedSnapshot } from './vendor-tasks.
|
|
34
|
+
import { g as getFullName, h as hasFailedSnapshot } from './vendor-tasks.f9d75aed.js';
|
|
35
35
|
import { getTests, hasFailed, getSuites, generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks } from '@vitest/runner/utils';
|
|
36
36
|
import { createRequire } from 'node:module';
|
|
37
37
|
import { createHash } from 'node:crypto';
|
|
@@ -60,7 +60,7 @@ function _mergeNamespaces(n, m) {
|
|
|
60
60
|
return Object.freeze(n);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
var version$1 = "0.31.
|
|
63
|
+
var version$1 = "0.31.3";
|
|
64
64
|
|
|
65
65
|
const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
|
|
66
66
|
async function ensurePackageInstalled(dependency, root) {
|
|
@@ -79,7 +79,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
79
79
|
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
80
80
|
});
|
|
81
81
|
if (install) {
|
|
82
|
-
await (await import('./chunk-install-pkg.
|
|
82
|
+
await (await import('./chunk-install-pkg.1ed93fe7.js')).installPackage(dependency, { dev: true });
|
|
83
83
|
process.stderr.write(c.yellow(`
|
|
84
84
|
Package ${dependency} installed, re-run the command to start.
|
|
85
85
|
`));
|
|
@@ -7676,11 +7676,10 @@ class BaseReporter {
|
|
|
7676
7676
|
}
|
|
7677
7677
|
async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
|
|
7678
7678
|
this.end = performance.now();
|
|
7679
|
-
await this.reportSummary(files);
|
|
7679
|
+
await this.reportSummary(files, errors);
|
|
7680
7680
|
if (errors.length) {
|
|
7681
7681
|
if (!this.ctx.config.dangerouslyIgnoreUnhandledErrors)
|
|
7682
7682
|
process.exitCode = 1;
|
|
7683
|
-
await this.ctx.logger.printUnhandledErrors(errors);
|
|
7684
7683
|
}
|
|
7685
7684
|
}
|
|
7686
7685
|
onTaskUpdate(packs) {
|
|
@@ -7821,14 +7820,14 @@ ${log.content}
|
|
|
7821
7820
|
reason === "config" ? "\nRestarting due to config changes..." : "\nRestarting Vitest..."
|
|
7822
7821
|
)));
|
|
7823
7822
|
}
|
|
7824
|
-
async reportSummary(files) {
|
|
7825
|
-
await this.printErrorsSummary(files);
|
|
7823
|
+
async reportSummary(files, errors) {
|
|
7824
|
+
await this.printErrorsSummary(files, errors);
|
|
7826
7825
|
if (this.mode === "benchmark")
|
|
7827
7826
|
await this.reportBenchmarkSummary(files);
|
|
7828
7827
|
else
|
|
7829
|
-
await this.reportTestSummary(files);
|
|
7828
|
+
await this.reportTestSummary(files, errors);
|
|
7830
7829
|
}
|
|
7831
|
-
async reportTestSummary(files) {
|
|
7830
|
+
async reportTestSummary(files, errors) {
|
|
7832
7831
|
const tests = getTests(files);
|
|
7833
7832
|
const logger = this.ctx.logger;
|
|
7834
7833
|
const executionTime = this.end - this.start;
|
|
@@ -7865,6 +7864,8 @@ ${log.content}
|
|
|
7865
7864
|
});
|
|
7866
7865
|
logger.log(padTitle("Type Errors"), failed.length ? c.bold(c.red(`${failed.length} failed`)) : c.dim("no errors"));
|
|
7867
7866
|
}
|
|
7867
|
+
if (errors.length)
|
|
7868
|
+
logger.log(padTitle("Errors"), c.bold(c.red(`${errors.length} error${errors.length > 1 ? "s" : ""}`)));
|
|
7868
7869
|
logger.log(padTitle("Start at"), formatTimeString(this._timeStart));
|
|
7869
7870
|
if (this.watchFilters)
|
|
7870
7871
|
logger.log(padTitle("Duration"), time(threadTime));
|
|
@@ -7874,7 +7875,7 @@ ${log.content}
|
|
|
7874
7875
|
logger.log(padTitle("Duration"), time(executionTime) + c.dim(` (transform ${time(transformTime)}, setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)}, environment ${time(environmentTime)}, prepare ${time(prepareTime)})`));
|
|
7875
7876
|
logger.log();
|
|
7876
7877
|
}
|
|
7877
|
-
async printErrorsSummary(files) {
|
|
7878
|
+
async printErrorsSummary(files, errors) {
|
|
7878
7879
|
const logger = this.ctx.logger;
|
|
7879
7880
|
const suites = getSuites(files);
|
|
7880
7881
|
const tests = getTests(files);
|
|
@@ -7900,6 +7901,10 @@ ${log.content}
|
|
|
7900
7901
|
logger.error();
|
|
7901
7902
|
await this.printTaskErrors(failedTests, errorDivider);
|
|
7902
7903
|
}
|
|
7904
|
+
if (errors.length) {
|
|
7905
|
+
await logger.printUnhandledErrors(errors);
|
|
7906
|
+
logger.error();
|
|
7907
|
+
}
|
|
7903
7908
|
return tests;
|
|
7904
7909
|
}
|
|
7905
7910
|
async reportBenchmarkSummary(files) {
|
|
@@ -7973,9 +7978,9 @@ class BasicReporter extends BaseReporter {
|
|
|
7973
7978
|
super(...arguments);
|
|
7974
7979
|
this.isTTY = false;
|
|
7975
7980
|
}
|
|
7976
|
-
reportSummary(files) {
|
|
7981
|
+
reportSummary(files, errors) {
|
|
7977
7982
|
this.ctx.logger.log();
|
|
7978
|
-
return super.reportSummary(files);
|
|
7983
|
+
return super.reportSummary(files, errors);
|
|
7979
7984
|
}
|
|
7980
7985
|
}
|
|
7981
7986
|
|
|
@@ -9009,7 +9014,7 @@ class DefaultReporter extends BaseReporter {
|
|
|
9009
9014
|
const files = this.ctx.state.getFiles(this.watchFilters);
|
|
9010
9015
|
createListRenderer(files, this.rendererOptions).stop();
|
|
9011
9016
|
this.ctx.logger.log();
|
|
9012
|
-
await super.reportSummary(files);
|
|
9017
|
+
await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
|
|
9013
9018
|
super.onWatcherStart();
|
|
9014
9019
|
}
|
|
9015
9020
|
onCollected() {
|
|
@@ -9068,35 +9073,54 @@ function getIcon(task) {
|
|
|
9068
9073
|
return pending;
|
|
9069
9074
|
}
|
|
9070
9075
|
}
|
|
9071
|
-
function render(tasks) {
|
|
9076
|
+
function render(tasks, width) {
|
|
9072
9077
|
const all = getTests(tasks);
|
|
9073
|
-
const output = [];
|
|
9074
9078
|
let currentIcon = pending;
|
|
9075
9079
|
let currentTasks = 0;
|
|
9076
|
-
|
|
9080
|
+
let previousLineWidth = 0;
|
|
9081
|
+
let output = "";
|
|
9082
|
+
const addOutput = () => {
|
|
9083
|
+
const { char, color } = currentIcon;
|
|
9084
|
+
const availableWidth = width - previousLineWidth;
|
|
9085
|
+
if (availableWidth > currentTasks) {
|
|
9086
|
+
output += color(char.repeat(currentTasks));
|
|
9087
|
+
previousLineWidth += currentTasks;
|
|
9088
|
+
} else {
|
|
9089
|
+
let buf = `${char.repeat(availableWidth)}
|
|
9090
|
+
`;
|
|
9091
|
+
const remaining = currentTasks - availableWidth;
|
|
9092
|
+
const fullRows = Math.floor(remaining / width);
|
|
9093
|
+
buf += `${char.repeat(width)}
|
|
9094
|
+
`.repeat(fullRows);
|
|
9095
|
+
const partialRow = remaining % width;
|
|
9096
|
+
if (partialRow > 0) {
|
|
9097
|
+
buf += char.repeat(partialRow);
|
|
9098
|
+
previousLineWidth = partialRow;
|
|
9099
|
+
} else {
|
|
9100
|
+
previousLineWidth = 0;
|
|
9101
|
+
}
|
|
9102
|
+
output += color(buf);
|
|
9103
|
+
}
|
|
9104
|
+
};
|
|
9077
9105
|
for (const task of all) {
|
|
9078
9106
|
const icon = getIcon(task);
|
|
9079
|
-
const isLast = all.indexOf(task) === all.length - 1;
|
|
9080
9107
|
if (icon === currentIcon) {
|
|
9081
9108
|
currentTasks++;
|
|
9082
|
-
if (isLast)
|
|
9083
|
-
addOutput();
|
|
9084
9109
|
continue;
|
|
9085
9110
|
}
|
|
9086
9111
|
addOutput();
|
|
9087
9112
|
currentTasks = 1;
|
|
9088
9113
|
currentIcon = icon;
|
|
9089
|
-
if (isLast)
|
|
9090
|
-
addOutput();
|
|
9091
9114
|
}
|
|
9092
|
-
|
|
9115
|
+
addOutput();
|
|
9116
|
+
return output;
|
|
9093
9117
|
}
|
|
9094
9118
|
function createDotRenderer(_tasks, options) {
|
|
9095
9119
|
let tasks = _tasks;
|
|
9096
9120
|
let timer;
|
|
9097
|
-
const log = options.logger
|
|
9121
|
+
const { logUpdate: log, outputStream } = options.logger;
|
|
9098
9122
|
function update() {
|
|
9099
|
-
log(render(tasks));
|
|
9123
|
+
log(render(tasks, outputStream.columns));
|
|
9100
9124
|
}
|
|
9101
9125
|
return {
|
|
9102
9126
|
start() {
|
|
@@ -9115,7 +9139,7 @@ function createDotRenderer(_tasks, options) {
|
|
|
9115
9139
|
timer = void 0;
|
|
9116
9140
|
}
|
|
9117
9141
|
log.clear();
|
|
9118
|
-
options.logger.log(render(tasks));
|
|
9142
|
+
options.logger.log(render(tasks, outputStream.columns));
|
|
9119
9143
|
return this;
|
|
9120
9144
|
},
|
|
9121
9145
|
clear() {
|
|
@@ -9885,7 +9909,7 @@ class TableReporter extends BaseReporter {
|
|
|
9885
9909
|
const files = this.ctx.state.getFiles(this.watchFilters);
|
|
9886
9910
|
createTableRenderer(files, this.rendererOptions).stop();
|
|
9887
9911
|
this.ctx.logger.log();
|
|
9888
|
-
await super.reportSummary(files);
|
|
9912
|
+
await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
|
|
9889
9913
|
super.onWatcherStart();
|
|
9890
9914
|
}
|
|
9891
9915
|
onCollected() {
|
|
@@ -10081,9 +10105,12 @@ class StateManager {
|
|
|
10081
10105
|
}
|
|
10082
10106
|
}
|
|
10083
10107
|
updateTasks(packs) {
|
|
10084
|
-
for (const [id, result] of packs) {
|
|
10085
|
-
|
|
10086
|
-
|
|
10108
|
+
for (const [id, result, meta] of packs) {
|
|
10109
|
+
const task = this.idMap.get(id);
|
|
10110
|
+
if (task) {
|
|
10111
|
+
task.result = result;
|
|
10112
|
+
task.meta = meta;
|
|
10113
|
+
}
|
|
10087
10114
|
}
|
|
10088
10115
|
}
|
|
10089
10116
|
updateUserLog(log) {
|
|
@@ -10110,6 +10137,7 @@ class StateManager {
|
|
|
10110
10137
|
result: {
|
|
10111
10138
|
state: "skip"
|
|
10112
10139
|
},
|
|
10140
|
+
meta: {},
|
|
10113
10141
|
// Cancelled files have not yet collected tests
|
|
10114
10142
|
tasks: []
|
|
10115
10143
|
})));
|
|
@@ -10145,6 +10173,7 @@ const coverageConfigDefaults = {
|
|
|
10145
10173
|
cleanOnRerun: true,
|
|
10146
10174
|
reportsDirectory: "./coverage",
|
|
10147
10175
|
exclude: defaultCoverageExcludes,
|
|
10176
|
+
reportOnFailure: true,
|
|
10148
10177
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
10149
10178
|
// default extensions used by c8, plus '.vue' and '.svelte'
|
|
10150
10179
|
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
|
|
@@ -10424,7 +10453,7 @@ function resolveApiServerConfig(options) {
|
|
|
10424
10453
|
return api;
|
|
10425
10454
|
}
|
|
10426
10455
|
function resolveConfig(mode, options, viteConfig) {
|
|
10427
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
10456
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
10428
10457
|
if (options.dom) {
|
|
10429
10458
|
if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
|
|
10430
10459
|
console.warn(
|
|
@@ -10476,10 +10505,18 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10476
10505
|
resolved.deps.inline.push(...extraInlineDeps);
|
|
10477
10506
|
}
|
|
10478
10507
|
}
|
|
10508
|
+
(_c = resolved.deps).moduleDirectories ?? (_c.moduleDirectories = ["/node_modules/"]);
|
|
10509
|
+
resolved.deps.moduleDirectories = resolved.deps.moduleDirectories.map((dir) => {
|
|
10510
|
+
if (!dir.startsWith("/"))
|
|
10511
|
+
dir = `/${dir}`;
|
|
10512
|
+
if (!dir.endsWith("/"))
|
|
10513
|
+
dir += "/";
|
|
10514
|
+
return normalize(dir);
|
|
10515
|
+
});
|
|
10479
10516
|
if (resolved.runner) {
|
|
10480
10517
|
resolved.runner = resolveModule(resolved.runner, { paths: [resolved.root] }) ?? resolve$2(resolved.root, resolved.runner);
|
|
10481
10518
|
}
|
|
10482
|
-
(
|
|
10519
|
+
(_d = resolved.deps).registerNodeLoader ?? (_d.registerNodeLoader = false);
|
|
10483
10520
|
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
|
|
10484
10521
|
const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
|
|
10485
10522
|
resolved.snapshotOptions = {
|
|
@@ -10544,19 +10581,19 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10544
10581
|
resolved.passWithNoTests ?? (resolved.passWithNoTests = true);
|
|
10545
10582
|
resolved.css ?? (resolved.css = {});
|
|
10546
10583
|
if (typeof resolved.css === "object") {
|
|
10547
|
-
(
|
|
10548
|
-
(
|
|
10584
|
+
(_e = resolved.css).modules ?? (_e.modules = {});
|
|
10585
|
+
(_f = resolved.css.modules).classNameStrategy ?? (_f.classNameStrategy = "stable");
|
|
10549
10586
|
}
|
|
10550
10587
|
resolved.cache ?? (resolved.cache = { dir: "" });
|
|
10551
10588
|
if (resolved.cache)
|
|
10552
10589
|
resolved.cache.dir = VitestCache.resolveCacheDir(resolved.root, resolved.cache.dir);
|
|
10553
10590
|
resolved.sequence ?? (resolved.sequence = {});
|
|
10554
|
-
if (!((
|
|
10591
|
+
if (!((_g = resolved.sequence) == null ? void 0 : _g.sequencer)) {
|
|
10555
10592
|
resolved.sequence.sequencer = resolved.sequence.shuffle ? RandomSequencer : BaseSequencer;
|
|
10556
10593
|
}
|
|
10557
|
-
(
|
|
10594
|
+
(_h = resolved.sequence).hooks ?? (_h.hooks = "parallel");
|
|
10558
10595
|
if (resolved.sequence.sequencer === RandomSequencer)
|
|
10559
|
-
(
|
|
10596
|
+
(_i = resolved.sequence).seed ?? (_i.seed = Date.now());
|
|
10560
10597
|
resolved.typecheck = {
|
|
10561
10598
|
...configDefaults.typecheck,
|
|
10562
10599
|
...resolved.typecheck
|
|
@@ -10567,9 +10604,9 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10567
10604
|
resolved.exclude = resolved.typecheck.exclude;
|
|
10568
10605
|
}
|
|
10569
10606
|
resolved.browser ?? (resolved.browser = {});
|
|
10570
|
-
(
|
|
10571
|
-
(
|
|
10572
|
-
(
|
|
10607
|
+
(_j = resolved.browser).enabled ?? (_j.enabled = false);
|
|
10608
|
+
(_k = resolved.browser).headless ?? (_k.headless = isCI);
|
|
10609
|
+
(_l = resolved.browser).slowHijackESM ?? (_l.slowHijackESM = true);
|
|
10573
10610
|
resolved.browser.api = resolveApiServerConfig(resolved.browser) || {
|
|
10574
10611
|
port: defaultBrowserPort
|
|
10575
10612
|
};
|
|
@@ -11128,7 +11165,7 @@ createLogUpdate(process$1.stdout);
|
|
|
11128
11165
|
|
|
11129
11166
|
createLogUpdate(process$1.stderr);
|
|
11130
11167
|
|
|
11131
|
-
var version = "0.31.
|
|
11168
|
+
var version = "0.31.3";
|
|
11132
11169
|
|
|
11133
11170
|
const comma = ','.charCodeAt(0);
|
|
11134
11171
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
@@ -11998,6 +12035,7 @@ class Typechecker {
|
|
|
11998
12035
|
files: [],
|
|
11999
12036
|
sourceErrors: []
|
|
12000
12037
|
};
|
|
12038
|
+
this._output = "";
|
|
12001
12039
|
this._tests = {};
|
|
12002
12040
|
}
|
|
12003
12041
|
onParseStart(fn) {
|
|
@@ -12157,6 +12195,13 @@ class Typechecker {
|
|
|
12157
12195
|
this.tempConfigPath = path;
|
|
12158
12196
|
this.allowJs = typecheck.allowJs || config.allowJs || false;
|
|
12159
12197
|
}
|
|
12198
|
+
getExitCode() {
|
|
12199
|
+
var _a;
|
|
12200
|
+
return ((_a = this.process) == null ? void 0 : _a.exitCode) != null && this.process.exitCode;
|
|
12201
|
+
}
|
|
12202
|
+
getOutput() {
|
|
12203
|
+
return this._output;
|
|
12204
|
+
}
|
|
12160
12205
|
async start() {
|
|
12161
12206
|
var _a, _b, _c;
|
|
12162
12207
|
if (!this.tempConfigPath)
|
|
@@ -12167,7 +12212,7 @@ class Typechecker {
|
|
|
12167
12212
|
args.push("--watch");
|
|
12168
12213
|
if (typecheck.allowJs)
|
|
12169
12214
|
args.push("--allowJs", "--checkJs");
|
|
12170
|
-
|
|
12215
|
+
this._output = "";
|
|
12171
12216
|
const child = execa(typecheck.checker, args, {
|
|
12172
12217
|
cwd: root,
|
|
12173
12218
|
stdout: "pipe",
|
|
@@ -12178,29 +12223,29 @@ class Typechecker {
|
|
|
12178
12223
|
let rerunTriggered = false;
|
|
12179
12224
|
(_b = child.stdout) == null ? void 0 : _b.on("data", (chunk) => {
|
|
12180
12225
|
var _a2;
|
|
12181
|
-
|
|
12226
|
+
this._output += chunk;
|
|
12182
12227
|
if (!watch)
|
|
12183
12228
|
return;
|
|
12184
|
-
if (
|
|
12229
|
+
if (this._output.includes("File change detected") && !rerunTriggered) {
|
|
12185
12230
|
(_a2 = this._onWatcherRerun) == null ? void 0 : _a2.call(this);
|
|
12186
12231
|
this._result.sourceErrors = [];
|
|
12187
12232
|
this._result.files = [];
|
|
12188
12233
|
this._tests = null;
|
|
12189
12234
|
rerunTriggered = true;
|
|
12190
12235
|
}
|
|
12191
|
-
if (/Found \w+ errors*. Watching for/.test(
|
|
12236
|
+
if (/Found \w+ errors*. Watching for/.test(this._output)) {
|
|
12192
12237
|
rerunTriggered = false;
|
|
12193
|
-
this.prepareResults(
|
|
12238
|
+
this.prepareResults(this._output).then((result) => {
|
|
12194
12239
|
var _a3;
|
|
12195
12240
|
this._result = result;
|
|
12196
12241
|
(_a3 = this._onParseEnd) == null ? void 0 : _a3.call(this, result);
|
|
12197
12242
|
});
|
|
12198
|
-
|
|
12243
|
+
this._output = "";
|
|
12199
12244
|
}
|
|
12200
12245
|
});
|
|
12201
12246
|
if (!watch) {
|
|
12202
12247
|
await child;
|
|
12203
|
-
this._result = await this.prepareResults(
|
|
12248
|
+
this._result = await this.prepareResults(this._output);
|
|
12204
12249
|
await ((_c = this._onParseEnd) == null ? void 0 : _c.call(this, this._result));
|
|
12205
12250
|
}
|
|
12206
12251
|
}
|
|
@@ -12211,7 +12256,7 @@ class Typechecker {
|
|
|
12211
12256
|
return Object.values(this._tests || {}).map((i) => i.file);
|
|
12212
12257
|
}
|
|
12213
12258
|
getTestPacks() {
|
|
12214
|
-
return Object.values(this._tests || {}).map(({ file }) => getTasks(file)).flat().map((i) => [i.id, void 0]);
|
|
12259
|
+
return Object.values(this._tests || {}).map(({ file }) => getTasks(file)).flat().map((i) => [i.id, void 0, { typecheck: true }]);
|
|
12215
12260
|
}
|
|
12216
12261
|
}
|
|
12217
12262
|
|
|
@@ -12241,13 +12286,15 @@ async function printError(error, ctx, options = {}) {
|
|
|
12241
12286
|
if (type)
|
|
12242
12287
|
printErrorType(type, ctx);
|
|
12243
12288
|
printErrorMessage(e, ctx.logger);
|
|
12289
|
+
if (e.diff)
|
|
12290
|
+
displayDiff(e.diff, ctx.logger.console);
|
|
12244
12291
|
if (e.frame) {
|
|
12245
12292
|
ctx.logger.error(c.yellow(e.frame));
|
|
12246
12293
|
} else {
|
|
12247
12294
|
printStack(ctx, stacks, nearest, errorProperties, (s) => {
|
|
12248
12295
|
if (showCodeFrame && s === nearest && nearest) {
|
|
12249
12296
|
const sourceCode = readFileSync(nearest.file, "utf-8");
|
|
12250
|
-
ctx.logger.error(
|
|
12297
|
+
ctx.logger.error(generateCodeFrame(sourceCode, 4, s.line, s.column));
|
|
12251
12298
|
}
|
|
12252
12299
|
});
|
|
12253
12300
|
}
|
|
@@ -12269,8 +12316,6 @@ async function printError(error, ctx, options = {}) {
|
|
|
12269
12316
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
12270
12317
|
}
|
|
12271
12318
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
12272
|
-
if (e.diff)
|
|
12273
|
-
displayDiff(e.diff, ctx.logger.console);
|
|
12274
12319
|
}
|
|
12275
12320
|
function printErrorType(type, ctx) {
|
|
12276
12321
|
ctx.logger.error(`
|
|
@@ -12345,7 +12390,9 @@ function printModuleWarningForSourceCode(logger, path) {
|
|
|
12345
12390
|
));
|
|
12346
12391
|
}
|
|
12347
12392
|
function displayDiff(diff, console) {
|
|
12348
|
-
console.error(
|
|
12393
|
+
console.error(`
|
|
12394
|
+
${diff}
|
|
12395
|
+
`);
|
|
12349
12396
|
}
|
|
12350
12397
|
function printErrorMessage(error, logger) {
|
|
12351
12398
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
@@ -12354,9 +12401,9 @@ function printErrorMessage(error, logger) {
|
|
|
12354
12401
|
function printStack(ctx, stack, highlight, errorProperties, onStack) {
|
|
12355
12402
|
const logger = ctx.logger;
|
|
12356
12403
|
for (const frame of stack) {
|
|
12357
|
-
const color = frame === highlight ? c.
|
|
12404
|
+
const color = frame === highlight ? c.cyan : c.gray;
|
|
12358
12405
|
const path = relative(ctx.config.root, frame.file);
|
|
12359
|
-
logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${
|
|
12406
|
+
logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, `${path}:${c.dim(`${frame.line}:${frame.column}`)}`].filter(Boolean).join(" ")}`));
|
|
12360
12407
|
onStack == null ? void 0 : onStack(frame);
|
|
12361
12408
|
}
|
|
12362
12409
|
if (stack.length)
|
|
@@ -12709,7 +12756,7 @@ async function createBrowserServer(project, options) {
|
|
|
12709
12756
|
});
|
|
12710
12757
|
await server.listen();
|
|
12711
12758
|
await server.watcher.close();
|
|
12712
|
-
(await import('./chunk-api-setup.
|
|
12759
|
+
(await import('./chunk-api-setup.3854747a.js')).setup(project, server);
|
|
12713
12760
|
return server;
|
|
12714
12761
|
}
|
|
12715
12762
|
|
|
@@ -13260,10 +13307,17 @@ class WorkspaceProject {
|
|
|
13260
13307
|
this.ctx.state.collectFiles(checker.getTestFiles());
|
|
13261
13308
|
await this.report("onTaskUpdate", checker.getTestPacks());
|
|
13262
13309
|
await this.report("onCollected");
|
|
13310
|
+
const failedTests = hasFailed(files);
|
|
13311
|
+
const exitCode = !failedTests && checker.getExitCode();
|
|
13312
|
+
if (exitCode) {
|
|
13313
|
+
const error = new Error(checker.getOutput());
|
|
13314
|
+
error.stack = "";
|
|
13315
|
+
this.ctx.state.catchError(error, "Typecheck Error");
|
|
13316
|
+
}
|
|
13263
13317
|
if (!files.length) {
|
|
13264
13318
|
this.ctx.logger.printNoTestFound();
|
|
13265
13319
|
} else {
|
|
13266
|
-
if (
|
|
13320
|
+
if (failedTests)
|
|
13267
13321
|
process.exitCode = 1;
|
|
13268
13322
|
await this.report("onFinished", files);
|
|
13269
13323
|
}
|
|
@@ -13272,8 +13326,9 @@ class WorkspaceProject {
|
|
|
13272
13326
|
await this.ctx.logger.printSourceTypeErrors(sourceErrors);
|
|
13273
13327
|
}
|
|
13274
13328
|
if (!files.length) {
|
|
13275
|
-
const
|
|
13276
|
-
|
|
13329
|
+
const exitCode2 = this.config.passWithNoTests ? process.exitCode ?? 0 : 1;
|
|
13330
|
+
await this.close();
|
|
13331
|
+
process.exit(exitCode2);
|
|
13277
13332
|
}
|
|
13278
13333
|
if (this.config.watch) {
|
|
13279
13334
|
await this.report("onWatcherStart", files, [
|
|
@@ -13863,21 +13918,21 @@ class Vitest {
|
|
|
13863
13918
|
return files;
|
|
13864
13919
|
}
|
|
13865
13920
|
async reportCoverage(allTestsRun) {
|
|
13921
|
+
if (!this.config.coverage.reportOnFailure && this.state.getCountOfFailedTests() > 0)
|
|
13922
|
+
return;
|
|
13866
13923
|
if (this.coverageProvider) {
|
|
13867
13924
|
this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
|
|
13868
13925
|
await this.coverageProvider.reportCoverage({ allTestsRun });
|
|
13869
13926
|
}
|
|
13870
13927
|
}
|
|
13871
13928
|
async close() {
|
|
13872
|
-
var _a;
|
|
13873
13929
|
if (!this.closingPromise) {
|
|
13874
|
-
const closePromises = this.projects.map((w) => w.close());
|
|
13930
|
+
const closePromises = this.projects.map((w) => w.close().then(() => w.server = void 0));
|
|
13875
13931
|
if (this.coreWorkspace && !this.projects.includes(this.coreWorkspace))
|
|
13876
|
-
closePromises.push(this.server.close());
|
|
13877
|
-
this.
|
|
13878
|
-
(
|
|
13879
|
-
|
|
13880
|
-
].filter(Boolean)).then((results) => {
|
|
13932
|
+
closePromises.push(this.server.close().then(() => this.server = void 0));
|
|
13933
|
+
if (this.pool)
|
|
13934
|
+
closePromises.push(this.pool.close().then(() => this.pool = void 0));
|
|
13935
|
+
this.closingPromise = Promise.allSettled(closePromises).then((results) => {
|
|
13881
13936
|
results.filter((r) => r.status === "rejected").forEach((err) => {
|
|
13882
13937
|
this.logger.error("error during close", err.reason);
|
|
13883
13938
|
});
|
|
@@ -13893,6 +13948,16 @@ class Vitest {
|
|
|
13893
13948
|
this.report("onProcessTimeout").then(() => {
|
|
13894
13949
|
console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
|
|
13895
13950
|
this.state.getProcessTimeoutCauses().forEach((cause) => console.warn(cause));
|
|
13951
|
+
if (!this.pool) {
|
|
13952
|
+
const runningServers = [this.server, ...this.projects.map((p) => p.server)].filter(Boolean).length;
|
|
13953
|
+
if (runningServers === 1)
|
|
13954
|
+
console.warn("Tests closed successfully but something prevents Vite server from exiting");
|
|
13955
|
+
else if (runningServers > 1)
|
|
13956
|
+
console.warn(`Tests closed successfully but something prevents ${runningServers} Vite servers from exiting`);
|
|
13957
|
+
else
|
|
13958
|
+
console.warn("Tests closed successfully but something prevents the main process from exiting");
|
|
13959
|
+
console.warn('You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters');
|
|
13960
|
+
}
|
|
13896
13961
|
process.exit();
|
|
13897
13962
|
});
|
|
13898
13963
|
}, this.config.teardownTimeout).unref();
|
|
@@ -14077,7 +14142,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
14077
14142
|
try {
|
|
14078
14143
|
await ctx.setServer(options, server, userConfig);
|
|
14079
14144
|
if (options.api && options.watch)
|
|
14080
|
-
(await import('./chunk-api-setup.
|
|
14145
|
+
(await import('./chunk-api-setup.3854747a.js')).setup(ctx);
|
|
14081
14146
|
} catch (err) {
|
|
14082
14147
|
await ctx.logger.printError(err, true);
|
|
14083
14148
|
process.exit(1);
|
|
@@ -20408,8 +20473,13 @@ ${keys.map((i) => c.dim(" press ") + c.reset([i[0]].flat().map(c.bold).join(",
|
|
|
20408
20473
|
function registerConsoleShortcuts(ctx) {
|
|
20409
20474
|
let latestFilename = "";
|
|
20410
20475
|
async function _keypressHandler(str, key) {
|
|
20411
|
-
if (str === "" || str === "\x1B" || key && key.ctrl && key.name === "c")
|
|
20476
|
+
if (str === "" || str === "\x1B" || key && key.ctrl && key.name === "c") {
|
|
20477
|
+
if (!ctx.isCancelling) {
|
|
20478
|
+
await ctx.cancelCurrentRun("keyboard-input");
|
|
20479
|
+
await ctx.runningPromise;
|
|
20480
|
+
}
|
|
20412
20481
|
return ctx.exit(true);
|
|
20482
|
+
}
|
|
20413
20483
|
if (!isWindows && key && key.ctrl && key.name === "z") {
|
|
20414
20484
|
process.kill(process.ppid, "SIGTSTP");
|
|
20415
20485
|
process.kill(process.pid, "SIGTSTP");
|
|
@@ -20524,6 +20594,8 @@ async function startVitest(mode, cliFilters = [], options = {}, viteOverrides) {
|
|
|
20524
20594
|
}
|
|
20525
20595
|
if (process.stdin.isTTY && ctx.config.watch)
|
|
20526
20596
|
registerConsoleShortcuts(ctx);
|
|
20597
|
+
else
|
|
20598
|
+
process.on("SIGINT", () => ctx.cancelCurrentRun("keyboard-input"));
|
|
20527
20599
|
ctx.onServerRestart((reason) => {
|
|
20528
20600
|
ctx.report("onServerRestart", reason);
|
|
20529
20601
|
if (process.env.VITEST_CLI_WRAPPER)
|
|
@@ -7,7 +7,7 @@ import { g as getWorkerState, a as getCurrentEnvironment } from './vendor-global
|
|
|
7
7
|
import { d as distDir } from './vendor-paths.84fc7a99.js';
|
|
8
8
|
import { existsSync, readdirSync } from 'node:fs';
|
|
9
9
|
import { getColors, getType } from '@vitest/utils';
|
|
10
|
-
import { e as getAllMockableProperties } from './vendor-index.
|
|
10
|
+
import { e as getAllMockableProperties } from './vendor-index.5037f2c0.js';
|
|
11
11
|
import { spyOn } from '@vitest/spy';
|
|
12
12
|
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
13
13
|
|
|
@@ -47,11 +47,17 @@ const _VitestMocker = class {
|
|
|
47
47
|
get moduleCache() {
|
|
48
48
|
return this.executor.moduleCache;
|
|
49
49
|
}
|
|
50
|
+
get moduleDirectories() {
|
|
51
|
+
return this.executor.options.moduleDirectories || [];
|
|
52
|
+
}
|
|
50
53
|
deleteCachedItem(id) {
|
|
51
54
|
const mockId = this.getMockPath(id);
|
|
52
55
|
if (this.moduleCache.has(mockId))
|
|
53
56
|
this.moduleCache.delete(mockId);
|
|
54
57
|
}
|
|
58
|
+
isAModuleDirectory(path) {
|
|
59
|
+
return this.moduleDirectories.some((dir) => path.includes(dir));
|
|
60
|
+
}
|
|
55
61
|
getSuiteFilepath() {
|
|
56
62
|
return getWorkerState().filepath || "global";
|
|
57
63
|
}
|
|
@@ -66,7 +72,7 @@ const _VitestMocker = class {
|
|
|
66
72
|
}
|
|
67
73
|
async resolvePath(rawId, importer) {
|
|
68
74
|
const [id, fsPath] = await this.executor.resolveUrl(rawId, importer);
|
|
69
|
-
const external = !isAbsolute(fsPath) ||
|
|
75
|
+
const external = !isAbsolute(fsPath) || this.isAModuleDirectory(fsPath) ? rawId : null;
|
|
70
76
|
return {
|
|
71
77
|
id,
|
|
72
78
|
fsPath,
|
|
@@ -205,7 +211,12 @@ ${c.green(`vi.mock("${mockpath}", async () => {
|
|
|
205
211
|
if (!define(newContainer, property, isFunction ? value : {}))
|
|
206
212
|
continue;
|
|
207
213
|
if (isFunction) {
|
|
208
|
-
spyOn(newContainer, property).mockImplementation(() => void 0);
|
|
214
|
+
const mock = spyOn(newContainer, property).mockImplementation(() => void 0);
|
|
215
|
+
mock.mockRestore = () => {
|
|
216
|
+
mock.mockReset();
|
|
217
|
+
mock.mockImplementation(void 0);
|
|
218
|
+
return mock;
|
|
219
|
+
};
|
|
209
220
|
Object.defineProperty(newContainer[property], "length", { value: 0 });
|
|
210
221
|
}
|
|
211
222
|
refs.track(value, newContainer[property]);
|
|
@@ -334,6 +345,7 @@ async function startViteNode(ctx) {
|
|
|
334
345
|
moduleCache,
|
|
335
346
|
mockMap,
|
|
336
347
|
interopDefault: config.deps.interopDefault,
|
|
348
|
+
moduleDirectories: config.deps.moduleDirectories,
|
|
337
349
|
root: config.root,
|
|
338
350
|
base: config.base
|
|
339
351
|
});
|
|
@@ -100,6 +100,7 @@ function defaultSerialize(i) {
|
|
|
100
100
|
}
|
|
101
101
|
const defaultDeserialize = defaultSerialize;
|
|
102
102
|
const { setTimeout } = globalThis;
|
|
103
|
+
const random = Math.random.bind(Math);
|
|
103
104
|
function createBirpc(functions, options) {
|
|
104
105
|
const {
|
|
105
106
|
post,
|
|
@@ -180,7 +181,7 @@ function nanoid(size = 21) {
|
|
|
180
181
|
let id = "";
|
|
181
182
|
let i = size;
|
|
182
183
|
while (i--)
|
|
183
|
-
id += urlAlphabet[
|
|
184
|
+
id += urlAlphabet[random() * 64 | 0];
|
|
184
185
|
return id;
|
|
185
186
|
}
|
|
186
187
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
import { e as bench, c as createExpect, d as globalExpect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.
|
|
2
|
+
import { e as bench, c as createExpect, d as globalExpect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.23b98fa1.js';
|
|
3
3
|
import { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
import { assert, should } from 'chai';
|
|
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
|
|
|
10
10
|
globalSetup = true;
|
|
11
11
|
setSafeTimers();
|
|
12
12
|
if (config.globals)
|
|
13
|
-
(await import('./chunk-integrations-globals.
|
|
13
|
+
(await import('./chunk-integrations-globals.6a234998.js')).registerApiGlobally();
|
|
14
14
|
}
|
|
15
15
|
function setupDefines(defines) {
|
|
16
16
|
for (const key in defines)
|
|
@@ -4,7 +4,7 @@ import '@vitest/utils';
|
|
|
4
4
|
function hasFailedSnapshot(suite) {
|
|
5
5
|
return getTests(suite).some((s) => {
|
|
6
6
|
var _a, _b;
|
|
7
|
-
return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => e
|
|
7
|
+
return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => typeof (e == null ? void 0 : e.message) === "string" && e.message.match(/Snapshot .* mismatched/));
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
function getFullName(task, separator = " > ") {
|
|
@@ -7,7 +7,7 @@ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
|
|
|
7
7
|
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect';
|
|
8
8
|
import { SnapshotClient, stripSnapshotIndentation, addSerializer } from '@vitest/snapshot';
|
|
9
9
|
import { g as getWorkerState, a as getCurrentEnvironment } from './vendor-global.6795f91f.js';
|
|
10
|
-
import { g as getFullName } from './vendor-tasks.
|
|
10
|
+
import { g as getFullName } from './vendor-tasks.f9d75aed.js';
|
|
11
11
|
import require$$0 from 'util';
|
|
12
12
|
import { spyOn, fn, isMockFunction, spies } from '@vitest/spy';
|
|
13
13
|
|
|
@@ -152,7 +152,7 @@ var chaiSubset = {exports: {}};
|
|
|
152
152
|
var Subset = chaiSubset.exports;
|
|
153
153
|
|
|
154
154
|
function recordAsyncExpect(test, promise) {
|
|
155
|
-
if (test) {
|
|
155
|
+
if (test && promise instanceof Promise) {
|
|
156
156
|
promise = promise.finally(() => {
|
|
157
157
|
const index = test.promises.indexOf(promise);
|
|
158
158
|
if (index !== -1)
|
|
@@ -252,9 +252,13 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
252
252
|
chai.Assertion.prototype,
|
|
253
253
|
"toMatchInlineSnapshot",
|
|
254
254
|
function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
255
|
+
var _a;
|
|
256
|
+
const test = utils.flag(this, "vitest-test");
|
|
257
|
+
const isInsideEach = test && (test.each || ((_a = test.suite) == null ? void 0 : _a.each));
|
|
258
|
+
if (isInsideEach)
|
|
259
|
+
throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
255
260
|
const expected = utils.flag(this, "object");
|
|
256
261
|
const error = utils.flag(this, "error");
|
|
257
|
-
const test = utils.flag(this, "vitest-test");
|
|
258
262
|
if (typeof properties === "string") {
|
|
259
263
|
message = inlineSnapshot;
|
|
260
264
|
inlineSnapshot = properties;
|
|
@@ -295,9 +299,13 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
295
299
|
chai.Assertion.prototype,
|
|
296
300
|
"toThrowErrorMatchingInlineSnapshot",
|
|
297
301
|
function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
302
|
+
var _a;
|
|
303
|
+
const test = utils.flag(this, "vitest-test");
|
|
304
|
+
const isInsideEach = test && (test.each || ((_a = test.suite) == null ? void 0 : _a.each));
|
|
305
|
+
if (isInsideEach)
|
|
306
|
+
throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
298
307
|
const expected = utils.flag(this, "object");
|
|
299
308
|
const error = utils.flag(this, "error");
|
|
300
|
-
const test = utils.flag(this, "vitest-test");
|
|
301
309
|
const promise = utils.flag(this, "promise");
|
|
302
310
|
const errorMessage = utils.flag(this, "message");
|
|
303
311
|
getSnapshotClient().assert({
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
|
-
import { c as createBirpc } from './vendor-index.
|
|
2
|
+
import { c as createBirpc } from './vendor-index.5037f2c0.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
5
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.
|
|
5
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.132a3e09.js';
|
|
6
6
|
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
|
|
7
7
|
import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
|
|
8
8
|
import '@vitest/utils';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.31.
|
|
4
|
+
"version": "0.31.3",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -148,12 +148,12 @@
|
|
|
148
148
|
"tinypool": "^0.5.0",
|
|
149
149
|
"vite": "^3.0.0 || ^4.0.0",
|
|
150
150
|
"why-is-node-running": "^2.2.2",
|
|
151
|
-
"@vitest/runner": "0.31.
|
|
152
|
-
"
|
|
153
|
-
"@vitest/
|
|
154
|
-
"
|
|
155
|
-
"@vitest/
|
|
156
|
-
"@vitest/
|
|
151
|
+
"@vitest/runner": "0.31.3",
|
|
152
|
+
"@vitest/spy": "0.31.3",
|
|
153
|
+
"@vitest/snapshot": "0.31.3",
|
|
154
|
+
"vite-node": "0.31.3",
|
|
155
|
+
"@vitest/expect": "0.31.3",
|
|
156
|
+
"@vitest/utils": "0.31.3"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
159
|
"@ampproject/remapping": "^2.2.1",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"@types/micromatch": "^4.0.2",
|
|
170
170
|
"@types/prompts": "^2.4.4",
|
|
171
171
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
172
|
-
"birpc": "0.2.
|
|
172
|
+
"birpc": "0.2.12",
|
|
173
173
|
"chai-subset": "^1.6.0",
|
|
174
174
|
"cli-truncate": "^3.1.0",
|
|
175
175
|
"event-target-polyfill": "^0.0.3",
|