new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · Test runner · all subjects

test/reporters

13 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

JUnit reporter configuration

Configure JUnit reporter output file path using [test.reporter] section: junit = 'path/to/junit.xml'. This is equivalent to using --reporter=junit --reporter-outfile CLI flags.

JUnit XML reports for CI/CD

To write a JUnit XML report, pass --reporter=junit together with --reporter-outfile. Example: bun test --reporter=junit --reporter-outfile=./bun.xml. bun test still writes to stdout/stderr as usual and writes the JUnit XML report to the given path at the end of the run.

Report merging with --parallel

Coverage, JUnit XML and snapshot writes are merged by the coordinator when using --parallel, so 'bun test --parallel --coverage --reporter=junit --reporter-outfile=junit.xml' produces one report.

Output format with --parallel

With --parallel, the output looks the same as a serial run: each file's results are printed together under its filename, and console.log output from a test is never interleaved with another file's output.

Default console reporter output format

The default `bun test` console reporter outputs test results in a human-readable format showing individual test names with pass/fail status and execution time in milliseconds, followed by a summary with pass count, fail count, expect() call count, and total execution time.

Console reporter without color support

When a terminal does not support colors, `bun test` console reporter avoids non-ASCII characters and uses '(pass)' and '(fail)' text instead of Unicode symbols.

Dots reporter usage

The dots reporter shows `.` for passing tests and prints full error details for failures. It is useful for large test suites. Enable it with `bun test --dots` or `bun test --reporter=dots`.

JUnit XML reporter command line usage

To generate a JUnit XML report, use `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.

JUnit reporter environment variables

The JUnit reporter includes environment variables as properties in the XML output. It captures CI build information from `GITHUB_RUN_ID`, `GITHUB_SERVER_URL`, `GITHUB_REPOSITORY`, `CI_JOB_URL` (property name: 'ci'), Git commit identifiers from `GITHUB_SHA`, `CI_COMMIT_SHA`, `GIT_SHA` (property name: 'commit'), and the system hostname (property name: 'hostname').

JUnit reporter limitations

The JUnit reporter does not include stdout and stderr output from individual tests, and does not include precise timestamp fields per test case.

GitHub Actions reporter auto-detection

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

Custom reporters with WebKit Inspector Protocol

Custom test reporters in Bun use WebKit Inspector Protocol extensions. Bun extends the standard protocol with two custom domains: TestReporter (reports test discovery, execution start, and completion events) and LifecycleReporter (reports errors and exceptions during test execution).

Custom reporter events

Custom reporters can listen for: 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), and LifecycleReporter.error (emitted when an error or exception occurs).

Give your agent this brain