# @probitas/reporter > Version: 0.7.1 Test result reporting and formatting for Probitas. This package provides multiple reporter implementations for formatting and displaying test execution results. All reporters implement the {@linkcode Reporter} interface from `@probitas/runner` and can be passed to `ScenarioRunner.run()`. ## Links - [GitHub Repository](https://github.com/probitas-test/probitas) - [@probitas/probitas](https://jsr.io/@probitas/probitas) - Main package (recommended for most users) ## Related Packages | Package | Description | |---------|-------------| | [@probitas/runner](https://jsr.io/@probitas/runner) | Uses reporters for output | | [@probitas/cli](https://jsr.io/@probitas/cli) | CLI that uses these reporters | | [@probitas/logger](https://jsr.io/@probitas/logger) | Logging used during execution | ## Available Reporters - {@linkcode ListReporter} - Detailed hierarchical output showing scenario and step names - {@linkcode JSONReporter} - JSON output for machine-readable results ## Classes ### `ListReporter` ```typescript class ListReporter implements Reporter ``` Reporter that outputs test results in a flat list format. Features: - Real-time per-step output as tests execute - Status indicators (✓ passed, ✗ failed, ⊘ skipped) - Origin location information - Execution timing for each step - Skip reasons for conditional skips - Error messages and stack traces for failures - Summary statistics - Semantic coloring via Theme **Constructor:** ```typescript new ListReporter(_: unknown) ``` **Methods:** ```typescript onStepEnd(): unknown ``` ```typescript onRunEnd(): unknown ``` Called when run ends - output summary **Example:** ```ts import { ListReporter } from "@probitas/reporter"; const reporter = new ListReporter(); void reporter; // Output: // ✓ Login scenario > Step that passes (test.ts:15) [10.000ms] // ✓ Login scenario > Another step (test.ts:20) [5.000ms] // ✗ Payment scenario > Process payment (test.ts:50) [25.000ms] // Error: Insufficient funds // at checkout (test.ts:52) // // Summary // ✓ 1 scenarios passed // ✗ 1 scenarios failed ``` --- ### `JSONReporter` ```typescript class JSONReporter implements Reporter ``` **Constructor:** ```typescript new JSONReporter(_: unknown) ``` **Methods:** ```typescript onRunStart(): unknown ``` ```typescript onRunEnd(): unknown ``` ```typescript onScenarioStart(): unknown ``` ```typescript onScenarioEnd(): unknown ``` ```typescript onStepStart(): unknown ``` ```typescript onStepEnd(): unknown ``` --- ## Interfaces ### `ListReporterOptions` ```typescript interface ListReporterOptions extends WriterOptions ``` Options for ListReporter initialization. **Properties:** - `theme?`: `Theme` — Custom theme for styling output. If not provided, uses defaultTheme (or noColorTheme if Deno.noColor is set). - `cwd?`: `string` — Base directory for making paths relative in output. If not provided, absolute paths are displayed as-is. --- ### `JSONReporterOptions` ```typescript interface JSONReporterOptions extends WriterOptions ``` --- ### `ReporterOptions` ```typescript interface ReporterOptions ``` Configuration options for reporter initialization. **Properties:** - [readonly] `output?`: `WritableStream` — Output stream for writing results. - [readonly] `theme?`: `Theme` — Custom theme for styling output. If not provided, uses {@linkcode defaultTheme} (or {@linkcode noColorTheme} if `Deno.noColor` is true). - [readonly] `cwd?`: `string` — Base directory for making paths relative in output. If provided, absolute paths in source locations will be displayed relative to this directory. **Example:** Basic usage ```ts import { ListReporter } from "@probitas/reporter"; const reporter = new ListReporter({ output: Deno.stdout.writable }); void reporter; ``` Custom output stream (using a buffer) ```ts import { ListReporter } from "@probitas/reporter"; import { Buffer } from "@std/streams"; const buffer = new Buffer(); const reporter = new ListReporter({ output: buffer.writable }); void reporter; ``` --- ## Related Links ### Other Packages - [`Reporter`](https://probitas-test.github.io/documents/api/runner#Reporter) (@probitas/runner) --- *Last updated: 2026-01-12*