# `mix affected.test`
[🔗](https://github.com/mnox/mix_affected/blob/v0.1.0/lib/mix/tasks/affected.test.ex#L1)

Runs `mix test` on the affected test files. Takes the input options of
`mix affected.files` (`--base` or `--files`, `--map`); everything after
`--` goes to `mix test` unchanged. Run with `MIX_ENV=test`.

    mix affected.test --base origin/main -- --warnings-as-errors

  * full run (including a graph or test map failure): plain
    `mix test <passthrough>`
  * empty selection: prints `mix_affected: no affected tests` and exits 0
    without starting ExUnit
  * otherwise `mix test <files> <passthrough>`; its exit status is this
    task's

With `--output <path>` the selection is also written there, in `--format`
(with `--explain` if given), for `mix affected.report` later. The summary
line goes to stderr.

---

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