# `mix juggernaut.check`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/mix/tasks/juggernaut.check.ex#L1)

Re-runs the named mutants now, usually after adding a test.

    mix juggernaut.check ID... [--format human|agent|json] [--seed N] [--no-server]

Runs on the warm pool of `mix juggernaut.server` when one is running for this checkout
(unless `--no-server`), else boots a pool of `min(workers, number of ids)`. `json` is
the mutation-testing-elements report of the named mutants. A
mutant killed only by a timeout counts as a survivor under `timeouts: :survived`, as it
does in the gate. An id is a short id
(`Grant.check/2:relational:4be1c09`), its hash part, or a unique hex prefix of at least
four characters. The result cache is not written.

## Example

    mix juggernaut.check 4be1c09 Grant.check/2:relational:91aa0e2 --format agent

## Options

  * `--format human|agent|json` - Output format. Default: `human`. Or set `JUGGERNAUT_FORMAT`.
  * `--seed N` - ExUnit seed (random and recorded if absent).
  * `--no-server` - Never attach to a running server (`--no-server`).

## Exit codes

  * 0 - every named mutant is killed (or ignored, or triaged equivalent)
  * 1 - a named mutant survived
  * 2 - an unknown or ambiguous id, or another usage error
  * 3 - infrastructure or harness error

# `exit_code`

```elixir
@spec exit_code(%{mutants: list(), results: map()}, :killed | :survived) :: 0..3
```

The exit code of a check: 3 when a named mutant hit a harness error, 1 when one
survived or no test covers it (or, under `timeouts: :survived`, was killed only by a
timeout, as the gate scores it), else 0 (killed, ignored, equivalent, or a mutant
that does not compile).

# `report`

```elixir
@spec report(
  :human | :agent | :json,
  %{mutants: list(), results: map()},
  :killed | :survived
) ::
  String.t()
```

The output of a check in `format` (`:human` or `:agent`), scored with `timeouts`. Each
agent mutant carries `survivor`, whether it counts as a survivor (so a timeout kill
under `timeouts: :survived` reads `"status": "killed"` with `"survivor": true`); the
human line of such a kill says it counts as a survivor.

---

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