IF Commons GitHub

logical/verbosity

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-headless-output FR-003

How much of a run reaches a person (commons headless 0003-headless-output FR-003): the four modes (calm, the default, quiet on success and loud and actionable on a problem; verbose, every item as it happens; quiet, the verdict alone; json, nothing for a person but one document), how the flags choose among them, and which kind of line each mode shows. The surface only draws what this says to show.

import { shows, verbosityOf } from "./verbosity.ts";
shows("calm", "step"); // false: a phase that went well is not a line in calm
shows("verbose", "item"); // true
verbosityOf({ json: false, quiet: false, verbose: true }); // ok("verbose")

Source: commons/headless/src/logical/verbosity.ts

4 of 14 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.Verbositytypeno test imports it
type Verbosity = "calm" | "verbose" | "quiet" | "json";

How much of a run is shown.

logical.VERBOSITIESconstno test imports it
const VERBOSITIES: readonly Verbosity[]

Every verbosity.

logical.VerbosityFlagstypeno test imports it
type VerbosityFlags = { readonly json: boolean; readonly quiet: boolean; readonly verbose: boolean };

The flags that choose a verbosity.

logical.verbosityOffunctionno test imports it
function verbosityOf(flags: VerbosityFlags): Result<Verbosity, string>

The verbosity the flags choose: json over everything (a program that reads the output wants the document whatever else is set), quiet and verbose together contradict each other and are refused, else calm.

logical.LineKindtypeno test imports it
type LineKind = "header" | "step" | "phase" | "item" | "change" | "problem" | "outcome" | "hint" | "verdict" | "next" | "live" | "log";

The kinds of line a run can show: a step is the line of a phase that went well, a phase the line of one that has something to see (a failure, a warning, a step for the person, something pending).

logical.LINE_KINDSconstno test imports it
const LINE_KINDS: readonly LineKind[]

Every kind of line.

logical.showsfunctionno test imports it
function shows(mode: Verbosity, kind: LineKind): boolean

Whether a mode shows a kind of line on the screen (the run's log records every kind whatever the mode).

Verbositytypeno test imports it
type Verbosity = "calm" | "verbose" | "quiet" | "json";

How much of a run is shown.

VERBOSITIESconst
const VERBOSITIES: readonly Verbosity[]

Every verbosity.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

VerbosityFlagstypeno test imports it
type VerbosityFlags = { readonly json: boolean; readonly quiet: boolean; readonly verbose: boolean };

The flags that choose a verbosity.

verbosityOffunction
function verbosityOf(flags: VerbosityFlags): Result<Verbosity, string>

The verbosity the flags choose: json over everything (a program that reads the output wants the document whatever else is set), quiet and verbose together contradict each other and are refused, else calm.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

LineKindtypeno test imports it
type LineKind = "header" | "step" | "phase" | "item" | "change" | "problem" | "outcome" | "hint" | "verdict" | "next" | "live" | "log";

The kinds of line a run can show: a step is the line of a phase that went well, a phase the line of one that has something to see (a failure, a warning, a step for the person, something pending).

LINE_KINDSconst
const LINE_KINDS: readonly LineKind[]

Every kind of line.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

showsfunction
function shows(mode: Verbosity, kind: LineKind): boolean

Whether a mode shows a kind of line on the screen (the run's log records every kind whatever the mode).

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.