# `Juggernaut.Report`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/report.ex#L1)

Writes the HTML dashboard of recorded runs (`mix juggernaut.report`, design notes §3,
§11): reads the selected run, the run recorded before it and the history, builds the
data document (`Juggernaut.Report.Data`) and writes the page (`Juggernaut.Report.Html`)
atomically.

Trends use at most `limit` history records, ending with the selected run when the
history holds it (so an earlier run is shown with the runs before it), else the newest.

# `history`

```elixir
@spec history(Path.t(), String.t(), pos_integer()) :: [map()]
```

At most `limit` history records, oldest first, ending with `run_id`'s record when the
history holds it, else with the newest.

# `previous`

```elixir
@spec previous(Path.t(), String.t()) :: Juggernaut.Run.t() | nil
```

The run recorded just before `run_id`, or `nil` when there is none or it is unreadable.

# `write`

```elixir
@spec write(Juggernaut.CLI.Task.ctx(), keyword()) ::
  {:ok, Path.t()} | {:error, Juggernaut.Error.t()}
```

Writes the dashboard for the project in `ctx` and returns the path written. `opts`:
`run` (a run reference, default the latest), `limit` (history records, default 50) and
`output` (a path, relative to the project root; default `_build/juggernaut/report/index.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
