vitest 0.19.1 → 0.20.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 +48 -3
- package/dist/browser.mjs +9 -7
- package/dist/{chunk-api-setup.0cf2c96a.mjs → chunk-api-setup.7c4c8879.mjs} +7 -6
- package/dist/{chunk-constants.38b43a44.mjs → chunk-constants.16825f0c.mjs} +3 -2
- package/dist/{chunk-defaults.ed196a9a.mjs → chunk-defaults.1c51d585.mjs} +6 -4
- package/dist/chunk-integrations-globals.56a11010.mjs +26 -0
- package/dist/{chunk-utils-global.2aa95025.mjs → chunk-mock-date.9160e13b.mjs} +6 -36
- package/dist/{chunk-node-git.9058b82a.mjs → chunk-node-git.43dbdd42.mjs} +1 -1
- package/dist/{chunk-runtime-chain.f2e00f4c.mjs → chunk-runtime-chain.b6c2cdbc.mjs} +5 -3
- package/dist/{chunk-runtime-error.606e0393.mjs → chunk-runtime-error.0aa0dc06.mjs} +17 -13
- package/dist/{chunk-runtime-hooks.d4cadf47.mjs → chunk-runtime-hooks.3ee34848.mjs} +7 -4
- package/dist/{chunk-runtime-mocker.dfdfd57b.mjs → chunk-runtime-mocker.0a8f7c5e.mjs} +23 -17
- package/dist/{chunk-runtime-rpc.45d8ee19.mjs → chunk-runtime-rpc.dbf0b31d.mjs} +3 -1
- package/dist/chunk-utils-global.fa20c2f6.mjs +5 -0
- package/dist/{chunk-utils-source-map.8b066ce2.mjs → chunk-utils-source-map.8198ebd9.mjs} +1 -1
- package/dist/chunk-utils-timers.b48455ed.mjs +27 -0
- package/dist/chunk-vite-node-client.a247c2c2.mjs +320 -0
- package/dist/chunk-vite-node-debug.c5887932.mjs +76 -0
- package/dist/{chunk-vite-node-externalize.e9af6472.mjs → chunk-vite-node-externalize.45323563.mjs} +76 -22
- package/dist/{chunk-vite-node-utils.ad73f2ab.mjs → chunk-vite-node-utils.9dfd1e3f.mjs} +4 -323
- package/dist/cli.mjs +9 -7
- package/dist/config.cjs +3 -2
- package/dist/config.d.ts +1 -0
- package/dist/config.mjs +3 -2
- package/dist/entry.mjs +10 -8
- package/dist/index.d.ts +49 -4
- package/dist/index.mjs +7 -5
- package/dist/loader.mjs +36 -0
- package/dist/node.d.ts +49 -3
- package/dist/node.mjs +10 -7
- package/dist/suite.mjs +6 -4
- package/dist/worker.mjs +9 -6
- package/package.json +6 -5
- package/suppress-warnings.cjs +20 -0
- package/dist/chunk-integrations-globals.1018e651.mjs +0 -24
package/dist/node.d.ts
CHANGED
|
@@ -108,7 +108,6 @@ declare class ViteNodeRunner {
|
|
|
108
108
|
*/
|
|
109
109
|
interopedImport(path: string): Promise<any>;
|
|
110
110
|
hasNestedDefault(target: any): any;
|
|
111
|
-
private debugLog;
|
|
112
111
|
}
|
|
113
112
|
interface DepsHandlingOptions {
|
|
114
113
|
external?: (string | RegExp)[];
|
|
@@ -179,6 +178,33 @@ interface ViteNodeServerOptions {
|
|
|
179
178
|
ssr?: RegExp[];
|
|
180
179
|
web?: RegExp[];
|
|
181
180
|
};
|
|
181
|
+
debug?: DebuggerOptions;
|
|
182
|
+
}
|
|
183
|
+
interface DebuggerOptions {
|
|
184
|
+
/**
|
|
185
|
+
* Dump the transformed module to filesystem
|
|
186
|
+
* Passing a string will dump to the specified path
|
|
187
|
+
*/
|
|
188
|
+
dumpModules?: boolean | string;
|
|
189
|
+
/**
|
|
190
|
+
* Read dumpped module from filesystem whenever exists.
|
|
191
|
+
* Useful for debugging by modifying the dump result from the filesystem.
|
|
192
|
+
*/
|
|
193
|
+
loadDumppedModules?: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare class Debugger {
|
|
197
|
+
options: DebuggerOptions;
|
|
198
|
+
dumpDir: string | undefined;
|
|
199
|
+
initPromise: Promise<void> | undefined;
|
|
200
|
+
externalizeMap: Map<string, string>;
|
|
201
|
+
constructor(root: string, options: DebuggerOptions);
|
|
202
|
+
clearDump(): Promise<void>;
|
|
203
|
+
encodeId(id: string): string;
|
|
204
|
+
recordExternalize(id: string, path: string): Promise<void>;
|
|
205
|
+
dumpFile(id: string, result: TransformResult | null): Promise<void>;
|
|
206
|
+
loadDump(id: string): Promise<TransformResult | null>;
|
|
207
|
+
writeInfo(): Promise<void>;
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
declare class ViteNodeServer {
|
|
@@ -190,6 +216,8 @@ declare class ViteNodeServer {
|
|
|
190
216
|
timestamp: number;
|
|
191
217
|
result: FetchResult;
|
|
192
218
|
}>;
|
|
219
|
+
externalizeCache: Map<string, Promise<string | false>>;
|
|
220
|
+
debugger?: Debugger;
|
|
193
221
|
constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
|
|
194
222
|
shouldExternalize(id: string): Promise<string | false>;
|
|
195
223
|
resolveId(id: string, importer?: string): Promise<ViteNodeResolveId | null>;
|
|
@@ -721,6 +749,7 @@ interface Suite extends TaskBase {
|
|
|
721
749
|
interface File extends Suite {
|
|
722
750
|
filepath: string;
|
|
723
751
|
collectDuration?: number;
|
|
752
|
+
setupDuration?: number;
|
|
724
753
|
}
|
|
725
754
|
interface Test<ExtraContext = {}> extends TaskBase {
|
|
726
755
|
type: 'test';
|
|
@@ -874,6 +903,11 @@ interface InlineConfig {
|
|
|
874
903
|
* @default false
|
|
875
904
|
*/
|
|
876
905
|
fallbackCJS?: boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Use experimental Node loader to resolve imports inside node_modules using Vite resolve algorithm.
|
|
908
|
+
* @default true
|
|
909
|
+
*/
|
|
910
|
+
registerNodeLoader?: boolean;
|
|
877
911
|
};
|
|
878
912
|
/**
|
|
879
913
|
* Base directory to scan for the test files
|
|
@@ -1161,6 +1195,10 @@ interface InlineConfig {
|
|
|
1161
1195
|
* Will be merged with the default aliases inside `resolve.alias`.
|
|
1162
1196
|
*/
|
|
1163
1197
|
alias?: AliasOptions;
|
|
1198
|
+
/**
|
|
1199
|
+
* Ignore any unhandled errors that occur
|
|
1200
|
+
*/
|
|
1201
|
+
dangerouslyIgnoreUnhandledErrors?: boolean;
|
|
1164
1202
|
}
|
|
1165
1203
|
interface UserConfig extends InlineConfig {
|
|
1166
1204
|
/**
|
|
@@ -1503,16 +1541,23 @@ interface WorkerPool {
|
|
|
1503
1541
|
close: () => Promise<void>;
|
|
1504
1542
|
}
|
|
1505
1543
|
|
|
1544
|
+
interface CollectingPromise {
|
|
1545
|
+
promise: Promise<void>;
|
|
1546
|
+
resolve: () => void;
|
|
1547
|
+
}
|
|
1506
1548
|
declare class StateManager {
|
|
1507
1549
|
filesMap: Map<string, File>;
|
|
1508
1550
|
pathsSet: Set<string>;
|
|
1551
|
+
collectingPromise: CollectingPromise | undefined;
|
|
1509
1552
|
idMap: Map<string, Task>;
|
|
1510
1553
|
taskFileMap: WeakMap<Task, File>;
|
|
1511
1554
|
errorsSet: Set<unknown>;
|
|
1512
1555
|
catchError(err: unknown, type: string): void;
|
|
1513
1556
|
clearErrors(): void;
|
|
1514
1557
|
getUnhandledErrors(): unknown[];
|
|
1515
|
-
|
|
1558
|
+
startCollectingPaths(): void;
|
|
1559
|
+
finishCollectingPaths(): void;
|
|
1560
|
+
getPaths(): Promise<string[]>;
|
|
1516
1561
|
getFiles(keys?: string[]): File[];
|
|
1517
1562
|
getFilepaths(): string[];
|
|
1518
1563
|
getFailedFilepaths(): string[];
|
|
@@ -1645,7 +1690,8 @@ declare class VitestMocker {
|
|
|
1645
1690
|
private resolvePath;
|
|
1646
1691
|
private resolveMocks;
|
|
1647
1692
|
private callFunctionMock;
|
|
1648
|
-
|
|
1693
|
+
private getMockPath;
|
|
1694
|
+
getDependencyMock(id: string): string | (() => unknown) | null;
|
|
1649
1695
|
normalizePath(path: string): string;
|
|
1650
1696
|
getFsPath(path: string, external: string | null): string;
|
|
1651
1697
|
resolveMockPath(mockPath: string, external: string | null): string | null;
|
package/dist/node.mjs
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.45323563.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.0a8f7c5e.mjs';
|
|
3
|
+
import './chunk-mock-date.9160e13b.mjs';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
|
-
import './chunk-defaults.
|
|
7
|
+
import './chunk-defaults.1c51d585.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
13
|
+
import './chunk-constants.16825f0c.mjs';
|
|
14
14
|
import 'os';
|
|
15
15
|
import 'util';
|
|
16
16
|
import 'stream';
|
|
17
17
|
import 'events';
|
|
18
18
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
19
|
-
import './chunk-vite-node-
|
|
19
|
+
import './chunk-vite-node-client.a247c2c2.mjs';
|
|
20
20
|
import 'vm';
|
|
21
|
+
import './chunk-vite-node-utils.9dfd1e3f.mjs';
|
|
21
22
|
import 'assert';
|
|
22
23
|
import 'debug';
|
|
23
24
|
import 'worker_threads';
|
|
24
25
|
import 'tinypool';
|
|
25
26
|
import 'perf_hooks';
|
|
26
|
-
import './chunk-utils-source-map.
|
|
27
|
+
import './chunk-utils-source-map.8198ebd9.mjs';
|
|
28
|
+
import './chunk-utils-timers.b48455ed.mjs';
|
|
27
29
|
import 'crypto';
|
|
28
30
|
import './vendor-index.61438b77.mjs';
|
|
29
31
|
import './chunk-magic-string.efe26975.mjs';
|
|
30
32
|
import 'readline';
|
|
31
33
|
import './vendor-index.de788b6a.mjs';
|
|
34
|
+
import './chunk-utils-global.fa20c2f6.mjs';
|
package/dist/suite.mjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import 'util';
|
|
2
|
-
import './chunk-
|
|
3
|
-
export { e as clearCollectorContext, o as createSuiteHooks, f as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
+
import './chunk-mock-date.9160e13b.mjs';
|
|
3
|
+
export { e as clearCollectorContext, o as createSuiteHooks, f as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.b6c2cdbc.mjs';
|
|
4
|
+
import './chunk-utils-global.fa20c2f6.mjs';
|
|
4
5
|
import 'path';
|
|
5
6
|
import 'tty';
|
|
6
7
|
import 'local-pkg';
|
|
7
8
|
import 'chai';
|
|
8
9
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
9
|
-
import './chunk-runtime-rpc.
|
|
10
|
+
import './chunk-runtime-rpc.dbf0b31d.mjs';
|
|
11
|
+
import './chunk-utils-timers.b48455ed.mjs';
|
|
10
12
|
import 'fs';
|
|
11
|
-
import './chunk-utils-source-map.
|
|
13
|
+
import './chunk-utils-source-map.8198ebd9.mjs';
|
|
12
14
|
import './spy.mjs';
|
|
13
15
|
import 'tinyspy';
|
package/dist/worker.mjs
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-
|
|
1
|
+
import { y as resolve } from './chunk-mock-date.9160e13b.mjs';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.a247c2c2.mjs';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
+
import { d as distDir } from './chunk-constants.16825f0c.mjs';
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.0a8f7c5e.mjs';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.dbf0b31d.mjs';
|
|
7
|
+
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
7
8
|
import 'path';
|
|
8
9
|
import 'tty';
|
|
9
10
|
import 'local-pkg';
|
|
10
11
|
import 'module';
|
|
11
12
|
import 'url';
|
|
12
13
|
import 'vm';
|
|
14
|
+
import './chunk-vite-node-utils.9dfd1e3f.mjs';
|
|
13
15
|
import 'fs';
|
|
14
16
|
import 'assert';
|
|
15
17
|
import 'util';
|
|
16
18
|
import 'debug';
|
|
17
19
|
import 'vite';
|
|
20
|
+
import './chunk-utils-timers.b48455ed.mjs';
|
|
18
21
|
|
|
19
22
|
let _viteNode;
|
|
20
23
|
const moduleCache = new ModuleCacheMap();
|
|
@@ -77,7 +80,7 @@ function init(ctx) {
|
|
|
77
80
|
if (ctx.invalidates) {
|
|
78
81
|
ctx.invalidates.forEach((fsPath) => {
|
|
79
82
|
moduleCache.delete(fsPath);
|
|
80
|
-
moduleCache.delete(
|
|
83
|
+
moduleCache.delete(`mock:${fsPath}`);
|
|
81
84
|
});
|
|
82
85
|
}
|
|
83
86
|
ctx.files.forEach((i) => moduleCache.delete(i));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"dist",
|
|
56
56
|
"bin",
|
|
57
57
|
"*.d.ts",
|
|
58
|
-
"*.mjs"
|
|
58
|
+
"*.mjs",
|
|
59
|
+
"*.cjs"
|
|
59
60
|
],
|
|
60
61
|
"engines": {
|
|
61
62
|
"node": ">=v14.16.0"
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
"@types/natural-compare": "^1.4.1",
|
|
110
111
|
"@types/prompts": "^2.4.0",
|
|
111
112
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
112
|
-
"@vitest/ui": "0.
|
|
113
|
+
"@vitest/ui": "0.20.2",
|
|
113
114
|
"birpc": "^0.2.3",
|
|
114
115
|
"c8": "^7.11.3",
|
|
115
116
|
"cac": "^6.7.12",
|
|
@@ -137,11 +138,11 @@
|
|
|
137
138
|
"source-map-js": "^1.0.2",
|
|
138
139
|
"strip-ansi": "^7.0.1",
|
|
139
140
|
"typescript": "^4.7.4",
|
|
140
|
-
"vite-node": "0.
|
|
141
|
+
"vite-node": "0.20.2",
|
|
141
142
|
"ws": "^8.8.1"
|
|
142
143
|
},
|
|
143
144
|
"scripts": {
|
|
144
145
|
"build": "rimraf dist && rollup -c",
|
|
145
|
-
"dev": "rollup -c --watch -m inline"
|
|
146
|
+
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" rollup -c --watch -m inline"
|
|
146
147
|
}
|
|
147
148
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// borrowed from tsx implementation:
|
|
2
|
+
// https://github.com/esbuild-kit/tsx
|
|
3
|
+
|
|
4
|
+
const ignoreWarnings = new Set([
|
|
5
|
+
'--experimental-loader is an experimental feature. This feature could change at any time',
|
|
6
|
+
'Custom ESM Loaders is an experimental feature. This feature could change at any time',
|
|
7
|
+
])
|
|
8
|
+
|
|
9
|
+
const { emit } = process
|
|
10
|
+
|
|
11
|
+
process.emit = function (event, warning) {
|
|
12
|
+
if (
|
|
13
|
+
event === 'warning'
|
|
14
|
+
&& ignoreWarnings.has(warning.message)
|
|
15
|
+
)
|
|
16
|
+
return
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line prefer-rest-params
|
|
19
|
+
return Reflect.apply(emit, this, arguments)
|
|
20
|
+
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.38b43a44.mjs';
|
|
2
|
-
import { i as index } from './chunk-runtime-hooks.d4cadf47.mjs';
|
|
3
|
-
import 'url';
|
|
4
|
-
import './chunk-utils-global.2aa95025.mjs';
|
|
5
|
-
import 'path';
|
|
6
|
-
import 'tty';
|
|
7
|
-
import 'local-pkg';
|
|
8
|
-
import './chunk-runtime-chain.f2e00f4c.mjs';
|
|
9
|
-
import 'util';
|
|
10
|
-
import 'chai';
|
|
11
|
-
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.45d8ee19.mjs';
|
|
13
|
-
import 'fs';
|
|
14
|
-
import './chunk-utils-source-map.8b066ce2.mjs';
|
|
15
|
-
import './spy.mjs';
|
|
16
|
-
import 'tinyspy';
|
|
17
|
-
|
|
18
|
-
function registerApiGlobally() {
|
|
19
|
-
globalApis.forEach((api) => {
|
|
20
|
-
globalThis[api] = index[api];
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { registerApiGlobally };
|