@probitas/reporter
Test result reporting and formatting for Probitas.
This package provides multiple reporter implementations for formatting and
displaying test execution results. All reporters implement the Reporter
interface from @probitas/runner and can be passed to ScenarioRunner.run().
Links
- GitHub Repository
- @probitas/probitas - Main package (recommended for most users)
Related Packages
| Package | Description |
|---|---|
| @probitas/runner | Uses reporters for output |
| @probitas/cli | CLI that uses these reporters |
| @probitas/logger | Logging used during execution |
Available Reporters
ListReporter- Detailed hierarchical output showing scenario and step namesJSONReporter- JSON output for machine-readable results
Installation
deno add jsr:@probitas/reporterClasses
#JSONReporter
class JSONReporter implements ReporterReporter| Name | Description |
|---|---|
onRunStart() | — |
onRunEnd() | — |
onScenarioStart() | — |
onScenarioEnd() | — |
onStepStart() | — |
onStepEnd() | — |
Constructor
new JSONReporter(_: unknown)Methods
onRunStart(): unknownonRunEnd(): unknownonScenarioStart(): unknownonScenarioEnd(): unknownonStepStart(): unknownonStepEnd(): unknown#ListReporter
class ListReporter implements ReporterReporterReporter 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
Examples
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
| Name | Description |
|---|---|
onStepEnd() | — |
onRunEnd() | Called when run ends - output summary |
Constructor
new ListReporter(_: unknown)Create a new ListReporter.
Methods
onStepEnd(): unknownonRunEnd(): unknownCalled when run ends - output summary
Interfaces
#JSONReporterOptions
interface JSONReporterOptions extends WriterOptions#ListReporterOptions
interface ListReporterOptions extends WriterOptionsOptions for ListReporter initialization.
| Name | Description |
|---|---|
theme | Custom theme for styling output. |
cwd | Base directory for making paths relative in output. |
Properties
theme?ThemeCustom theme for styling output. If not provided, uses defaultTheme (or noColorTheme if Deno.noColor is set).
cwd?stringBase directory for making paths relative in output. If not provided, absolute paths are displayed as-is.
#ReporterOptions
interface ReporterOptionsConfiguration options for reporter initialization.
Examples
Basic usage
import { ListReporter } from "@probitas/reporter";
const reporter = new ListReporter({
output: Deno.stdout.writable
});
void reporter;
Custom output stream (using a buffer)
import { ListReporter } from "@probitas/reporter";
import { Buffer } from "@std/streams";
const buffer = new Buffer();
const reporter = new ListReporter({
output: buffer.writable
});
void reporter;
| Name | Description |
|---|---|
output | Output stream for writing results. |
theme | Custom theme for styling output. |
cwd | Base directory for making paths relative in output. |
Properties
- readonly
output?WritableStreamOutput stream for writing results.
- readonly
theme?ThemeCustom theme for styling output.
If not provided, uses
defaultTheme(ornoColorThemeifDeno.noColoris true). - readonly
cwd?stringBase directory for making paths relative in output.
If provided, absolute paths in source locations will be displayed relative to this directory.
