vitest 0.0.140 → 0.0.141

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/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { ViteDevServer, CommonServerOptions, TransformResult } from 'vite';
2
- import { ViteNodeServer } from 'vite-node/server';
1
+ import { ViteDevServer, TransformResult, CommonServerOptions } from 'vite';
3
2
  import { MessagePort } from 'worker_threads';
4
3
  import { SpyImpl } from 'tinyspy';
5
4
  export { Spy, SpyFn } from 'tinyspy';
@@ -262,6 +261,37 @@ interface RawSourceMap extends StartOfSourceMap {
262
261
  mappings: string;
263
262
  }
264
263
 
264
+ interface ExternalizeOptions {
265
+ external?: (string | RegExp)[];
266
+ inline?: (string | RegExp)[];
267
+ fallbackCJS?: boolean;
268
+ }
269
+ interface ViteNodeServerOptions {
270
+ deps?: ExternalizeOptions;
271
+ transformMode?: {
272
+ ssr?: RegExp[];
273
+ web?: RegExp[];
274
+ };
275
+ }
276
+
277
+ declare class ViteNodeServer {
278
+ server: ViteDevServer;
279
+ options: ViteNodeServerOptions;
280
+ promiseMap: Map<string, Promise<TransformResult | null | undefined>>;
281
+ constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
282
+ shouldExternalize(id: string): Promise<string | false>;
283
+ fetchModule(id: string): Promise<{
284
+ externalize: string;
285
+ code?: undefined;
286
+ } | {
287
+ code: string | undefined;
288
+ externalize?: undefined;
289
+ }>;
290
+ transformRequest(id: string): Promise<TransformResult | null | undefined>;
291
+ private getTransformMode;
292
+ private _transformRequest;
293
+ }
294
+
265
295
  declare class SnapshotManager {
266
296
  config: ResolvedConfig;
267
297
  summary: SnapshotSummary;
@@ -923,6 +953,10 @@ interface InlineConfig {
923
953
  */
924
954
  web?: RegExp[];
925
955
  };
956
+ /**
957
+ * Format options for snapshot testing.
958
+ */
959
+ snapshotFormat?: PrettyFormatOptions;
926
960
  }
