# Test Reporters (/docs/test/reporters)

<!-- agent-signals: reading_time_min: 3 · est_tokens: 1113 · updated: 2026-07-28 -->
Related: [Writing tests](/docs/test/writing-tests.md), [Test configuration](/docs/test/configuration.md), [Runtime behavior](/docs/test/runtime-behavior.md), [Finding tests](/docs/test/discovery.md), [Lifecycle hooks](/docs/test/lifecycle.md), [Mocks](/docs/test/mocks.md)

`bun test` supports different output formats through reporters, both built-in and custom.

***

## Built-in Reporters [#built-in-reporters]

### Default Console Reporter [#default-console-reporter]

By default, `bun test` outputs results to the console in a human-readable format:

```sh terminal icon="terminal"
test/package-json-lint.test.ts:
✓ test/package.json [0.88ms]
✓ test/js/third_party/grpc-js/package.json [0.18ms]
✓ test/js/third_party/svelte/package.json [0.21ms]
✓ test/js/third_party/express/package.json [1.05ms]

 4 pass
 0 fail
 4 expect() calls
Ran 4 tests in 1.44ms
```

When a terminal doesn't support colors, the output avoids non-ASCII characters:

```sh terminal icon="terminal"
test/package-json-lint.test.ts:
(pass) test/package.json [0.48ms]
(pass) test/js/third_party/grpc-js/package.json [0.10ms]
(pass) test/js/third_party/svelte/package.json [0.04ms]
(pass) test/js/third_party/express/package.json [0.04ms]

 4 pass
 0 fail
 4 expect() calls
Ran 4 tests across 1 files. [0.66ms]
```

### Dots Reporter [#dots-reporter]

The dots reporter shows `.` for passing tests and prints full error details for failures, useful for large test suites.

```sh terminal icon="terminal"
bun test --dots
bun test --reporter=dots
```

### JUnit XML Reporter [#junit-xml-reporter]

For CI/CD environments, Bun can generate JUnit XML reports, a widely-adopted test result format that many CI/CD systems can parse, including GitLab and Jenkins.

#### Using the JUnit Reporter [#using-the-junit-reporter]

To generate a JUnit XML report, use the `--reporter=junit` flag along with `--reporter-outfile` to specify the output file:

```sh terminal icon="terminal"
bun test --reporter=junit --reporter-outfile=./junit.xml
```

Console output is unchanged; Bun writes the JUnit XML report to the specified path at the end of the test run.

#### Configuring via bunfig.toml [#configuring-via-bunfigtoml]

You can also configure the JUnit reporter in `bunfig.toml`:

```toml title="bunfig.toml" icon="settings"
[test.reporter]
junit = "path/to/junit.xml"  # Output path for JUnit XML report
```

#### Environment Variables in JUnit Reports [#environment-variables-in-junit-reports]

The JUnit reporter includes environment information as `<properties>` in the XML output, so you can tell which environment and commit a test run was for.

It includes the following environment variables when available:

| Environment Variable                                                    | Property Name | Description            |
| ----------------------------------------------------------------------- | ------------- | ---------------------- |
| `GITHUB_RUN_ID`, `GITHUB_SERVER_URL`, `GITHUB_REPOSITORY`, `CI_JOB_URL` | `ci`          | CI build information   |
| `GITHUB_SHA`, `CI_COMMIT_SHA`, `GIT_SHA`                                | `commit`      | Git commit identifiers |
| System hostname                                                         | `hostname`    | Machine hostname       |

#### Current Limitations [#current-limitations]

The JUnit reporter does not include:

* `stdout` and `stderr` output from individual tests
* Precise timestamp fields per test case

### GitHub Actions reporter [#github-actions-reporter]

`bun test` detects when it's running inside GitHub Actions and emits GitHub Actions annotations to the console directly. No configuration is needed beyond installing Bun and running `bun test`.

For an example GitHub Actions workflow, see [CI/CD integration](/pm/cli/install#ci%2Fcd).

***

## Custom Reporters [#custom-reporters]

You can implement custom test reporters with Bun's testing-specific extensions to the WebKit Inspector Protocol, which report detailed information about test execution in real time.

### Inspector Protocol for Testing [#inspector-protocol-for-testing]

Bun extends the standard WebKit Inspector Protocol with two custom domains:

1. **TestReporter**: Reports test discovery, execution start, and completion events
2. **LifecycleReporter**: Reports errors and exceptions during test execution

### Key Events [#key-events]

Custom reporters can listen for these events:

* `TestReporter.found`: Emitted when a test is discovered
* `TestReporter.start`: Emitted when a test starts running
* `TestReporter.end`: Emitted when a test completes
* `Console.messageAdded`: Emitted when console output occurs during a test
* `LifecycleReporter.error`: Emitted when an error or exception occurs
