vitest 0.5.3 → 0.5.6

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.
Files changed (44) hide show
  1. package/dist/chunk-api-setup.ab3a8330.js +4444 -0
  2. package/dist/chunk-constants.a1a50d89.js +32 -0
  3. package/dist/chunk-defaults.8ca84d7b.js +1833 -0
  4. package/dist/chunk-install-pkg.7ce2052a.js +1643 -0
  5. package/dist/chunk-integrations-globals.9bda85f1.js +24 -0
  6. package/dist/chunk-magic-string.6c8f4a10.js +1361 -0
  7. package/dist/chunk-runtime-chain.d86ab074.js +5946 -0
  8. package/dist/chunk-runtime-hooks.aef17670.js +42 -0
  9. package/dist/chunk-runtime-rpc.1832c38c.js +6 -0
  10. package/dist/chunk-utils-base.39767f3e.js +225 -0
  11. package/dist/chunk-utils-source-map.be2b14e2.js +3407 -0
  12. package/dist/chunk-vite-node-externalize.e6096d90.js +10515 -0
  13. package/dist/chunk-vite-node-utils.952694b8.js +9451 -0
  14. package/dist/cli.js +13 -15
  15. package/dist/config.cjs +1 -1
  16. package/dist/config.d.ts +8 -0
  17. package/dist/config.js +1 -1
  18. package/dist/entry.js +26 -16
  19. package/dist/index.d.ts +27 -2
  20. package/dist/index.js +5 -5
  21. package/dist/node.d.ts +8 -0
  22. package/dist/node.js +11 -11
  23. package/dist/{_commonjsHelpers-c9e3b764.js → vendor-_commonjsHelpers.91d4f591.js} +1 -1
  24. package/dist/vendor-index.665a6ba4.js +5708 -0
  25. package/dist/vendor-index.76be1f4d.js +187 -0
  26. package/dist/vendor-index.f6809970.js +1111 -0
  27. package/dist/worker.js +5 -5
  28. package/package.json +3 -3
  29. package/dist/cli-api-fad4785e.js +0 -10497
  30. package/dist/client-4904f549.js +0 -9451
  31. package/dist/constants-c746dc5b.js +0 -32
  32. package/dist/diff-d3ddd21a.js +0 -1833
  33. package/dist/globals-5a96d13e.js +0 -24
  34. package/dist/index-013ecdfe.js +0 -225
  35. package/dist/index-072c45fd.js +0 -5708
  36. package/dist/index-0996637f.js +0 -1111
  37. package/dist/index-1488b423.js +0 -187
  38. package/dist/index-1945a7c3.js +0 -1643
  39. package/dist/index-8353ea65.js +0 -42
  40. package/dist/magic-string.es-94000aea.js +0 -1361
  41. package/dist/rpc-377d999b.js +0 -6
  42. package/dist/setup-047a81dd.js +0 -4444
  43. package/dist/source-map-b4f7fd10.js +0 -3407
  44. package/dist/vi-3bad443e.js +0 -5943
package/dist/index.d.ts CHANGED
@@ -358,6 +358,7 @@ declare abstract class BaseReporter implements Reporter {
358
358
  watchFilters?: string[];
359
359
  isTTY: boolean;
360
360
  ctx: Vitest;
361
+ constructor();
361
362
  onInit(ctx: Vitest): void;
362
363
  relative(path: string): string;
363
364
  onFinished(files?: File[]): Promise<void>;
@@ -368,6 +369,7 @@ declare abstract class BaseReporter implements Reporter {
368
369
  onServerRestart(): void;
369
370
  reportSummary(files: File[]): Promise<void>;
370
371
  private printTaskErrors;
372
+ registerUnhandledRejection(): void;
371
373
  }
372
374
 
373
375
  interface ListRendererOptions {
@@ -699,7 +701,24 @@ interface Test extends TaskBase {
699
701
  declare type Task = Test | Suite | File;
700
702
  declare type DoneCallback = (error?: any) => void;
701
703
  declare type TestFunction = (done: DoneCallback) => Awaitable<void>;
702
- declare type EachFunction = <T>(cases: T[] | readonly T[]) => (name: string, fn: (...args: T extends any[] | readonly any[] ? MutableArray<T> : [T]) => void) => void;
704
+ declare type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
705
+ 1: [T[0]];
706
+ 2: [T[0], T[1]];
707
+ 3: [T[0], T[1], T[2]];
708
+ 4: [T[0], T[1], T[2], T[3]];
709
+ 5: [T[0], T[1], T[2], T[3], T[4]];
710
+ 6: [T[0], T[1], T[2], T[3], T[4], T[5]];
711
+ 7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6]];
712
+ 8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7]];
713
+ 9: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8]];
714
+ 10: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8], T[9]];
715
+ fallback: Array<T extends ReadonlyArray<infer U> ? U : any>;
716
+ }[T extends Readonly<[any]> ? 1 : T extends Readonly<[any, any]> ? 2 : T extends Readonly<[any, any, any]> ? 3 : T extends Readonly<[any, any, any, any]> ? 4 : T extends Readonly<[any, any, any, any, any]> ? 5 : T extends Readonly<[any, any, any, any, any, any]> ? 6 : T extends Readonly<[any, any, any, any, any, any, any]> ? 7 : T extends Readonly<[any, any, any, any, any, any, any, any]> ? 8 : T extends Readonly<[any, any, any, any, any, any, any, any, any]> ? 9 : T extends Readonly<[any, any, any, any, any, any, any, any, any, any]> ? 10 : 'fallback'];
717
+ interface EachFunction {
718
+ <T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => void) => void;
719
+ <T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => void) => void;
720
+ <T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => void) => void;
721
+ }
703
722
  declare type TestAPI = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