927
961
  interface UserConfig extends InlineConfig {
928
962
  /**
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-8e5d0623.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-4a8eca63.js';
1
+ export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-8d17efa1.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-9387000b.js';
3
3
  export { f as fn, i as isMockFunction, s as spies, a as spyOn } from './jest-mock-6c629944.js';
4
4
  export { assert, default as chai, should } from 'chai';
5
- import './index-53aca3c1.js';
5
+ import './index-1bb8e174.js';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
8
  import './_commonjsHelpers-c9e3b764.js';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { CommonServerOptions, ViteDevServer, UserConfig as UserConfig$1, Plugin as Plugin$1 } from 'vite';
2
- import { ViteNodeServer } from 'vite-node/server';
1
+ import { ViteDevServer, TransformResult, CommonServerOptions, UserConfig as UserConfig$1, Plugin as Plugin$1 } from 'vite';
3
2
 
4
3
  interface StartOfSourceMap {
5
4
  file?: string;
@@ -14,6 +13,124 @@ interface RawSourceMap extends StartOfSourceMap {
14
13
  mappings: string;
15
14
  }
16
15
 
16
+ interface ExternalizeOptions {
17
+ external?: (string | RegExp)[];
18
+ inline?: (string | RegExp)[];
19
+ fallbackCJS?: boolean;
20
+ }
21
+ interface ViteNodeServerOptions {
22
+ deps?: ExternalizeOptions;
23
+ transformMode?: {
24
+ ssr?: RegExp[];
25
+ web?: RegExp[];
26
+ };
27
+ }
28
+
29
+ declare class ViteNodeServer {
30
+ server: ViteDevServer;
31
+ options: ViteNodeServerOptions;
32
+ promiseMap: Map<string, Promise<TransformResult | null | undefined>>;
33
+ constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
34
+ shouldExternalize(id: string): Promise<string | false>;
35
+ fetchModule(id: string): Promise<{
36
+ externalize: string;
37
+ code?: undefined;
38
+ } | {
39
+ code: string | undefined;
40
+ externalize?: undefined;
41
+ }>;
42
+ transformRequest(id: string): Promise<TransformResult | null | undefined>;
43
+ private getTransformMode;
44
+ private _transformRequest;
45
+ }
46
+
47
+ /**
48
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
49
+ *
50
+ * This source code is licensed under the MIT license found in the
51
+ * LICENSE file in the root directory of this source tree.
52
+ */
53
+ declare type Colors = {
54
+ comment: {
55
+ close: string;
56
+ open: string;
57
+ };
58
+ content: {
59
+ close: string;
60
+ open: string;
61
+ };
62
+ prop: {
63
+ close: string;
64
+ open: string;
65
+ };
66
+ tag: {
67
+ close: string;
68
+ open: string;
69
+ };
70
+ value: {
71
+ close: string;
72
+ open: string;
73
+ };
74
+ };
75
+ declare type Indent = (arg0: string) => string;
76
+ declare type Refs = Array<unknown>;
77
+ declare type Print = (arg0: unknown) => string;
78
+ declare type ThemeReceived = {
79
+ comment?: string;
80
+ content?: string;
81
+ prop?: string;
82
+ tag?: string;
83
+ value?: string;
84
+ };
85
+ declare type CompareKeys = ((a: string, b: string) => number) | undefined;
86
+ interface PrettyFormatOptions {
87
+ callToJSON?: boolean;
88
+ compareKeys?: CompareKeys;
89
+ escapeRegex?: boolean;
90
+ escapeString?: boolean;
91
+ highlight?: boolean;
92
+ indent?: number;
93
+ maxDepth?: number;
94
+ min?: boolean;
95
+ plugins?: Plugins;
96
+ printBasicPrototype?: boolean;
97
+ printFunctionName?: boolean;
98
+ theme?: ThemeReceived;
99
+ }
100
+ declare type OptionsReceived = PrettyFormatOptions;
101
+ declare type Config = {
102
+ callToJSON: boolean;
103
+ compareKeys: CompareKeys;
104
+ colors: Colors;
105
+ escapeRegex: boolean;
106
+ escapeString: boolean;
107
+ indent: string;
108
+ maxDepth: number;
109
+ min: boolean;
110
+ plugins: Plugins;
111
+ printBasicPrototype: boolean;
112
+ printFunctionName: boolean;
113
+ spacingInner: string;
114
+ spacingOuter: string;
115
+ };
116
+ declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
117
+ declare type Test$1 = (arg0: any) => boolean;
118
+ declare type NewPlugin = {
119
+ serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
120
+ test: Test$1;
121
+ };
122
+ declare type PluginOptions = {
123
+ edgeSpacing: string;
124
+ min: boolean;
125
+ spacing: string;
126
+ };
127
+ declare type OldPlugin = {
128
+ print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
129
+ test: Test$1;
130
+ };
131
+ declare type Plugin = NewPlugin | OldPlugin;
132
+ declare type Plugins = Array<Plugin>;
133
+
17
134
  declare abstract class BaseReporter implements Reporter {
18
135
  start: number;
19
136
  end: number;
@@ -276,13 +393,13 @@ interface File extends Suite {
276
393
  filepath: string;
277
394
  collectDuration?: number;
278
395
  }
279
- interface Test$1 extends TaskBase {
396
+ interface Test extends TaskBase {
280
397
  type: 'test';
281
398
  suite: Suite;
282
399
  result?: TaskResult;
283
400
  fails?: boolean;
284
401
  }
285
- declare type Task = Test$1 | Suite | File;
402
+ declare type Task = Test | Suite | File;
286
403
 
287
404
  interface Reporter {
288
405
  onInit?(ctx: Vitest): void;
@@ -295,93 +412,6 @@ interface Reporter {
295
412
  onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
296
413
  }
297
414
 
298
- /**
299
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
300
- *
301
- * This source code is licensed under the MIT license found in the
302
- * LICENSE file in the root directory of this source tree.
303
- */
304
- declare type Colors = {
305
- comment: {
306
- close: string;
307
- open: string;
308
- };
309
- content: {
310
- close: string;
311
- open: string;
312
- };
313
- prop: {
314
- close: string;
315
- open: string;
316
- };
317
- tag: {
318
- close: string;
319
- open: string;
320
- };
321
- value: {
322
- close: string;
323
- open: string;
324
- };
325
- };
326
- declare type Indent = (arg0: string) => string;
327
- declare type Refs = Array<unknown>;
328
- declare type Print = (arg0: unknown) => string;
329
- declare type ThemeReceived = {
330
- comment?: string;
331
- content?: string;
332
- prop?: string;
333
- tag?: string;
334
- value?: string;
335
- };
336
- declare type CompareKeys = ((a: string, b: string) => number) | undefined;
337
- interface PrettyFormatOptions {
338
- callToJSON?: boolean;
339
- compareKeys?: CompareKeys;
340
- escapeRegex?: boolean;
341
- escapeString?: boolean;
342
- highlight?: boolean;
343
- indent?: number;
344
- maxDepth?: number;
345
- min?: boolean;
346
- plugins?: Plugins;
347
- printBasicPrototype?: boolean;
348
- printFunctionName?: boolean;
349
- theme?: ThemeReceived;
350
- }
351
- declare type OptionsReceived = PrettyFormatOptions;
352
- declare type Config = {
353
- callToJSON: boolean;
354
- compareKeys: CompareKeys;
355
- colors: Colors;
356
- escapeRegex: boolean;
357
- escapeString: boolean;
358
- indent: string;
359
- maxDepth: number;
360
- min: boolean;
361
- plugins: Plugins;
362
- printBasicPrototype: boolean;
363
- printFunctionName: boolean;
364
- spacingInner: string;
365
- spacingOuter: string;
366
- };
367
- declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
368
- declare type Test = (arg0: any) => boolean;
369
- declare type NewPlugin = {
370
- serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
371
- test: Test;
372
- };
373
- declare type PluginOptions = {
374
- edgeSpacing: string;
375
- min: boolean;
376
- spacing: string;
377
- };
378
- declare type OldPlugin = {
379
- print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
380
- test: Test;
381
- };
382
- declare type Plugin = NewPlugin | OldPlugin;
383
- declare type Plugins = Array<Plugin>;
384
-
385
415
  declare type SnapshotUpdateState = 'all' | 'new' | 'none';
386
416
  interface SnapshotStateOptions {
387
417
  updateSnapshot: SnapshotUpdateState;
@@ -632,6 +662,10 @@ interface InlineConfig {
632
662
  */
633
663
  web?: RegExp[];
634
664
  };
665
+ /**
666
+ * Format options for snapshot testing.
667
+ */
668
+ snapshotFormat?: PrettyFormatOptions;
635
669
  }
636
670
  interface UserConfig extends InlineConfig {
637
671
  /**
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestPlugin, c as createVitest } from './index-3faf3d6e.js';
1
+ export { V as VitestPlugin, c as createVitest } from './index-9a69ca2e.js';
2
2
  import 'fs';
3
3
  import './index-1b2eb03b.js';
4
4
  import 'path';
@@ -8,7 +8,7 @@ import 'os';
8
8
  import 'util';
9
9
  import 'stream';
10
10
  import 'events';
11
- import './index-53aca3c1.js';
11
+ import './index-1bb8e174.js';
12
12
  import 'tty';
13
13
  import 'local-pkg';
14
14
  import './index-c037b40c.js';
@@ -18,7 +18,7 @@ import 'assert';
18
18
  import './constants-124522a1.js';
19
19
  import './magic-string.es-94000aea.js';
20
20
  import 'perf_hooks';
21
- import './diff-deb11fa7.js';
21
+ import './diff-f7af3876.js';
22
22
  import './index-648e7ab2.js';
23
23
  import './_commonjsHelpers-c9e3b764.js';
24
24
  import 'worker_threads';