Mutare.Report.Live (mutare v0.4.1)

Copy Markdown View Source

Live progress for the human report.

Progress is written to stderr so stdout remains safe for the final or machine-readable report. An interactive terminal gets a spinner, current mutant, counts, and ETA; pipes and CI logs get plain scrollback. Survivors, timeouts, and harness errors remain visible after the live display advances.

--verbose prints a line for every mutant and timing details for each phase. --quiet suppresses live progress entirely and takes precedence over --verbose.

This module manages the process, output modes, and terminal writes; the text of every line it draws is rendered by Mutare.Report.Live.Lines.

Summary

Functions

Returns whether the reporter is using an animated ANSI status block.

Returns a specification to start this module under a supervisor.

Clears the current status block without stopping the reporter.

Returns whether persistent labels may use color.

Returns whether the default live reporter should draw its ANSI status block for the detected stderr terminal state.

Stops the status display and clears its terminal lines.

Records a phase transition or detail event.

Records a completed mutant result and updates the progress display.

Updates scanning progress with the processed file count, total file count, and number of mutants found.

Starts the live reporter.

Records the mutant currently being tested.

Types

phase_event()

@type phase_event() ::
  :scanning
  | :compiling
  | :baseline
  | :coverage_probe
  | {:running, non_neg_integer()}
  | {:confirming_timeouts, non_neg_integer()}
  | {:compiled, non_neg_integer()}
  | {:baseline_done, non_neg_integer()}
  | {:coverage_done, map()}
  | {:run_config, map()}
  | {:seed_app_build, map()}
  | {:inference_override_declined, map()}
  | {:poison_round, map()}
  | {:macro_poison, map()}

Functions

animating?(server)

@spec animating?(GenServer.server()) :: boolean()

Returns whether the reporter is using an animated ANSI status block.

Plain reporters emit persistent lines but do not display the current-mutant activity line.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(server)

@spec clear(GenServer.server()) :: :ok

Clears the current status block without stopping the reporter.

This call is synchronous, so the terminal is clear before subsequent output.

color_enabled?()

@spec color_enabled?() :: boolean()

Returns whether persistent labels may use color.

Any non-empty NO_COLOR value disables color. This does not disable ANSI cursor animation.

default_ansi?(stderr_tty?)

@spec default_ansi?(boolean()) :: boolean()

Returns whether the default live reporter should draw its ANSI status block for the detected stderr terminal state.

This is intentionally independent of IO.ANSI.enabled?/0: Elixir's flag is initialized from stdout, but Mutare's live UI is written to stderr.

finish(server)

@spec finish(GenServer.server()) :: :ok

Stops the status display and clears its terminal lines.

phase(server, phase)

@spec phase(GenServer.server(), phase_event()) :: :ok

Records a phase transition or detail event.

Phase transitions are :scanning, :compiling, :baseline, :coverage_probe, {:running, total}, and {:confirming_timeouts, count} (the post-stream confirmation pass, announced while the phase stays :running). Detail events are verbose-only notes: {:compiled, ms}, {:baseline_done, ms}, {:run_config, cfg} (stashed for the {:running, total} label), {:seed_app_build, summary}, and {:inference_override_declined, info}. {:coverage_done, summary} is verbose for its breakdown, but its whole-suite news (a run-all degrade, or mutants that will run the whole suite under a narrowing mode) leaves a line in every mode, as do {:poison_round, info} (a compile-poison recovery round) and {:macro_poison, info} (the macro-expansion fallback skipping an inline DSL macro). Unrecognised events are ignored.

report(server, result)

@spec report(GenServer.server(), Mutare.Result.t()) :: :ok

Records a completed mutant result and updates the progress display.

scanned(server, progress)

@spec scanned(GenServer.server(), %{
  done: non_neg_integer(),
  total: non_neg_integer(),
  found: non_neg_integer()
}) :: :ok

Updates scanning progress with the processed file count, total file count, and number of mutants found.

Animated reporters redraw the status block. Plain reporters do not print a line for each update.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the live reporter.

Options:

  • :device — output device; defaults to :standard_error
  • :ansi — enables or disables animation; by default it is enabled when stderr is a terminal
  • :color — enables or disables colored persistent labels; by default it follows animation and NO_COLOR
  • :width — terminal width; defaults to the detected width or 80
  • :verbose — retains a line for every mutant and shows phase details; defaults to false

started(server, site)

@spec started(GenServer.server(), Mutare.Site.t()) :: :ok

Records the mutant currently being tested.