| 9 | export type TestRunEndReason = 'passed' | 'interrupted' | 'failed' |
| 10 | |
| 11 | export interface Reporter { |
| 12 | onInit?: (vitest: Vitest) => void |
| 13 | /** |
| 14 | * Called when the project initiated the browser instance. |
| 15 | * project.browser will always be defined. |
| 16 | */ |
| 17 | onBrowserInit?: (project: TestProject) => Awaitable<void> |
| 18 | /** @internal */ |
| 19 | onTaskUpdate?: (packs: TaskResultPack[], events: TaskEventPack[]) => Awaitable<void> |
| 20 | onTestRemoved?: (trigger?: string) => Awaitable<void> |
| 21 | onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void> |
| 22 | onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void> |
| 23 | onServerRestart?: (reason?: string) => Awaitable<void> |
| 24 | onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void> |
| 25 | onProcessTimeout?: () => Awaitable<void> |
| 26 | |
| 27 | /** |
| 28 | * Called when the new test run starts. |
| 29 | */ |
| 30 | onTestRunStart?: (specifications: ReadonlyArray<TestSpecification>) => Awaitable<void> |
| 31 | /** |
| 32 | * Called when the test run is finished. |
| 33 | */ |
| 34 | onTestRunEnd?: ( |
| 35 | testModules: ReadonlyArray<TestModule>, |
| 36 | unhandledErrors: ReadonlyArray<SerializedError>, |
| 37 | reason: TestRunEndReason, |
| 38 | ) => Awaitable<void> |
| 39 | |
| 40 | /** |
| 41 | * Called when the module is enqueued for testing. The file itself is not loaded yet. |
| 42 | */ |
| 43 | onTestModuleQueued?: (testModule: TestModule) => Awaitable<void> |
| 44 | /** |
| 45 | * Called when the test file is loaded and the module is ready to run tests. |
| 46 | */ |
| 47 | onTestModuleCollected?: (testModule: TestModule) => Awaitable<void> |
| 48 | /** |
| 49 | * Called when starting to run tests of the test file |
| 50 | */ |
| 51 | onTestModuleStart?: (testModule: TestModule) => Awaitable<void> |
| 52 | /** |
| 53 | * Called when all tests of the test file have finished running. |
| 54 | */ |
| 55 | onTestModuleEnd?: (testModule: TestModule) => Awaitable<void> |
| 56 | |
| 57 | /** |
| 58 | * Called when test case is ready to run. |
| 59 | * Called before the `beforeEach` hooks for the test are run. |
| 60 | */ |
| 61 | onTestCaseReady?: (testCase: TestCase) => Awaitable<void> |
| 62 | /** |
| 63 | * Called after the test and its hooks are finished running. |
| 64 | * The `result()` cannot be `pending`. |
| 65 | */ |
| 66 | onTestCaseResult?: (testCase: TestCase) => Awaitable<void> |
| 67 | |
| 68 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…