supercov 4.29.16 → 4.29.17

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/mutation.md CHANGED
@@ -233,7 +233,9 @@ mutants the tests let survive.
233
233
  of the tests each runs against, so a pass cut short has decided as many as
234
234
  it could. `--budget <seconds>` is the whole command's, measuring and
235
235
  planning included: once it is spent the pass stops and ends as a finished
236
- one, its verdicts saved, so a job ends when its budget says. The summary
236
+ one, its verdicts saved, so a job ends when its budget says. Nothing is
237
+ judged once the pass begins to stop: a test the stop cut short says nothing
238
+ of its mutant, which is left for the next pass. The summary
237
239
  says how many mutants it left for the next pass (`budget of 2400 s spent:
238
240
  812 mutant(s) left without a verdict, for the next pass`), and, where
239
241
  measuring took half the budget or more, what it took (`measuring took 310 s
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "4.29.16",
3
+ "version": "4.29.17",
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.16",
129
- "@supercov/cli-darwin-x64": "4.29.16",
130
- "@supercov/cli-linux-arm64-gnu": "4.29.16",
131
- "@supercov/cli-linux-arm64-musl": "4.29.16",
132
- "@supercov/cli-linux-x64-gnu": "4.29.16",
133
- "@supercov/cli-linux-x64-musl": "4.29.16",
134
- "@supercov/cli-win32-arm64": "4.29.16",
135
- "@supercov/cli-win32-x64": "4.29.16"
128
+ "@supercov/cli-darwin-arm64": "4.29.17",
129
+ "@supercov/cli-darwin-x64": "4.29.17",
130
+ "@supercov/cli-linux-arm64-gnu": "4.29.17",
131
+ "@supercov/cli-linux-arm64-musl": "4.29.17",
132
+ "@supercov/cli-linux-x64-gnu": "4.29.17",
133
+ "@supercov/cli-linux-x64-musl": "4.29.17",
134
+ "@supercov/cli-win32-arm64": "4.29.17",
135
+ "@supercov/cli-win32-x64": "4.29.17"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@playwright/test": ">=1.55.0",
@@ -1868,6 +1868,7 @@ export const WHY = {
1868
1868
  "module-level": "it is a server module's top-level code",
1869
1869
  "by-time": "its code ran for a request that named no test",
1870
1870
  "unfinished": "not every candidate test ran in the shared pass",
1871
+ "unfinished-twice": "not every candidate test ran in two rounds of tests side by side",
1871
1872
  "confirm": "a test killed it beside other mutants' attempts",
1872
1873
  "doubt": "the test that killed it failed without it too, on the same server",
1873
1874
  "unreached": "its candidates passed on the shared server, yet no attempt of theirs ran it there: the requests that reached its code did not carry their test's mutant",
@@ -498,9 +498,20 @@ export default class SupercovPlaywrightStrongReporter {
498
498
  // signal stopped leaves its mutants without a verdict, for the next
499
499
  // pass (a confirmation round stopped before its first test made two
500
500
  // mutants of a 60 s pass `error`s).
501
+ // A `rest` round's mutant runs one test at a time first: beside one
502
+ // another, a worker with nothing it could take yet ran through a
503
+ // test's copies while another worker's attempt ran, and the round
504
+ // ended with mutants still waiting for that test. One whose every
505
+ // candidate kills it (a test that fails without it is left out)
506
+ // was an `error` on a loaded runner. One at a time, no copy is spent
507
+ // so; what a serial round leaves is the `error`.
501
508
  if (kind !== "main" && !decided && !stopped) {
502
- for (const job of rest)
503
- write({ id: job.id, status: "error", reason: "its tests did not finish, in two rounds", tests: 0, durationMs: 0 });
509
+ for (const job of rest) {
510
+ if (kind === "rest")
511
+ serial.push({ ...job, reason: "unfinished-twice" });
512
+ else
513
+ write({ id: job.id, status: "error", reason: "its tests did not finish, in two rounds", tests: 0, durationMs: 0 });
514
+ }
504
515
  rest.splice(0, rest.length);
505
516
  }
506
517
  // A mutant run alone with the whole command started with it, whose
@@ -20,15 +20,17 @@
20
20
  // whose parent was not chosen) runs whole from then on. A kill by a job that
21
21
  // ran other tests than its baseline did is confirmed by running the job's
22
22
  // tests again without the mutant. A job past 3x its baseline and 10 s is
23
- // stopped: a timeout, unless a test had already failed. A baseline ran with
24
- // the machine to itself, and a job that ran beside others may have spent its
25
- // time waiting on them (the CPU; Cargo's lock on a build directory, where
26
- // each job builds Rust compiled to wasm): such a job runs again alone, and
27
- // only one past its limit there is a timeout.
23
+ // stopped: a timeout, unless a test had already failed. A stopped job may
24
+ // only have waited: on the jobs beside it (the CPU; Cargo's lock on a build
25
+ // directory, where each job builds Rust compiled to wasm), or on a machine
26
+ // busier than when its baseline ran (other work on it, beyond the pass's
27
+ // own). So it runs again alone, after its tests ran alone without the
28
+ // mutant, and its limit there is 3x the slower of that run and its
29
+ // baseline, and 10 s: only a job past that is a timeout.
28
30
  import { fork, spawn } from "node:child_process";
29
31
  import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
30
32
  import { availableParallelism, constants, cpus } from "node:os";
31
- import { basename, delimiter, join, resolve } from "node:path";
33
+ import { basename, delimiter, dirname, join, resolve } from "node:path";
32
34
  import { fileURLToPath } from "node:url";
33
35
 
34
36
  // A file whose baseline job took at most this long, the start of the command
@@ -386,7 +388,15 @@ function stop(child) {
386
388
 
387
389
  export async function drive({ command, plan, resultsPath, root = process.cwd(), workers = parallelism(), environment = process.env, graceMs = 10_000, baselineGraceMs = 60_000 }) {
388
390
  const started = Date.now();
389
- const write = (record) => appendFileSync(resultsPath, `${JSON.stringify(record)}\n`);
391
+ // Once the pass is told to stop (`stopped-at` beside the results), its
392
+ // jobs are stopped under their tests: one that ends then says nothing of
393
+ // its mutant, and no verdict is written (vitestStrongReporter.mjs).
394
+ const stopping = join(dirname(resultsPath), "stopped-at");
395
+ const write = (record) => {
396
+ if (record.status !== undefined && existsSync(stopping))
397
+ return;
398
+ appendFileSync(resultsPath, `${JSON.stringify(record)}\n`);
399
+ };
390
400
  const work = `${resultsPath}.jobs`;
391
401
  mkdirSync(work, { recursive: true });
392
402
  const tests = plan.tests;
@@ -685,11 +695,16 @@ export async function drive({ command, plan, resultsPath, root = process.cwd(),
685
695
  const bail = !whole || [...baseline.statuses.values()].every((status) => status === "passed");
686
696
  let result = await job({ mutant, file: group.file, tests: chosen, bail, limitMs, priority });
687
697
  const killerIn = (outcome) => [...outcome.statuses].find(([id, status]) => status === "failed" && (chosen === null || chosen.has(id)) && !excluded(id))?.[0];
688
- // Past its limit beside other jobs, with nothing failed: it may
689
- // only have waited on them, so it runs again alone.
690
- if (result.timedOut && result.crowded && !result.mutantTimedOut && killerIn(result) === undefined) {
698
+ // Past its limit with nothing failed: it may only have waited, on
699
+ // the jobs beside it or on a machine busier than when its
700
+ // baseline ran. It runs again alone, its limit from the same
701
+ // tests without the mutant run alone just before it, at the
702
+ // machine's speed now.
703
+ if (result.timedOut && !result.mutantTimedOut && killerIn(result) === undefined) {
691
704
  profile.alone += 1;
692
- result = await job({ mutant, file: group.file, tests: chosen, bail, limitMs, alone: true });
705
+ const now = await job({ mutant: null, file: group.file, tests: chosen, bail: false, limitMs: baselineLimit(group.file, chosen), alone: true });
706
+ const slowest = Math.max(baseline.durationMs, now.durationMs);
707
+ result = await job({ mutant, file: group.file, tests: chosen, bail, limitMs: 3 * slowest + graceMs, alone: true });
693
708
  }
694
709
  const ran = [...result.statuses].filter(([id, status]) => status !== "skipped" && (chosen === null || chosen.has(id)));
695
710
  const killer = killerIn(result);
@@ -21,7 +21,7 @@ import { syncBuiltinESMExports } from "node:module";
21
21
  import { PassThrough } from "node:stream";
22
22
  import { fileURLToPath } from "node:url";
23
23
  import { availableParallelism } from "node:os";
24
- import { relative, sep } from "node:path";
24
+ import { dirname, join, relative, sep } from "node:path";
25
25
 
26
26
  // A mutant's test, and its copy, get twice StrykerJS's limit: 1.5× the
27
27
  // measured time and 5 s, doubled.
@@ -719,7 +719,18 @@ async function drive(vitest, runFiles, specs, plan, resultsPath) {
719
719
  // Vitest 2 and later pass specifications; Vitest 1, [project, file].
720
720
  const fileOf = (spec) => spec.moduleId ?? (Array.isArray(spec) ? spec[1] : spec);
721
721
  const specOf = new Map(specs.map((spec) => [toRelative(root, fileOf(spec)), spec]));
722
- const write = (record) => appendFileSync(resultsPath, `${JSON.stringify(record)}\n`);
722
+ // Once the pass is told to stop (Supercov notes when, `stopped-at`
723
+ // beside the results, before it signals the command), its copies are
724
+ // stopped under their tests: a copy that ends then says nothing of its
725
+ // mutant, and no verdict is written. The mutant is left for the next
726
+ // pass. One judged from a copy the budget stopped on a macOS runner was a
727
+ // `killed` for a mutant whose test waits five minutes.
728
+ const stopping = join(dirname(resultsPath), "stopped-at");
729
+ const write = (record) => {
730
+ if (record.status !== undefined && existsSync(stopping))
731
+ return;
732
+ appendFileSync(resultsPath, `${JSON.stringify(record)}\n`);
733
+ };
723
734
  const tests = plan.tests;
724
735
  const started = Date.now();
725
736
  const passCpu = machineCpu();