# `Juggernaut.View.Survivors`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/view/survivors.ex#L1)

The survivors of a run, grouped (`mix juggernaut.survivors`, design notes §3): the
mutants `Juggernaut.View.survivors/2` lists (survived, not covered, and timeouts when
they are scored as survived), grouped by file, module or operator.

Groups that hold a core mutant come first, then the others by name; inside a group the
order is that of `View.survivors/2`. One page of the whole list is shown, and each group
heading gives the group's total, so a group split across pages says so. When more
survivors exist than the page, the output says how many and names the command for the
next page with the same grouping, and a page past the end names the last page: nothing
is cut silently.

The `github` format prints every survivor as an annotation, as `mix juggernaut
--format github` does; grouping and paging do not apply to it.

The agent document is `{"format": 1, "kind": "survivors", "run_id", "group_by",
"core_only", "counts", "groups": [{"key", "core", "total", "survivors"}], "page"}`, each
survivor the agent survivor object (`Juggernaut.View.Agent.survivor/4`). Its `page` is
`{"page", "per_page", "pages", "total", "more", "past_end", "next"}`: `pages` is the
number of the last page and `past_end` is true for a page after it.

# `group_by`

```elixir
@type group_by() :: :file | :module | :operator
```

# `listing`

```elixir
@type listing() :: [group_by: group_by(), core_only: boolean()]
```

# `key`

```elixir
@spec key(Juggernaut.View.survivor(), group_by()) :: String.t()
```

The group a survivor belongs to under `group_by`.

# `render`

```elixir
@spec render(
  :human | :agent | :markdown | :github,
  Juggernaut.Run.t(),
  keyword() | Juggernaut.View.options(),
  keyword()
) :: iodata()
```

Renders the survivors of `run` in `format`. `listing` holds `group_by` (default
`:file`) and `core_only` (default `false`); `opts` are view options.

---

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