704
723
  name: string,
705
724
  fn?: TestFunction,
@@ -848,6 +867,12 @@ interface InlineConfig {
848
867
  */
849
868
  fallbackCJS?: boolean;
850
869
  };
870
+ /**
871
+ * Base directory to scan for the test files
872
+ *
873
+ * @default `config.root`
874
+ */
875
+ dir?: string;
851
876
  /**
852
877
  * Register apis globally
853
878
  *
@@ -1416,4 +1441,4 @@ declare global {
1416
1441
  }
1417
1442
  }
1418
1443
 
1419
- 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, 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, describe, expect, fn, isMockFunction, it, spies, spyOn, suite, test, vi, vitest };
1444
+ export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, 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, describe, expect, fn, isMockFunction, it, spies, spyOn, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-3bad443e.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-8353ea65.js';
1
+ export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './chunk-runtime-chain.d86ab074.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './chunk-runtime-hooks.aef17670.js';
3
3
  export { fn, isMockFunction, spies, spyOn } from './jest-mock.js';
4
4
  export { assert, default as chai, should } from 'chai';
5
5
  import 'util';
6
- import './index-013ecdfe.js';
6
+ import './chunk-utils-base.39767f3e.js';
7
7
  import 'tty';
8
8
  import 'local-pkg';
9
- import './source-map-b4f7fd10.js';
10
- import './_commonjsHelpers-c9e3b764.js';
9
+ import './chunk-utils-source-map.be2b14e2.js';
10
+ import './vendor-_commonjsHelpers.91d4f591.js';
11
11
  import 'tinyspy';
12
12
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OyJ9
package/dist/node.d.ts CHANGED
@@ -163,6 +163,7 @@ declare abstract class BaseReporter implements Reporter {
163
163
  watchFilters?: string[];
164
164
  isTTY: boolean;
165
165
  ctx: Vitest;
166
+ constructor();
166
167
  onInit(ctx: Vitest): void;
167
168
  relative(path: string): string;
168
169
  onFinished(files?: File[]): Promise<void>;
@@ -173,6 +174,7 @@ declare abstract class BaseReporter implements Reporter {
173
174
  onServerRestart(): void;
174
175
  reportSummary(files: File[]): Promise<void>;
175
176
  private printTaskErrors;
177
+ registerUnhandledRejection(): void;
176
178
  }
177
179
 
178
180
  interface ListRendererOptions {
@@ -570,6 +572,12 @@ interface InlineConfig {
570
572
  */
571
573
  fallbackCJS?: boolean;
572
574
  };
575
+ /**
576
+ * Base directory to scan for the test files
577
+ *
578
+ * @default `config.root`
579
+ */
580
+ dir?: string;
573
581
  /**
574
582
  * Register apis globally
575
583
  *
package/dist/node.js CHANGED
@@ -1,10 +1,10 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './cli-api-fad4785e.js';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.e6096d90.js';
2
2
  import 'buffer';
3
3
  import 'path';
4
4
  import 'child_process';
5
5
  import 'process';
6
- import './index-0996637f.js';
7
- import './_commonjsHelpers-c9e3b764.js';
6
+ import './vendor-index.f6809970.js';
7
+ import './vendor-_commonjsHelpers.91d4f591.js';
8
8
  import 'fs';
9
9
  import 'assert';
10
10
  import 'events';
@@ -12,21 +12,21 @@ import 'stream';
12
12
  import 'util';
13
13
  import 'url';
14
14
  import 'os';
15
- import './index-013ecdfe.js';
15
+ import './chunk-utils-base.39767f3e.js';
16
16
  import 'tty';
17
17
  import 'local-pkg';
18
- import './index-1488b423.js';
18
+ import './vendor-index.76be1f4d.js';
19
19
  import 'vite';
20
- import './constants-c746dc5b.js';
21
- import './client-4904f549.js';
20
+ import './chunk-constants.a1a50d89.js';
21
+ import './chunk-vite-node-utils.952694b8.js';
22
22
  import 'module';
23
23
  import 'vm';
24
- import './diff-d3ddd21a.js';
25
- import './source-map-b4f7fd10.js';
24
+ import './chunk-defaults.8ca84d7b.js';
25
+ import './chunk-utils-source-map.be2b14e2.js';
26
26
  import 'perf_hooks';
27
27
  import 'worker_threads';
28
28
  import 'tinypool';
29
- import './magic-string.es-94000aea.js';
29
+ import './chunk-magic-string.6c8f4a10.js';
30
30
  import 'readline';
31
- import './index-072c45fd.js';
31
+ import './vendor-index.665a6ba4.js';
32
32
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
@@ -9,4 +9,4 @@ function commonjsRequire (path) {
9
9
  }
10
10
 
11
11
  export { commonjsRequire as a, commonjsGlobal as c, getDefaultExportFromCjs as g };
12
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiX2NvbW1vbmpzSGVscGVycy1jOWUzYjc2NC5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7In0=
12
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVuZG9yLV9jb21tb25qc0hlbHBlcnMuOTFkNGY1OTEuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OyJ9