supercov 4.28.0 → 4.29.1

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