@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().

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 names
  • DotReporter - Compact single-character output (. for pass, F for fail)
  • TapReporter - TAP (Test Anything Protocol) format for CI integration
  • JsonReporter - 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 noColor option to disable)

Theming

Configuration Types

Installation

deno add jsr:@probitas/reporter

Classes

class

#DotReporter

class DotReporter implements Reporter
ImplementsReporter
NameDescription
onScenarioEnd()
onRunEnd()
Constructor
new DotReporter(_: unknown)
Methods
onScenarioEnd(): unknown
onRunEnd(): unknown
class

#JSONReporter

class JSONReporter implements Reporter
ImplementsReporter
Constructor
new JSONReporter(_: unknown)
Methods
onRunStart(): unknown
onRunEnd(): unknown
onScenarioStart(): unknown
onScenarioEnd(): unknown
onStepStart(): unknown
onStepEnd(): unknown
class

#ListReporter

class ListReporter implements Reporter
ImplementsReporter

Reporter 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
NameDescription
onStepEnd()
onRunEnd()Called when run ends - output summary
Constructor
new ListReporter(_: unknown)

Create a new ListReporter.

Methods
onStepEnd(): unknown
onRunEnd(): unknown

Called when run ends - output summary

class

#TAPReporter

class TAPReporter implements Reporter
ImplementsReporter
NameDescription
onRunStart()
onStepEnd()Called when step completes - output TAP result
onRunEnd()
Constructor
new TAPReporter(_: unknown)
Methods
onRunStart(): unknown
onStepEnd(): unknown

Called when step completes - output TAP result

onRunEnd(): unknown

Interfaces

interface

#DotReporterOptions

interface DotReporterOptions extends WriterOptions
NameDescription
theme
Properties
interface

#JSONReporterOptions

interface JSONReporterOptions extends WriterOptions
interface

#ListReporterOptions

interface ListReporterOptions extends WriterOptions

Options for ListReporter initialization.

NameDescription
themeCustom theme for styling output.
Properties
  • theme?Theme

    Custom theme for styling output. If not provided, uses defaultTheme (or noColorTheme if Deno.noColor is set).

interface

#ReporterOptions

interface ReporterOptions

Configuration 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
});
NameDescription
outputOutput stream for writing results.
themeCustom theme for styling output.
Properties
  • readonlyoutput?WritableStream

    Output stream for writing results.

  • readonlytheme?Theme

    Custom theme for styling output.

    If not provided, uses defaultTheme (or noColorTheme if Deno.noColor is true).

interface

#TAPReporterOptions

interface TAPReporterOptions extends WriterOptions
interface

#Theme

interface Theme

Theme 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)
};
NameDescription
successStyle for successful/passing states
failureStyle for failed/error states
skipStyle for skipped states
dimStyle for secondary/muted information
titleStyle for titles and headers
infoStyle for informational messages
warningStyle for warnings
lightGrayStyle for light gray text (used for resource/setup step titles)
Properties

Type Aliases

type

#ThemeFunction

type ThemeFunction = (text: string) => unknown

Function type for theme color/styling transformations.

Takes a string and returns a styled version (typically with ANSI codes).

Variables

const

#colorTheme

const colorTheme: Theme

Default theme with colors

const

#defaultTheme

const defaultTheme: unknown
const

#noColorTheme

const noColorTheme: Theme

No-color theme (NO_COLOR compatible)

Search Documentation