vitest 0.3.1 → 0.3.5
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/cli.js +21 -17
- package/dist/{client-ab3f363e.js → client-d27bd0a9.js} +3 -3
- package/dist/constants-861ea902.js +32 -0
- package/dist/{create-b3b05216.js → create-c989e565.js} +24 -16
- package/dist/defaults-ac98ff15.js +52 -0
- package/dist/{diff-e2ede84f.js → diff-00c7fe6a.js} +4 -3
- package/dist/entry.js +18 -17
- package/dist/{globals-b87ef70d.js → globals-4885c33f.js} +9 -7
- package/dist/index-373b5ce3.js +187 -0
- package/dist/index-5e0ca99c.js +224 -0
- package/dist/index-b99f1c97.js +49 -0
- package/dist/index.d.ts +47 -19
- package/dist/index.js +6 -8
- package/dist/node.d.ts +0 -4
- package/dist/node.js +11 -9
- package/dist/rpc-377d999b.js +6 -0
- package/dist/{setup-55c4a74b.js → setup-a6f25b61.js} +6 -5
- package/dist/{source-map-0ecca7b8.js → source-map-1b1fae71.js} +2 -2
- package/dist/vi-b258f071.js +5936 -0
- package/dist/worker.js +11 -12
- package/package.json +4 -4
- package/dist/constants-8fcbf9b6.js +0 -80
- package/dist/index-e32575f8.js +0 -44
- package/dist/index-f55e7b59.js +0 -406
- package/dist/rpc-8c7cc374.js +0 -6
- package/dist/vi-93df942a.js +0 -5922
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViteDevServer, TransformResult, CommonServerOptions } from 'vite';
|
|
1
|
+
import { ViteDevServer, TransformResult, CommonServerOptions, UserConfig as UserConfig$1 } from 'vite';
|
|
2
2
|
import { MessagePort } from 'worker_threads';
|
|
3
3
|
import { SpyImpl } from 'tinyspy';
|
|
4
4
|
export { assert, default as chai, should } from 'chai';
|
|
@@ -370,7 +370,7 @@ declare class Vitest {
|
|
|
370
370
|
private handleFileChanged;
|
|
371
371
|
close(): Promise<void>;
|
|
372
372
|
exit(force?: boolean): Promise<void>;
|
|
373
|
-
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
373
|
+
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
374
374
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
375
375
|
isTargetFile(id: string): boolean;
|
|
376
376
|
onServerRestarted(fn: () => void): void;
|
|
@@ -486,17 +486,20 @@ declare type BuiltinReporters = keyof typeof ReportersMap;
|
|
|
486
486
|
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
487
487
|
declare type Nullable<T> = T | null | undefined;
|
|
488
488
|
declare type Arrayable<T> = T | Array<T>;
|
|
489
|
-
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
489
|
+
declare type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
|
|
490
490
|
declare type MergeInsertions<T> = T extends object ? {
|
|
491
491
|
[K in keyof T]: MergeInsertions<T[K]>;
|
|
492
492
|
} : T;
|
|
493
493
|
declare type DeepMerge<F, S> = MergeInsertions<{
|
|
494
494
|
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
495
495
|
}>;
|
|
496
|
+
declare type MutableArray<T extends readonly any[]> = {
|
|
497
|
+
-readonly [k in keyof T]: T[k];
|
|
498
|
+
};
|
|
496
499
|
interface Constructable {
|
|
497
500
|
new (...args: any[]): any;
|
|
498
501
|
}
|
|
499
|
-
interface ModuleCache {
|
|
502
|
+
interface ModuleCache$1 {
|
|
500
503
|
promise?: Promise<any>;
|
|
501
504
|
exports?: any;
|
|
502
505
|
code?: string;
|
|
@@ -715,7 +718,7 @@ interface Test extends TaskBase {
|
|
|
715
718
|
declare type Task = Test | Suite | File;
|
|
716
719
|
declare type DoneCallback = (error?: any) => void;
|
|
717
720
|
declare type TestFunction = (done: DoneCallback) => Awaitable<void>;
|
|
718
|
-
declare type EachFunction = <T>(cases: T[]) => (name: string, fn: (...args: T extends any[] ? T : [T]) => void) => void;
|
|
721
|
+
declare type EachFunction = <T>(cases: T[] | readonly T[]) => (name: string, fn: (...args: T extends any[] | readonly any[] ? MutableArray<T> : [T]) => void) => void;
|
|
719
722
|
declare type TestAPI = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
720
723
|
name: string,
|
|
721
724
|
fn?: TestFunction,
|
|
@@ -1056,10 +1059,6 @@ interface UserConfig extends InlineConfig {
|
|
|
1056
1059
|
* Use happy-dom
|
|
1057
1060
|
*/
|
|
1058
1061
|
dom?: boolean;
|
|
1059
|
-
/**
|
|
1060
|
-
* Do not watch
|
|
1061
|
-
*/
|
|
1062
|
-
run?: boolean;
|
|
1063
1062
|
/**
|
|
1064
1063
|
* Pass with no tests
|
|
1065
1064
|
*/
|
|
@@ -1102,6 +1101,11 @@ interface FetchResult {
|
|
|
1102
1101
|
map?: RawSourceMap;
|
|
1103
1102
|
}
|
|
1104
1103
|
declare type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
1104
|
+
interface ModuleCache {
|
|
1105
|
+
promise?: Promise<any>;
|
|
1106
|
+
exports?: any;
|
|
1107
|
+
code?: string;
|
|
1108
|
+
}
|
|
1105
1109
|
interface ViteNodeResolveId {
|
|
1106
1110
|
external?: boolean | 'absolute' | 'relative';
|
|
1107
1111
|
id: string;
|
|
@@ -1110,6 +1114,22 @@ interface ViteNodeResolveId {
|
|
|
1110
1114
|
syntheticNamedExports?: boolean | string | null;
|
|
1111
1115
|
}
|
|
1112
1116
|
|
|
1117
|
+
declare type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
1118
|
+
declare type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
1119
|
+
declare type BirpcFn<T> = {
|
|
1120
|
+
/**
|
|
1121
|
+
* Call the remote function and wait for the result.
|
|
1122
|
+
*/
|
|
1123
|
+
(...args: ArgumentsType<T>): Promise<Awaited<ReturnType$1<T>>>;
|
|
1124
|
+
/**
|
|
1125
|
+
* Send event without asking for response
|
|
1126
|
+
*/
|
|
1127
|
+
asEvent(...args: ArgumentsType<T>): void;
|
|
1128
|
+
};
|
|
1129
|
+
declare type BirpcReturn<RemoteFunctions> = {
|
|
1130
|
+
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1113
1133
|
interface WorkerContext {
|
|
1114
1134
|
port: MessagePort;
|
|
1115
1135
|
config: ResolvedConfig;
|
|
@@ -1128,6 +1148,14 @@ interface WorkerRPC {
|
|
|
1128
1148
|
onTaskUpdate: (pack: TaskResultPack[]) => void;
|
|
1129
1149
|
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
1130
1150
|
}
|
|
1151
|
+
interface WorkerGlobalState {
|
|
1152
|
+
ctx: WorkerContext;
|
|
1153
|
+
config: ResolvedConfig;
|
|
1154
|
+
rpc: BirpcReturn<WorkerRPC>;
|
|
1155
|
+
current?: Test;
|
|
1156
|
+
filepath?: string;
|
|
1157
|
+
moduleCache: Map<string, ModuleCache>;
|
|
1158
|
+
}
|
|
1131
1159
|
|
|
1132
1160
|
declare const suite: SuiteAPI;
|
|
1133
1161
|
declare const test: TestAPI;
|
|
@@ -1249,14 +1277,14 @@ declare class VitestUtils {
|
|
|
1249
1277
|
* return it.
|
|
1250
1278
|
* - If there is no `__mocks__` folder or a file with the same name inside, will call original
|
|
1251
1279
|
* module and mock it.
|
|
1252
|
-
* @param path Path to the module. Can be aliased, if your config
|
|
1280
|
+
* @param path Path to the module. Can be aliased, if your config supports it
|
|
1253
1281
|
* @param factory Factory for the mocked module. Has the highest priority.
|
|
1254
1282
|
*/
|
|
1255
1283
|
mock(path: string, factory?: () => any): void;
|
|
1256
1284
|
/**
|
|
1257
1285
|
* Removes module from mocked registry. All subsequent calls to import will
|
|
1258
1286
|
* return original module even if it was mocked.
|
|
1259
|
-
* @param path Path to the module. Can be aliased, if your config
|
|
1287
|
+
* @param path Path to the module. Can be aliased, if your config supports it
|
|
1260
1288
|
*/
|
|
1261
1289
|
unmock(path: string): void;
|
|
1262
1290
|
doMock(path: string, factory?: () => any): void;
|
|
@@ -1270,14 +1298,14 @@ declare class VitestUtils {
|
|
|
1270
1298
|
*
|
|
1271
1299
|
* return { ...axios, get: vi.fn() }
|
|
1272
1300
|
* })
|
|
1273
|
-
* @param path Path to the module. Can be aliased, if your config
|
|
1301
|
+
* @param path Path to the module. Can be aliased, if your config supports it
|
|
1274
1302
|
* @returns Actual module without spies
|
|
1275
1303
|
*/
|
|
1276
1304
|
importActual<T>(path: string): Promise<T>;
|
|
1277
1305
|
/**
|
|
1278
1306
|
* Imports a module with all of its properties and nested properties mocked.
|
|
1279
1307
|
* For the rules applied, see docs.
|
|
1280
|
-
* @param path Path to the module. Can be aliased, if your config
|
|
1308
|
+
* @param path Path to the module. Can be aliased, if your config supports it
|
|
1281
1309
|
* @returns Fully mocked module
|
|
1282
1310
|
*/
|
|
1283
1311
|
importMock<T>(path: string): Promise<MaybeMockedDeep<T>>;
|
|
@@ -1326,7 +1354,6 @@ interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' |
|
|
|
1326
1354
|
declare const configDefaults: UserConfig;
|
|
1327
1355
|
|
|
1328
1356
|
declare type VitestInlineConfig = InlineConfig;
|
|
1329
|
-
|
|
1330
1357
|
declare module 'vite' {
|
|
1331
1358
|
interface UserConfig {
|
|
1332
1359
|
/**
|
|
@@ -1335,6 +1362,7 @@ declare module 'vite' {
|
|
|
1335
1362
|
test?: VitestInlineConfig;
|
|
1336
1363
|
}
|
|
1337
1364
|
}
|
|
1365
|
+
declare function defineConfig(config: UserConfig$1): UserConfig$1;
|
|
1338
1366
|
interface AsymmetricMatchersContaining {
|
|
1339
1367
|
stringContaining(expected: string): any;
|
|
1340
1368
|
objectContaining(expected: any): any;
|
|
@@ -1386,10 +1414,10 @@ declare global {
|
|
|
1386
1414
|
toContainEqual<E>(item: E): void;
|
|
1387
1415
|
toBeTruthy(): void;
|
|
1388
1416
|
toBeFalsy(): void;
|
|
1389
|
-
toBeGreaterThan(num: number): void;
|
|
1390
|
-
toBeGreaterThanOrEqual(num: number): void;
|
|
1391
|
-
toBeLessThan(num: number): void;
|
|
1392
|
-
toBeLessThanOrEqual(num: number): void;
|
|
1417
|
+
toBeGreaterThan(num: number | bigint): void;
|
|
1418
|
+
toBeGreaterThanOrEqual(num: number | bigint): void;
|
|
1419
|
+
toBeLessThan(num: number | bigint): void;
|
|
1420
|
+
toBeLessThanOrEqual(num: number | bigint): void;
|
|
1393
1421
|
toBeNaN(): void;
|
|
1394
1422
|
toBeUndefined(): void;
|
|
1395
1423
|
toBeNull(): void;
|
|
@@ -1432,4 +1460,4 @@ declare global {
|
|
|
1432
1460
|
}
|
|
1433
1461
|
}
|
|
1434
1462
|
|
|
1435
|
-
export { ApiConfig, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EachFunction, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, ModuleGraphData, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, configDefaults, describe, expect, fn, isMockFunction, it, spies, spyOn, suite, test, vi, vitest };
|
|
1463
|
+
export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EachFunction, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache$1 as ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, configDefaults, defineConfig, describe, expect, fn, isMockFunction, it, spies, spyOn, suite, test, vi, vitest };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-
|
|
2
|
-
export { a as afterAll,
|
|
1
|
+
export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-b258f071.js';
|
|
2
|
+
export { a as afterAll, e as afterEach, b as beforeAll, c as beforeEach, d as defineConfig, f as expect } from './index-b99f1c97.js';
|
|
3
3
|
export { fn, isMockFunction, spies, spyOn } from './jest-mock.js';
|
|
4
|
-
export { c as configDefaults } from './
|
|
4
|
+
export { c as configDefaults } from './defaults-ac98ff15.js';
|
|
5
5
|
export { assert, default as chai, should } from 'chai';
|
|
6
6
|
import 'util';
|
|
7
|
-
import './index-
|
|
8
|
-
import 'path';
|
|
7
|
+
import './index-5e0ca99c.js';
|
|
9
8
|
import 'tty';
|
|
10
9
|
import 'local-pkg';
|
|
11
|
-
import './source-map-
|
|
10
|
+
import './source-map-1b1fae71.js';
|
|
12
11
|
import './_commonjsHelpers-c9e3b764.js';
|
|
13
12
|
import 'tinyspy';
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OyJ9
|
|
13
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OzsifQ==
|
package/dist/node.d.ts
CHANGED
package/dist/node.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest } from './create-
|
|
2
|
-
import './index-
|
|
1
|
+
export { V as VitestPlugin, c as createVitest } from './create-c989e565.js';
|
|
2
|
+
import './index-373b5ce3.js';
|
|
3
3
|
import 'path';
|
|
4
|
-
import 'tty';
|
|
5
|
-
import 'local-pkg';
|
|
6
4
|
import 'vite';
|
|
7
5
|
import 'process';
|
|
8
6
|
import 'fs';
|
|
9
|
-
import './constants-
|
|
7
|
+
import './constants-861ea902.js';
|
|
10
8
|
import 'url';
|
|
11
9
|
import 'os';
|
|
12
10
|
import 'util';
|
|
13
11
|
import 'stream';
|
|
14
12
|
import 'events';
|
|
15
|
-
import './
|
|
13
|
+
import './index-5e0ca99c.js';
|
|
14
|
+
import 'tty';
|
|
15
|
+
import 'local-pkg';
|
|
16
|
+
import './client-d27bd0a9.js';
|
|
16
17
|
import 'module';
|
|
17
18
|
import 'assert';
|
|
18
19
|
import 'vm';
|
|
20
|
+
import './defaults-ac98ff15.js';
|
|
19
21
|
import 'perf_hooks';
|
|
20
|
-
import './diff-
|
|
21
|
-
import './source-map-
|
|
22
|
+
import './diff-00c7fe6a.js';
|
|
23
|
+
import './source-map-1b1fae71.js';
|
|
22
24
|
import './index-648e7ab2.js';
|
|
23
25
|
import './_commonjsHelpers-c9e3b764.js';
|
|
24
26
|
import 'worker_threads';
|
|
25
27
|
import 'tinypool';
|
|
26
28
|
import './magic-string.es-94000aea.js';
|
|
27
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const rpc = () => {
|
|
2
|
+
return __vitest_worker__.rpc;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export { rpc as r };
|
|
6
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLTM3N2Q5OTliLmpzIiwic291cmNlcyI6WyIuLi9zcmMvcnVudGltZS9ycGMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IHJwYyA9ICgpID0+IHtcbiAgcmV0dXJuIF9fdml0ZXN0X3dvcmtlcl9fIS5ycGNcbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBWSxNQUFDLEdBQUcsR0FBRyxNQUFNO0FBQ3pCLEVBQUUsT0FBTyxpQkFBaUIsQ0FBQyxHQUFHLENBQUM7QUFDL0I7OyJ9
|