版博士V2.0程序
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

95 wiersze
3.4 KiB

  1. import { q as SequenceHooks, r as SequenceSetupFiles, F as File, g as Test, e as Suite, k as TaskResult, d as TestContext } from './tasks-3fbb29e4.js';
  2. interface VitestRunnerConfig {
  3. root: string;
  4. setupFiles: string[] | string;
  5. name: string;
  6. passWithNoTests: boolean;
  7. testNamePattern?: RegExp;
  8. allowOnly?: boolean;
  9. sequence: {
  10. shuffle?: boolean;
  11. seed: number;
  12. hooks: SequenceHooks;
  13. setupFiles: SequenceSetupFiles;
  14. };
  15. maxConcurrency: number;
  16. testTimeout: number;
  17. hookTimeout: number;
  18. }
  19. type VitestRunnerImportSource = 'collect' | 'setup';
  20. interface VitestRunnerConstructor {
  21. new (config: VitestRunnerConfig): VitestRunner;
  22. }
  23. interface VitestRunner {
  24. /**
  25. * First thing that's getting called before actually collecting and running tests.
  26. */
  27. onBeforeCollect?(paths: string[]): unknown;
  28. /**
  29. * Called after collecting tests and before "onBeforeRun".
  30. */
  31. onCollected?(files: File[]): unknown;
  32. /**
  33. * Called before running a single test. Doesn't have "result" yet.
  34. */
  35. onBeforeRunTest?(test: Test): unknown;
  36. /**
  37. * Called before actually running the test function. Already has "result" with "state" and "startTime".
  38. */
  39. onBeforeTryTest?(test: Test, retryCount: number): unknown;
  40. /**
  41. * Called after result and state are set.
  42. */
  43. onAfterRunTest?(test: Test): unknown;
  44. /**
  45. * Called right after running the test function. Doesn't have new state yet. Will not be called, if the test function throws.
  46. */
  47. onAfterTryTest?(test: Test, retryCount: number): unknown;
  48. /**
  49. * Called before running a single suite. Doesn't have "result" yet.
  50. */
  51. onBeforeRunSuite?(suite: Suite): unknown;
  52. /**
  53. * Called after running a single suite. Has state and result.
  54. */
  55. onAfterRunSuite?(suite: Suite): unknown;
  56. /**
  57. * If defined, will be called instead of usual Vitest suite partition and handling.
  58. * "before" and "after" hooks will not be ignored.
  59. */
  60. runSuite?(suite: Suite): Promise<void>;
  61. /**
  62. * If defined, will be called instead of usual Vitest handling. Useful, if you have your custom test function.
  63. * "before" and "after" hooks will not be ignored.
  64. */
  65. runTest?(test: Test): Promise<void>;
  66. /**
  67. * Called, when a task is updated. The same as "onTaskUpdate" in a reporter, but this is running in the same thread as tests.
  68. */
  69. onTaskUpdate?(task: [string, TaskResult | undefined][]): Promise<void>;
  70. /**
  71. * Called before running all tests in collected paths.
  72. */
  73. onBeforeRun?(files: File[]): unknown;
  74. /**
  75. * Called right after running all tests in collected paths.
  76. */
  77. onAfterRun?(files: File[]): unknown;
  78. /**
  79. * Called when new context for a test is defined. Useful, if you want to add custom properties to the context.
  80. * If you only want to define custom context, consider using "beforeAll" in "setupFiles" instead.
  81. */
  82. extendTestContext?(context: TestContext): TestContext;
  83. /**
  84. * Called, when files are imported. Can be called in two situations: when collecting tests and when importing setup files.
  85. */
  86. importFile(filepath: string, source: VitestRunnerImportSource): unknown;
  87. /**
  88. * Publicly available configuration.
  89. */
  90. config: VitestRunnerConfig;
  91. }
  92. export { VitestRunner as V, VitestRunnerConfig as a, VitestRunnerImportSource as b, VitestRunnerConstructor as c };