# `mix tia`
[🔗](https://github.com/devaction-labs/tia/blob/v0.1.0/lib/mix/tasks/tia.ex#L1)

Test impact analysis driven by a recorded map (`.tia/map.json` by default).

    mix tia                  # record the stale test files, update the map
    mix tia --all            # record every test file
    mix tia --check          # CI: run the affected test files, change nothing
    mix tia --dry-run        # only print the selection

The task must run in the test environment. As it comes from a dependency,
Mix cannot know that by itself, so declare it in `mix.exs`:

    def cli, do: [preferred_envs: [tia: :test]]

Recording runs each test file on its own and stores the files it executed. A
file whose tests fail is not recorded and stays stale, and the task then
exits with an error. `--check` selects the stale test files plus those whose
recorded sources appear in `git diff --name-only BASE`, and runs the whole
suite when the map is missing or the globals moved.

## Options

  * `--base` - git ref to diff against, overrides the `:base` config
  * `--map` - map path, overrides the `:map` config
  * `--only` - when recording, restrict to the test files matching this glob

Arguments after the options are passed to `mix test` on `--check`. See
`Tia.Config` for the `:tia` project options.

---

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