Mutation testing for MoonBit projects
moon install f4ah6o/turtles/cmd/turtles@0.4.7moon install https://github.com/gpui-mbt/turtles.mbt.git cmd/turtles --branch mainmoon install https://github.com/gpui-mbt/turtles.mbt.git cmd/turtles --tag v0.4.7moon install ./cmd/turtlesturtles --version # turtles 0.4.7 for this source release
turtles --help
cd path/to/your-moonbit-module
turtles --dir . # or: turtles --list to preview the mutation setturtles --dir . # run all discovered mutants
turtles --dir . --list # preview mutations without running tests
turtles --dir . --file src/parser # only mutate paths containing TEXT
turtles --dir . --target native # run only what moon compiles for native
turtles --dir . --target js --list # preview the js-active mutation set
turtles --dir . --timeout 120 # per-command timeout in seconds (default 60)
turtles --dir . --json report.json # machine-readable report (schema 3)
turtles --dir . --iterate # reuse KILLED/UNVIABLE outcomes from the last run
turtles --dir . --affected # run only tests that can observe each mutant
turtles --dir . --emit-regressions # write regression-test templates for property kills
turtles --dir . --emit-properties # write property-test skeletons for survivors
turtles --dir . --pbt-witness # differential QuickCheck witness for survivors
turtles --dir . --pbt-amplify 4 # re-run survivor properties with 4x budget
turtles --dir . --timeout-multiplier 3 # per-phase timeout = 3x the measured baseline (min 10s)turtles --dir . --jobs 4moon install f4ah6o/turtles/cmd/turtles@0.4.7
turtles --dir . --fail-under 80 --json turtles-report.jsonturtles --dir . --fail-under 80score = killed / viable * 100 where viable = killed + survived + timeout{
"schema": 3,
"module": "/abs/path",
"turtles_version": "0.4.7",
"moon_version": "moon 0.1.20260920 (914d7da 2026-09-20) ~/.moon/bin/moon",
"target": "native",
"inactive_mutants": 1,
"inactive_files": ["js_only.mbt"],
"baseline_duration_ms": "216",
"baseline_check_ms": "70",
"baseline_test_ms": "146",
"test_scope": "module",
"mutants": [
{ "id": "m-e7ccdf47c3b8bc0b", "path": "math.mbt", "line": 3, "column": 5,
"offset": 47, "end": 48, "group": "arithmetic",
"original": "+", "replacement": "-", "outcome": "KILLED",
"duration_ms": "202", "reused": false }
],
"summary": { "killed": 6, "survived": 0, "timeout": 0, "unviable": 0,
"reused": 0, "score": 100 }
}include = ["src/", "lib/"]
exclude = ["generated/", "vendor/"]
operators = ["comparison", "boolean", "arithmetic", "literal", "condition"]///|
#turtles.skip
pub fn fragile() -> Int {
1 + 2
}
// turtles: skip
///|
pub fn also_skipped() -> Int {
3 + 4
}moon update
moon fmt --check
moon check --target native --deny-warn
moon test --target native
moon -C fixtures/basic test
moon run cmd/turtles -- --dir fixtures/basic --timeout 30