vitest 0.30.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +370 -370
- package/dist/browser.d.ts +1 -1
- package/dist/child.js +2 -2
- package/dist/{chunk-api-setup.6662587e.js → chunk-api-setup.c93e5069.js} +6 -4
- package/dist/{chunk-install-pkg.6450b372.js → chunk-install-pkg.ee5cc9a8.js} +2 -2
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +6 -3
- package/dist/coverage.d.ts +1 -1
- package/dist/entry.js +1 -0
- package/dist/environments.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +1 -0
- package/dist/{types-f03c83c4.d.ts → types-e3c9754d.d.ts} +3 -3
- package/dist/{vendor-cli-api.c04eaa34.js → vendor-cli-api.70680cd5.js} +23 -23
- package/dist/{vendor-execute.8eaab47b.js → vendor-execute.70609f6f.js} +1 -1
- package/dist/{vendor-index.4f82d248.js → vendor-index.7dcbfa46.js} +7 -1
- package/dist/worker.js +3 -2
- package/package.json +7 -7
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig, _ as CoverageOptions, S as CoverageProvider, Y as CoverageProviderModule } from './types-
|
|
2
|
+
import { a as ResolvedConfig, _ as CoverageOptions, S as CoverageProvider, Y as CoverageProviderModule } from './types-e3c9754d.js';
|
|
3
3
|
import '@vitest/expect';
|
|
4
4
|
import '@vitest/snapshot';
|
|
5
5
|
import 'vite';
|
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.7dcbfa46.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.70609f6f.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,5 +1,6 @@
|
|
|
1
1
|
import { promises, existsSync } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { dirname } from 'pathe';
|
|
3
|
+
import { c as createBirpc, i as isPrimitive } from './vendor-index.7dcbfa46.js';
|
|
3
4
|
import require$$0$2 from 'stream';
|
|
4
5
|
import require$$0 from 'zlib';
|
|
5
6
|
import require$$0$1 from 'buffer';
|
|
@@ -13,7 +14,6 @@ import require$$7 from 'url';
|
|
|
13
14
|
import { A as API_PATH } from './vendor-constants.538d9b49.js';
|
|
14
15
|
import './vendor-index.fad2598b.js';
|
|
15
16
|
import { parseErrorStacktrace } from '@vitest/utils';
|
|
16
|
-
import 'pathe';
|
|
17
17
|
import 'std-env';
|
|
18
18
|
import '@vitest/runner/utils';
|
|
19
19
|
import './vendor-global.6795f91f.js';
|
|
@@ -4548,8 +4548,10 @@ function setup(vitestOrWorkspace, server) {
|
|
|
4548
4548
|
snapshotSaved(snapshot) {
|
|
4549
4549
|
ctx.snapshot.add(snapshot);
|
|
4550
4550
|
},
|
|
4551
|
-
writeFile(id, content) {
|
|
4552
|
-
|
|
4551
|
+
async writeFile(id, content, ensureDir) {
|
|
4552
|
+
if (ensureDir)
|
|
4553
|
+
await promises.mkdir(dirname(id), { recursive: true });
|
|
4554
|
+
return await promises.writeFile(id, content, "utf-8");
|
|
4553
4555
|
},
|
|
4554
4556
|
async rerun(files) {
|
|
4555
4557
|
await ctx.rerunFiles(files);
|
|
@@ -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.70680cd5.js';
|
|
7
7
|
import require$$0$2 from 'os';
|
|
8
8
|
import 'node:buffer';
|
|
9
9
|
import 'node:path';
|
|
@@ -36,7 +36,7 @@ import 'vite-node/client';
|
|
|
36
36
|
import '@vitest/snapshot/manager';
|
|
37
37
|
import './vendor-paths.84fc7a99.js';
|
|
38
38
|
import 'node:v8';
|
|
39
|
-
import './vendor-index.
|
|
39
|
+
import './vendor-index.7dcbfa46.js';
|
|
40
40
|
import 'node:worker_threads';
|
|
41
41
|
import 'tinypool';
|
|
42
42
|
import 'node:perf_hooks';
|
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.70680cd5.js';
|
|
5
5
|
import './vendor-constants.538d9b49.js';
|
|
6
6
|
import './vendor-coverage.a585b712.js';
|
|
7
7
|
import './vendor-index.75f2b63d.js';
|
|
@@ -30,7 +30,7 @@ import '@vitest/snapshot/manager';
|
|
|
30
30
|
import './vendor-paths.84fc7a99.js';
|
|
31
31
|
import 'node:v8';
|
|
32
32
|
import 'node:child_process';
|
|
33
|
-
import './vendor-index.
|
|
33
|
+
import './vendor-index.7dcbfa46.js';
|
|
34
34
|
import 'node:worker_threads';
|
|
35
35
|
import 'node:os';
|
|
36
36
|
import 'tinypool';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, mergeConfig } from 'vite';
|
|
3
|
-
import { $ as ResolvedCoverageOptions, q as UserConfig$1, a2 as CoverageC8Options, a3 as CustomProviderOptions, a1 as CoverageIstanbulOptions, af as HtmlOptions, ag as FileOptions, ah as CloverOptions, ai as CoberturaOptions, aj as HtmlSpaOptions, ak as LcovOptions, al as LcovOnlyOptions, am as TeamcityOptions, an as TextOptions, ao as ProjectOptions, F as FakeTimerInstallOpts, P as ProjectConfig } from './types-
|
|
3
|
+
import { $ as ResolvedCoverageOptions, q as UserConfig$1, a2 as CoverageC8Options, a3 as CustomProviderOptions, a1 as CoverageIstanbulOptions, af as HtmlOptions, ag as FileOptions, ah as CloverOptions, ai as CoberturaOptions, aj as HtmlSpaOptions, ak as LcovOptions, al as LcovOnlyOptions, am as TeamcityOptions, an as TextOptions, ao as ProjectOptions, F as FakeTimerInstallOpts, P as ProjectConfig } from './types-e3c9754d.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/snapshot';
|
|
6
6
|
import '@vitest/runner';
|
|
@@ -76,7 +76,6 @@ interface UserConfig extends UserConfig$2 {
|
|
|
76
76
|
test?: UserConfig$2['test'];
|
|
77
77
|
}
|
|
78
78
|
interface UserWorkspaceConfig extends UserConfig$2 {
|
|
79
|
-
extends?: string;
|
|
80
79
|
test?: ProjectConfig;
|
|
81
80
|
}
|
|
82
81
|
|
|
@@ -86,6 +85,10 @@ type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<Use
|
|
|
86
85
|
type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
87
86
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
88
87
|
declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
|
|
89
|
-
declare function defineWorkspace(config: (string | UserProjectConfigExport
|
|
88
|
+
declare function defineWorkspace(config: (string | (UserProjectConfigExport & {
|
|
89
|
+
extends?: string;
|
|
90
|
+
}))[]): (string | (UserProjectConfigExport & {
|
|
91
|
+
extends?: string | undefined;
|
|
92
|
+
}))[];
|
|
90
93
|
|
|
91
94
|
export { UserConfig, UserConfigExport, UserConfigFn, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, configDefaults, coverageConfigDefaults, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace };
|
package/dist/coverage.d.ts
CHANGED
package/dist/entry.js
CHANGED
package/dist/environments.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { SequenceHooks, SequenceSetupFiles, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
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-
|
|
3
|
-
export { n as ApiConfig, D as ArgumentsType, z as Arrayable, y as Awaitable, a0 as BaseCoverageOptions, a7 as BenchFunction, a5 as Benchmark, a6 as BenchmarkResult, a4 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, H as Constructable, j as Context, u as ContextRPC, t as ContextTestEnvironment, a2 as CoverageC8Options, a1 as CoverageIstanbulOptions, _ as CoverageOptions, S as CoverageProvider, Y as CoverageProviderModule, Z as CoverageReporter, a3 as CustomProviderOptions, O as Environment, E as EnvironmentOptions, L as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, K as ModuleCache, G as MutableArray, N as Nullable, Q as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, X as ReportContext, w as ResolveIdFunction, $ as ResolvedCoverageOptions, i as RootAndTarget, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, v as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, x as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-
|
|
2
|
+
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-e3c9754d.js';
|
|
3
|
+
export { n as ApiConfig, D as ArgumentsType, z as Arrayable, y as Awaitable, a0 as BaseCoverageOptions, a7 as BenchFunction, a5 as Benchmark, a6 as BenchmarkResult, a4 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, H as Constructable, j as Context, u as ContextRPC, t as ContextTestEnvironment, a2 as CoverageC8Options, a1 as CoverageIstanbulOptions, _ as CoverageOptions, S as CoverageProvider, Y as CoverageProviderModule, Z as CoverageReporter, a3 as CustomProviderOptions, O as Environment, E as EnvironmentOptions, L as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, K as ModuleCache, G as MutableArray, N as Nullable, Q as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, X as ReportContext, w as ResolveIdFunction, $ as ResolvedCoverageOptions, i as RootAndTarget, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, v as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, x as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-e3c9754d.js';
|
|
4
4
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
|
|
5
5
|
export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
|
|
6
6
|
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
@@ -323,7 +323,7 @@ interface VitestUtils {
|
|
|
323
323
|
declare const vitest: VitestUtils;
|
|
324
324
|
declare const vi: VitestUtils;
|
|
325
325
|
|
|
326
|
-
declare function getRunningMode(): "
|
|
326
|
+
declare function getRunningMode(): "run" | "watch";
|
|
327
327
|
declare function isWatchMode(): boolean;
|
|
328
328
|
|
|
329
329
|
interface TransformResultWithSource extends TransformResult {
|
|
@@ -343,7 +343,7 @@ interface WebSocketHandlers {
|
|
|
343
343
|
getModuleGraph(id: string): Promise<ModuleGraphData>;
|
|
344
344
|
getTransformResult(id: string): Promise<TransformResultWithSource | undefined>;
|
|
345
345
|
readFile(id: string): Promise<string | null>;
|
|
346
|
-
writeFile(id: string, content: string): Promise<void>;
|
|
346
|
+
writeFile(id: string, content: string, ensureDir?: boolean): Promise<void>;
|
|
347
347
|
removeFile(id: string): Promise<void>;
|
|
348
348
|
createDirectory(id: string): Promise<string | undefined>;
|
|
349
349
|
snapshotSaved(snapshot: SnapshotResult): void;
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as VitestRunMode, q as UserConfig, v as Vitest, a8 as MockFactory, a9 as MockMap, aa as TestSequencer, ab as WorkspaceSpec } from './types-
|
|
2
|
-
export { ae as TestSequencerConstructor, ac as VitestWorkspace, ad as startVitest } from './types-
|
|
1
|
+
import { o as VitestRunMode, q as UserConfig, v as Vitest, a8 as MockFactory, a9 as MockMap, aa as TestSequencer, ab as WorkspaceSpec } from './types-e3c9754d.js';
|
|
2
|
+
export { ae as TestSequencerConstructor, ac as VitestWorkspace, ad as startVitest } from './types-e3c9754d.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';
|
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.70680cd5.js';
|
|
2
|
+
export { V as VitestExecutor } from './vendor-execute.70609f6f.js';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import './vendor-constants.538d9b49.js';
|
|
5
5
|
import './vendor-coverage.a585b712.js';
|
|
@@ -30,7 +30,7 @@ import '@vitest/snapshot/manager';
|
|
|
30
30
|
import './vendor-paths.84fc7a99.js';
|
|
31
31
|
import 'node:v8';
|
|
32
32
|
import 'node:child_process';
|
|
33
|
-
import './vendor-index.
|
|
33
|
+
import './vendor-index.7dcbfa46.js';
|
|
34
34
|
import 'node:worker_threads';
|
|
35
35
|
import 'node:os';
|
|
36
36
|
import 'tinypool';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, TestContext } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-e3c9754d.js';
|
|
3
3
|
import '@vitest/expect';
|
|
4
4
|
import '@vitest/snapshot';
|
|
5
5
|
import 'vite';
|
package/dist/runners.js
CHANGED
|
@@ -5,6 +5,7 @@ import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
|
5
5
|
import { g as getFullName } from './vendor-tasks.042d6084.js';
|
|
6
6
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
7
7
|
import { getNames } from '@vitest/runner/utils';
|
|
8
|
+
import { performance } from 'node:perf_hooks';
|
|
8
9
|
import { updateTask } from '@vitest/runner';
|
|
9
10
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
10
11
|
import 'chai';
|
|
@@ -250,7 +250,7 @@ declare class VitestServer extends ViteNodeServer {
|
|
|
250
250
|
protected processTransformResult(id: string, result: TransformResult$1): Promise<TransformResult$1>;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
interface
|
|
253
|
+
interface InitializeServerOptions {
|
|
254
254
|
server?: VitestServer;
|
|
255
255
|
runner?: ViteNodeRunner;
|
|
256
256
|
}
|
|
@@ -275,7 +275,7 @@ declare class WorkspaceProject {
|
|
|
275
275
|
globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
|
|
276
276
|
filterFiles(testFiles: string[], filters?: string[]): string[];
|
|
277
277
|
initBrowserServer(options: UserConfig): Promise<void>;
|
|
278
|
-
setServer(options: UserConfig, server: ViteDevServer, params?:
|
|
278
|
+
setServer(options: UserConfig, server: ViteDevServer, params?: InitializeServerOptions): Promise<void>;
|
|
279
279
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
280
280
|
typecheck(filters?: string[]): Promise<void>;
|
|
281
281
|
isBrowserEnabled(): boolean | 0;
|
|
@@ -2061,7 +2061,7 @@ declare module '@vitest/runner' {
|
|
|
2061
2061
|
}
|
|
2062
2062
|
declare global {
|
|
2063
2063
|
namespace jest {
|
|
2064
|
-
interface Matchers<
|
|
2064
|
+
interface Matchers<R, T = {}> {
|
|
2065
2065
|
}
|
|
2066
2066
|
}
|
|
2067
2067
|
namespace Vi {
|
|
@@ -24,7 +24,7 @@ import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
|
24
24
|
import { d as distDir, r as rootDir } from './vendor-paths.84fc7a99.js';
|
|
25
25
|
import v8 from 'node:v8';
|
|
26
26
|
import { fork } from 'node:child_process';
|
|
27
|
-
import { g as groupBy, a as getEnvironmentTransformMode, c as createBirpc, s as slash$1, t as toArray, i as isPrimitive, d as deepMerge, n as noop$1, b as stdout } from './vendor-index.
|
|
27
|
+
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.7dcbfa46.js';
|
|
28
28
|
import { MessageChannel } from 'node:worker_threads';
|
|
29
29
|
import { cpus, hostname } from 'node:os';
|
|
30
30
|
import Tinypool from 'tinypool';
|
|
@@ -61,7 +61,7 @@ function _mergeNamespaces(n, m) {
|
|
|
61
61
|
return Object.freeze(n);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
var version$1 = "0.30.
|
|
64
|
+
var version$1 = "0.30.1";
|
|
65
65
|
|
|
66
66
|
async function ensurePackageInstalled(dependency, root) {
|
|
67
67
|
if (isPackageExists(dependency, { paths: [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.ee5cc9a8.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
|
`));
|
|
@@ -7254,7 +7254,7 @@ function createThreadsPool(ctx, { execArgv, env }) {
|
|
|
7254
7254
|
const results = await Promise.allSettled(promises.map(({ file, environment, project }) => runFiles(project, getConfig(project), [file], environment, invalidates)));
|
|
7255
7255
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
7256
7256
|
if (errors.length > 0)
|
|
7257
|
-
throw new
|
|
7257
|
+
throw new AggregateErrorPonyfill(errors, "Errors occurred while running tests. For more information, see serialized error.");
|
|
7258
7258
|
}
|
|
7259
7259
|
if (singleThreads.length) {
|
|
7260
7260
|
const filesByEnv = await groupFilesByEnv(singleThreads);
|
|
@@ -11034,7 +11034,7 @@ createLogUpdate(process$1.stdout);
|
|
|
11034
11034
|
|
|
11035
11035
|
createLogUpdate(process$1.stderr);
|
|
11036
11036
|
|
|
11037
|
-
var version = "0.30.
|
|
11037
|
+
var version = "0.30.1";
|
|
11038
11038
|
|
|
11039
11039
|
function L(n){return /^\\\\\?\\/.test(n)?n:n.replace(/\\/g,"/")}function S(n,s){for(;;){const t=p.posix.join(n,s);if(require$$0$3.existsSync(t))return t;const e=p.dirname(n);if(e===n)return;n=e;}}const W=/^\.{1,2}(\/.*)?$/,M=n=>L(W.test(n)?n:`./${n}`);function un(n,s=!1){const t=n.length;let e=0,i="",l=0,c=16,a=0,g=0,v=0,k=0,r=0;function F(o,f){let u=0,j=0;for(;u<o||!f;){let T=n.charCodeAt(e);if(T>=48&&T<=57)j=j*16+T-48;else if(T>=65&&T<=70)j=j*16+T-65+10;else if(T>=97&&T<=102)j=j*16+T-97+10;else break;e++,u++;}return u<o&&(j=-1),j}function U(o){e=o,i="",l=0,c=16,r=0;}function A(){let o=e;if(n.charCodeAt(e)===48)e++;else for(e++;e<n.length&&_(n.charCodeAt(e));)e++;if(e<n.length&&n.charCodeAt(e)===46)if(e++,e<n.length&&_(n.charCodeAt(e)))for(e++;e<n.length&&_(n.charCodeAt(e));)e++;else return r=3,n.substring(o,e);let f=e;if(e<n.length&&(n.charCodeAt(e)===69||n.charCodeAt(e)===101))if(e++,(e<n.length&&n.charCodeAt(e)===43||n.charCodeAt(e)===45)&&e++,e<n.length&&_(n.charCodeAt(e))){for(e++;e<n.length&&_(n.charCodeAt(e));)e++;f=e;}else r=3;return n.substring(o,f)}function b(){let o="",f=e;for(;;){if(e>=t){o+=n.substring(f,e),r=2;break}const u=n.charCodeAt(e);if(u===34){o+=n.substring(f,e),e++;break}if(u===92){if(o+=n.substring(f,e),e++,e>=t){r=2;break}switch(n.charCodeAt(e++)){case 34:o+='"';break;case 92:o+="\\";break;case 47:o+="/";break;case 98:o+="\b";break;case 102:o+="\f";break;case 110:o+=`
|
|
11040
11040
|
`;break;case 114:o+="\r";break;case 116:o+=" ";break;case 117:const T=F(4,!0);T>=0?o+=String.fromCharCode(T):r=4;break;default:r=5;}f=e;continue}if(u>=0&&u<=31)if(N(u)){o+=n.substring(f,e),r=2;break}else r=6;e++;}return o}function O(){if(i="",r=0,l=e,g=a,k=v,e>=t)return l=t,c=17;let o=n.charCodeAt(e);if(R(o)){do e++,i+=String.fromCharCode(o),o=n.charCodeAt(e);while(R(o));return c=15}if(N(o))return e++,i+=String.fromCharCode(o),o===13&&n.charCodeAt(e)===10&&(e++,i+=`
|
|
@@ -11142,7 +11142,7 @@ function createIndexMap(source) {
|
|
|
11142
11142
|
}
|
|
11143
11143
|
|
|
11144
11144
|
async function collectTests(ctx, filepath) {
|
|
11145
|
-
const request = await ctx.vitenode.transformRequest(filepath);
|
|
11145
|
+
const request = await ctx.vitenode.transformRequest(filepath, filepath);
|
|
11146
11146
|
if (!request)
|
|
11147
11147
|
return null;
|
|
11148
11148
|
const ast = parse$4(request.code, {
|
|
@@ -11361,7 +11361,7 @@ class Typechecker {
|
|
|
11361
11361
|
const processedPos = (mapConsumer == null ? void 0 : mapConsumer.generatedPositionFor({
|
|
11362
11362
|
line: originalError.line,
|
|
11363
11363
|
column: originalError.column,
|
|
11364
|
-
source: path
|
|
11364
|
+
source: basename(path)
|
|
11365
11365
|
})) || originalError;
|
|
11366
11366
|
const line = processedPos.line ?? originalError.line;
|
|
11367
11367
|
const column = processedPos.column ?? originalError.column;
|
|
@@ -11846,7 +11846,7 @@ async function createBrowserServer(project, options) {
|
|
|
11846
11846
|
});
|
|
11847
11847
|
await server.listen();
|
|
11848
11848
|
await server.watcher.close();
|
|
11849
|
-
(await import('./chunk-api-setup.
|
|
11849
|
+
(await import('./chunk-api-setup.c93e5069.js')).setup(project, server);
|
|
11850
11850
|
return server;
|
|
11851
11851
|
}
|
|
11852
11852
|
|
|
@@ -13402,10 +13402,10 @@ class VitestServer extends ViteNodeServer {
|
|
|
13402
13402
|
}
|
|
13403
13403
|
}
|
|
13404
13404
|
|
|
13405
|
-
async function initializeProject(workspacePath, ctx, options
|
|
13405
|
+
async function initializeProject(workspacePath, ctx, options) {
|
|
13406
13406
|
var _a, _b, _c;
|
|
13407
13407
|
const project = new WorkspaceProject(workspacePath, ctx);
|
|
13408
|
-
const configFile = options.extends ? resolve$2(
|
|
13408
|
+
const configFile = options.extends ? resolve$2(dirname(options.workspaceConfigPath), options.extends) : typeof workspacePath === "number" || workspacePath.endsWith("/") ? false : workspacePath;
|
|
13409
13409
|
const root = options.root || (typeof workspacePath === "number" ? void 0 : dirname(workspacePath));
|
|
13410
13410
|
const config = {
|
|
13411
13411
|
...options,
|
|
@@ -13711,22 +13711,22 @@ class Vitest {
|
|
|
13711
13711
|
return this.coreWorkspace;
|
|
13712
13712
|
}
|
|
13713
13713
|
async resolveWorkspace(options, cliOptions) {
|
|
13714
|
-
const configDir = dirname(this.server.config.configFile
|
|
13714
|
+
const configDir = this.server.config.configFile ? dirname(this.server.config.configFile) : this.config.root;
|
|
13715
13715
|
const rootFiles = await promises.readdir(configDir);
|
|
13716
13716
|
const workspaceConfigName = workspacesFiles.find((configFile) => {
|
|
13717
13717
|
return rootFiles.includes(configFile);
|
|
13718
13718
|
});
|
|
13719
13719
|
if (!workspaceConfigName)
|
|
13720
13720
|
return [await this.createCoreWorkspace(options)];
|
|
13721
|
-
const
|
|
13722
|
-
const
|
|
13723
|
-
if (!
|
|
13724
|
-
throw new Error(`Workspace config file ${
|
|
13725
|
-
const
|
|
13721
|
+
const workspaceConfigPath = join(configDir, workspaceConfigName);
|
|
13722
|
+
const workspaceModule = await this.runner.executeFile(workspaceConfigPath);
|
|
13723
|
+
if (!workspaceModule.default || !Array.isArray(workspaceModule.default))
|
|
13724
|
+
throw new Error(`Workspace config file ${workspaceConfigPath} must export a default array of project paths.`);
|
|
13725
|
+
const workspaceGlobMatches = [];
|
|
13726
13726
|
const projectsOptions = [];
|
|
13727
|
-
for (const project of
|
|
13727
|
+
for (const project of workspaceModule.default) {
|
|
13728
13728
|
if (typeof project === "string")
|
|
13729
|
-
|
|
13729
|
+
workspaceGlobMatches.push(project.replace("<rootDir>", this.config.root));
|
|
13730
13730
|
else
|
|
13731
13731
|
projectsOptions.push(project);
|
|
13732
13732
|
}
|
|
@@ -13738,7 +13738,7 @@ class Vitest {
|
|
|
13738
13738
|
cwd: this.config.root,
|
|
13739
13739
|
ignore: ["**/node_modules/**"]
|
|
13740
13740
|
};
|
|
13741
|
-
const workspacesFs = await out(
|
|
13741
|
+
const workspacesFs = await out(workspaceGlobMatches, globOptions);
|
|
13742
13742
|
const resolvedWorkspacesPaths = await Promise.all(workspacesFs.filter((file) => {
|
|
13743
13743
|
if (file.endsWith("/")) {
|
|
13744
13744
|
const hasWorkspaceWithConfig = workspacesFs.some((file2) => {
|
|
@@ -13752,7 +13752,7 @@ class Vitest {
|
|
|
13752
13752
|
if (filepath.endsWith("/")) {
|
|
13753
13753
|
const filesInside = await promises.readdir(filepath);
|
|
13754
13754
|
const configFile = configFiles.find((config) => filesInside.includes(config));
|
|
13755
|
-
return configFile
|
|
13755
|
+
return configFile ? join(filepath, configFile) : filepath;
|
|
13756
13756
|
}
|
|
13757
13757
|
return filepath;
|
|
13758
13758
|
}));
|
|
@@ -13775,10 +13775,10 @@ class Vitest {
|
|
|
13775
13775
|
const projects = resolvedWorkspacesPaths.map(async (workspacePath) => {
|
|
13776
13776
|
if (this.server.config.configFile === workspacePath)
|
|
13777
13777
|
return this.createCoreWorkspace(options);
|
|
13778
|
-
return initializeProject(workspacePath, this, { test: cliOverrides });
|
|
13778
|
+
return initializeProject(workspacePath, this, { workspaceConfigPath, test: cliOverrides });
|
|
13779
13779
|
});
|
|
13780
13780
|
projectsOptions.forEach((options2, index) => {
|
|
13781
|
-
projects.push(initializeProject(index, this, mergeConfig(options2, { test: cliOverrides })));
|
|
13781
|
+
projects.push(initializeProject(index, this, mergeConfig(options2, { workspaceConfigPath, test: cliOverrides })));
|
|
13782
13782
|
});
|
|
13783
13783
|
if (!projects.length)
|
|
13784
13784
|
return [await this.createCoreWorkspace(options)];
|
|
@@ -14333,7 +14333,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
14333
14333
|
try {
|
|
14334
14334
|
await ctx.setServer(options, server, userConfig);
|
|
14335
14335
|
if (options.api && options.watch)
|
|
14336
|
-
(await import('./chunk-api-setup.
|
|
14336
|
+
(await import('./chunk-api-setup.c93e5069.js')).setup(ctx);
|
|
14337
14337
|
} catch (err) {
|
|
14338
14338
|
await ctx.logger.printError(err, true);
|
|
14339
14339
|
process.exit(1);
|
|
@@ -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.7dcbfa46.js';
|
|
11
11
|
import { spyOn } from '@vitest/spy';
|
|
12
12
|
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
13
13
|
|
|
@@ -87,6 +87,12 @@ function getEnvironmentTransformMode(config, environment) {
|
|
|
87
87
|
return void 0;
|
|
88
88
|
return environment === "happy-dom" || environment === "jsdom" ? "web" : "ssr";
|
|
89
89
|
}
|
|
90
|
+
class AggregateErrorPonyfill extends Error {
|
|
91
|
+
constructor(errors, message = "") {
|
|
92
|
+
super(message);
|
|
93
|
+
this.errors = [...errors];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
90
96
|
|
|
91
97
|
const DEFAULT_TIMEOUT = 6e4;
|
|
92
98
|
function createBirpc(functions, options) {
|
|
@@ -158,4 +164,4 @@ function nanoid(size = 21) {
|
|
|
158
164
|
return id;
|
|
159
165
|
}
|
|
160
166
|
|
|
161
|
-
export { getEnvironmentTransformMode as a, stdout as b, createBirpc as c, deepMerge as d, getAllMockableProperties as e, groupBy as g, isPrimitive as i, noop as n, slash as s, toArray as t };
|
|
167
|
+
export { AggregateErrorPonyfill as A, getEnvironmentTransformMode as a, stdout as b, createBirpc as c, deepMerge as d, getAllMockableProperties as e, groupBy as g, isPrimitive as i, noop as n, slash as s, toArray as t };
|
package/dist/worker.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
|
+
import { c as createBirpc } from './vendor-index.7dcbfa46.js';
|
|
2
3
|
import { workerId } from 'tinypool';
|
|
3
4
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
4
|
-
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.70609f6f.js';
|
|
5
6
|
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
|
|
6
7
|
import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
|
|
7
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.30.
|
|
4
|
+
"version": "0.30.1",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -149,12 +149,12 @@
|
|
|
149
149
|
"tinypool": "^0.4.0",
|
|
150
150
|
"vite": "^3.0.0 || ^4.0.0",
|
|
151
151
|
"why-is-node-running": "^2.2.2",
|
|
152
|
-
"
|
|
153
|
-
"@vitest/
|
|
154
|
-
"@vitest/
|
|
155
|
-
"@vitest/
|
|
156
|
-
"@vitest/utils": "0.30.
|
|
157
|
-
"
|
|
152
|
+
"@vitest/snapshot": "0.30.1",
|
|
153
|
+
"@vitest/expect": "0.30.1",
|
|
154
|
+
"@vitest/runner": "0.30.1",
|
|
155
|
+
"@vitest/spy": "0.30.1",
|
|
156
|
+
"@vitest/utils": "0.30.1",
|
|
157
|
+
"vite-node": "0.30.1"
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
160
|
"@ampproject/remapping": "^2.2.0",
|