Swift edition
mutastic explain
Everything known of one mutant, with its tests run. Its card when it's missed, or what became of it otherwise, then what the change is, its operator, how its id is made, where it is, and how the last run of every mutant, by run or next, went for it, from that run's mutation.json.
Usage
mutastic explain ID [DIR]A coding agent's hooks run it as the command: the build plugins don't.
Output
On the pricing sample. This is mutastic's own output, written from the CLI and checked against it on every build.
✗ MISSED no test checks discount() at total == 100 ┌─ Sources/Pricing/Pricing.swift:12 │ 11 │ public func discount(total: Int) -> Int { 12 │ if total >= 100 { │ ^^ >= changed to > 13 │ return total / 10 │ = mutant - if total >= 100 { + if total > 100 { = operator mutastic/boundary · https://docs.mutastic.io/swift/operators/conditions/#boundary = note: every test calls discount() away from the boundary inputs seen: 50, 250 (none is 100) covered by PricingTests.bigOrdersGetTenPercentOff(), PricingTests.smallOrdersPayFullPrice() (all 2 covering tests still pass) = help: test discount() with total = 100 and assert the result
// in Tests/PricingTests/PricingTests.swift @Test func discountAtTheTotalEdge() { #expect(Pricing().discount(total: 100) == 10) // today 10 · with this mutant 0 } check today's value is the one you intend: the test pins what the code does now
done when mutastic verify m86f9a31d samples/pricing passes reproduce mutastic run --only=m86f9a31d samples/pricing or ignore mutastic ignore m86f9a31d --reason="<why>" samples/pricing
About this mutant ─────────────────────────────────────────────── = change total >= 100 → total > 100 the code the switch puts in place of the original when this mutant is live = operator mutastic/boundary: `>=` becomes `>` = id m86f9a31d: `m` and the first 8 hex digits of its fingerprint, 86f9a31dc50ca15c, a SHA-256 of the file, function, operator, site and change no line number goes in, so the id stays the same when code above it moves = site `total >= 100` in Pricing.discount, line 12, column 14: the function's site 1, counting from 1 in source order = last run none yet: `run` or `next` records oneExit status
0 whatever the mutant's result: it explains, it doesn't judge. Any command exits 2 when mutastic couldn't run: see exit codes.
Options
--workers=N
How many mutants run side by side; half the cores, from 1 to 4, unless set.
| Command line | --workers=N |
|---|
--confirm-catches
Run each catching test again on its own, to confirm the catch.
| Command line | --confirm-catches |
|---|
--no-suggestions
Don't look for a test that catches each missed mutant, which runs the missed mutant's function outside the tests.
| Command line | --no-suggestions |
|---|
--exclude-tests=TEST
A test to leave out of the run, by its name as a run shows it, or a module of tests by its path: one that can't run reliably here, with a race or a fixed port; the summary names it, and says so of a name that matches no test. mutastic.yaml's exclude-tests: leaves one out of every run, with its reason.
| Command line | --exclude-tests=TEST |
|---|
--build-system=BUILD
Which build a directory with both a Package.swift and an Xcode project uses: the one with tests unless set, and a refusal when both have them.
One of swiftpmxcode
| Command line | --build-system=BUILD |
|---|
--scheme=SCHEME
The Xcode scheme whose tests a run uses, for a project or workspace with several: the only one with tests for macOS or iOS unless set.
| Command line | --scheme=SCHEME |
|---|
--format=FORMAT
How the result is shown; full on a terminal, concise elsewhere, agent for coding agents; explain takes full and jsonl.
One of fullbriefconcisegroupedagentjsonl
| Command line | --format=FORMAT |
|---|---|
| Environment | MUTASTIC_FORMAT, MUTASTIC_AGENT |
--vocabulary=WORDS
plain says caught and missed; classic says killed and survived.
One of plainclassic
| Command line | --vocabulary=WORDS |
|---|---|
| Environment | MUTASTIC_VOCABULARY |
--color=WHEN
Colour: auto uses it on a terminal that wants it.
One of autoalwaysnever
| Command line | --color=WHEN |
|---|---|
| Environment | NO_COLOR, FORCE_COLOR |
--hyperlinks=WHEN
File locations as links a terminal can open: auto uses them on a terminal.
One of autoalwaysnever
| Command line | --hyperlinks=WHEN |
|---|
--progress=STYLE
Progress on stderr: redrawn in place on a terminal, a line every 30 s in logs, CI and agents' runs, or none.
One of autobarcounternone
| Command line | --progress=STYLE |
|---|---|
| Environment | MUTASTIC_PROGRESS |