Aludel.Evals.Reporter behaviour (aludel v0.7.0)

Copy Markdown View Source

Renders evaluation reports for people and CI systems.

The built-in reporter names are :console, :json, :junit, and :github. A custom module can also be passed directly when it implements this module's callback.

{:ok, output} = Aludel.Evals.Reporter.render(suite_run, :junit)

Reporter options are passed to the selected implementation. The JSON reporter, for example, accepts pretty: true.

Summary

Types

A stable error returned before or while rendering a report.

A built-in reporter name or a custom reporter module.

Functions

Renders a suite run with a built-in or custom reporter.

Renders a report and raises ArgumentError when rendering fails.

Types

error()

@type error() :: :unknown_reporter | :invalid_reporter_output

A stable error returned before or while rendering a report.

reporter()

@type reporter() :: :console | :json | :junit | :github | module()

A built-in reporter name or a custom reporter module.

Callbacks

render(t, keyword)

@callback render(
  Aludel.Evals.Report.t(),
  keyword()
) :: {:ok, iodata()} | {:error, term()}

Functions

render(suite_run_or_report, reporter, options \\ [])

@spec render(
  Aludel.Evals.SuiteRun.t() | Aludel.Evals.Report.t(),
  reporter(),
  keyword()
) ::
  {:ok, String.t()} | {:error, error() | term()}

Renders a suite run with a built-in or custom reporter.

render!(suite_run_or_report, reporter, options \\ [])

Renders a report and raises ArgumentError when rendering fails.