Juggernaut reads .juggernaut.exs at the project root. The file is optional and every
key has a default, so a project with no file runs with the values below.
The file is evaluated as Elixir and must return a keyword list. It is checked in this order, and any failure is a configuration error (exit 2) naming the file:
- the file evaluates (a syntax error, raise, throw or exit is reported, never a crash);
- the result is a keyword list;
- no key is given twice, at the top level or inside a nested group;
- every key and value is valid: unknown keys are reported together, and a nested error names its path.
For example:
.juggernaut.exs: invalid value for :core option: expected one of 0..100, got: 200 (in options [:thresholds])Nested groups (thresholds, timeout, test_lanes, connections) fill in their own
defaults, so you only write the keys you change.
Every key, with its default
# .juggernaut.exs: these are the defaults
[
paths: ["lib"],
exclude: [],
test_paths: :project,
core: [],
thresholds: [core: 100, changed: 80, per: :file],
no_coverage: :count,
timeouts: :killed,
base: "main",
workers: :auto,
worker_schedulers: 2,
spares: true,
operators: :default,
ignore_prefixes: ["juggernaut:ignore", "mutare:ignore"],
strict_ignores: false,
raw_calls: [],
skip_calls: [],
arid_calls: [],
timeout: [multiplier: 3.0, min_ms: 1_000],
test_lanes: [
integration: [tags: [:integration], paths: ["test/integration/**"], timeout: []]
],
env: [{"MIX_TEST_PARTITION", "${MIX_TEST_PARTITION}_jg{worker}"}],
worker_setup: :test_alias,
lasting_supervisors: [],
lasting_servers: [],
connections: [budget: :none, per_worker: :auto],
cache: true,
cache_inputs: :tracked,
refuse_env: :secrets
]What to mutate
| Key | Default | Meaning |
|---|---|---|
paths | ["lib"] | Source roots to mutate (.ex files only). Each must be an existing directory, and the list may not be empty. |
exclude | [] | File globs that are never mutated. |
test_paths | :project | Where the tests are. :project uses the Mix project's :test_paths; otherwise a list of directories. |
operators | :default | Which operator families run: :default and :all are every family; otherwise a non-empty list of family names (such as :relational) and categories (:operator, :literal, :call, :condition, :function, :pattern, :clause, :otp). An unknown name is an error listing the valid ones. The families are the modules under Juggernaut.Operators. |
raw_calls | [] | Calls whose arguments are never mutated: {Mod, :fun}, {Mod, :fun, arity} or {Mod, :fun, arity, [positions]} (zero-based argument positions; all of them when none are listed). Mod or :fun may be :*. A local call matches when the module is imported or used. Use it for macros such as Ecto.Query.from/2, whose arguments are a query language rather than Elixir. |
skip_calls | [] | {Mod, :fun} or {Mod, :fun, arity}: the call itself, its arguments and whatever is piped into it are never mutated. |
arid_calls | [] | Extra calls that the fast inner lane skips, outside core code. It already skips Logger, IO and :telemetry calls and treats the message of raise/1,2 as raw. |
ignore_prefixes | ["juggernaut:ignore", "mutare:ignore"] | Comment prefixes read as ignore directives (see the README). |
strict_ignores | false | When true, an ignore warning (an ignore comment that cannot apply, such as an empty filter) is a usage error (exit 2). |
The gate
| Key | Default | Meaning |
|---|---|---|
core | [] | What is held to thresholds.core: file globs ("lib/my_app/auth/**") and module patterns, either a module (MyApp.Billing) or a string ending in .* ("MyApp.Billing.*", its submodules). |
thresholds | [core: 100, changed: 80, per: :file] | core (0..100) is the minimum score of core mutants; changed (0..100) the minimum elsewhere; per applies changed to each non-core file on its own (:file) or to the whole run (:run). |
no_coverage | :count | A mutant no test reaches: :count scores it as not killed; :fail also fails the gate. |
timeouts | :killed | How a kill only by timeout is scored: :killed, or :survived to count it as a survivor. |
base | "main" | The git ref that the default "changed" scope is measured against. The JUGGERNAUT_BASE environment variable overrides it. A ref that does not resolve is an error, never a silent fallback. |
Workers and the test environment
| Key | Default | Meaning |
|---|---|---|
workers | :auto | The pool size. :auto is min(8, max(1, div(schedulers, worker_schedulers))); otherwise a positive integer. |
worker_schedulers | 2 | Schedulers (+S) each worker VM runs with. |
spares | true | Keep spare worker VMs parked with the project loaded (no application started, no database connection held), so a worker recycle or a boot-lane job skips starting a VM. false starts a VM for every boot. |
env | [{"MIX_TEST_PARTITION", "${MIX_TEST_PARTITION}_jg{worker}"}] | OS environment for each worker, as {name, template}. ${NAME} is the value in the shell that started the run (empty when unset); {worker} is the worker index, or bootN for slot N of the boot lane. With MIX_TEST_PARTITION=_myapp, worker 3 gets _myapp_jg3, so each worker has its own test database. |
worker_setup | :test_alias | Mix tasks each worker runs once before its application starts. :test_alias takes the string steps of the project's test alias other than test itself (in a Phoenix project, ecto.create --quiet and ecto.migrate --quiet); a function step gives none, so list the tasks yourself in that case. Each task is retried 4 times before the boot fails. |
lasting_supervisors | [] | 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 between jobs are not treated as drift. A supervisor that is not running is ignored. |
lasting_servers | [] | Project server modules whose state tests change but no later test reads: state keyed by each test's own fresh ids, a debug event ring. Their state is left out of the check after each job, so a probe job that changed it does not restart its worker, and a survivor found after it is not run again on a fresh worker. Never list a memo or cache, or a server a later test can read (a fake whose scripted answers are keyed by something tests reuse): a value it kept can let a mutant survive. |
connections | [budget: :none, per_worker: :auto] | The database connection budget. budget is the number of connections all workers may hold together (:none sets no limit); per_worker is what one worker holds (:auto is twice worker_schedulers). The pool is cut to div(budget, per_worker) workers; a budget below one worker is an error. |
timeout | [multiplier: 3.0, min_ms: 1_000] | Per-test and per-job deadlines: multiplier (a number greater than 1.0) times the test's recorded duration, and never below min_ms milliseconds. |
test_lanes | see below | Which tests are integration tests. |
test_lanes
test_lanes: [
integration: [
tags: [:integration], # a test with any of these tags set
paths: ["test/integration/**"], # or a test in a file matching these globs
timeout: [] # its own multiplier/min_ms; missing keys take `timeout`'s
]
]A tag counts when it is set by @tag, @describetag or @moduletag to anything other
than false or nil. Every other test is a unit test. A mutant runs its unit tests
first and its integration tests only when those all pass, so a mutant that only an
integration test kills is reported apart (it still counts as killed). tags: [], paths: [] turns the lane off.
Reuse and safety
| Key | Default | Meaning |
|---|---|---|
cache | true | The per-mutant result cache: a mutant whose function, tests and inputs are unchanged reuses its earlier result. |
cache_inputs | :tracked | Files outside paths and the test paths that cached results rest on. :tracked is every git-tracked file (except those and the triage file); a list of globs narrows it, for a project whose tests read only known data files. |
refuse_env | :secrets | Environment variable name patterns that make a run refuse to start (exit 2). Only the names are printed, never the values. :secrets matches, case-insensitively, names containing API_KEY, API-KEY, TOKEN, SECRET, PASSWORD, PASSWD, CREDENTIAL, PRIVATE_KEY, ANTHROPIC, OPENAI, XAI_ or AWS_. A list of regex strings replaces it; [] refuses nothing. Only set, non-empty variables count. |
Environment variables
| Variable | Effect |
|---|---|
JUGGERNAUT_BASE | Overrides base. It is not part of the config fingerprint: the base chooses which mutants run, not how one is judged, so changing it never invalidates cached results. |
JUGGERNAUT_FORMAT | The default --format of every task. A known format that a task does not offer is ignored by that task; an unknown one is a usage error. |
JUGGERNAUT_ACTOR | Who ran the command (for example agent:claude), recorded with each run. Acknowledgements of triage claims and warm-safe declarations are refused to an actor whose name starts with agent. |
The config fingerprint
Each run records a SHA-256 over the validated options (nested keyword lists sorted, so
formatting and key order do not matter), Juggernaut's code, the Elixir and OTP versions
and mix.lock. A cached result is reused only under the same fingerprint, so changing
the configuration, upgrading a dependency or upgrading Juggernaut re-runs the mutants.
An example
A Phoenix and Ecto project with a billing core:
[
core: [MyApp.Billing, "MyApp.Billing.*", "lib/my_app/auth/**"],
thresholds: [core: 100, changed: 85],
exclude: ["lib/my_app_web/telemetry.ex"],
raw_calls: [
{Ecto.Query, :from},
{Ecto.Query, :where},
{Ecto.Query, :select}
],
lasting_supervisors: [Req.FinchSupervisor],
connections: [budget: 40],
test_lanes: [integration: [tags: [:integration, :browser]]]
]mix juggernaut.install writes a starting file (Ecto projects get the Ecto query macros
as raw_calls), and mix juggernaut.install --from-mutare converts the call routes of
an existing .mutare.exs.