supercov 4.28.0 → 4.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +43 -16
  2. package/docs/cli.md +322 -2
  3. package/docs/getting-started.md +18 -0
  4. package/docs/mutation.md +539 -0
  5. package/docs/supported-suites.md +109 -60
  6. package/package.json +11 -10
  7. package/runtime/javascript/atomic.mjs +6 -2
  8. package/runtime/javascript/ava.mjs +12 -0
  9. package/runtime/javascript/bunTest.mjs +17 -0
  10. package/runtime/javascript/jest.cjs +67 -0
  11. package/runtime/javascript/jest.config.mjs +46 -6
  12. package/runtime/javascript/jestReporter.mjs +5 -2
  13. package/runtime/javascript/mocha.mjs +79 -5
  14. package/runtime/javascript/nodeTest.mjs +28 -0
  15. package/runtime/javascript/playwright.mjs +33 -0
  16. package/runtime/javascript/playwrightStrong.mjs +477 -0
  17. package/runtime/javascript/playwrightStrongReporter.mjs +377 -0
  18. package/runtime/javascript/runnerEntry.mjs +62 -0
  19. package/runtime/javascript/runtime.mjs +752 -13
  20. package/runtime/javascript/snapshots.mjs +16 -1
  21. package/runtime/javascript/strongJestHost.mjs +103 -0
  22. package/runtime/javascript/strongJob.mjs +78 -0
  23. package/runtime/javascript/strongJobs.mjs +809 -0
  24. package/runtime/javascript/strongMochaHost.mjs +166 -0
  25. package/runtime/javascript/strongWasmOut.cjs +96 -0
  26. package/runtime/javascript/tap.mjs +43 -1
  27. package/runtime/javascript/transport.mjs +5 -0
  28. package/runtime/javascript/vitest.mjs +74 -2
  29. package/runtime/javascript/vitestBrowser.mjs +34 -2
  30. package/runtime/javascript/vitestStrong.mjs +234 -0
  31. package/runtime/javascript/vitestStrongReporter.mjs +2268 -0
  32. package/runtime/javascript/vitestStrongSpawner.mjs +248 -0
