# `MixAffected.Result`
[🔗](https://github.com/mnox/mix_affected/blob/v0.1.0/lib/mix_affected/result.ex#L1)

The answer of `mix affected.files` / `mix affected.test`, and its v1 JSON
and text renderings (see the README for the schema).

`exit_status` is `0` for any answer, `2` when the graph or the test map
could not be built: the result is then a full run.

# `t`

```elixir
@type t() :: %MixAffected.Result{
  affected_files: [String.t()],
  changed_files: [String.t()],
  exit_status: 0 | 2,
  explain: %{optional(String.t()) =&gt; [String.t()]},
  full_run: boolean(),
  graph_source: String.t(),
  reason: String.t() | nil,
  tests: [String.t()],
  total_test_files: non_neg_integer()
}
```

# `full_run`

```elixir
@spec full_run(t(), String.t(), 0 | 2) :: t()
```

Marks `result` as a full run for `reason`; `tests`, `affected_files` and `explain` are cleared.

# `summary`

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

A one-line human summary for stderr.

# `to_json`

```elixir
@spec to_json(t(), boolean()) :: String.t()
```

The v1 JSON document. `explain` is `%{}` unless `explain?`.

# `to_text`

```elixir
@spec to_text(t(), boolean()) :: String.t()
```

Text output: one test file per line (with `explain?`, one chain per line,
`changed -> ... -> test`). A full run prints nothing; its reason goes to
stderr (see `summary/1`).

---

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