@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 namesDotReporter- Compact single-character output (.for pass,Ffor fail)TapReporter- TAP (Test Anything Protocol) format for CI integrationJsonReporter- JSON output for machine-readable results
Base Class
BaseReporter- Abstract base class with common functionality:- Output stream management (defaults to stderr)
- Serialized write operations for concurrent scenarios
- Customizable color themes (use
noColoroption to disable)
Theming
Theme- Interface defining semantic color functionsdefaultTheme- Default colored themenoColorTheme- Theme without ANSI color codes
Configuration Types
ReporterOptions- Options for reporter initializationThemeFunction- Type for theme color functions
Installation
deno add jsr:@probitas/reporterClasses
#DotReporter
class DotReporter implements ReporterReporter| Name | Description |
|---|---|
onScenarioEnd() | — |
onRunEnd() | — |
Constructor
new DotReporter(_: unknown)Methods
onScenarioEnd(): unknownonRunEnd(): unknown#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)
- Source 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
const reporter = new ListReporter();
const runner = new Runner(reporter);
const result = await runner.run(scenarios);
// 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
#TAPReporter
class TAPReporter implements ReporterReporter| Name | Description |
|---|---|
onRunStart() | — |
onStepEnd() | Called when step completes - output TAP result |
onRunEnd() | — |
Constructor
new TAPReporter(_: unknown)Methods
onRunStart(): unknownonStepEnd(): unknownCalled when step completes - output TAP result
onRunEnd(): unknownInterfaces
#DotReporterOptions
interface DotReporterOptions extends WriterOptions| Name | Description |
|---|---|
theme | — |
Properties
theme?Theme
#JSONReporterOptions
interface JSONReporterOptions extends WriterOptions#ListReporterOptions
interface ListReporterOptions extends WriterOptionsOptions for ListReporter initialization.
| Name | Description |
|---|---|
theme | Custom theme for styling output. |
Properties
theme?ThemeCustom theme for styling output. If not provided, uses defaultTheme (or noColorTheme if Deno.noColor is set).
#ReporterOptions
interface ReporterOptionsConfiguration options for reporter initialization.
Examples
Basic usage
const reporter = new ListReporter({
output: Deno.stdout.writable
});
Custom output stream
const file = await Deno.open("results.txt", { write: true });
const reporter = new ListReporter({
output: file.writable
});
Properties
- readonly
output?WritableStreamOutput stream for writing results.
Custom theme for styling output.
If not provided, uses
defaultTheme(ornoColorThemeifDeno.noColoris true).
#TAPReporterOptions
interface TAPReporterOptions extends WriterOptions#Theme
interface ThemeTheme interface for semantic output styling.
Provides a consistent vocabulary for styling test output. Use semantic
names (success, failure) rather than colors (green, red) to
support different terminal themes and accessibility needs.
Examples
Custom theme
const myTheme: Theme = {
success: (t) => chalk.green(t),
failure: (t) => chalk.red.bold(t),
skip: (t) => chalk.yellow(t),
dim: (t) => chalk.gray(t),
title: (t) => chalk.bold(t),
info: (t) => chalk.cyan(t),
warning: (t) => chalk.yellow(t)
};
| Name | Description |
|---|---|
success | Style for successful/passing states |
failure | Style for failed/error states |
skip | Style for skipped states |
dim | Style for secondary/muted information |
title | Style for titles and headers |
info | Style for informational messages |
warning | Style for warnings |
lightGray | Style for light gray text (used for resource/setup step titles) |
Properties
Style for successful/passing states
Style for failed/error states
Style for skipped states
Style for secondary/muted information
Style for titles and headers
Style for informational messages
Style for warnings
Style for light gray text (used for resource/setup step titles)
Type Aliases
#ThemeFunction
type ThemeFunction = (text: string) => unknownFunction type for theme color/styling transformations.
Takes a string and returns a styled version (typically with ANSI codes).
Variables
#defaultTheme
const defaultTheme: unknown