supercov 4.29.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.
package/docs/cli.md CHANGED
@@ -537,7 +537,11 @@ many in a line per runner (`12 mutant(s) not run: no strong driver for
537
537
  phpunit`). See `docs/design/strong-mutation.md`,
538
538
  `docs/design/python-mutants.md` and `docs/design/mutation-drivers.md`.
539
539
 
540
- - `--shard k/n` runs one of n shares of the mutants, for parallel jobs.
540
+ - `--shard k/n` runs one of n shares of the mutants, for parallel jobs; each
541
+ job's run holds its share's verdicts, `merge` keeps them all in the merged
542
+ run, and a later `supercov mutants` keeps each verdict nothing changed could
543
+ move from whichever earlier run holds it (see
544
+ [Combine shards](#combine-shards)).
541
545
  - `--critical <glob>` (repeatable): every mutant there must be killed or
542
546
  accepted, or the command fails.
543
547
  - `--fail-on survived,timeout,no-coverage,error`: fail on any asked mutant with
@@ -1201,6 +1205,18 @@ recorded with the same bytes are not merged. A run that listed no mutants
1201
1205
  adds none, and where its tests ran a mutant, a verdict that needs values they
1202
1206
  did not record is `unknown`.
1203
1207
 
1208
+ The merged run keeps the strong verdicts the runs saved (`mutants test`,
1209
+ `--shard` among them), by mutant, and `merge` prints how many and from which
1210
+ runs. A kill in any run is a kill. A survival stands only where the run that
1211
+ let the mutant survive measured every test of the merged suite that could
1212
+ kill it; where another run's tests could, and it has no verdict, the mutant is
1213
+ left for a pass over the merged run to run. An error stands only where no run
1214
+ holds anything else. A run whose verdicts are of another mutant set than the
1215
+ merged run lists lends none, and `merge` names it; a run some of whose tests
1216
+ another measured again lends none either. Split a strong pass across jobs this
1217
+ way: each job measures and runs `supercov mutants --shard k/n -- <command>`,
1218
+ and the last merges (see `docs/mutation.md`, A pass split across jobs).
1219
+
1204
1220
  `assertions assess` assesses a merged run across every suite merged into it,
1205
1221
  reusing the answers saved when its parts were assessed. `tests affected` of a
1206
1222
  merged run is answered from the runs it was merged from, which hold the record
package/docs/mutation.md CHANGED
@@ -109,8 +109,12 @@ mutants the tests let survive.
109
109
  verdict for each mutant whose file is as it was and whose candidate tests,
110
110
  and their test files, nothing changed could reach, as `runs latest tests
111
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.
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`).
114
118
  - **Interrupted.** Each verdict is saved as it is made. A pass stopped by
115
119
  Ctrl-C, a killed job or a test worker that never ended keeps what it
116
120
  decided, Ctrl-C stops every process the pass started, and the next pass runs
@@ -208,7 +212,8 @@ npx supercov runs latest mutants test --plan --json
208
212
 
209
213
  - `--critical <glob>` (repeatable): every mutant in those files must be killed
210
214
  or accepted, or the command fails.
211
- - `--shard k/n` runs one of n shares of the mutants, for parallel jobs.
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)).
212
217
  - `--plan` prints what would run, and runs nothing.
213
218
 
214
219
  Some mutants no test can tell apart from the original. Accept them in
@@ -225,6 +230,50 @@ command. An entry whose mutant is killed or no longer exists is listed as
225
230
  stale. A mutant's id is its file, its span, its mutator and what it becomes,
226
231
  and stays the same while that code does.
227
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
+
228
277
  ### Runners without a driver
229
278
 
230
279
  A test runner Supercov has no adapter for, such as tape, records no test: a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "4.29.0",
3
+ "version": "4.29.1",
4
4
  "description": "Coverage, security and code quality for coding agents",
5
5
  "keywords": [
6
6
  "coverage",
@@ -125,14 +125,14 @@
125
125
  "test:windows-tls": "node scripts/windows-tls-test.mjs"
126
126
  },
127
127
  "optionalDependencies": {
128
- "@supercov/cli-darwin-arm64": "4.29.0",
129
- "@supercov/cli-darwin-x64": "4.29.0",
130
- "@supercov/cli-linux-arm64-gnu": "4.29.0",
131
- "@supercov/cli-linux-arm64-musl": "4.29.0",
132
- "@supercov/cli-linux-x64-gnu": "4.29.0",
133
- "@supercov/cli-linux-x64-musl": "4.29.0",
134
- "@supercov/cli-win32-arm64": "4.29.0",
135
- "@supercov/cli-win32-x64": "4.29.0"
128
+ "@supercov/cli-darwin-arm64": "4.29.1",
129
+ "@supercov/cli-darwin-x64": "4.29.1",
130
+ "@supercov/cli-linux-arm64-gnu": "4.29.1",
131
+ "@supercov/cli-linux-arm64-musl": "4.29.1",
132
+ "@supercov/cli-linux-x64-gnu": "4.29.1",
133
+ "@supercov/cli-linux-x64-musl": "4.29.1",
134
+ "@supercov/cli-win32-arm64": "4.29.1",
135
+ "@supercov/cli-win32-x64": "4.29.1"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@playwright/test": ">=1.55.0",
@@ -157,9 +157,12 @@ function redirected(specifier, context) {
157
157
  if (REPLACEMENT.startsWith("file:")) {
158
158
  return { url: REPLACEMENT, shortCircuit: true };
159
159
  }
160
+ // Relative to the project's root, not the process's directory: a
161
+ // server Playwright starts from its config's folder imports
162
+ // Playwright too.
160
163
  if (REPLACEMENT.startsWith(".")) {
161
164
  return {
162
- url: pathToFileURL(resolvePath(process.cwd(), REPLACEMENT)).href,
165
+ url: pathToFileURL(resolvePath(PROJECT_ROOT ?? process.cwd(), REPLACEMENT)).href,
163
166
  shortCircuit: true,
164
167
  };
165
168
  }