[ agent view ]
Documentation Index
Fetch the complete documentation index at: https://e2e.com/docs/llms.txt Use this file to discover all available pages before exploring further.
Reporters
Receive run events and publish results with a custom reporter.
A reporter receives the run's events as they happen and the finished run
once its report is written. reporters in e2e.config.ts lists built-in
reporters by id beside reporter objects.
export default {
targets: [{ engine: web(), app: { url: 'http://localhost:3000' } }],
reporters: ['list', 'junit', github()],
} satisfies E2EConfig;
Reference
Built-in reporters
| Reporter | Description |
|---|---|
list | Terminal progress and run summary |
json | Report document to stdout |
junit | Writes <output>/junit.xml |
markdown | Writes <output>/summary.md |
github() | Pull request comment and job summary |
htmlReporter() | Writes <output>/report.html |
| Throws | When |
|---|---|
INVALID_CONFIG | reporters is not an array. |
INVALID_CONFIG | An id other than list, json, junit, or markdown. |
INVALID_CONFIG | An entry that is neither an id nor an object with a name and at least one handler. |
INVALID_CONFIG | json together with list. |
list
Renders terminal progress, failures, and the run summary.
reporters: ['list'], // default
- It renders the same events
onEventreceives. - On a TTY a live view shows the running tests. When stdout is not a terminal (piped, redirected, most CI), each test prints as it finishes.
- The summary rows reporters return print under its summary.
- The output ends with a
Failedrow per failed test: its file and line, its error's first line, and its trace page when one was written, soe2e run | tailstill names what broke.
json
Prints the report document to stdout.
reporters: ['json'],
junit
Writes junit.xml beside the report.
reporters: ['list', 'junit'],
- It reads
run.report, writesjunit.xmlbesiderun.reportPath, and returns one row naming the file. It is the smallest complete example of a reporter. - When a test that failed, timed out, passed only on a retry, or failed as
test.failexpected recorded a failure screenshot, its<testcase>links it as<system-out>[[ATTACHMENT|<path>]]</system-out>, which GitLab CI shows in the pipeline test report. The path is relative to$CI_PROJECT_DIR, or to the project root when that is unset; screenshots outside it get no link. - A second Ctrl-C still lets it write its file, so no file from the previous run is left beside the new report.
markdown
Writes summary.md beside the report.
reporters: ['list', 'markdown'],
It does what junit does, second Ctrl-C included, with summary.md and
through renderMarkdownReport.
renderMarkdownReport
Renders a report as the Markdown page the markdown reporter writes, so
your own reporter can post the same page elsewhere.
const reporter: Reporter = {
name: 'wiki',
async onRunFinished(run) {
const page = renderMarkdownReport(run.report, { traces: run.traces });
await fetch('https://wiki.example.test/runs', { method: 'POST', body: page });
},
};
traceslinks each block to its trace page by result id.@e2e-dev/githubis that reporter for GitHub Actions.
github()
@e2e-dev/github posts the run as one pull request comment from GitHub
Actions, keeps it current on reruns, and writes the same text to the job
summary.
const reporter = github({ key: 'chromium' });
keytells one job's comment apart from another's when the workflow, job, and project are the same, as in a matrix. Without it, matrix replicas of one job share a comment, and the last one to finish wins. Never use the run id: a rerun must find the old comment. The key also names the comment in its headline:e2e chromium: 77 passed.- It reads the token, the event, and the repository when the run finishes, never when the config loads.
- With
--last-failed, it folds the rerun intolastRunto show both runs as one comment. - Setup and permissions are on Pull request comments.
htmlReporter()
@e2e-dev/html-reporter writes the run as one page you open in a browser:
the tests by file with status tabs and a search box, and for each test its
attempts, error, steps, screenshots, and video.
const reporter = htmlReporter({ media: 'embed' });
-
It writes
report.htmlbeside the report, with the report document embedded. The page opens from disk with no server. -
mediadecides what happens to screenshots, videos, and downloads:mediaThe page To share it 'link'(default)links them from <output>/results/by relative pathkeep the output directory together, as one CI artifact 'embed'holds them, so the one file is the whole report send the file; device videos make it tens of megabytes per minute 'none'leaves them out and shows text only send the file A download link saves the file instead of opening it. A download the runner could not scan for secrets, such as a PDF or a zip, stays out of an embedded page, and a video a hosted browser or device service keeps stays a link to it.
-
outputFileputs the page elsewhere, as a path from the project root. -
The page shows only the run that wrote it: after
--last-failed, the rerun's tests without the failures it carried over, and undere2e explore, the exploration without its findings. -
The tests list as a tree: each file, its describe blocks, then their tests, failures first. Selecting a file's path folds its tests away.
-
Each step shows where it starts in the attempt's video; selecting the time plays the video from there, and the step the video is on stays highlighted. The video's timeline marks each step's start, and its speed button steps from 0.25× to 4×; a recording under five seconds starts slowed down. A phone recording sits beside the steps instead of above them.
-
A failed assertion that reports expected and received values (a locator assertion, say) shows them with the characters that differ marked. When the test file is in the project, the failure shows the code around the failing call, and each step opens to the code that ran it. The page keeps a few lines of the test files around each step for this, so a shared report shows them too.
-
copy prompt on a failed attempt's error copies the failure for a coding agent: the error, the steps, what the failed step did, and the paths of whichever of its trace page, screen tree, screenshot, and video exist, from the project root.
-
Agent steps show their explanation, the actions they took, the model, tokens and cost, whether the step replayed from the cache, and their last turns.
-
The page follows the system's light or dark theme. The sun and moon at the top hold one, and the browser keeps the choice for every report it opens.
Custom reporters
A reporter object has a name and at least one handler. Use onEvent for
live progress and onRunFinished to process the final report and artifacts.
const upload: Reporter = {
name: 'upload',
async onRunFinished(run) {
const response = await fetch('https://example.test/runs', {
method: 'POST',
body: JSON.stringify(run.report),
});
const { url } = (await response.json()) as { url: string };
return [{ label: 'Results', text: url }];
},
};
export default {
targets: [{ engine: web(), app: { url: 'localhost:3000' } }],
reporters: ['list', upload],
} satisfies E2EConfig;
| Member | Type |
|---|---|
name | string |
onEvent | (event: RunEvent) => void |
onRunFinished | (run, signal) => Promise<…> |
interface Reporter {
readonly name: string;
onEvent?(event: RunEvent): void;
onRunFinished?(run: FinishedRun, signal: AbortSignal): Promise<ReporterSummary | void>;
}
Cached steps expose cache.recordedBy: { provider, model } in report.json
and on the trace page when the recording has it. Older recordings omit it.
The console prints replayed · recorded with provider/model only when that
identity differs from the configured model. It stays quiet for multi-agent
runs and for pinned agents whose model is not in the run header.
name
The reporter's label in diagnostics. Required and non-empty.
name: 'upload',
onEvent
Receives every run event as it happens, as plain JSON.
onEvent(event) {
switch (event.type) {
case 'test-finished':
console.log(event.result.test.title, event.result.status);
break;
default:
}
},
Events lists them.
onEvent must not block and must not throw. Do slow work in
onRunFinished. A throw quarantines the reporter for the rest of the run and
prints one line on stderr naming the reporter, the event type, and the error.
The run's outcome is unchanged.
onRunFinished
Runs once the report is written and the terminal summary prints, with the
finished run and an AbortSignal.
async onRunFinished(run, signal) {
await fetch('https://example.test/runs', { method: 'POST', body: JSON.stringify(run.report), signal });
return [{ label: 'Results', text: 'https://example.test/runs/0192c' }];
},
interface FinishedRun {
readonly report: Report; // the report-1 document, as written
readonly status: RunStatus; // report.run.status
readonly exitCode: RunExitCode;
readonly projectRoot: string; // what the terminal shows paths relative to
readonly reportPath: string | undefined; // absent when the write failed
readonly artifactsRoot: string; // what the report's artifact paths are relative to
readonly aiTracePath: string | undefined;
readonly traces: ReadonlyMap<string, string>; // result id -> its trace page, from the project root
readonly lastRun?: Report; // with --last-failed, the report the rerun selected from
redact(text: string): string; // masks the config's fixed secret values (not provider-resolved ones) in text from outside the report
}
type ReporterSummary = readonly { label: string; text: string }[];
- All reporters run concurrently, each with a one-minute deadline.
- A timeout, exception, or invalid return value is reported on stderr. The run's status, exit code, and report do not change.
- One Ctrl-C still lets reporters finish. A second Ctrl-C stops waiting for
them, except
junitandmarkdown. signalaborts when the budget runs out or the run is forced to stop.- The runner writes the trace pages,
results/<test>/trace.md, before it callsonRunFinished.
Hand signal to every request and timer. The CLI exits without waiting for
a reporter it abandoned, cutting off what it still does; under
e2e/runner, that work keeps your process alive.
Summary rows
The rows a reporter resolves with print under the list summary, in the
same layout as its own rows. The json reporter does not carry them.
Test Files 2 passed (2)
Tests 6 passed (6)
Start at 14:02:11
Duration 8.41s
JUnit .e2e/junit.xml
Results https://example.test/runs/0192c…
Artifacts
- Artifact paths in the report are POSIX paths relative to
artifactsRoot. path,size, andsha256are optional: an artifact whose file never appeared, or that a redaction withheld, is recorded without them. Check forpathbefore reading.- A video a hosted service keeps has an
http(s)urlin place ofpath.
Reruns with --last-failed
- The rerun's own report lists the tests it left out as unselected. A
reporter that keeps one place current, the way
@e2e-dev/githubkeeps a pull request comment, folds the rerun intolastRunto show both runs as one. - A test the rerun owed but another filter left out is in the rerun's
run.carried. It holds the test's last result, the serial group its attempts live on, and thebeforeAllorafterAllfailure whose scope holds it, from whichever earlier run reported them. - A fold shows the carried result in place of the unselected one and counts a carried failure or hook error against the outcome.
- The artifacts both reports name are on disk under
artifactsRoot.
Test filters
- A test a test filter left out is an unselected result with
skip.causefilteredandskip.filternaming the filter. run.filtersholds one record per filter that was called, in order:name,candidates,excluded(the tests left out once serial groups took back their members),note(cut to 1024 characters; for a filter that failed or timed out, the warning saying why), andoutcome, set when the filter left nothing out:failedwhen it threw or returned an invalid result,timed-outwhen it ran past 5 minutes. A filter left with no tests is not called and has no record.- Once the filters have decided,
run.changesholds the change they judged, by counts:base(the merge base),files, andskipped(why no filter ran, such asno files changed since abc1234). It is present when filters are configured and the run passed--changed-since, except undere2e explore, on--watchreruns, and when the run ends before the filters decide. On--last-failed, or with no tests to judge, it holdsskippedalone. - A failure while the filters decide, such as
INVALID_CHANGED_SINCEfor a ref that names no commit, is inrun.errorswithphasefilter. A malformedchangedSincehasphaseconfig.
Events
onEvent receives one of these facts. Each event also has a sequence
number, seq, and an ISO timestamp, at.
type RunEventFact =
| { type: 'run-started'; runId; projectId; projectRoot; artifactsRoot; ci; targets; agents?; model?; judge? }
| { type: 'plan'; total; files: { file; target; tests }[] }
| { type: 'notice'; target; message }
| { type: 'output'; target; pair; stream: 'stdout' | 'stderr'; text }
| { type: 'setup'; step: SetupStep; state: 'started' }
| { type: 'setup'; step: SetupStep; state: 'finished'; durationMs; outcome?: 'reused' | 'failed' | 'timed-out' }
| { type: 'test-started'; testId; agent; repeat; title; file; serialId; target }
| { type: 'step'; testId; agent; repeat; target; progress: StepProgress }
| { type: 'test-finished'; result: RunEventResult }
| { type: 'serial-group'; group: SerialGroupRecord }
| { type: 'explore'; progress: ExploreProgress }
| { type: 'run-error'; error: SerializedError }
| { type: 'run-interrupted'; mode: 'graceful' | 'forced' }
| { type: 'run-stopped'; failures; limit }
| { type: 'run-finished'; status; exitCode; reportPath?; aiTracePath?; traces? };
run-startedcomes first andrun-finishedlast.targetsonrun-startednames the targets the run selected with--target, in config order, or every configured target without it or when--targetnames an unknown target, which fails the run withUNKNOWN_TARGET. The report'srun.targetsstill lists every configured target.judgeonrun-startedis the run agent's judge model, present only when judgments use a model other thanmodel.setupbrackets the work before the tests start. Itsstep.kindiscollect,filter(one test filter, by itsname),prepare,service, orapp. Anappstep'surlis the URL its readiness probe polls, with a free port filled in and no userinfo or query.outcomeisreusedwhen a service or app command attached to a process already serving its URL,failedwhen a filter threw or returned an invalid result, andtimed-outwhen a filter ran past 5 minutes.- A
noticenames what its line is about intarget: a target,app,collect,filterfor a test filter's progress and summary, orrun. outputis one write a test made to stdout or stderr;pairnames the test running at the time and is undefined between tests.test-finishedcarries the full result record, including every attempt's artifacts.exploreappears only in ane2e explorerun:started,planning,step-started,step-finished,finding, andfinished. The record of all of it isrun.explorein the report.- New event types are added over time. Handle the types you know and ignore
the rest; leave the
defaultbranch of aswitchempty.
Tests and attempts
- A test pinned to several agents starts and finishes once per agent, so key running state by test id, target, and agent together.
- Ordinary tests emit
test-startedonce for that combination. Serial members emit it on each group attempt they execute. - Use step progress identity to distinguish retries.
- An attempt that fails before any step emits no step progress and appears in the final result.
Secrets are redacted before events are built. Error messages are only stripped of control characters, so treat them as untrusted.
Step progress
The phase field describes step progress:
startandendmark the step's boundaries.eventreports a completed model turn, tool call, or observation.activityreports work starting:observe,action, ormodel.replayreports when replay from the cache starts or returns control to the agent.
type StepProgress = (
| { phase: 'start'; kind: StepKind; api: string; label: string }
| {
phase: 'end';
kind: StepKind;
api: string;
label: string;
status: 'passed' | 'failed' | 'blocked' | 'timed-out' | 'cancelled';
durationMs: number;
modelCalls: number;
error?: SerializedError;
explanation?: string;
}
| { phase: 'event'; api: string; event: StepEvent }
| { phase: 'activity'; api: string; activity: 'observe' | 'model' | 'action' }
| { phase: 'replay'; api: string; active: boolean }
) & { identity?: StepProgressIdentity };
An end phase's error and explanation are redacted. Keep its status,
including blocked and cancelled. Do not treat every non-passed step as a
product failure.
Every step phase the runner emits includes progress.identity:
{ attemptId: string; attemptIndex: number; stepId: string; stepIndex: number }
- The IDs match the final report. Both indexes start at zero.
- A retry has a new attempt ID and a higher attempt index; its step indexes start again at zero.
- Serial-group members share the group's attempt ID and index. Each member's step IDs stay distinct.
- Use
stepIdto match start, activity, event, replay, and end phases, including nested steps. identityis optional in the type so a reporter can also accept older streams.
What --reporter does to reporter objects
--reporter replaces only the built-in reporters; configured reporter
objects still run.
npx e2e run --reporter list,junit
pnpm exec e2e run --reporter list,junit
bunx e2e run --reporter list,junit
- A config with only reporter objects has no built-in terminal output.
Run errors still print on stderr, each as
CODE: message.
Where a reporter runs
Handlers run in the runner process. Workers also load the config, so reporter construction must have no side effects.
- Read tokens and start requests inside handlers.
- Adding a reporter leaves cached traces valid.
Types
Reporter, FinishedRun, ReporterSummary, Report, RunEvent, and
RunEventOf are exported from the main entrypoint, and so is
renderMarkdownReport(report, options).
Related
Pull request comments sets up @e2e-dev/github. The
CLI reference lists what the built-in reporters write.
