···44This is an advanced API. If you just want to configure built-in reporters, read the ["Reporters"](/guide/reporters) guide.
55:::
6677-You can import reporters from `vitest/reporters` and extend them to create your custom reporters.
77+You can import reporters from `vitest/node` and extend them to create your custom reporters.
8899## Extending Built-in Reporters
1010···1818}
1919```
20202121-Of course, you can create your reporter from scratch. Just extend the `BaseReporter` class and implement the methods you need.
2121+::: warning
2222+However, note that exposed reports are not considered stable and can change the shape of their API within a minor version.
2323+:::
2424+2525+Of course, you can create your reporter from scratch. Just implement the [`Reporter`](/api/advanced/reporters) interface:
22262327And here is an example of a custom reporter:
2424-2525-```ts [custom-reporter.js]
2626-import { BaseReporter } from 'vitest/node'
2727-2828-export default class CustomReporter extends BaseReporter {
2929- onTestModuleCollected() {
3030- const files = this.ctx.state.getFiles(this.watchFilters)
3131- this.reportTestSummary(files)
3232- }
3333-}
3434-```
3535-3636-Or implement the `Reporter` interface:
37283829```ts [custom-reporter.js]
3930import type { Reporter } from 'vitest/node'
40314132export default class CustomReporter implements Reporter {
4242- onTestModuleCollected() {
4343- // print something
3333+ onTestModuleCollected(testModule) {
3434+ console.log(testModule.moduleId, 'is finished')
3535+3636+ for (const test of testModule.children.allTests()) {
3737+ console.log(test.name, test.result().state)
3838+ }
4439 }
4540}
4641```
···60556156## Reported Tasks
62576363-Instead of using the tasks that reporters receive, it is recommended to use the Reported Tasks API instead.
6464-6565-You can get access to this API by calling `vitest.state.getReportedEntity(runnerTask)`:
5858+Reported [events](/api/advanced/reporters) receive tasks for [tests](/api/advanced/test-case), [suites](/api/advanced/test-suite) and [modules](/api/advanced/test-module):
66596760```ts twoslash
6861import type { Reporter, TestModule } from 'vitest/node'
···94877. `TapFlatReporter`
95888. `HangingProcessReporter`
96899. `TreeReporter`
9797-9898-### Base Abstract reporters:
9999-100100-1. `BaseReporter`
1019010291### Interface reporters:
10392