| 92 | | (string & Record<string, never>) |
| 93 | |
| 94 | export interface VitestRunner { |
| 95 | /** |
| 96 | * First thing that's getting called before actually collecting and running tests. |
| 97 | */ |
| 98 | onBeforeCollect?: (paths: string[]) => unknown |
| 99 | /** |
| 100 | * Called after the file task was created but not collected yet. |
| 101 | */ |
| 102 | onCollectStart?: (file: File) => unknown |
| 103 | /** |
| 104 | * Called after collecting tests and before "onBeforeRun". |
| 105 | */ |
| 106 | onCollected?: (files: File[]) => unknown |
| 107 | |
| 108 | /** |
| 109 | * Called when test runner should cancel next test runs. |
| 110 | * Runner should listen for this method and mark tests and suites as skipped in |
| 111 | * "onBeforeRunSuite" and "onBeforeRunTask" when called. |
| 112 | */ |
| 113 | cancel?: (reason: CancelReason) => unknown |
| 114 | |
| 115 | /** |
| 116 | * Called before running a single test. Doesn't have "result" yet. |
| 117 | */ |
| 118 | onBeforeRunTask?: (test: Test) => unknown |
| 119 | /** |
| 120 | * Called before actually running the test function. Already has "result" with "state" and "startTime". |
| 121 | */ |
| 122 | onBeforeTryTask?: ( |
| 123 | test: Test, |
| 124 | options: { retry: number; repeats: number }, |
| 125 | ) => unknown |
| 126 | /** |
| 127 | * When the task has finished running, but before cleanup hooks are called |
| 128 | */ |
| 129 | onTaskFinished?: (test: Test) => unknown |
| 130 | /** |
| 131 | * Called after result and state are set. |
| 132 | */ |
| 133 | onAfterRunTask?: (test: Test) => unknown |
| 134 | /** |
| 135 | * Called right after running the test function. Doesn't have new state yet. Will not be called, if the test function throws. |
| 136 | */ |
| 137 | onAfterTryTask?: ( |
| 138 | test: Test, |
| 139 | options: { retry: number; repeats: number }, |
| 140 | ) => unknown |
| 141 | /** |
| 142 | * Called after the retry resolution happened. Unlike `onAfterTryTask`, the test now has a new state. |
| 143 | * All `after` hooks were also called by this point. |
| 144 | */ |
| 145 | onAfterRetryTask?: ( |
| 146 | test: Test, |
| 147 | options: { retry: number; repeats: number }, |
| 148 | ) => unknown |
| 149 | |
| 150 | /** |
| 151 | * Called before running a single suite. Doesn't have "result" yet. |
no outgoing calls
no test coverage detected
searching dependent graphs…