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

PackageDescription
@probitas/runnerUses reporters for output
@probitas/cliCLI that uses these reporters
@probitas/loggerLogging used during execution

Available Reporters

  • ListReporter - Detailed hierarchical output showing scenario and step names
  • JSONReporter - JSON output for machine-readable results

Installation

deno add jsr:@probitas/reporter

Classes

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)
  • 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
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

Interfaces

interface

#JSONReporterOptions

interface JSONReporterOptions extends WriterOptions
interface

#ListReporterOptions

interface ListReporterOptions extends WriterOptions

Options for ListReporter initialization.

NameDescription
themeCustom theme for styling output.
cwdBase directory for making paths relative in output.
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.

interface

#ReporterOptions

interface ReporterOptions

Configuration 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;
NameDescription
outputOutput stream for writing results.
themeCustom theme for styling output.
cwdBase directory for making paths relative in 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).

  • readonlycwd?string

    Base directory for making paths relative in output.

    If provided, absolute paths in source locations will be displayed relative to this directory.

Search Documentation