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

The mutation-testing-elements report (`--format json`, design notes §5.4), schema
version 2, the format Stryker and Mutare write (deps:mutation-testing-elements).

Files are keyed by their path relative to the project root, each with its whole
original source (from the `sources` option; empty when not given) and its mutants.
Mutant ids are the short ids, so every mutant serialises differently (`uniqueItems`).
Statuses:

| Juggernaut | Schema |
| --- | --- |
| killed (`assertion`, `exception`) | `Killed` |
| killed (`timeout`) | `Timeout` |
| killed (`crash`) | `Killed`, `statusReason` the crash |
| killed (`boot`) | `Killed`, `static: true`, `statusReason` the start failure |
| `survived`, `no_coverage` | `Survived`, `NoCoverage` |
| `ignored`, `equivalent` | `Ignored`, `statusReason` the reason |
| `compile_error` | `CompileError` |
| `harness_error` | `RuntimeError`, `statusReason` the diagnostic |
| `pending`, or no result | `Pending` |

Juggernaut's own fields go in one `juggernaut` object per mutant (`key`, `kill_kind`,
`test_lane`, `selection`, `reused_from`, `worker`): `test_lane` is `"integration"` for a
kill only an integration test made. It is not put in `statusReason`, which on a kill
reads as a doubt (`Juggernaut.Import.MTE`). `thresholds` are `high` and `low`, both the
configured `changed` threshold (as Mutare writes a single minimum score); `performance`
comes from the recorded phase clocks; optional fields without a value are left out.
`testFiles` lists each test once by its id and name: the tests a `for` loop defines on
one line share their `file:line` id, so each is listed with that id and its own name,
and a `killedBy` or `coveredBy` id names every test on that line (the schema does not
require test ids to be unique).

Options: see `Juggernaut.View` (`thresholds`, `sources`, `ci`).

# `document`

```elixir
@spec document(Juggernaut.Run.t(), keyword() | Juggernaut.View.options()) ::
  Jason.OrderedObject.t()
```

The report of `run`.

# `render`

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

The report of `run` as compact JSON, followed by a newline.

# `status`

```elixir
@spec status(Juggernaut.Result.t() | nil) :: String.t()
```

The schema status of a result (`nil`: not run, `Pending`).

---

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