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

Fast mutation testing for Elixir.

Most people run it through `mix juggernaut` and its sibling tasks. The same runs are
available as functions: `run/1` runs mutation testing and returns the finished
`Juggernaut.Run`; `check/2` runs named mutants of the latest scored run again. Both
take the request `Juggernaut.Engine.run/1` documents (the project `:root`, its loaded
`:config`, and so on) and return `{:error, Juggernaut.Error.t()}` instead of a verdict
when the run cannot happen.

Module docs cite sections of the design notes as "design notes §N": they are
[docs/DESIGN.md](https://github.com/holsee/juggernaut/blob/main/docs/DESIGN.md) in the
repository.

# `check`

```elixir
@spec check([String.t()], Juggernaut.Engine.request()) ::
  {:ok, %{mutants: [Juggernaut.Mutant.t()], results: map()}}
  | {:error, Juggernaut.Error.t()}
```

Runs the mutants named by `ids` again now (`Juggernaut.Engine.check/1`).

# `code_id`

```elixir
@spec code_id() :: String.t()
```

The identity of Juggernaut's code: SHA-256 over the MD5 of each of its modules. It
changes with any change to Juggernaut's code, where `version/0` changes only with a
release, so what is keyed on it (the result cache, through the config fingerprint) is
never reused across a fix that kept the version. A run computes it once, when it loads
its config.

# `run`

```elixir
@spec run(Juggernaut.Engine.request()) ::
  {:ok, Juggernaut.Run.t()} | {:error, Juggernaut.Error.t()}
```

Runs mutation testing (`Juggernaut.Engine.run/1`).

# `version`

```elixir
@spec version() :: String.t()
```

The version of Juggernaut, as a string.

---

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