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

The validated configuration of one project (see the [configuration guide](configuration.md)).

`load/2` reads `.juggernaut.exs` at the project root (it is optional), validates it,
applies the `JUGGERNAUT_BASE` override and computes the config fingerprint. Every
failure is a `Juggernaut.Error` of type `:config` (exit 2) naming the file.

The fingerprint is a SHA-256 over the validated options (nested keyword lists sorted,
so formatting and key order do not matter), Juggernaut's version, the Elixir and OTP
versions and the contents of `mix.lock`. The `JUGGERNAUT_BASE` override is not part of
it: the base selects which mutants run, not how a mutant is judged.

# `call`

```elixir
@type call() ::
  {module() | :*, atom()}
  | {module() | :*, atom(), arity()}
  | {module() | :*, atom(), arity(), [non_neg_integer()]}
```

# `t`

```elixir
@type t() :: %Juggernaut.Config{
  arid_calls: [call()],
  base: String.t(),
  cache: boolean(),
  cache_inputs: :tracked | [String.t()],
  connections: [
    budget: :none | pos_integer(),
    per_worker: :auto | pos_integer()
  ],
  core: [String.t() | module()],
  env: [{String.t(), String.t()}],
  exclude: [String.t()],
  file: Path.t() | nil,
  fingerprint: String.t(),
  ignore_prefixes: [String.t()],
  lasting_servers: [module()],
  lasting_supervisors: [atom()],
  no_coverage: :count | :fail,
  operators: :default | :all | [atom()],
  paths: [String.t()],
  raw_calls: [call()],
  refuse_env: :secrets | [String.t()],
  root: Path.t(),
  skip_calls: [call()],
  spares: boolean(),
  strict_ignores: boolean(),
  test_lanes: [
    {:integration,
     tags: [atom()],
     paths: [String.t()],
     timeout: [multiplier: number(), min_ms: pos_integer()]}
  ],
  test_paths: :project | [String.t()],
  thresholds: [core: 0..100, changed: 0..100, per: :file | :run],
  timeout: [multiplier: number(), min_ms: pos_integer()],
  timeouts: :killed | :survived,
  worker_schedulers: pos_integer(),
  worker_setup: :test_alias | [String.t()],
  workers: :auto | pos_integer()
}
```

# `check_env`

```elixir
@spec check_env(t(), %{required(String.t()) =&gt; String.t()}) ::
  :ok | {:error, Juggernaut.Error.t()}
```

`:ok`, or a config error naming (never showing) the refused variables.

# `fingerprint`

```elixir
@spec fingerprint(keyword(), binary()) :: String.t()
```

The fingerprint of validated options and the contents of `mix.lock`, with Juggernaut's
code (`Juggernaut.code_id/0`, not its version), Elixir's and OTP's.

# `keys`

```elixir
@spec keys() :: [atom()]
```

The option keys of `.juggernaut.exs`, in documentation order.

# `load`

```elixir
@spec load(Path.t(), %{required(String.t()) =&gt; String.t()}) ::
  {:ok, t()} | {:error, Juggernaut.Error.t()}
```

Loads the configuration of the project at `root`. `env` supplies `JUGGERNAUT_BASE`.

# `refused_env`

```elixir
@spec refused_env(t(), %{required(String.t()) =&gt; String.t()}) :: [String.t()]
```

Names of set, non-empty environment variables matching `refuse_env`, sorted. Values
are never returned.

# `workers`

```elixir
@spec workers(t(), pos_integer()) :: pos_integer()
```

The pool size: `workers`, or for `:auto`
`min(8, max(1, div(schedulers, worker_schedulers)))`.

---

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