vitest 0.0.68 → 0.0.69

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.
@@ -1,294 +0,0 @@
1
- import { TransformResult, ViteDevServer } from 'vite';
2
- import { OptionsReceived } from 'pretty-format';
3
-
4
- declare class StateManager {
5
- filesMap: Record<string, File>;
6
- idMap: Record<string, Task>;
7
- taskFileMap: WeakMap<Task, File>;
8
- getFiles(keys?: string[]): File[];
9
- collectFiles(files: File[]): void;
10
- updateId(task: Task): void;
11
- updateTasks(packs: TaskResultPack[]): void;
12
- }
13
-
14
- declare class SnapshotManager {
15
- config: ResolvedConfig;
16
- summary: SnapshotSummary;
17
- constructor(config: ResolvedConfig);
18
- clear(): void;
19
- add(result: SnapshotResult): void;
20
- }
21
-
22
- declare type Awaitable<T> = T | PromiseLike<T>;
23
- declare type Nullable<T> = T | null | undefined;
24
- declare type Arrayable<T> = T | Array<T>;
25
- interface ModuleCache {
26
- promise?: Promise<any>;
27
- exports?: any;
28
- transformResult?: TransformResult;
29
- }
30
- interface EnvironmentReturn {
31
- teardown: (global: any) => Awaitable<void>;
32
- }
33
- interface Environment {
34
- name: string;
35
- setup(global: any): Awaitable<EnvironmentReturn>;
36
- }
37
- interface VitestContext {
38
- config: ResolvedConfig;
39
- server: ViteDevServer;
40
- state: StateManager;
41
- snapshot: SnapshotManager;
42
- reporter: Reporter;
43
- }
44
-
45
- declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
46
- declare type TaskState = RunMode | 'pass' | 'fail';
47
- declare type ComputeMode = 'serial' | 'concurrent';
48
- interface TaskBase {
49
- id: string;
50
- name: string;
51
- mode: RunMode;
52
- computeMode: ComputeMode;
53
- suite?: Suite;
54
- file?: File;
55
- result?: TaskResult;
56
- }
57
- interface TaskResult {
58
- state: TaskState;
59
- start: number;
60
- end?: number;
61
- error?: unknown;
62
- }
63
- declare type TaskResultPack = [id: string, result: TaskResult | undefined];
64
- interface Suite extends TaskBase {
65
- type: 'suite';
66
- tasks: Task[];
67
- }
68
- interface File extends Suite {
69
- filepath: string;
70
- }
71
- interface Test extends TaskBase {
72
- type: 'test';
73
- suite: Suite;
74
- result?: TaskResult;
75
- }
76
- declare type Task = Test | Suite | File;
77
- declare type TestFunction = () => Awaitable<void>;
78
- declare type TestCollectorFn = (name: string, fn: TestFunction, timeout?: number) => void;
79
- interface ConcurrentCollector {
80
- (name: string, fn: TestFunction, timeout?: number): void;
81
- only: TestCollectorFn;
82
- skip: TestCollectorFn;
83
- todo: (name: string) => void;
84
- }
85
- interface OnlyCollector {
86
- (name: string, fn: TestFunction, timeout?: number): void;
87
- concurrent: TestCollectorFn;
88
- }
89
- interface SkipCollector {
90
- (name: string, fn: TestFunction, timeout?: number): void;
91
- concurrent: TestCollectorFn;
92
- }
93
- interface TodoCollector {
94
- (name: string): void;
95
- concurrent: (name: string) => void;
96
- }
97
- interface TestCollector {
98
- (name: string, fn: TestFunction, timeout?: number): void;
99
- concurrent: ConcurrentCollector;
100
- only: OnlyCollector;
101
- skip: SkipCollector;
102
- todo: TodoCollector;
103
- }
104
- declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
105
- interface SuiteHooks {
106
- beforeAll: HookListener<[Suite]>[];
107
- afterAll: HookListener<[Suite]>[];
108
- beforeEach: HookListener<[Test, Suite]>[];
109
- afterEach: HookListener<[Test, Suite]>[];
110
- }
111
- interface SuiteCollector {
112
- readonly name: string;
113
- readonly mode: RunMode;
114
- type: 'collector';
115
- test: TestCollector;
116
- tasks: (Suite | Test | SuiteCollector)[];
117
- collect: (file?: File) => Promise<Suite>;
118
- clear: () => void;
119
- on: <T extends keyof SuiteHooks>(name: T, ...fn: SuiteHooks[T]) => void;
120
- }
121
- declare type TestFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable<void>;
122
- interface GlobalContext {
123
- tasks: (SuiteCollector | Test)[];
124
- currentSuite: SuiteCollector | null;
125
- }
126
-
127
- interface Reporter {
128
- onStart?: (files?: string[]) => Awaitable<void>;
129
- onFinished?: (files?: File[]) => Awaitable<void>;
130
- onTaskUpdate?: (pack: TaskResultPack) => Awaitable<void>;
131
- onWatcherStart?: () => Awaitable<void>;
132
- onWatcherRerun?: (files: string[], trigger: string) => Awaitable<void>;
133
- }
134
-
135
- declare type SnapshotData = Record<string, string>;
136
- declare type SnapshotUpdateState = 'all' | 'new' | 'none';
137
- declare type SnapshotStateOptions = {
138
- updateSnapshot: SnapshotUpdateState;
139
- expand?: boolean;
140
- snapshotFormat?: OptionsReceived;
141
- };
142
- declare type SnapshotMatchOptions = {
143
- testName: string;
144
- received: unknown;
145
- key?: string;
146
- inlineSnapshot?: string;
147
- isInline: boolean;
148
- error?: Error;
149
- };
150
- interface SnapshotResult {
151
- filepath: string;
152
- added: number;
153
- fileDeleted: boolean;
154
- matched: number;
155
- unchecked: number;
156
- uncheckedKeys: Array<string>;
157
- unmatched: number;
158
- updated: number;
159
- }
160
- interface UncheckedSnapshot {
161
- filePath: string;
162
- keys: Array<string>;
163
- }
164
- interface SnapshotSummary {
165
- added: number;
166
- didUpdate: boolean;
167
- failure: boolean;
168
- filesAdded: number;
169
- filesRemoved: number;
170
- filesRemovedList: Array<string>;
171
- filesUnmatched: number;
172
- filesUpdated: number;
173
- matched: number;
174
- total: number;
175
- unchecked: number;
176
- uncheckedKeysByFile: Array<UncheckedSnapshot>;
177
- unmatched: number;
178
- updated: number;
179
- }
180
-
181
- interface UserOptions {
182
- /**
183
- * Include globs for test files
184
- *
185
- * @default ['**\/*.test.ts']
186
- */
187
- includes?: string[];
188
- /**
189
- * Exclude globs for test files
190
- * @default ['**\/node_modules\/**']
191
- */
192
- excludes?: string[];
193
- /**
194
- * Handling for dependencies inlining or externalizing
195
- */
196
- deps?: {
197
- /**
198
- * Externalize means that Vite will bypass the package to native Node.
199
- *
200
- * Externaled dependencies will not be applied Vite's transformers and resolvers.
201
- * And does not support HMR on reload.
202
- *
203
- * Typically, packages under `node_modules` are externalized.
204
- */
205
- external?: (string | RegExp)[];
206
- /**
207
- * Vite will process inlined modules.
208
- *
209
- * This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
210
- */
211
- inline?: (string | RegExp)[];
212
- };
213
- /**
214
- * Register apis globally
215
- *
216
- * @default false
217
- */
218
- global?: boolean;
219
- /**
220
- * Running environment
221
- *
222
- * Supports 'node', 'jsdom', 'happy-dom'
223
- *
224
- * @default 'node'
225
- */
226
- environment?: 'node' | 'jsdom' | 'happy-dom';
227
- /**
228
- * Update snapshot files
229
- *
230
- * @default false
231
- */
232
- update?: boolean;
233
- /**
234
- * Watch mode
235
- *
236
- * @default false
237
- */
238
- watch?: boolean;
239
- /**
240
- * Project root
241
- */
242
- root?: string;
243
- /**
244
- * Custom reporter for output
245
- */
246
- reporter?: Reporter;
247
- /**
248
- * Enable multi-threading
249
- *
250
- * @default true
251
- */
252
- threads?: boolean;
253
- /**
254
- * Maximum number of threads
255
- *
256
- * @default available CPUs
257
- */
258
- maxThreads?: number;
259
- /**
260
- * Minimum number of threads
261
- *
262
- * @default available CPUs
263
- */
264
- minThreads?: number;
265
- interpretDefault?: boolean;
266
- testTimeout?: number;
267
- hookTimeout?: number;
268
- }
269
- interface CliOptions extends UserOptions {
270
- /**
271
- * Filters by name
272
- */
273
- cliFilters?: string[];
274
- /**
275
- * Path to the config file.
276
- *
277
- * Default resolving to one of:
278
- * - `vitest.config.js`
279
- * - `vitest.config.ts`
280
- * - `vite.config.js`
281
- * - `vite.config.ts`
282
- */
283
- config?: string | undefined;
284
- dom?: boolean;
285
- }
286
- interface ResolvedConfig extends Omit<Required<CliOptions>, 'config' | 'filters'> {
287
- config?: string;
288
- filters?: string[];
289
- depsInline: (string | RegExp)[];
290
- depsExternal: (string | RegExp)[];
291
- snapshotOptions: SnapshotStateOptions;
292
- }
293
-
294
- export { Awaitable as A, CliOptions as C, EnvironmentReturn as E, File as F, GlobalContext as G, HookListener as H, ModuleCache as M, Nullable as N, ResolvedConfig as R, SnapshotResult as S, TaskResultPack as T, UserOptions as U, VitestContext as V, TestFactory as a, SuiteCollector as b, TestFunction as c, SuiteHooks as d, RunMode as e, TaskState as f, ComputeMode as g, TaskBase as h, TaskResult as i, Suite as j, Test as k, Task as l, TestCollector as m, Reporter as n, SnapshotData as o, SnapshotUpdateState as p, SnapshotStateOptions as q, SnapshotMatchOptions as r, UncheckedSnapshot as s, SnapshotSummary as t, Arrayable as u, Environment as v };
@@ -1,7 +0,0 @@
1
- import { R as ResolvedConfig } from '../options-63a726fa';
2
- import 'vite';
3
- import 'pretty-format';
4
-
5
- declare function run(files: string[], config: ResolvedConfig): Promise<void>;
6
-
7
- export { run };