vitest 0.0.127 → 0.0.131

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/node.d.ts CHANGED
@@ -1,6 +1,17 @@
1
- import { ViteDevServer, UserConfig as UserConfig$1 } from 'vite';
2
- import { RawSourceMap } from 'source-map-js';
3
- import { OptionsReceived } from 'pretty-format';
1
+ import { CommonServerOptions, ViteDevServer, UserConfig as UserConfig$1 } from 'vite';
2
+
3
+ interface StartOfSourceMap {
4
+ file?: string;
5
+ sourceRoot?: string;
6
+ }
7
+
8
+ interface RawSourceMap extends StartOfSourceMap {
9
+ version: string;
10
+ sources: string[];
11
+ names: string[];
12
+ sourcesContent?: string[];
13
+ mappings: string;
14
+ }
4
15
 
5
16
  declare abstract class BaseReporter implements Reporter {
6
17
  start: number;
@@ -170,13 +181,13 @@ interface File extends Suite {
170
181
  filepath: string;
171
182
  collectDuration?: number;
172
183
  }
173
- interface Test extends TaskBase {
184
+ interface Test$1 extends TaskBase {
174
185
  type: 'test';
175
186
  suite: Suite;
176
187
  result?: TaskResult;
177
188
  fails?: boolean;
178
189
  }
179
- declare type Task = Test | Suite | File;
190
+ declare type Task = Test$1 | Suite | File;
180
191
 
181
192
  interface Reporter {
182
193
  onInit?(ctx: Vitest): void;
@@ -189,6 +200,93 @@ interface Reporter {
189
200
  onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
190
201
  }
191
202
 
203
+ /**
204
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
205
+ *
206
+ * This source code is licensed under the MIT license found in the
207
+ * LICENSE file in the root directory of this source tree.
208
+ */
209
+ declare type Colors = {
210
+ comment: {
211
+ close: string;
212
+ open: string;
213
+ };
214
+ content: {
215
+ close: string;
216
+ open: string;
217
+ };
218
+ prop: {
219
+ close: string;
220
+ open: string;
221
+ };
222
+ tag: {
223
+ close: string;
224
+ open: string;
225
+ };
226
+ value: {
227
+ close: string;
228
+ open: string;
229
+ };
230
+ };
231
+ declare type Indent = (arg0: string) => string;
232
+ declare type Refs = Array<unknown>;
233
+ declare type Print = (arg0: unknown) => string;
234
+ declare type ThemeReceived = {
235
+ comment?: string;
236
+ content?: string;
237
+ prop?: string;
238
+ tag?: string;
239
+ value?: string;
240
+ };
241
+ declare type CompareKeys = ((a: string, b: string) => number) | undefined;
242
+ interface PrettyFormatOptions {
243
+ callToJSON?: boolean;
244
+ compareKeys?: CompareKeys;
245
+ escapeRegex?: boolean;
246
+ escapeString?: boolean;
247
+ highlight?: boolean;
248
+ indent?: number;
249
+ maxDepth?: number;
250
+ min?: boolean;
251
+ plugins?: Plugins;
252
+ printBasicPrototype?: boolean;
253
+ printFunctionName?: boolean;
254
+ theme?: ThemeReceived;
255
+ }
256
+ declare type OptionsReceived = PrettyFormatOptions;
257
+ declare type Config = {
258
+ callToJSON: boolean;
259
+ compareKeys: CompareKeys;
260
+ colors: Colors;
261
+ escapeRegex: boolean;
262
+ escapeString: boolean;
263
+ indent: string;
264
+ maxDepth: number;
265
+ min: boolean;
266
+ plugins: Plugins;
267
+ printBasicPrototype: boolean;
268
+ printFunctionName: boolean;
269
+ spacingInner: string;
270
+ spacingOuter: string;
271
+ };
272
+ declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
273
+ declare type Test = (arg0: any) => boolean;
274
+ declare type NewPlugin = {
275
+ serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
276
+ test: Test;
277
+ };
278
+ declare type PluginOptions = {
279
+ edgeSpacing: string;
280
+ min: boolean;
281
+ spacing: string;
282
+ };
283
+ declare type OldPlugin = {
284
+ print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
285
+ test: Test;
286
+ };
287
+ declare type Plugin = NewPlugin | OldPlugin;
288
+ declare type Plugins = Array<Plugin>;
289
+
192
290
  declare type SnapshotUpdateState = 'all' | 'new' | 'none';
193
291
  declare type SnapshotStateOptions = {
194
292
  updateSnapshot: SnapshotUpdateState;
@@ -227,6 +325,7 @@ interface SnapshotSummary {
227
325
  }
228
326
 
229
327
  declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom';
328
+ declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
230
329
  interface InlineConfig {
231
330
  /**
232
331
  * Include globs for test files
@@ -363,24 +462,10 @@ interface InlineConfig {
363
462
  * Coverage options
364
463
  */
365
464
  coverage?: C8Options;
366
- /**
367
- * Open Vitest UI
368
- * @internal WIP
369
- */
370
- open?: boolean;
371
465
  /**
372
466
  * run test names with the specified pattern
373
467
  */
374
468
  testNamePattern?: string | RegExp;
375
- /**
376
- * Listen to port and serve API
377
- *
378
- * When set to true, the default port is 55555
379
- *
380
- * @internal WIP
381
- * @default false
382
- */
383
- api?: boolean | number;
384
469
  /**
385
470
  * Will call `.mockClear()` on all spies before each test
386
471
  * @default false
@@ -396,6 +481,19 @@ interface InlineConfig {
396
481
  * @default false
397
482
  */
398
483
  restoreMocks?: boolean;
484
+ /**
485
+ * Serve API options.
486
+ *
487
+ * When set to true, the default port is 51204.
488
+ *
489
+ * @default false
490
+ */
491
+ api?: boolean | number | ApiConfig;
492
+ /**
493
+ * Open Vitest UI
494
+ * @internal WIP
495
+ */
496
+ open?: boolean;
399
497
  }
400
498
  interface UserConfig extends InlineConfig {
401
499
  /**
@@ -425,7 +523,7 @@ interface UserConfig extends InlineConfig {
425
523
  */
426
524
  related?: string[] | string;
427
525
  }
428
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related'> {
526
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api'> {
429
527
  config?: string;
430
528
  filters?: string[];
431
529
  testNamePattern?: RegExp;
@@ -436,6 +534,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
436
534
  interpretDefault: boolean;
437
535
  coverage: ResolvedC8Options;
438
536
  snapshotOptions: SnapshotStateOptions;
537
+ api?: ApiConfig;
439
538
  }
440
539
 
441
540
  declare class SnapshotManager {
package/dist/node.js CHANGED
@@ -1,6 +1,6 @@
1
- export { c as createVitest } from './index-05648ba5.js';
1
+ export { c as createVitest } from './index-98403570.js';
2
2
  import 'fs';
3
- import './index-f0488a5d.js';
3
+ import './index-9fdde2e8.js';
4
4
  import 'url';
5
5
  import 'tty';
6
6
  import 'local-pkg';
@@ -11,14 +11,15 @@ import 'os';
11
11
  import 'util';
12
12
  import 'stream';
13
13
  import 'events';
14
- import './constants-2cd49e0a.js';
14
+ import './constants-5b9c0d41.js';
15
15
  import './magic-string.es-94000aea.js';
16
16
  import 'perf_hooks';
17
- import './diff-711cddf1.js';
18
- import './index-7975be53.js';
17
+ import './diff-aa2146ff.js';
18
+ import './index-648e7ab2.js';
19
19
  import './_commonjsHelpers-c9e3b764.js';
20
20
  import 'assert';
21
21
  import 'module';
22
22
  import 'worker_threads';
23
23
  import 'tinypool';
24
24
  import './index-e909c175.js';
25
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
@@ -3,3 +3,4 @@ const rpc = () => {
3
3
  };
4
4
 
5
5
  export { rpc as r };
6
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLThjN2NjMzc0LmpzIiwic291cmNlcyI6WyIuLi9zcmMvcnVudGltZS9ycGMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IHJwYyA9ICgpID0+IHtcbiAgcmV0dXJuIHByb2Nlc3MuX192aXRlc3Rfd29ya2VyX18hLnJwY1xufVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFZLE1BQUMsR0FBRyxHQUFHLE1BQU07QUFDekIsRUFBRSxPQUFPLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxHQUFHLENBQUM7QUFDdkM7OyJ9