vitest 0.31.1 → 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.86042fed.js → chunk-api-setup.3854747a.js} +1 -1
- package/dist/{chunk-install-pkg.d1609923.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 +2 -2
- 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 +4 -3
- package/dist/environments.d.ts +1 -2
- package/dist/index.d.ts +4 -6
- package/dist/index.js +3 -3
- package/dist/loader.js +0 -1
- 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-ad1c3f45.d.ts → types-73d6349f.d.ts} +31 -13
- package/dist/{vendor-cli-api.d608f86b.js → vendor-cli-api.35332ab3.js} +123 -56
- 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.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 +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-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';
|
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-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;
|
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';
|
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/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-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[];
|
|
@@ -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,7 +25,7 @@ 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';
|
|
@@ -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.2";
|
|
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.4207d842.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
|
`));
|
|
@@ -9068,35 +9068,54 @@ function getIcon(task) {
|
|
|
9068
9068
|
return pending;
|
|
9069
9069
|
}
|
|
9070
9070
|
}
|
|
9071
|
-
function render(tasks) {
|
|
9071
|
+
function render(tasks, width) {
|
|
9072
9072
|
const all = getTests(tasks);
|
|
9073
|
-
const output = [];
|
|
9074
9073
|
let currentIcon = pending;
|
|
9075
9074
|
let currentTasks = 0;
|
|
9076
|
-
|
|
9075
|
+
let previousLineWidth = 0;
|
|
9076
|
+
let output = "";
|
|
9077
|
+
const addOutput = () => {
|
|
9078
|
+
const { char, color } = currentIcon;
|
|
9079
|
+
const availableWidth = width - previousLineWidth;
|
|
9080
|
+
if (availableWidth > currentTasks) {
|
|
9081
|
+
output += color(char.repeat(currentTasks));
|
|
9082
|
+
previousLineWidth += currentTasks;
|
|
9083
|
+
} else {
|
|
9084
|
+
let buf = `${char.repeat(availableWidth)}
|
|
9085
|
+
`;
|
|
9086
|
+
const remaining = currentTasks - availableWidth;
|
|
9087
|
+
const fullRows = Math.floor(remaining / width);
|
|
9088
|
+
buf += `${char.repeat(width)}
|
|
9089
|
+
`.repeat(fullRows);
|
|
9090
|
+
const partialRow = remaining % width;
|
|
9091
|
+
if (partialRow > 0) {
|
|
9092
|
+
buf += char.repeat(partialRow);
|
|
9093
|
+
previousLineWidth = partialRow;
|
|
9094
|
+
} else {
|
|
9095
|
+
previousLineWidth = 0;
|
|
9096
|
+
}
|
|
9097
|
+
output += color(buf);
|
|
9098
|
+
}
|
|
9099
|
+
};
|
|
9077
9100
|
for (const task of all) {
|
|
9078
9101
|
const icon = getIcon(task);
|
|
9079
|
-
const isLast = all.indexOf(task) === all.length - 1;
|
|
9080
9102
|
if (icon === currentIcon) {
|
|
9081
9103
|
currentTasks++;
|
|
9082
|
-
if (isLast)
|
|
9083
|
-
addOutput();
|
|
9084
9104
|
continue;
|
|
9085
9105
|
}
|
|
9086
9106
|
addOutput();
|
|
9087
9107
|
currentTasks = 1;
|
|
9088
9108
|
currentIcon = icon;
|
|
9089
|
-
if (isLast)
|
|
9090
|
-
addOutput();
|
|
9091
9109
|
}
|
|
9092
|
-
|
|
9110
|
+
addOutput();
|
|
9111
|
+
return output;
|
|
9093
9112
|
}
|
|
9094
9113
|
function createDotRenderer(_tasks, options) {
|
|
9095
9114
|
let tasks = _tasks;
|
|
9096
9115
|
let timer;
|
|
9097
|
-
const log = options.logger
|
|
9116
|
+
const { logUpdate: log, outputStream } = options.logger;
|
|
9098
9117
|
function update() {
|
|
9099
|
-
log(render(tasks));
|
|
9118
|
+
log(render(tasks, outputStream.columns));
|
|
9100
9119
|
}
|
|
9101
9120
|
return {
|
|
9102
9121
|
start() {
|
|
@@ -9115,7 +9134,7 @@ function createDotRenderer(_tasks, options) {
|
|
|
9115
9134
|
timer = void 0;
|
|
9116
9135
|
}
|
|
9117
9136
|
log.clear();
|
|
9118
|
-
options.logger.log(render(tasks));
|
|
9137
|
+
options.logger.log(render(tasks, outputStream.columns));
|
|
9119
9138
|
return this;
|
|
9120
9139
|
},
|
|
9121
9140
|
clear() {
|
|
@@ -10081,9 +10100,12 @@ class StateManager {
|
|
|
10081
10100
|
}
|
|
10082
10101
|
}
|
|
10083
10102
|
updateTasks(packs) {
|
|
10084
|
-
for (const [id, result] of packs) {
|
|
10085
|
-
|
|
10086
|
-
|
|
10103
|
+
for (const [id, result, meta] of packs) {
|
|
10104
|
+
const task = this.idMap.get(id);
|
|
10105
|
+
if (task) {
|
|
10106
|
+
task.result = result;
|
|
10107
|
+
task.meta = meta;
|
|
10108
|
+
}
|
|
10087
10109
|
}
|
|
10088
10110
|
}
|
|
10089
10111
|
updateUserLog(log) {
|
|
@@ -10110,6 +10132,7 @@ class StateManager {
|
|
|
10110
10132
|
result: {
|
|
10111
10133
|
state: "skip"
|
|
10112
10134
|
},
|
|
10135
|
+
meta: {},
|
|
10113
10136
|
// Cancelled files have not yet collected tests
|
|
10114
10137
|
tasks: []
|
|
10115
10138
|
})));
|
|
@@ -10145,6 +10168,7 @@ const coverageConfigDefaults = {
|
|
|
10145
10168
|
cleanOnRerun: true,
|
|
10146
10169
|
reportsDirectory: "./coverage",
|
|
10147
10170
|
exclude: defaultCoverageExcludes,
|
|
10171
|
+
reportOnFailure: true,
|
|
10148
10172
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
10149
10173
|
// default extensions used by c8, plus '.vue' and '.svelte'
|
|
10150
10174
|
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
|
|
@@ -10424,7 +10448,7 @@ function resolveApiServerConfig(options) {
|
|
|
10424
10448
|
return api;
|
|
10425
10449
|
}
|
|
10426
10450
|
function resolveConfig(mode, options, viteConfig) {
|
|
10427
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
10451
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
10428
10452
|
if (options.dom) {
|
|
10429
10453
|
if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
|
|
10430
10454
|
console.warn(
|
|
@@ -10476,10 +10500,18 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10476
10500
|
resolved.deps.inline.push(...extraInlineDeps);
|
|
10477
10501
|
}
|
|
10478
10502
|
}
|
|
10503
|
+
(_c = resolved.deps).moduleDirectories ?? (_c.moduleDirectories = ["/node_modules/"]);
|
|
10504
|
+
resolved.deps.moduleDirectories = resolved.deps.moduleDirectories.map((dir) => {
|
|
10505
|
+
if (!dir.startsWith("/"))
|
|
10506
|
+
dir = `/${dir}`;
|
|
10507
|
+
if (!dir.endsWith("/"))
|
|
10508
|
+
dir += "/";
|
|
10509
|
+
return normalize(dir);
|
|
10510
|
+
});
|
|
10479
10511
|
if (resolved.runner) {
|
|
10480
10512
|
resolved.runner = resolveModule(resolved.runner, { paths: [resolved.root] }) ?? resolve$2(resolved.root, resolved.runner);
|
|
10481
10513
|
}
|
|
10482
|
-
(
|
|
10514
|
+
(_d = resolved.deps).registerNodeLoader ?? (_d.registerNodeLoader = false);
|
|
10483
10515
|
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
|
|
10484
10516
|
const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
|
|
10485
10517
|
resolved.snapshotOptions = {
|
|
@@ -10544,19 +10576,19 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10544
10576
|
resolved.passWithNoTests ?? (resolved.passWithNoTests = true);
|
|
10545
10577
|
resolved.css ?? (resolved.css = {});
|
|
10546
10578
|
if (typeof resolved.css === "object") {
|
|
10547
|
-
(
|
|
10548
|
-
(
|
|
10579
|
+
(_e = resolved.css).modules ?? (_e.modules = {});
|
|
10580
|
+
(_f = resolved.css.modules).classNameStrategy ?? (_f.classNameStrategy = "stable");
|
|
10549
10581
|
}
|
|
10550
10582
|
resolved.cache ?? (resolved.cache = { dir: "" });
|
|
10551
10583
|
if (resolved.cache)
|
|
10552
10584
|
resolved.cache.dir = VitestCache.resolveCacheDir(resolved.root, resolved.cache.dir);
|
|
10553
10585
|
resolved.sequence ?? (resolved.sequence = {});
|
|
10554
|
-
if (!((
|
|
10586
|
+
if (!((_g = resolved.sequence) == null ? void 0 : _g.sequencer)) {
|
|
10555
10587
|
resolved.sequence.sequencer = resolved.sequence.shuffle ? RandomSequencer : BaseSequencer;
|
|
10556
10588
|
}
|
|
10557
|
-
(
|
|
10589
|
+
(_h = resolved.sequence).hooks ?? (_h.hooks = "parallel");
|
|
10558
10590
|
if (resolved.sequence.sequencer === RandomSequencer)
|
|
10559
|
-
(
|
|
10591
|
+
(_i = resolved.sequence).seed ?? (_i.seed = Date.now());
|
|
10560
10592
|
resolved.typecheck = {
|
|
10561
10593
|
...configDefaults.typecheck,
|
|
10562
10594
|
...resolved.typecheck
|
|
@@ -10567,9 +10599,9 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10567
10599
|
resolved.exclude = resolved.typecheck.exclude;
|
|
10568
10600
|
}
|
|
10569
10601
|
resolved.browser ?? (resolved.browser = {});
|
|
10570
|
-
(
|
|
10571
|
-
(
|
|
10572
|
-
(
|
|
10602
|
+
(_j = resolved.browser).enabled ?? (_j.enabled = false);
|
|
10603
|
+
(_k = resolved.browser).headless ?? (_k.headless = isCI);
|
|
10604
|
+
(_l = resolved.browser).slowHijackESM ?? (_l.slowHijackESM = true);
|
|
10573
10605
|
resolved.browser.api = resolveApiServerConfig(resolved.browser) || {
|
|
10574
10606
|
port: defaultBrowserPort
|
|
10575
10607
|
};
|
|
@@ -11128,7 +11160,7 @@ createLogUpdate(process$1.stdout);
|
|
|
11128
11160
|
|
|
11129
11161
|
createLogUpdate(process$1.stderr);
|
|
11130
11162
|
|
|
11131
|
-
var version = "0.31.
|
|
11163
|
+
var version = "0.31.2";
|
|
11132
11164
|
|
|
11133
11165
|
const comma = ','.charCodeAt(0);
|
|
11134
11166
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
@@ -11998,6 +12030,7 @@ class Typechecker {
|
|
|
11998
12030
|
files: [],
|
|
11999
12031
|
sourceErrors: []
|
|
12000
12032
|
};
|
|
12033
|
+
this._output = "";
|
|
12001
12034
|
this._tests = {};
|
|
12002
12035
|
}
|
|
12003
12036
|
onParseStart(fn) {
|
|
@@ -12157,6 +12190,13 @@ class Typechecker {
|
|
|
12157
12190
|
this.tempConfigPath = path;
|
|
12158
12191
|
this.allowJs = typecheck.allowJs || config.allowJs || false;
|
|
12159
12192
|
}
|
|
12193
|
+
getExitCode() {
|
|
12194
|
+
var _a;
|
|
12195
|
+
return ((_a = this.process) == null ? void 0 : _a.exitCode) != null && this.process.exitCode;
|
|
12196
|
+
}
|
|
12197
|
+
getOutput() {
|
|
12198
|
+
return this._output;
|
|
12199
|
+
}
|
|
12160
12200
|
async start() {
|
|
12161
12201
|
var _a, _b, _c;
|
|
12162
12202
|
if (!this.tempConfigPath)
|
|
@@ -12167,7 +12207,7 @@ class Typechecker {
|
|
|
12167
12207
|
args.push("--watch");
|
|
12168
12208
|
if (typecheck.allowJs)
|
|
12169
12209
|
args.push("--allowJs", "--checkJs");
|
|
12170
|
-
|
|
12210
|
+
this._output = "";
|
|
12171
12211
|
const child = execa(typecheck.checker, args, {
|
|
12172
12212
|
cwd: root,
|
|
12173
12213
|
stdout: "pipe",
|
|
@@ -12178,29 +12218,29 @@ class Typechecker {
|
|
|
12178
12218
|
let rerunTriggered = false;
|
|
12179
12219
|
(_b = child.stdout) == null ? void 0 : _b.on("data", (chunk) => {
|
|
12180
12220
|
var _a2;
|
|
12181
|
-
|
|
12221
|
+
this._output += chunk;
|
|
12182
12222
|
if (!watch)
|
|
12183
12223
|
return;
|
|
12184
|
-
if (
|
|
12224
|
+
if (this._output.includes("File change detected") && !rerunTriggered) {
|
|
12185
12225
|
(_a2 = this._onWatcherRerun) == null ? void 0 : _a2.call(this);
|
|
12186
12226
|
this._result.sourceErrors = [];
|
|
12187
12227
|
this._result.files = [];
|
|
12188
12228
|
this._tests = null;
|
|
12189
12229
|
rerunTriggered = true;
|
|
12190
12230
|
}
|
|
12191
|
-
if (/Found \w+ errors*. Watching for/.test(
|
|
12231
|
+
if (/Found \w+ errors*. Watching for/.test(this._output)) {
|
|
12192
12232
|
rerunTriggered = false;
|
|
12193
|
-
this.prepareResults(
|
|
12233
|
+
this.prepareResults(this._output).then((result) => {
|
|
12194
12234
|
var _a3;
|
|
12195
12235
|
this._result = result;
|
|
12196
12236
|
(_a3 = this._onParseEnd) == null ? void 0 : _a3.call(this, result);
|
|
12197
12237
|
});
|
|
12198
|
-
|
|
12238
|
+
this._output = "";
|
|
12199
12239
|
}
|
|
12200
12240
|
});
|
|
12201
12241
|
if (!watch) {
|
|
12202
12242
|
await child;
|
|
12203
|
-
this._result = await this.prepareResults(
|
|
12243
|
+
this._result = await this.prepareResults(this._output);
|
|
12204
12244
|
await ((_c = this._onParseEnd) == null ? void 0 : _c.call(this, this._result));
|
|
12205
12245
|
}
|
|
12206
12246
|
}
|
|
@@ -12211,7 +12251,7 @@ class Typechecker {
|
|
|
12211
12251
|
return Object.values(this._tests || {}).map((i) => i.file);
|
|
12212
12252
|
}
|
|
12213
12253
|
getTestPacks() {
|
|
12214
|
-
return Object.values(this._tests || {}).map(({ file }) => getTasks(file)).flat().map((i) => [i.id, void 0]);
|
|
12254
|
+
return Object.values(this._tests || {}).map(({ file }) => getTasks(file)).flat().map((i) => [i.id, void 0, { typecheck: true }]);
|
|
12215
12255
|
}
|
|
12216
12256
|
}
|
|
12217
12257
|
|
|
@@ -12241,13 +12281,15 @@ async function printError(error, ctx, options = {}) {
|
|
|
12241
12281
|
if (type)
|
|
12242
12282
|
printErrorType(type, ctx);
|
|
12243
12283
|
printErrorMessage(e, ctx.logger);
|
|
12284
|
+
if (e.diff)
|
|
12285
|
+
displayDiff(e.diff, ctx.logger.console);
|
|
12244
12286
|
if (e.frame) {
|
|
12245
12287
|
ctx.logger.error(c.yellow(e.frame));
|
|
12246
12288
|
} else {
|
|
12247
12289
|
printStack(ctx, stacks, nearest, errorProperties, (s) => {
|
|
12248
12290
|
if (showCodeFrame && s === nearest && nearest) {
|
|
12249
12291
|
const sourceCode = readFileSync(nearest.file, "utf-8");
|
|
12250
|
-
ctx.logger.error(
|
|
12292
|
+
ctx.logger.error(generateCodeFrame(sourceCode, 4, s.line, s.column));
|
|
12251
12293
|
}
|
|
12252
12294
|
});
|
|
12253
12295
|
}
|
|
@@ -12269,8 +12311,6 @@ async function printError(error, ctx, options = {}) {
|
|
|
12269
12311
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
12270
12312
|
}
|
|
12271
12313
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
12272
|
-
if (e.diff)
|
|
12273
|
-
displayDiff(e.diff, ctx.logger.console);
|
|
12274
12314
|
}
|
|
12275
12315
|
function printErrorType(type, ctx) {
|
|
12276
12316
|
ctx.logger.error(`
|
|
@@ -12345,7 +12385,9 @@ function printModuleWarningForSourceCode(logger, path) {
|
|
|
12345
12385
|
));
|
|
12346
12386
|
}
|
|
12347
12387
|
function displayDiff(diff, console) {
|
|
12348
|
-
console.error(
|
|
12388
|
+
console.error(`
|
|
12389
|
+
${diff}
|
|
12390
|
+
`);
|
|
12349
12391
|
}
|
|
12350
12392
|
function printErrorMessage(error, logger) {
|
|
12351
12393
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
@@ -12354,9 +12396,9 @@ function printErrorMessage(error, logger) {
|
|
|
12354
12396
|
function printStack(ctx, stack, highlight, errorProperties, onStack) {
|
|
12355
12397
|
const logger = ctx.logger;
|
|
12356
12398
|
for (const frame of stack) {
|
|
12357
|
-
const color = frame === highlight ? c.
|
|
12399
|
+
const color = frame === highlight ? c.cyan : c.gray;
|
|
12358
12400
|
const path = relative(ctx.config.root, frame.file);
|
|
12359
|
-
logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${
|
|
12401
|
+
logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, `${path}:${c.dim(`${frame.line}:${frame.column}`)}`].filter(Boolean).join(" ")}`));
|
|
12360
12402
|
onStack == null ? void 0 : onStack(frame);
|
|
12361
12403
|
}
|
|
12362
12404
|
if (stack.length)
|
|
@@ -12709,7 +12751,7 @@ async function createBrowserServer(project, options) {
|
|
|
12709
12751
|
});
|
|
12710
12752
|
await server.listen();
|
|
12711
12753
|
await server.watcher.close();
|
|
12712
|
-
(await import('./chunk-api-setup.
|
|
12754
|
+
(await import('./chunk-api-setup.3854747a.js')).setup(project, server);
|
|
12713
12755
|
return server;
|
|
12714
12756
|
}
|
|
12715
12757
|
|
|
@@ -13260,10 +13302,17 @@ class WorkspaceProject {
|
|
|
13260
13302
|
this.ctx.state.collectFiles(checker.getTestFiles());
|
|
13261
13303
|
await this.report("onTaskUpdate", checker.getTestPacks());
|
|
13262
13304
|
await this.report("onCollected");
|
|
13305
|
+
const failedTests = hasFailed(files);
|
|
13306
|
+
const exitCode = !failedTests && checker.getExitCode();
|
|
13307
|
+
if (exitCode) {
|
|
13308
|
+
const error = new Error(checker.getOutput());
|
|
13309
|
+
error.stack = "";
|
|
13310
|
+
this.ctx.state.catchError(error, "Typecheck Error");
|
|
13311
|
+
}
|
|
13263
13312
|
if (!files.length) {
|
|
13264
13313
|
this.ctx.logger.printNoTestFound();
|
|
13265
13314
|
} else {
|
|
13266
|
-
if (
|
|
13315
|
+
if (failedTests)
|
|
13267
13316
|
process.exitCode = 1;
|
|
13268
13317
|
await this.report("onFinished", files);
|
|
13269
13318
|
}
|
|
@@ -13272,8 +13321,9 @@ class WorkspaceProject {
|
|
|
13272
13321
|
await this.ctx.logger.printSourceTypeErrors(sourceErrors);
|
|
13273
13322
|
}
|
|
13274
13323
|
if (!files.length) {
|
|
13275
|
-
const
|
|
13276
|
-
|
|
13324
|
+
const exitCode2 = this.config.passWithNoTests ? process.exitCode ?? 0 : 1;
|
|
13325
|
+
await this.close();
|
|
13326
|
+
process.exit(exitCode2);
|
|
13277
13327
|
}
|
|
13278
13328
|
if (this.config.watch) {
|
|
13279
13329
|
await this.report("onWatcherStart", files, [
|
|
@@ -13863,21 +13913,21 @@ class Vitest {
|
|
|
13863
13913
|
return files;
|
|
13864
13914
|
}
|
|
13865
13915
|
async reportCoverage(allTestsRun) {
|
|
13916
|
+
if (!this.config.coverage.reportOnFailure && this.state.getCountOfFailedTests() > 0)
|
|
13917
|
+
return;
|
|
13866
13918
|
if (this.coverageProvider) {
|
|
13867
13919
|
this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
|
|
13868
13920
|
await this.coverageProvider.reportCoverage({ allTestsRun });
|
|
13869
13921
|
}
|
|
13870
13922
|
}
|
|
13871
13923
|
async close() {
|
|
13872
|
-
var _a;
|
|
13873
13924
|
if (!this.closingPromise) {
|
|
13874
|
-
const closePromises = this.projects.map((w) => w.close());
|
|
13925
|
+
const closePromises = this.projects.map((w) => w.close().then(() => w.server = void 0));
|
|
13875
13926
|
if (this.coreWorkspace && !this.projects.includes(this.coreWorkspace))
|
|
13876
|
-
closePromises.push(this.server.close());
|
|
13877
|
-
this.
|
|
13878
|
-
(
|
|
13879
|
-
|
|
13880
|
-
].filter(Boolean)).then((results) => {
|
|
13927
|
+
closePromises.push(this.server.close().then(() => this.server = void 0));
|
|
13928
|
+
if (this.pool)
|
|
13929
|
+
closePromises.push(this.pool.close().then(() => this.pool = void 0));
|
|
13930
|
+
this.closingPromise = Promise.allSettled(closePromises).then((results) => {
|
|
13881
13931
|
results.filter((r) => r.status === "rejected").forEach((err) => {
|
|
13882
13932
|
this.logger.error("error during close", err.reason);
|
|
13883
13933
|
});
|
|
@@ -13893,6 +13943,16 @@ class Vitest {
|
|
|
13893
13943
|
this.report("onProcessTimeout").then(() => {
|
|
13894
13944
|
console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
|
|
13895
13945
|
this.state.getProcessTimeoutCauses().forEach((cause) => console.warn(cause));
|
|
13946
|
+
if (!this.pool) {
|
|
13947
|
+
const runningServers = [this.server, ...this.projects.map((p) => p.server)].filter(Boolean).length;
|
|
13948
|
+
if (runningServers === 1)
|
|
13949
|
+
console.warn("Tests closed successfully but something prevents Vite server from exiting");
|
|
13950
|
+
else if (runningServers > 1)
|
|
13951
|
+
console.warn(`Tests closed successfully but something prevents ${runningServers} Vite servers from exiting`);
|
|
13952
|
+
else
|
|
13953
|
+
console.warn("Tests closed successfully but something prevents the main process from exiting");
|
|
13954
|
+
console.warn('You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters');
|
|
13955
|
+
}
|
|
13896
13956
|
process.exit();
|
|
13897
13957
|
});
|
|
13898
13958
|
}, this.config.teardownTimeout).unref();
|
|
@@ -14077,7 +14137,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
14077
14137
|
try {
|
|
14078
14138
|
await ctx.setServer(options, server, userConfig);
|
|
14079
14139
|
if (options.api && options.watch)
|
|
14080
|
-
(await import('./chunk-api-setup.
|
|
14140
|
+
(await import('./chunk-api-setup.3854747a.js')).setup(ctx);
|
|
14081
14141
|
} catch (err) {
|
|
14082
14142
|
await ctx.logger.printError(err, true);
|
|
14083
14143
|
process.exit(1);
|
|
@@ -20408,8 +20468,13 @@ ${keys.map((i) => c.dim(" press ") + c.reset([i[0]].flat().map(c.bold).join(",
|
|
|
20408
20468
|
function registerConsoleShortcuts(ctx) {
|
|
20409
20469
|
let latestFilename = "";
|
|
20410
20470
|
async function _keypressHandler(str, key) {
|
|
20411
|
-
if (str === "" || str === "\x1B" || key && key.ctrl && key.name === "c")
|
|
20471
|
+
if (str === "" || str === "\x1B" || key && key.ctrl && key.name === "c") {
|
|
20472
|
+
if (!ctx.isCancelling) {
|
|
20473
|
+
await ctx.cancelCurrentRun("keyboard-input");
|
|
20474
|
+
await ctx.runningPromise;
|
|
20475
|
+
}
|
|
20412
20476
|
return ctx.exit(true);
|
|
20477
|
+
}
|
|
20413
20478
|
if (!isWindows && key && key.ctrl && key.name === "z") {
|
|
20414
20479
|
process.kill(process.ppid, "SIGTSTP");
|
|
20415
20480
|
process.kill(process.pid, "SIGTSTP");
|
|
@@ -20524,6 +20589,8 @@ async function startVitest(mode, cliFilters = [], options = {}, viteOverrides) {
|
|
|
20524
20589
|
}
|
|
20525
20590
|
if (process.stdin.isTTY && ctx.config.watch)
|
|
20526
20591
|
registerConsoleShortcuts(ctx);
|
|
20592
|
+
else
|
|
20593
|
+
process.on("SIGINT", () => ctx.cancelCurrentRun("keyboard-input"));
|
|
20527
20594
|
ctx.onServerRestart((reason) => {
|
|
20528
20595
|
ctx.report("onServerRestart", reason);
|
|
20529
20596
|
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.c6384282.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.51b8ecab.js')).registerApiGlobally();
|
|
14
14
|
}
|
|
15
15
|
function setupDefines(defines) {
|
|
16
16
|
for (const key in defines)
|
|
@@ -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.2",
|
|
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
|
-
"vite-node": "0.31.
|
|
153
|
-
"@vitest/expect": "0.31.
|
|
154
|
-
"@vitest/spy": "0.31.
|
|
155
|
-
"@vitest/utils": "0.31.
|
|
156
|
-
"@vitest/snapshot": "0.31.
|
|
151
|
+
"@vitest/runner": "0.31.2",
|
|
152
|
+
"vite-node": "0.31.2",
|
|
153
|
+
"@vitest/expect": "0.31.2",
|
|
154
|
+
"@vitest/spy": "0.31.2",
|
|
155
|
+
"@vitest/utils": "0.31.2",
|
|
156
|
+
"@vitest/snapshot": "0.31.2"
|
|
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",
|