MCPcopy
hub / github.com/vitest-dev/vitest / Reporter

Interface Reporter

packages/vitest/src/node/types/reporter.ts:11–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9export type TestRunEndReason = 'passed' | 'interrupted' | 'failed'
10
11export 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 /**

Callers

nothing calls this directly

Implementers 12

HTMLReporterpackages/ui/node/reporter.ts
WebSocketReporterpackages/vitest/src/api/setup.ts
GithubActionsReporterpackages/vitest/src/node/reporters/git
HangingProcessReporterpackages/vitest/src/node/reporters/han
SummaryReporterpackages/vitest/src/node/reporters/sum
JsonReporterpackages/vitest/src/node/reporters/jso
JUnitReporterpackages/vitest/src/node/reporters/jun
BlobReporterpackages/vitest/src/node/reporters/blo
TapReporterpackages/vitest/src/node/reporters/tap
AbortReportertest/cli/test/signal.test.ts
CustomReportertest/cli/test/reporters/test-run.test.
TestReportertest/cli/fixtures/reporters/implementa

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…