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

The NimbleOptions schema of `.juggernaut.exs` (see the [configuration guide](configuration.md)).

Every key is optional. Every nested group has `default: []`, so its own defaults fill
in when only some of its keys are given.

## Options

* `:paths` - Source roots to mutate (`.ex` files). Each must exist. The default value is `["lib"]`.

* `:exclude` (list of `t:String.t/0`) - File globs never mutated. The default value is `[]`.

* `:test_paths` - Where the tests are; `:project` uses the Mix project's `:test_paths`. The default value is `:project`.

* `:core` - File globs or module patterns held to `thresholds.core`. The default value is `[]`.

* `:thresholds` (`t:keyword/0`) - Score thresholds. The default value is `[]`.

  * `:core` - Minimum score of core mutants. The default value is `100`.

  * `:changed` - Minimum score elsewhere. The default value is `80`.

  * `:per` - Apply `changed` to each non-core file, or to the whole run. The default value is `:file`.

* `:no_coverage` - `:count` scores NoCoverage as not killed; `:fail` also fails the gate. The default value is `:count`.

* `:timeouts` - How a `timeout` kill is scored. The default value is `:killed`.

* `:base` (`t:String.t/0`) - Git ref the changed scope is measured against. `JUGGERNAUT_BASE` overrides. The default value is `"main"`.

* `:workers` - Pool size; `:auto` is `min(8, max(1, div(schedulers, worker_schedulers)))`. The default value is `:auto`.

* `:worker_schedulers` (`t:pos_integer/0`) - Schedulers (`+S`) per worker. The default value is `2`.

* `:spares` (`t:boolean/0`) - Keep spare worker VMs parked with the project loaded (no app started, no database connection held), so a worker recycle or a boot-lane job skips starting a VM and loading the project. The default value is `true`.

* `:operators` - `:default`, `:all`, or a non-empty list of operator families and categories. The default value is `:default`.

* `:ignore_prefixes` - Comment prefixes recognised as ignore directives. The default value is `["juggernaut:ignore", "mutare:ignore"]`.

* `:strict_ignores` (`t:boolean/0`) - Ignore warnings become usage errors. The default value is `false`.

* `:raw_calls` - Calls whose arguments are never mutated: `{Mod, :fun}`, `{Mod, :fun, arity}` or `{Mod, :fun, arity, [positions]}`; `Mod` may be `:*`. The default value is `[]`.

* `:skip_calls` - Calls never mutated, with their arguments and piped upstream. The default value is `[]`.

* `:arid_calls` - Extra calls whose arguments the inner lane skips. The default value is `[]`.

* `:timeout` (`t:keyword/0`) - Per-test and per-job deadlines. The default value is `[]`.

  * `:multiplier` - Times the recorded duration (greater than 1.0). The default value is `3.0`.

  * `:min_ms` (`t:pos_integer/0`) - Lower bound in milliseconds. The default value is `1000`.

* `:test_lanes` (`t:keyword/0`) - Which tests are integration tests. A mutant runs its unit tests first and its integration tests only when they all pass, so a mutant that only an integration test kills is reported apart (it still counts as killed). The default value is `[]`.

  * `:integration` (`t:keyword/0`) - The integration lane; every other test is a unit test. The default value is `[]`.

    * `:tags` (list of `t:atom/0`) - A test with any of these tags set (`@tag`, `@describetag` or `@moduletag`, to anything but `false` or `nil`). The default value is `[:integration]`.

    * `:paths` (list of `t:String.t/0`) - A test in a file matching any of these globs. The default value is `["test/integration/**"]`.

    * `:timeout` (`t:keyword/0`) - The integration tests' deadlines; a key left out takes the top-level `timeout`'s value. The default value is `[]`.

      * `:multiplier` - Times the recorded duration (greater than 1.0).

      * `:min_ms` (`t:pos_integer/0`) - Lower bound in milliseconds.

* `:env` - OS environment per worker as `{name, template}`; `${NAME}` is the controller's value, `{worker}` the worker index or `boot`. The default value is `[{"MIX_TEST_PARTITION", "${MIX_TEST_PARTITION}_jg{worker}"}]`.

* `:worker_setup` - Mix tasks run once per worker before the app starts. The default value is `:test_alias`.

* `:lasting_supervisors` (list of `t:atom/0`) - Registered supervisors under which tests may leave state that is meant to last (a pool started on first use, such as `Req.FinchSupervisor`; sessions the app keeps): changes in their subtrees are not drift. The default value is `[]`.

* `:lasting_servers` (list of `t:atom/0`) - Project server modules whose state tests change but no later test reads (state keyed by each test's own fresh ids, a debug ring): a change in their state is not residue, so it neither recycles a probe worker nor sends a survivor to a fresh one. Never list a memo or cache. The default value is `[]`.

* `:connections` (`t:keyword/0`) - The database connection budget the pool is sized within. The default value is `[]`.

  * `:budget` - Connections all workers may hold together; `:none` sets no limit. The default value is `:none`.

  * `:per_worker` - Connections one worker holds; `:auto` is twice `worker_schedulers`. The default value is `:auto`.

* `:cache` (`t:boolean/0`) - Per-mutant result cache. The default value is `true`.

* `:cache_inputs` - Files outside `paths` and the test paths that cached results rest on: `:tracked` (every git-tracked file) or a list of globs. The default value is `:tracked`.

* `:refuse_env` - Environment variable name patterns that make a run refuse to start. The default value is `:secrets`.

# `docs`

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

Markdown documentation of every key.

# `schema`

```elixir
@spec schema() :: NimbleOptions.t()
```

The compiled NimbleOptions schema.

# `secrets_pattern`

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

The regex source used for `refuse_env: :secrets` (case-insensitive).

# `validate`

```elixir
@spec validate(keyword()) ::
  {:ok, keyword()} | {:error, NimbleOptions.ValidationError.t()}
```

Validates a keyword list, filling defaults.

---

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