@@ -0,0 +1,539 @@
1
+ # Mutation testing
2
+
3
+ Coverage says which code the tests ran. It does not say whether they would
4
+ notice that code doing the wrong thing. Mutation testing asks that directly:
5
+ it makes small changes to the source, one at a time (`a < b` becomes
6
+ `a <= b`, a `return` gives `0`, a call is removed), and checks whether a test
7
+ fails. Each change is a **mutant**. A mutant a test fails on is **killed**; one
8
+ every test passes with **survived**, and points at a check no test makes.
9
+
10
+ Supercov makes the mutants each language's established tool makes, so its
11
+ counts and verdicts can be compared with that tool's:
12
+
13
+ | Language | Mutants of | Support |
14
+ | --- | --- | --- |
15
+ | JavaScript, TypeScript | StrykerJS 10.1.1 | Full, under nine runners |
16
+ | Python | mutmut 3.8.1 | Preview |
17
+ | Rust | cargo-mutants 27.1.0 | Preview |
18
+ | Go | Gremlins 0.6.0, every mutator | Preview |
19
+ | Ruby | mutant 0.17.1, light operators | Preview |
20
+
21
+ A preview language works end to end and was validated against its tool on
22
+ public projects (see [Compared with the established tools](#compared-with-the-established-tools)),
23
+ but has been run on fewer projects than JavaScript and may change in a later
24
+ release. Java and Kotlin have no mutants in this release. On Windows,
25
+ Python's and Ruby's mutants are listed and the weak report reads them, but
26
+ the strong pass does not run them: their drivers fork the loaded suite, which
27
+ Windows cannot, so each is counted "not run" under its runner.
28
+
29
+ ```sh supercov-example
30
+ npx supercov mutants -- npm test
31
+ npx supercov mutants --diff origin/main
32
+ ```
33
+
34
+ ## Weak and strong mutation
35
+
36
+ Supercov answers in two steps.
37
+
38
+ **Weak mutation** reads the run you already measured. Nothing runs again. For
39
+ each mutant it says how far the tests got toward killing it:
40
+
41
+ | Status | Meaning |
42
+ | --- | --- |
43
+ | `not-reached` | No test ran the mutated code |
44
+ | `not-infected` | A test ran it, and every evaluation gave the mutant the same value as the original: these tests cannot kill it |
45
+ | `infected` | Some evaluation gave the mutant another value: a candidate kill, not a kill |
46
+ | `unknown` | The run cannot tell, such as code whose values it did not record |
47
+ | `equivalent` | No input can make it differ, shown from the code alone |
48
+
49
+ A `not-infected` mutant is a certain survivor, and its reason says what is
50
+ missing: `a never equal to b` for `a < b` made `a <= b` means no test tries
51
+ the boundary. The weak score is `infected / (infected + not-infected +
52
+ not-reached)`, with unknown and equivalent mutants left out.
53
+
54
+ **Strong mutation** (`mutants test`) runs the tests again with each mutant
55
+ switched on and records what the established tools record:
56
+
57
+ | Verdict | Meaning |
58
+ | --- | --- |
59
+ | `killed` | A test failed with the mutant in place |
60
+ | `survived` | Every test that could kill it passed |
61
+ | `timeout` | A test ran past its time limit with the mutant in place |
62
+ | `no-coverage` | No test ran the mutated code |
63
+ | `unviable` | The mutant does not compile (Rust and Go); counted apart and left out of the score |
64
+ | `error` | The pass could not give it a verdict, with the reason; left out of the score |
65
+
66
+ The mutation score is `(killed + timeout) / (killed + timeout + survived +
67
+ no-coverage)`, as StrykerJS computes it. It appears only after a strong pass
68
+ and is never estimated from weak results. Both scores are shown beside
69
+ coverage and never change a coverage figure.
70
+
71
+ The strong pass is cheaper than running every test against every mutant
72
+ because the measured run already holds what the established tools learn in a
73
+ first pass of their own:
74
+
75
+ - a mutant no test reached is `no-coverage`, and one no test infected is
76
+ `survived`, without running anything;
77
+ - every other mutant runs only against the tests whose own evidence shows they
78
+ reached or infected it, the likeliest killer first, and stops at the first
79
+ failure.
80
+
81
+ Each of these shortcuts is exact. Where the run cannot prove a test is
82
+ irrelevant, the test runs.
83
+
84
+ ### How this differs from coverage
85
+
86
+ A line can be covered, its branch taken both ways, and still have no test that
87
+ checks its result. Coverage counts that line as done; a `not-infected` or
88
+ `survived` mutant on it says it is not. A mutant on code no test runs is
89
+ `not-reached`, the same gap `runs latest gaps` already lists, so the mutants
90
+ worth reading first are the reached ones that survive.
91
+
92
+ ## Commands
93
+
94
+ ### Test the tests
95
+
96
+ ```sh supercov-example
97
+ npx supercov mutants -- npm test
98
+ ```
99
+
100
+ `supercov mutants` measures the command with the probes that record the values
101
+ its mutants' verdicts read (`SUPERCOV_MUTANTS=1`), lists the mutants, and runs
102
+ the strong pass. Without `--` it uses the latest run's command. The pass's
103
+ summary gives the mutation score, every verdict counted, and ends with the
104
+ mutants the tests let survive.
105
+
106
+ - **Unchanged checkout.** The next `supercov mutants` reads the same run again
107
+ and runs nothing it already decided.
108
+ - **After an edit.** It measures the checkout again and keeps an earlier
109
+ verdict for each mutant whose file is as it was and whose candidate tests,
110
+ and their test files, nothing changed could reach, as `runs latest tests
111
+ affected` reads a change: a test file's edit reaches its tests, a source's
112
+ edit the tests that ran the changed code. The rest run, and the summary says
113
+ how many verdicts were kept and from which run.
114
+ - **Interrupted.** Each verdict is saved as it is made. A pass stopped by
115
+ Ctrl-C, a killed job or a test worker that never ended keeps what it
116
+ decided, Ctrl-C stops every process the pass started, and the next pass runs
117
+ only the rest.
118
+ - **Exit codes.** `0` with an answer; `1` when `--fail-on` or `--critical`
119
+ finds a mutant; `2`, after the answer, when the measured command failed (a
120
+ failing test kills nothing, so the verdicts cannot gate) or no mutant could
121
+ be run. A run that recorded no test is refused with exit `2`.
122
+
123
+ The steps can also be taken one at a time:
124
+
125
+ ```sh supercov-example
126
+ npx supercov -- npm test # a plain run: no cost for mutants
127
+ npx supercov runs latest mutants # weak mutation, from the run
128
+ npx supercov runs latest mutants test # strong mutation, saved into the run
129
+ npx supercov runs latest mutants --status survived
130
+ ```
131
+
132
+ A plain run lists its mutants from its sources the first time they are asked
133
+ for. Without the value probes, a mutant whose verdict needs a recorded value
134
+ is `unknown`, and the strong pass runs it.
135
+
136
+ ### Read the mutants
137
+
138
+ ```sh supercov-example
139
+ npx supercov runs latest mutants # a table of files and the scores
140
+ npx supercov runs latest mutants src/billing.ts # one file's mutants, by line
141
+ npx supercov runs latest mutants src/billing.ts:42 # one line's, with their reasons and ids
142
+ npx supercov runs latest mutants --status not-infected,not-reached
143
+ npx supercov runs latest mutants --mutator EqualityOperator
144
+ npx supercov runs latest mutants --json # the coverage.mutants reply, a page at a time
145
+ npx supercov runs latest mutants --format jsonl --output mutants.jsonl
146
+ ```
147
+
148
+ After a strong pass, each mutant shows its verdict beside its weak status, the
149
+ mutation score appears with every verdict counted, and `--status` also takes a
150
+ verdict (`survived`, `killed`, `timeout`, `no-coverage`, `error`,
151
+ `unviable`). The table of files puts first the files with the most mutants a
152
+ test reaches and does not infect. A listed mutant shows its change as
153
+ `original → replacement`, or by the part it changes where the code is long
154
+ (`….slice(0, maxUsers) → …`). `--kind`, `--runner`, `--tag`, `--title` and
155
+ `--test-file` read the verdicts of those tests alone.
156
+
157
+ ### Gate a pull request
158
+
159
+ `--diff <base>` keeps the mutants on lines the change added or modified since
160
+ it left `<base>`, and lists first the ones its tests leave alive:
161
+
162
+ ```sh supercov-example
163
+ npx supercov runs latest mutants --diff origin/main
164
+ npx supercov runs latest mutants --diff origin/main --format markdown --output mutants.md
165
+ npx supercov runs latest mutants --diff origin/main --fail-on not-infected,not-reached
166
+ npx supercov mutants --diff origin/main --fail-on survived
167
+ npx supercov mutants --diff origin/main --format markdown --output mutants.md
168
+ ```
169
+
170
+ - `--format markdown` writes a table for a pull request's comment: the counts,
171
+ then up to 25 mutants left alive with where they are, what they change and
172
+ why, and the command that lists the rest. Once a strong pass gave verdicts,
173
+ it has the mutation score and lists the survivors. `supercov mutants` takes
174
+ `--format markdown` and `--output <file>` too, and writes its own answer
175
+ that way.
176
+ - `--fail-on` exits `1` when a mutant asked about has one of the statuses
177
+ given. On `runs latest mutants` they are weak statuses, from the run alone;
178
+ on `supercov mutants` and `mutants test` they are verdicts: `survived`,
179
+ `timeout`, `no-coverage` and `error`. A second `mutants test` over the same
180
+ run runs nothing already decided, so it can gate on the first's verdicts.
181
+ - The change is the commit the run measured against its merge base with
182
+ `<base>`. A run with uncommitted changes is compared as the working tree,
183
+ and the output says so. A base git does not know, as in a shallow checkout,
184
+ exits `2`: fetch it (`fetch-depth: 0`).
185
+
186
+ In GitHub Actions, after the tests:
187
+
188
+ ```yaml
189
+ - uses: actions/checkout@v6
190
+ with:
191
+ fetch-depth: 0 # the base and the merge base
192
+ - run: npx supercov -- npm test
193
+ - run: npx supercov runs latest mutants test --diff origin/${{ github.base_ref }}
194
+ - run: npx supercov runs latest mutants --diff origin/${{ github.base_ref }} --format markdown --output mutants.md
195
+ - run: gh pr comment ${{ github.event.number }} --body-file mutants.md --edit-last --create-if-none
196
+ env:
197
+ GH_TOKEN: ${{ github.token }}
198
+ - run: npx supercov runs latest mutants test --diff origin/${{ github.base_ref }} --fail-on survived
199
+ ```
200
+
201
+ ### Critical code and accepted mutants
202
+
203
+ ```sh supercov-example
204
+ npx supercov runs latest mutants test --critical "src/auth/**" --fail-on survived
205
+ npx supercov runs latest mutants test --shard 1/4
206
+ npx supercov runs latest mutants test --plan --json
207
+ ```
208
+
209
+ - `--critical <glob>` (repeatable): every mutant in those files must be killed
210
+ or accepted, or the command fails.
211
+ - `--shard k/n` runs one of n shares of the mutants, for parallel jobs.
212
+ - `--plan` prints what would run, and runs nothing.
213
+
214
+ Some mutants no test can tell apart from the original. Accept them in
215
+ `supercov.accepted.json` at the project root:
216
+
217
+ ```json
218
+ [
219
+ { "id": "src/quota.ts:12:21-12:26:EqualityOperator:>=", "reason": "n is never 0 here: the caller returns early" }
220
+ ]
221
+ ```
222
+
223
+ An accepted mutant still runs, is shown as accepted, and never fails the
224
+ command. An entry whose mutant is killed or no longer exists is listed as
225
+ stale. A mutant's id is its file, its span, its mutator and what it becomes,
226
+ and stays the same while that code does.
227
+
228
+ ### Runners without a driver
229
+
230
+ A test runner Supercov has no adapter for, such as tape, records no test: a
231
+ strong pass over its run is refused with exit `2`, naming the runner and how
232
+ many mutants its command ran. Tests Supercov records under a runner no strong
233
+ driver runs keep the mutants list and the weak report; in a strong pass their
234
+ mutants are `error`, which the score leaves out, counted in a line per runner
235
+ (`12 mutant(s) not run: no strong driver for pytest`), never survivors.
236
+
237
+ ### Join and export other tools' reports
238
+
239
+ ```sh supercov-example
240
+ npx supercov runs latest mutants --stryker reports/mutation/mutation.json
241
+ npx supercov runs latest mutants --stryker reports/mutation
242
+ ```
243
+
244
+ `--stryker` reads StrykerJS's `mutation.json` reports, or a directory of
245
+ them, and mutant's session results for Ruby (`.mutant/results`). Each mutant
246
+ then shows the other tool's status beside Supercov's, and the reply counts the
247
+ mutants each tool made alone. A mutant Supercov calls not reached, not
248
+ infected or equivalent that the other tool killed is a soundness violation:
249
+ it is listed, and the command exits `1`.
250
+
251
+ `mutants --format stryker` writes a run's mutants as StrykerJS's
252
+ `mutation.json` (the mutation testing report schema, version 2), which
253
+ mutation-testing-elements' HTML report, the Stryker Dashboard and CI
254
+ integrations read, and `mutants --format pit` as PIT's `mutations.xml`, which
255
+ PIT's report aggregator and Sonar's PIT plugin read. Each carries every
256
+ mutant's strong verdict where a pass gave one. These are file formats only:
257
+ they work for every language above, and are not Java or Kotlin support.
258
+
259
+ ## The HTML reports
260
+
261
+ `npx supercov report` and `npx supercov runs latest report --format html`
262
+ show a run's mutation testing beside its coverage, for a run that listed
263
+ mutants:
264
+
265
+ - **The Mutation testing card** holds the weak score and the mutation score
266
+ side by side, each with how many mutants it is over, every status and
267
+ verdict counted, why the mutants without a verdict have none, each language
268
+ where the run has several, and the mutants left alive by file, each opening
269
+ its line.
270
+ - **The Files list** gets a Mutants column with each file's score, sortable,
271
+ lowest first.
272
+ - **A file's source** marks each line with a mutant left alive. The line's
273
+ evidence lists each mutant with what it changes, its weak status and reason,
274
+ its verdict and why, and the test that killed it.
275
+
276
+ `--diff <base>` on either report keeps the mutants of a change, as
277
+ `runs latest mutants --diff` does; coverage is not narrowed. A run that listed
278
+ no mutants shows none of this.
279
+
280
+ ## Languages and runners
281
+
282
+ | Language | Strong pass runs under |
283
+ | --- | --- |
284
+ | JavaScript, TypeScript | Vitest, Vitest Browser Mode, Playwright, Jest, `node:test`, Mocha, AVA, node-tap, `bun:test` |
285
+ | Python (preview) | pytest, `python -m unittest` |
286
+ | Rust (preview) | `cargo test` (libtest and doctests), cargo-nextest; wasm in Node, under WASI and in Chrome |
287
+ | Go (preview) | `go test` |
288
+ | Ruby (preview) | RSpec, Minitest, test-unit, Cucumber |
289
+
290
+ ### JavaScript and TypeScript
291
+
292
+ - **Vitest** runs many mutants at once in one resident Vitest: each test file
293
+ can carry its own mutant, a mutant is switched on before the file's imports,
294
+ and a mutant's test files run one after another, the likeliest killer first,
295
+ stopping at its first failing test.
296
+ - **Playwright** carries each test's mutant with its requests, so one server
297
+ serves different mutants to different workers. A mutant of a server's
298
+ start-up runs with the server started again for it. StrykerJS has no
299
+ Playwright runner, so Playwright's verdicts are checked by hand (see below).
300
+ - **Jest and Mocha** run in resident runners, as StrykerJS's do; `node:test`,
301
+ AVA, node-tap, `bun:test` and Vitest Browser Mode run one test file per
302
+ start of the command, with the mutant on from its start.
303
+ - Rust compiled to wasm and loaded by these tests is mutated too (preview):
304
+ the command builds the wasm with the mutants switched in, and each wasm
305
+ instance, in Node or in a Playwright page, runs the test's mutant.
306
+ - Limits: wasm loaded in Vitest Browser Mode's pages is not measured, so its
307
+ mutants are not planned. A function body StrykerJS empties where no switch
308
+ can be placed is `error`.
309
+
310
+ ### Python (preview)
311
+
312
+ The tests are collected once; each mutant then runs in a fork of that
313
+ process, its function switched to mutmut's copy, against its candidate tests
314
+ in collection order. A mutant whose code ran while the test modules loaded (a
315
+ decorator applied at import) runs in a fresh interpreter with the mutant on
316
+ from its start. `SUPERCOV_STRONG_WORKERS` sets how many forks run at once.
317
+
318
+ Limits: Windows, since the pass forks. A suite that runs unittest through its
319
+ own script (`TextTestRunner().run`) rather than `unittest.main` has its
320
+ mutants recorded `error`. mutmut's `do_not_mutate_patterns` and
321
+ `mutate_only_covered_lines` are not read.
322
+
323
+ ### Rust (preview)
324
+
325
+ Every mutant of a pass is built in one switched copy, and each test runs by
326
+ its exact name in a process of its own; doctests run through `cargo test
327
+ --doc`. Under cargo-nextest each test runs through nextest with the project's
328
+ configuration. A mutant the compiler refuses is `unviable`, as cargo-mutants
329
+ reports it; a mutant in code the compiler evaluates (`const`, `static`,
330
+ `const fn`) is built on its own.
331
+
332
+ Limits: tests built for wasm run against mutants in Node, under WASI and in
333
+ Chrome; tests run in Firefox, Safari or Edge have their mutants recorded
334
+ `error`. Value probes do not cover `&&`, `||`, struct fields and returns that
335
+ are not numbers or booleans: those mutants stay `unknown` where they ran, and
336
+ the strong pass decides them.
337
+
338
+ ### Go (preview)
339
+
340
+ Each package's test binary is built once (`go test -c`); each mutant runs the
341
+ packages that hold a candidate, whole, as `go test` runs them, with the
342
+ command's own flags (`-tags`, `-race`, `-short` and the rest, read from the
343
+ `go test` the command runs, even behind `make test` or a script). A mutant the
344
+ type checker or `go vet`'s test-time checks refuse is `unviable`; Gremlins
345
+ counts such a mutant killed. A constant declaration's mutant is built on its
346
+ own.
347
+
348
+ Limits: floating-point operations have no value probe. On Windows, the
349
+ command's flags are read only from a `go test` the command names itself.
350
+
351
+ ### Ruby (preview)
352
+
353
+ The pass runs once the suite has loaded: one fork of the loaded process per
354
+ mutant, its candidate tests in the suite's order, through RSpec's own
355
+ `run_specs`, Minitest's run, test-unit's mediator and Cucumber's filters, so
356
+ suite hooks run with the mutant on.
357
+
358
+ Limits: the test-unit and Cucumber drivers have run under test-unit 3.7 and
359
+ Cucumber 12 only. A method holding syntax the port does not convert yet (a
360
+ heredoc, a constant pattern) is skipped, and named. A switched file loaded
361
+ before Supercov's runtime (a gemspec that requires the library under `bundle
362
+ exec`) has its mutants recorded `error`.
363
+
364
+ ## Compared with the established tools
365
+
366
+ Measured on public projects pinned to a tag, every mutant of each tool joined
367
+ by its id. A soundness violation is a mutant one tool kills and the other
368
+ calls survived; every disagreement was applied by hand and the suite run as
369
+ written. Each tool's settings and every disagreement are in `docs/design/`.
370
+ Support for PIT's mutants, for Java and Kotlin, is planned.
371
+
372
+ ### JavaScript and TypeScript, against StrykerJS 10.1.1
373
+
374
+ Vitest, against StrykerJS's full kill matrix, whole wall time on 16-CPU Linux
375
+ machines (AWS c8a and m8a.4xlarge), 2026-11-23: StrykerJS's set-up, dry run
376
+ and mutants against Supercov's measured run and strong pass. tRPC does not fit
377
+ one 10-minute job, so both tools ran in 8 jobs, each repeating its dry run or
378
+ measured run:
379
+
380
+ | Project | StrykerJS | Supercov (measure + strong) | Without what each job repeats | Disagreements |
381
+ | --- | ---: | ---: | --- | --- |
382
+ | hono (5,111 tests) | 258.5 s | 177.1 s (8.6 + 168.5) | the same, one job | 10 |
383
+ | tRPC (1,032 tests) | 2,782.2 s | 2,018.1 s (181.3 + 1,836.8) | 2,125.3 s against 1,752.8 s | 2 |
384
+
385
+ On defu, scule, cookie-es, pathe and ufo the verdicts agree, mutant for
386
+ mutant. hono's 10 disagreements are kills of StrykerJS's covering subset (a
387
+ test run without the tests it depends on, a fake clock left running) that the
388
+ suite as written does not make; tRPC's 2 are a flaky test and a mutant
389
+ StrykerJS calls Timeout for passing its hit limit while every test passes.
390
+
391
+ The other runners, against StrykerJS with `disableBail` (every covering test
392
+ against every mutant), one project per 16-CPU machine (AWS c8a and
393
+ m8a.4xlarge), both tools with 15 workers, 2026-11-22. Times in seconds:
394
+
395
+ | Project | Runner | Mutants joined | Disagreements | StrykerJS | Supercov (measure + strong) |
396
+ | --- | --- | ---: | ---: | ---: | ---: |
397
+ | bytes.js | Mocha | 146 | 0 | 3.0 | 1.1 + 0.4 |
398
+ | negotiator | Mocha | 544 | 0 | 3.4 | 1.2 + 1.0 |
399
+ | pathval | Mocha (ES modules) | 123 | 13 | 1.6 | 0.9 + 1.3 |
400
+ | deep-eql | Mocha (ES modules) | StrykerJS cannot run it | | | 1.1 + 5.9 |
401
+ | ms | Jest | 227 | 0 | 4.6 | 1.8 + 3.2 |
402
+ | cron-parser | Jest | 460 | 1 (error) | 31.8 | 2.4 + 22.4 |
403
+ | classnames | `node:test` | 161 | 0 | 7.8 | 0.6 + 2.8 |
404
+ | camelcase | `node:test` | 234 | 0 | 10.1 | 1.2 + 3.9 |
405
+ | dot-prop | AVA | 590 | 0 | 46.4 | 2.7 + 26.7 |
406
+ | p-map | AVA | 512 | 1 | 354.6 | 25.9 + 118.4 |
407
+ | ini | node-tap | 413 | 0 (28 StrykerJS errors) | 13.6 | 1.6 + 6.5 |
408
+ | remix-auth | `bun:test` | 625 | 0 | 7.3 | 0.4 + 1.9 |
409
+ | mini-throttle | Vitest Browser Mode | 77 | 1 (error) | 32.4 | 9.0 + 28.0 |
410
+
411
+ Playwright, which StrykerJS does not run, on playwright-test-coverage (a Vite
412
+ app served by `npm run dev`, three tests): its 9 mutants run are 7 `timeout`
413
+ and 2 `survived`, and each applied by hand to the source, with `npx playwright
414
+ test` as written, agrees: the 7 fail, waiting out Playwright's 30 seconds, and
415
+ the 2 pass.
416
+
417
+ pathval's 13 are kills StrykerJS makes because it runs every mutant in one
418
+ process: once a mutant left a polluted global behind, one test failed for
419
+ every mutant after it; each applied by hand survives `npx mocha`. The two
420
+ `error`s are function bodies where no switch could be placed. p-map's one is a
421
+ kill by a test that fails run alone and passes in the whole suite. Where
422
+ StrykerJS has no runner of its own (`node:test`, AVA, Bun) it runs the whole
423
+ command per mutant, and Supercov is 2.5 to 3.5 times faster.
424
+
425
+ ### Python (preview), against mutmut 3.8.1
426
+
427
+ Against mutmut's full kill matrix (every test against every mutant), 5,438
428
+ mutants, on 16-CPU Linux machines (AWS c8a and m8a.4xlarge), 2026-11-22:
429
+ every mutant the matrix detects,
430
+ Supercov detects. The five Supercov detects alone each fail the suite as
431
+ written when applied by hand: mutmut does not switch on a mutant in a module
432
+ run with `-m`, or in a decorator applied as the test modules load.
433
+
434
+ Wall time with mutmut at one child per CPU and Supercov's forks one per CPU,
435
+ each tool on a machine of its own, 4-CPU Linux machines (AWS m8a.xlarge),
436
+ 2026-11-22, parse's pytest-cov off for both:
437
+
438
+ | Project | Mutants | mutmut | Supercov measure + strong |
439
+ | --- | ---: | ---: | ---: |
440
+ | python-slugify 9.2.0 | 1,124 | 23.6 s | 1.2 + 17.9 s |
441
+ | cachetools 8.0.2 | 1,660 | 44.8 s | 1.6 + 43.6 s |
442
+ | parse 1.22.4 | 1,306 | 56.5 s | 1.4 + 12.6 s |
443
+ | humanize 4.17.0 | 1,348 | 152.3 s | 4.6 + 19.8 s |
444
+
445
+ ### Rust (preview), against cargo-mutants 27.1.0
446
+
447
+ On 16-CPU Linux machines (AWS c8a and m8a.4xlarge), one a job, 2026-11-22,
448
+ cargo-mutants with `-j 8` in shards, Supercov's strong pass with its default 8
449
+ workers:
450
+
451
+ | Crate | Mutants | Agree | Soundness violations | Viability disagreements | cargo-mutants (shards summed) | Supercov strong pass |
452
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: |
453
+ | strsim-rs 0.11.1 | 363 | 363 | 0 | 0 | 60.3 s | 15.7 s |
454
+ | rust-hex 0.4.3 | 104 | 102 | 0 | 2 | 74.2 s | 22.5 s |
455
+ | semver 1.0.27 | 365 | 362 | 0 | 3 | 43.0 s | 15.8 s |
456
+
457
+ Four of the five viability disagreements are mutants cargo-mutants' build
458
+ refuses on a deny-by-default lint, which Supercov caps as a measured run does
459
+ (the mutant then builds and is killed); the fifth is in a `const` no test
460
+ reaches, which cargo-mutants' build refuses and Supercov records as no
461
+ coverage. None is a mutant one tool kills and the other calls survived.
462
+
463
+ ### Go (preview), against Gremlins 0.6.0
464
+
465
+ Five modules at their tags, Gremlins with every test per mutant
466
+ (`--integration`, `-count=1`), each tool on its own machine of the same type.
467
+ Supercov's time is the whole of `supercov mutants -- go test ./...`, its
468
+ measured run and builds included. 16 CPUs: AWS c8a.4xlarge, 2026-11-22. 4
469
+ CPUs: GitHub's `ubuntu-latest`, 2026-11-22, measured before a change that
470
+ shortened Supercov's retries:
471
+
472
+ | Module | Mutants | Killed (Gremlins / Supercov) | Unviable | 16 CPUs: Gremlins / Supercov | 4 CPUs: Gremlins / Supercov |
473
+ | --- | ---: | ---: | ---: | ---: | ---: |
474
+ | go-humanize 1.0.1 | 332 | 234 / 211 | 84 | 15.5 / 12.3 s | 61.2 / 24.7 s |
475
+ | btree 1.1.3 | 367 | 140 / 134 | 21 | 11.3 / 11.4 s | 41.1 / 29.0 s |
476
+ | golang-lru 2.0.7 | 165 | 120 / 104 | 11 | 31.7 / 17.9 s | 165.3 / 59.3 s |
477
+ | uuid 1.6.0 | 205 | 130 / 145 | 1 | 15.3 / 13.6 s | 90.0 / 43.7 s |
478
+ | cast 1.7.1 | 190 | 129 / 122 | 7 | 9.4 / 8.8 s | 59.4 / 22.9 s |
479
+
480
+ Gremlins counts mutants that do not compile as killed; Supercov counts them
481
+ unviable. Supercov kills 16 mutants of go-humanize's and 16 of uuid's constant
482
+ declarations, which Gremlins never runs. Gremlins runs one `go test` per
483
+ mutant; Supercov builds each package's test binary once, and its measured run
484
+ is most of its time on 16 CPUs. The remaining differences are a nested module
485
+ and a `//go:build ignore` file Gremlins mutates and `go test ./...` never
486
+ builds, time-dependent kills of clock arithmetic, and a flaky Example; none is
487
+ a soundness violation.
488
+
489
+ ### Ruby (preview), against mutant 0.17.1
490
+
491
+ On 16-CPU Linux machines (AWS c8a and m8a.4xlarge, Ruby 3.4.13, 16 jobs for
492
+ both tools), 2026-11-22, mutant with every test a candidate for every subject:
493
+
494
+ | Project | mutant's mutants | Joined | Disagreements | mutant | Supercov measure + strong |
495
+ | --- | ---: | ---: | ---: | ---: | ---: |
496
+ | dry-inflector 1.3.1 (RSpec) | 2,061 | 2,061 | 0 | 30.6 s | 1.6 + 17.8 s |
497
+ | dotenv 3.2.0 (RSpec) | 1,345 | 1,345 | 0 | 21.0 s | 1.0 + 18.2 s |
498
+ | erubi 1.13.1 (Minitest) | 1,571 | 1,571 | 0 | 14.2 s | 0.4 + 1.5 s |
499
+
500
+ mutant has no test-unit or Cucumber integration; on ostruct 0.6.3 (test-unit,
501
+ 824 mutants run) and json_test_data 1.2.0 (Cucumber, 1,313) every mutant the
502
+ pass ran was run again by hand with the whole suite, with no disagreement.
503
+
504
+ ## Cost, and turning it off
505
+
506
+ Mutation testing costs nothing until it is asked for:
507
+
508
+ - A plain run (`supercov -- <tests>`) places no probe and lists no mutant.
509
+ - The first `runs <id> mutants` lists the run's mutants from its sources and
510
+ keeps the list beside the run. A file changed since the run is left out
511
+ until it is measured again.
512
+ - The HTML reports and the run summary show mutants only for a run that
513
+ listed them.
514
+
515
+ What costs time:
516
+
517
+ - **The value probes** (`SUPERCOV_MUTANTS=1`, which `supercov mutants` sets)
518
+ record the values that decide a mutant's infection, so more mutants are
519
+ decided without running. Over a measured run without them:
520
+ - Python: 0.98 to 1.15 times (16-CPU AWS c8a and m8a.4xlarge, 2026-11-22);
521
+ - Rust: 4 to 11% more, warm builds (16-CPU AWS c8a and m8a.4xlarge,
522
+ 2026-11-22);
523
+ - Go: within the noise, with up to 0.11 s for the type checker's facts
524
+ after an edit (16-CPU AWS c8a.4xlarge, 2026-11-22);
525
+ - Ruby: 1.02 to 1.16 times the whole run (16-CPU AWS c8a and m8a.4xlarge,
526
+ 2026-11-22);
527
+ - JavaScript and TypeScript: 1.4 to 1.7% on hono and 2.6% on ufo (Vitest),
528
+ 3.6% on cron-parser (Jest) and 4% on negotiator (Mocha), medians of 5
529
+ (16-CPU AWS c8a and m8a.4xlarge, 2026-11-22).
530
+ - **The strong pass** reruns tests, so it takes about as long as the
531
+ established tool on the same project: the tables above. Use `--diff` on a
532
+ pull request to run only the change's mutants, and `--shard` to split a
533
+ large pass across jobs.
534
+
535
+ To turn it off, measure without `SUPERCOV_MUTANTS` and do not run `supercov
536
+ mutants` or `mutants test`; a run's coverage is the same either way.
537
+ `npx supercov runs clean` removes stored runs with their mutants and verdicts.
538
+
539
+ See [CLI reference](cli.md#mutants) for every option.