vitest 0.5.8 → 0.6.1

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 (42) hide show
  1. package/LICENSE.md +0 -7
  2. package/dist/chunk-api-setup.ec0afa15.js +4443 -0
  3. package/dist/chunk-constants.5cf7e54e.js +32 -0
  4. package/dist/chunk-defaults.52b18365.js +148 -0
  5. package/dist/chunk-install-pkg.ba2381b8.js +1643 -0
  6. package/dist/chunk-integrations-globals.b5263259.js +24 -0
  7. package/dist/chunk-magic-string.d5e0e473.js +1408 -0
  8. package/dist/chunk-runtime-chain.3d6b5653.js +7086 -0
  9. package/dist/chunk-runtime-rpc.1832c38c.js +1 -1
  10. package/dist/chunk-utils-base.2c363063.js +409 -0
  11. package/dist/chunk-utils-source-map.2d4c71ab.js +4648 -0
  12. package/dist/chunk-vite-node-externalize.5b9aed30.js +10859 -0
  13. package/dist/chunk-vite-node-utils.61fb6891.js +9451 -0
  14. package/dist/cli.js +26 -19
  15. package/dist/config.d.ts +19 -2
  16. package/dist/entry.js +57 -1088
  17. package/dist/index.d.ts +19 -9
  18. package/dist/index.js +8 -6
  19. package/dist/jest-mock.js +1 -1
  20. package/dist/node.d.ts +19 -2
  21. package/dist/node.js +13 -14
  22. package/dist/{vendor-_commonjsHelpers.91d4f591.js → vendor-_commonjsHelpers.edc3a5f0.js} +2 -2
  23. package/dist/vendor-index.a89597d0.js +1109 -0
  24. package/dist/vendor-index.ee829ed6.js +5708 -0
  25. package/dist/worker.js +11 -7
  26. package/importMeta.d.ts +4 -0
  27. package/package.json +38 -35
  28. package/dist/chunk-api-setup.95613d8f.js +0 -4444
  29. package/dist/chunk-constants.a1a50d89.js +0 -32
  30. package/dist/chunk-defaults.99570caf.js +0 -1833
  31. package/dist/chunk-install-pkg.7ce2052a.js +0 -1643
  32. package/dist/chunk-integrations-globals.9bda85f1.js +0 -24
  33. package/dist/chunk-magic-string.6c8f4a10.js +0 -1361
  34. package/dist/chunk-runtime-chain.d86ab074.js +0 -5946
  35. package/dist/chunk-runtime-hooks.aef17670.js +0 -42
  36. package/dist/chunk-utils-base.39767f3e.js +0 -225
  37. package/dist/chunk-utils-source-map.be2b14e2.js +0 -3407
  38. package/dist/chunk-vite-node-externalize.fcce9ced.js +0 -10515
  39. package/dist/chunk-vite-node-utils.f2f4fe4b.js +0 -9451
  40. package/dist/vendor-index.665a6ba4.js +0 -5708
  41. package/dist/vendor-index.76be1f4d.js +0 -187
  42. package/dist/vendor-index.f6809970.js +0 -1111
package/dist/config.d.ts CHANGED
@@ -130,7 +130,7 @@ interface ViteNodeServerOptions {
130
130
  */
131
131
  deps?: DepsHandlingOptions;
132
132
  /**
133
- * Tranform method for modules
133
+ * Transform method for modules
134
134
  */
135
135
  transformMode?: {
136
136
  ssr?: RegExp[];
@@ -233,7 +233,9 @@ declare class Vitest {
233
233
  exit(force?: boolean): Promise<void>;
234
234
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
235
235
  globTestFiles(filters?: string[]): Promise<string[]>;
236
- isTargetFile(id: string): boolean;
236
+ isTargetFile(id: string, source?: string): Promise<boolean>;
237
+ isInSourceTestFile(code: string): boolean;
238
+ printError(err: unknown): Promise<void>;
237
239
  onServerRestarted(fn: () => void): void;
238
240
  }
239
241
 
@@ -530,7 +532,9 @@ interface TaskBase {
530
532
  interface TaskResult {
531
533
  state: TaskState;
532
534
  duration?: number;
535
+ startTime?: number;
533
536
  error?: ErrorWithDiff;
537
+ hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
534
538
  }
535
539
  declare type TaskResultPack = [id: string, result: TaskResult | undefined];
536
540
  interface Suite extends TaskBase {
@@ -548,6 +552,13 @@ interface Test extends TaskBase {
548
552
  fails?: boolean;
549
553
  }
550
554
  declare type Task = Test | Suite | File;
555
+ declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
556
+ interface SuiteHooks {
557
+ beforeAll: HookListener<[Suite]>[];
558
+ afterAll: HookListener<[Suite]>[];
559
+ beforeEach: HookListener<[Test, Suite]>[];
560
+ afterEach: HookListener<[Test, Suite]>[];
561
+ }
551
562
 
552
563
  interface Reporter {
553
564
  onInit?(ctx: Vitest): void;
@@ -618,6 +629,12 @@ interface InlineConfig {
618
629
  * @default ['node_modules', 'dist', '.idea', '.git', '.cache']
619
630
  */
620
631
  exclude?: string[];
632
+ /**
633
+ * Include globs for in-source test files
634
+ *
635
+ * @default []
636
+ */
637
+ includeSource?: string[];
621
638
  /**
622
639
  * Handling for dependencies inlining or externalizing
623
640
  */