APITest.Reporter

Test.Reporter

Handlers for test progress and the command-line test entry point.

Test.execute emits Reporter events. console prints the traditional failures and summary, progress prints dots, and documentation prints groups and indented case names. silent discards events. These handlers return the action’s result without exiting. run selects a format from command-line arguments, optionally writes a JSON report, and sets the process exit status.

CaseOutcome

type CaseOutcome    = CasePassed    | CaseFailed Error    | CaseSkipped    | CaseTodoSource

The outcome of a leaf in the suite.

Constructors

CaseFailed

CaseFailed : Error -> CaseOutcomeSource

The body’s first failing expectation.

CasePassed

CasePassed : CaseOutcomeSource

The body completed without a failing expectation.

CaseSkipped

CaseSkipped : CaseOutcomeSource

The body or placeholder was skipped explicitly or by focus.

CaseTodo

CaseTodo : CaseOutcomeSource

A placeholder with no body, not explicitly skipped.

Instances:

Eq CaseOutcome
Show CaseOutcome

Event

type Event    = SuiteStarted Int    | CaseStarted (List String)    | CaseFinished (List String) CaseOutcome    | GroupFailed (List String) String    | SuiteFinished SummarySource

A synchronous notification in depth-first tree order. Paths contain group and leaf names from outermost to innermost, without formatting.

Constructors

CaseFinished

CaseFinished : List String -> CaseOutcome -> EventSource

A leaf completed, failed, was skipped, or is a todo. Skipped leaves and todos have no preceding CaseStarted.

CaseStarted

CaseStarted : List String -> EventSource

An active body is about to run.

GroupFailed

GroupFailed : List String -> String -> EventSource

One group validation problem, reported before visiting its children.

SuiteStarted

SuiteStarted : Int -> EventSource

The run begins, with its total number of leaves, including todos and skipped leaves. Group validation problems are not included.

SuiteFinished

SuiteFinished : Summary -> EventSource

The completed summary, identical to the value returned by execute.

Instances:

Eq Event
Show Event

Summary

type Summary =    { passed : Int    , failed : Int    , skipped : Int    , todo : Int    , verdict : Verdict    }Source

Counts and verdict of a completed suite. Group validation problems each count as a failure, so the counts can exceed the number of leaves.

Fields

passed

passed : IntSource

Bodies that completed successfully.

failed

failed : IntSource

Failed bodies plus individual group validation problems.

skipped

skipped : IntSource

Leaves not run because of skip or focus.

todo

todo : IntSource

Placeholders not explicitly skipped; focus does not suppress todos.

verdict

verdict : VerdictSource

Whether the run passed, failed, or was incomplete.

Instances:

Eq Summary
Show Summary

Verdict

type Verdict    = RunPassed    | RunFailed    | RunIncompleteSource

The verdict of a completed suite. Failures take precedence over incompleteness.

Constructors

RunPassed

RunPassed : VerdictSource

Every test passed and the suite was complete.

RunFailed

RunFailed : VerdictSource

A test or group validation failed.

RunIncomplete

RunIncomplete : VerdictSource

No failures, but the suite contains only, skipped tests, or todos.

Instances:

Eq Verdict
Show Verdict

Reporter

effect ReporterSource

Progress notifications from execute. There is no default handler; console, silent, or a custom handler chooses what to do with them.

Operations

report

report : Event ->{Reporter} ()Source

Reports one event synchronously before execution continues.

console

console : (() ->{Reporter, e} a) ->{Console, e} aSource

Handles progress by printing failures and the final summary to standard output, preserving run’s report format. Start events and non-failing outcomes are silent. Returns the action’s result without exiting; effects besides Reporter pass through.

documentation

documentation : (() ->{Reporter, e} a) ->{Console, e} aSource

Prints group headings and indented case names with their outcomes as leaves complete. Full failure messages and the summary follow. Group names shared by consecutive paths are printed once. Returns the action’s result without exiting.

progress

progress : (() ->{Reporter, e} a) ->{Console, e} aSource

Prints one progress character for each completed leaf: . for a pass, F for a failure, and * for a skipped leaf or todo. Group validation failures also print F. Full failure messages and the summary follow the progress line. Returns the action’s result without exiting.

run

run : (() ->{Reporter, e} Summary) ->{Environment, Console, FileSystem, e} StatusSource

Executes a test action using command-line options (without the program name). With no options it uses console. Supported options are:

  • --format console|progress|documentation|silent: selects stdout output.
  • --json PATH: also writes a UTF-8 JSON report after the run completes, replacing PATH if it exists through File.FileSystem. Its parent directory must exist.
  • --help: prints usage without executing the action.

The answer is the process status for main to return. Repeated format or JSON options use the last value. Unknown options, missing values, and invalid formats print a diagnostic and usage, and answer status 2 before executing the action. JSON encoding or file write errors print a diagnostic and answer status 2. Diagnostics go to stdout, like the test report. Test failures or incomplete suites answer status 1, after writing any requested JSON report; passing complete suites and --help answer success. Unhandled effects and crashes propagate without writing a completed report.

The JSON document has schemaVersion: 2, cases, groupFailures, and summary. Each case has a path array, outcome (passed, failed, skipped, or todo), message (failure text or null), and location (an object with the failing expectation’s file and line, or null). Each group failure has path and message. Both arrays retain execution order. The summary has passed, failed, skipped, todo, and verdict (passed, failed, or incomplete). No durations are inferred from progress events. A JSON report can accompany any console format, including silent.

fango run Tests.fango --format progress --json report.json
fango run Tests.fango --format documentation
fango run Tests.fango --format silent --json report.json

silent

silent : (() ->{Reporter, e} a) ->{e} aSource

Discards progress events and returns the action’s result. Effects besides Reporter pass through, so pure suites can execute without IO.