vitest 0.32.4 → 0.34.0
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 +0 -83
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +4 -8
- package/dist/child.js +43 -29
- package/dist/{chunk-api-setup.8f785c4a.js → chunk-api-setup.644415c3.js} +13 -7
- package/dist/{chunk-install-pkg.3fc886f2.js → chunk-install-pkg.dd70081b.js} +14 -13
- package/dist/{chunk-integrations-globals.0093e2ed.js → chunk-integrations-globals.877c84db.js} +7 -6
- package/dist/chunk-runtime-console.ea222ffb.js +108 -0
- package/dist/cli.js +15 -16
- package/dist/config.cjs +6 -5
- package/dist/config.d.ts +15 -19
- package/dist/config.js +6 -5
- package/dist/coverage.d.ts +3 -2
- package/dist/entry-vm.js +60 -0
- package/dist/entry.js +34 -213
- package/dist/environments.d.ts +3 -2
- package/dist/environments.js +4 -2
- package/dist/execute.js +15 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.js +8 -7
- package/dist/loader.js +6 -4
- package/dist/node.d.ts +6 -53
- package/dist/node.js +17 -20
- package/dist/runners.d.ts +3 -2
- package/dist/runners.js +6 -5
- package/dist/{types-198fd1d9.d.ts → types-3c7dbfa5.d.ts} +139 -121
- package/dist/vendor-base.9c08bbd0.js +96 -0
- package/dist/{vendor-coverage.2e41927a.js → vendor-coverage.78040316.js} +1 -2
- package/dist/vendor-date.6e993429.js +50 -0
- package/dist/{vendor-environments.75f2b63d.js → vendor-environments.443ecd82.js} +202 -3
- package/dist/vendor-execute.9ab1c1a7.js +978 -0
- package/dist/{vendor-global.6795f91f.js → vendor-global.97e4527c.js} +2 -1
- package/dist/{vendor-index.23ac4e13.js → vendor-index.087d1af7.js} +2 -20
- package/dist/vendor-index.9378c9a4.js +89 -0
- package/dist/vendor-index.b271ebe4.js +92 -0
- package/dist/{vendor-index.2af39fbb.js → vendor-index.eff408fd.js} +2 -3
- package/dist/{vendor-cli-api.cb31e1db.js → vendor-node.00226ab1.js} +1671 -1882
- package/dist/{vendor-rpc.ad5b08c7.js → vendor-rpc.cbd8e972.js} +7 -4
- package/dist/{vendor-run-once.1fa85ba7.js → vendor-run-once.3e5ef7d7.js} +1 -2
- package/dist/vendor-source-map.e6c1997b.js +747 -0
- package/dist/{vendor-vi.dd6706cb.js → vendor-vi.271667ef.js} +26 -59
- package/dist/vm.js +114 -0
- package/dist/worker.js +39 -27
- package/execute.d.ts +1 -0
- package/package.json +14 -11
- package/suppress-warnings.cjs +2 -0
- package/dist/vendor-execute.3576af13.js +0 -421
- package/dist/vendor-index.cc463d9e.js +0 -189
- package/dist/vendor-tasks.f9d75aed.js +0 -14
package/dist/loader.js
CHANGED
|
@@ -10,8 +10,8 @@ import 'node:path';
|
|
|
10
10
|
import v8 from 'node:v8';
|
|
11
11
|
import { format, inspect } from 'node:util';
|
|
12
12
|
import { normalizeModuleId } from 'vite-node/utils';
|
|
13
|
-
import './vendor-index.
|
|
14
|
-
import { g as getWorkerState } from './vendor-global.
|
|
13
|
+
import './vendor-index.087d1af7.js';
|
|
14
|
+
import { g as getWorkerState } from './vendor-global.97e4527c.js';
|
|
15
15
|
import 'std-env';
|
|
16
16
|
import '@vitest/runner/utils';
|
|
17
17
|
import '@vitest/utils';
|
|
@@ -568,14 +568,16 @@ function detectESM(url, source) {
|
|
|
568
568
|
return hasESMSyntax(source) && !hasCJSSyntax(source);
|
|
569
569
|
}
|
|
570
570
|
const resolve = async (url, context, next) => {
|
|
571
|
+
var _a;
|
|
571
572
|
const { parentURL } = context;
|
|
572
573
|
const state = getWorkerState();
|
|
573
574
|
const resolver = state == null ? void 0 : state.rpc.resolveId;
|
|
574
|
-
|
|
575
|
+
const environment = state == null ? void 0 : state.ctx.environment;
|
|
576
|
+
if (!parentURL || isNodeBuiltin(url) || !resolver || !environment)
|
|
575
577
|
return next(url, context, next);
|
|
576
578
|
const id = normalizeModuleId(url);
|
|
577
579
|
const importer = normalizeModuleId(parentURL);
|
|
578
|
-
const resolved = await resolver(id, importer,
|
|
580
|
+
const resolved = await resolver(id, importer, environment.transformMode ?? ((_a = environment.environment) == null ? void 0 : _a.transformMode) ?? "ssr");
|
|
579
581
|
let result;
|
|
580
582
|
let filepath;
|
|
581
583
|
if (resolved) {
|
package/dist/node.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { V as VitestRunMode, U as UserConfig,
|
|
2
|
-
export {
|
|
1
|
+
import { V as VitestRunMode, U as UserConfig, e as Vitest, T as TestSequencer, W as WorkspaceSpec } from './types-3c7dbfa5.js';
|
|
2
|
+
export { g as TestSequencerConstructor, f as VitestWorkspace, s as startVitest } from './types-3c7dbfa5.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
|
-
import { ViteNodeRunner } from 'vite-node/client';
|
|
5
|
-
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
6
4
|
import '@vitest/snapshot';
|
|
7
5
|
import '@vitest/expect';
|
|
8
6
|
import '@vitest/runner';
|
|
7
|
+
import 'vite-node';
|
|
9
8
|
import '@vitest/runner/utils';
|
|
10
9
|
import '@vitest/utils';
|
|
11
10
|
import 'tinybench';
|
|
11
|
+
import 'vite-node/client';
|
|
12
12
|
import '@vitest/snapshot/manager';
|
|
13
13
|
import 'vite-node/server';
|
|
14
14
|
import 'node:worker_threads';
|
|
15
|
+
import 'rollup';
|
|
15
16
|
import 'node:fs';
|
|
16
17
|
import 'chai';
|
|
17
18
|
|
|
@@ -21,54 +22,6 @@ declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugi
|
|
|
21
22
|
|
|
22
23
|
declare function registerConsoleShortcuts(ctx: Vitest): () => void;
|
|
23
24
|
|
|
24
|
-
type Key = string | symbol;
|
|
25
|
-
declare class VitestMocker {
|
|
26
|
-
executor: VitestExecutor;
|
|
27
|
-
static pendingIds: PendingSuiteMock[];
|
|
28
|
-
private resolveCache;
|
|
29
|
-
constructor(executor: VitestExecutor);
|
|
30
|
-
private get root();
|
|
31
|
-
private get mockMap();
|
|
32
|
-
private get moduleCache();
|
|
33
|
-
private get moduleDirectories();
|
|
34
|
-
private deleteCachedItem;
|
|
35
|
-
private isAModuleDirectory;
|
|
36
|
-
getSuiteFilepath(): string;
|
|
37
|
-
getMocks(): {
|
|
38
|
-
[x: string]: string | MockFactory | null;
|
|
39
|
-
};
|
|
40
|
-
private resolvePath;
|
|
41
|
-
resolveMocks(): Promise<void>;
|
|
42
|
-
private callFunctionMock;
|
|
43
|
-
getMockPath(dep: string): string;
|
|
44
|
-
getDependencyMock(id: string): string | MockFactory | null;
|
|
45
|
-
normalizePath(path: string): string;
|
|
46
|
-
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
47
|
-
mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
|
|
48
|
-
unmockPath(path: string): void;
|
|
49
|
-
mockPath(originalId: string, path: string, external: string | null, factory?: MockFactory): void;
|
|
50
|
-
importActual<T>(rawId: string, importee: string): Promise<T>;
|
|
51
|
-
importMock(rawId: string, importee: string): Promise<any>;
|
|
52
|
-
requestWithMock(url: string, callstack: string[]): Promise<any>;
|
|
53
|
-
queueMock(id: string, importer: string, factory?: MockFactory): void;
|
|
54
|
-
queueUnmock(id: string, importer: string): void;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
interface ExecuteOptions extends ViteNodeRunnerOptions {
|
|
58
|
-
mockMap: MockMap;
|
|
59
|
-
moduleDirectories?: string[];
|
|
60
|
-
}
|
|
61
|
-
declare class VitestExecutor extends ViteNodeRunner {
|
|
62
|
-
options: ExecuteOptions;
|
|
63
|
-
mocker: VitestMocker;
|
|
64
|
-
constructor(options: ExecuteOptions);
|
|
65
|
-
shouldResolveId(id: string, _importee?: string | undefined): boolean;
|
|
66
|
-
originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
|
|
67
|
-
resolveUrl(id: string, importer?: string): Promise<[string, string]>;
|
|
68
|
-
dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
|
|
69
|
-
prepareContext(context: Record<string, any>): Record<string, any>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
25
|
declare class BaseSequencer implements TestSequencer {
|
|
73
26
|
protected ctx: Vitest;
|
|
74
27
|
constructor(ctx: Vitest);
|
|
@@ -76,4 +29,4 @@ declare class BaseSequencer implements TestSequencer {
|
|
|
76
29
|
sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
|
|
77
30
|
}
|
|
78
31
|
|
|
79
|
-
export { BaseSequencer,
|
|
32
|
+
export { BaseSequencer, TestSequencer, Vitest, VitestPlugin, WorkspaceSpec, createVitest, registerConsoleShortcuts };
|
package/dist/node.js
CHANGED
|
@@ -1,42 +1,40 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-
|
|
2
|
-
export { V as VitestExecutor } from './vendor-execute.3576af13.js';
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.00226ab1.js';
|
|
3
2
|
import 'pathe';
|
|
4
|
-
import './vendor-constants.538d9b49.js';
|
|
5
|
-
import './vendor-coverage.2e41927a.js';
|
|
6
|
-
import './vendor-environments.75f2b63d.js';
|
|
7
|
-
import 'node:console';
|
|
8
|
-
import 'local-pkg';
|
|
9
|
-
import 'node:url';
|
|
10
|
-
import 'picocolors';
|
|
11
|
-
import './vendor-index.23ac4e13.js';
|
|
12
|
-
import 'std-env';
|
|
13
|
-
import '@vitest/runner/utils';
|
|
14
|
-
import '@vitest/utils';
|
|
15
|
-
import './vendor-global.6795f91f.js';
|
|
16
3
|
import 'vite';
|
|
17
4
|
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
18
6
|
import 'node:process';
|
|
19
7
|
import 'node:fs';
|
|
8
|
+
import './vendor-constants.538d9b49.js';
|
|
20
9
|
import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
21
|
-
import 'path';
|
|
22
10
|
import 'os';
|
|
11
|
+
import 'path';
|
|
23
12
|
import 'util';
|
|
24
13
|
import 'stream';
|
|
25
14
|
import 'events';
|
|
26
15
|
import 'fs';
|
|
16
|
+
import 'picocolors';
|
|
27
17
|
import 'vite-node/utils';
|
|
28
18
|
import 'vite-node/client';
|
|
29
19
|
import '@vitest/snapshot/manager';
|
|
30
20
|
import 'vite-node/server';
|
|
21
|
+
import './vendor-index.087d1af7.js';
|
|
22
|
+
import 'std-env';
|
|
23
|
+
import '@vitest/runner/utils';
|
|
24
|
+
import '@vitest/utils';
|
|
25
|
+
import './vendor-global.97e4527c.js';
|
|
26
|
+
import './vendor-coverage.78040316.js';
|
|
31
27
|
import './vendor-paths.84fc7a99.js';
|
|
32
28
|
import 'node:v8';
|
|
33
29
|
import 'node:child_process';
|
|
34
|
-
import './vendor-index.
|
|
30
|
+
import './vendor-index.b271ebe4.js';
|
|
31
|
+
import './vendor-base.9c08bbd0.js';
|
|
35
32
|
import 'node:worker_threads';
|
|
36
33
|
import 'node:os';
|
|
37
34
|
import 'tinypool';
|
|
35
|
+
import 'local-pkg';
|
|
38
36
|
import 'node:perf_hooks';
|
|
39
|
-
import './vendor-
|
|
37
|
+
import './vendor-source-map.e6c1997b.js';
|
|
40
38
|
import 'node:module';
|
|
41
39
|
import 'node:crypto';
|
|
42
40
|
import './vendor-index.1f85e5f1.js';
|
|
@@ -51,8 +49,7 @@ import 'acorn';
|
|
|
51
49
|
import 'acorn-walk';
|
|
52
50
|
import 'magic-string';
|
|
53
51
|
import 'strip-literal';
|
|
52
|
+
import './vendor-environments.443ecd82.js';
|
|
53
|
+
import 'node:console';
|
|
54
54
|
import 'node:readline';
|
|
55
55
|
import 'readline';
|
|
56
|
-
import '@vitest/utils/error';
|
|
57
|
-
import '@vitest/spy';
|
|
58
|
-
import './vendor-rpc.ad5b08c7.js';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, TestContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './types-
|
|
2
|
+
import { R as ResolvedConfig } from './types-3c7dbfa5.js';
|
|
3
3
|
import '@vitest/snapshot';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
|
6
|
+
import 'vite-node';
|
|
6
7
|
import '@vitest/runner/utils';
|
|
7
8
|
import '@vitest/utils';
|
|
8
9
|
import 'tinybench';
|
|
@@ -10,7 +11,7 @@ import 'vite-node/client';
|
|
|
10
11
|
import '@vitest/snapshot/manager';
|
|
11
12
|
import 'vite-node/server';
|
|
12
13
|
import 'node:worker_threads';
|
|
13
|
-
import '
|
|
14
|
+
import 'rollup';
|
|
14
15
|
import 'node:fs';
|
|
15
16
|
import 'chai';
|
|
16
17
|
|
package/dist/runners.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.
|
|
3
|
-
import './vendor-index.
|
|
4
|
-
import { a as rpc } from './vendor-rpc.
|
|
5
|
-
import { g as getFullName } from './vendor-
|
|
6
|
-
import { g as getWorkerState } from './vendor-global.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.271667ef.js';
|
|
3
|
+
import './vendor-index.087d1af7.js';
|
|
4
|
+
import { a as rpc } from './vendor-rpc.cbd8e972.js';
|
|
5
|
+
import { g as getFullName } from './vendor-source-map.e6c1997b.js';
|
|
6
|
+
import { g as getWorkerState } from './vendor-global.97e4527c.js';
|
|
7
7
|
import { getNames } from '@vitest/runner/utils';
|
|
8
8
|
import { performance } from 'node:perf_hooks';
|
|
9
9
|
import { updateTask } from '@vitest/runner';
|
|
@@ -13,6 +13,7 @@ import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
|
13
13
|
import '@vitest/snapshot';
|
|
14
14
|
import '@vitest/utils/error';
|
|
15
15
|
import 'util';
|
|
16
|
+
import './vendor-date.6e993429.js';
|
|
16
17
|
import '@vitest/spy';
|
|
17
18
|
import 'pathe';
|
|
18
19
|
import 'std-env';
|