supercov 4.29.3 → 4.29.5
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 +5 -0
- package/docs/mutation.md +14 -0
- package/package.json +9 -9
- package/runtime/javascript/playwright.mjs +11 -1
- package/runtime/javascript/playwrightStrong.mjs +872 -303
- package/runtime/javascript/playwrightStrongReporter.mjs +328 -299
- package/runtime/javascript/runtime.mjs +25 -0
package/docs/cli.md
CHANGED
|
@@ -559,6 +559,10 @@ phpunit`). See `docs/design/strong-mutation.md`,
|
|
|
559
559
|
- `--budget <seconds>` stops the pass once it is spent: it ends as a finished
|
|
560
560
|
pass, its verdicts saved, and says how many mutants it left for the next.
|
|
561
561
|
The cheapest mutants run first, by their tests' recorded times.
|
|
562
|
+
- `--timeout-factor <x>`: a Playwright test that runs with a mutant is
|
|
563
|
+
stopped past x times its baseline + 5 s (default 1.5, StrykerJS's), and the
|
|
564
|
+
mutant is a `timeout`. `SUPERCOV_STRONG_TIMEOUT_FACTOR` sets it where the
|
|
565
|
+
option is not given.
|
|
562
566
|
- After an edit, `supercov mutants` measures the checkout again and keeps an
|
|
563
567
|
earlier run's verdict for each mutant whose file is as it was and whose
|
|
564
568
|
candidate tests, and their test files, nothing changed could reach (as
|
|
@@ -1316,6 +1320,7 @@ terminal or offline environment after the package has been downloaded.
|
|
|
1316
1320
|
| `SUPERCOV_KEEP_WORKSPACE` | Set to `1` to leave the instrumented copy of the project in `.supercov/workspaces/` after the run, to inspect what the command ran |
|
|
1317
1321
|
| `SUPERCOV_MUTANTS` | Set to `1` to measure a run with the probes that record the values its mutants' verdicts read, and list its mutants as it runs (see [Mutants](#mutants)); a plain run lists none and places no probe |
|
|
1318
1322
|
| `SUPERCOV_STRONG_WORKERS` | How many test processes a JavaScript or Python strong pass runs at once (default: about one per CPU) |
|
|
1323
|
+
| `SUPERCOV_STRONG_TIMEOUT_FACTOR` | A Playwright strong pass's time limit for a test run with a mutant: this many times the test's baseline, + 5 s (default `1.5`; `--timeout-factor` overrides it) |
|
|
1319
1324
|
| `SUPERCOV_COMMAND_TIMEOUT_MS` | Stop the test command after this many milliseconds: what is still running is asked to stop, then made to five seconds later, what ran is recorded, and Supercov exits `124`. No deadline by default |
|
|
1320
1325
|
|
|
1321
1326
|
Examples:
|
package/docs/mutation.md
CHANGED
|
@@ -224,6 +224,10 @@ npx supercov runs latest mutants test --plan --json
|
|
|
224
224
|
[A pass split across jobs](#a-pass-split-across-jobs)).
|
|
225
225
|
- `--budget <seconds>` stops the pass once that time is spent, its verdicts
|
|
226
226
|
saved, and leaves the rest for the next pass.
|
|
227
|
+
- `--timeout-factor <x>` (or `SUPERCOV_STRONG_TIMEOUT_FACTOR`) sets a
|
|
228
|
+
Playwright test's time limit when it runs with a mutant: x times its
|
|
229
|
+
baseline, + 5 s (default 1.5, StrykerJS's `timeoutFactor`). See
|
|
230
|
+
[Playwright](#javascript-and-typescript).
|
|
227
231
|
- `--plan` prints what would run, and runs nothing.
|
|
228
232
|
|
|
229
233
|
Some mutants no test can tell apart from the original. Accept them in
|
|
@@ -368,6 +372,16 @@ no mutants shows none of this.
|
|
|
368
372
|
serves different mutants to different workers. A mutant of a server's
|
|
369
373
|
start-up runs with the server started again for it. StrykerJS has no
|
|
370
374
|
Playwright runner, so Playwright's verdicts are checked by hand (see below).
|
|
375
|
+
A test run with a mutant gets StrykerJS's time limit: its baseline (the
|
|
376
|
+
longest of its measured run and its runs without a mutant in the pass)
|
|
377
|
+
× 1.5 + 5 s, or its own timeout where that is shorter. Playwright's test
|
|
378
|
+
timeout is set to it, and a `test.setTimeout()` or `test.slow()` in the
|
|
379
|
+
test may shorten it but not lengthen it, so a click or an `expect` that
|
|
380
|
+
waits for an element the mutant broke ends there, not at its own 30 s. A
|
|
381
|
+
test that runs out of its limit makes its mutant a `timeout`, which counts
|
|
382
|
+
as detected; the summary says how many, and against what limit.
|
|
383
|
+
`--timeout-factor <x>` (or `SUPERCOV_STRONG_TIMEOUT_FACTOR`) changes the
|
|
384
|
+
1.5: a suite whose tests' times vary widely between runs may want 2 or 3.
|
|
371
385
|
- **Jest and Mocha** run in resident runners, as StrykerJS's do; `node:test`,
|
|
372
386
|
AVA, node-tap, `bun:test` and Vitest Browser Mode run one test file per
|
|
373
387
|
start of the command, with the mutant on from its start.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supercov",
|
|
3
|
-
"version": "4.29.
|
|
3
|
+
"version": "4.29.5",
|
|
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.
|
|
129
|
-
"@supercov/cli-darwin-x64": "4.29.
|
|
130
|
-
"@supercov/cli-linux-arm64-gnu": "4.29.
|
|
131
|
-
"@supercov/cli-linux-arm64-musl": "4.29.
|
|
132
|
-
"@supercov/cli-linux-x64-gnu": "4.29.
|
|
133
|
-
"@supercov/cli-linux-x64-musl": "4.29.
|
|
134
|
-
"@supercov/cli-win32-arm64": "4.29.
|
|
135
|
-
"@supercov/cli-win32-x64": "4.29.
|
|
128
|
+
"@supercov/cli-darwin-arm64": "4.29.5",
|
|
129
|
+
"@supercov/cli-darwin-x64": "4.29.5",
|
|
130
|
+
"@supercov/cli-linux-arm64-gnu": "4.29.5",
|
|
131
|
+
"@supercov/cli-linux-arm64-musl": "4.29.5",
|
|
132
|
+
"@supercov/cli-linux-x64-gnu": "4.29.5",
|
|
133
|
+
"@supercov/cli-linux-x64-musl": "4.29.5",
|
|
134
|
+
"@supercov/cli-win32-arm64": "4.29.5",
|
|
135
|
+
"@supercov/cli-win32-x64": "4.29.5"
|
|
136
136
|
},
|
|
137
137
|
"peerDependencies": {
|
|
138
138
|
"@playwright/test": ">=1.55.0",
|
|
@@ -20,7 +20,7 @@ import { inferTestProvenance, testTags } from "./provenance.mjs";
|
|
|
20
20
|
import { appendJsonLineDurableSync, appendJsonLineSync } from "./atomic.mjs";
|
|
21
21
|
import { expandSnapshot, mergeSnapshots, columnarEvents } from "./snapshots.mjs";
|
|
22
22
|
import { COVERAGE_DOCUMENT_PHASE_COOKIE, COVERAGE_DOCUMENT_PHASE_SITE_COOKIE, COVERAGE_PHASE_HEADER, COVERAGE_PHASE_COOKIE, COVERAGE_PHASE_SITE_COOKIE, COVERAGE_SCOPE_COOKIE, COVERAGE_SCOPE_HEADER, COVERAGE_SCOPE_SITE_COOKIE, COVERAGE_CARRIER_ENV, encodeCoverageCarrier, encodeCoverageScope, serverEvidenceDirectory, serverEvidencePath, startDocumentInPhase, } from "./transport.mjs";
|
|
23
|
-
import { PAGE_TIMEOUT_MARKER, activatePageMutant, strongClaim, strongFinish } from "./playwrightStrong.mjs";
|
|
23
|
+
import { PAGE_TIMEOUT_MARKER, activatePageMutant, installCopies, ranInWorker, strongClaim, strongFinish } from "./playwrightStrong.mjs";
|
|
24
24
|
export * from "@playwright/test";
|
|
25
25
|
const generatedTargetModule = "__SUPERCOV_PLAYWRIGHT_MODULE__";
|
|
26
26
|
const targetModule = process.env["SUPERCOV_PLAYWRIGHT_MODULE"] ??
|
|
@@ -1905,6 +1905,9 @@ const instrumentedFixtures = {
|
|
|
1905
1905
|
// test is running for all of this, not only during its actions.
|
|
1906
1906
|
const startedAtMs = Date.now();
|
|
1907
1907
|
timingCount("fixture.testSetup", performance.now() - setupStarted);
|
|
1908
|
+
// A mutant that ran in this worker's own process may have left
|
|
1909
|
+
// state in it: the next test gets a new worker.
|
|
1910
|
+
let restartWorker = false;
|
|
1908
1911
|
try {
|
|
1909
1912
|
await use();
|
|
1910
1913
|
}
|
|
@@ -1944,6 +1947,7 @@ const instrumentedFixtures = {
|
|
|
1944
1947
|
}
|
|
1945
1948
|
finally {
|
|
1946
1949
|
strongFinish(testInfo, strong, { attemptId: scope.attemptId, pageTimeout: controller.mutantRanAway === true });
|
|
1950
|
+
restartWorker = ranInWorker(strong, scope.attemptId) && testInfo.status === "passed";
|
|
1947
1951
|
await timed("controller.dispose", () => controller.dispose());
|
|
1948
1952
|
timingCount("fixture.testTeardown", performance.now() - teardownStarted);
|
|
1949
1953
|
timingReport(testInfo.title);
|
|
@@ -1953,10 +1957,16 @@ const instrumentedFixtures = {
|
|
|
1953
1957
|
controllers.delete(scope.attemptId);
|
|
1954
1958
|
}
|
|
1955
1959
|
}
|
|
1960
|
+
if (restartWorker)
|
|
1961
|
+
throw new Error("Supercov strong mutation: the mutant ran in this worker's process, so the next test runs in a new worker");
|
|
1956
1962
|
},
|
|
1957
1963
|
{ auto: true },
|
|
1958
1964
|
],
|
|
1959
1965
|
};
|
|
1966
|
+
// A strong pass declares each test it needs as many times as it may run it
|
|
1967
|
+
// (playwrightStrong.mjs): on Playwright's test type, before the test object
|
|
1968
|
+
// every spec uses is made.
|
|
1969
|
+
installCopies(base);
|
|
1960
1970
|
const instrumentedTest = base.extend(instrumentedFixtures);
|
|
1961
1971
|
export const test = instrumentedTest;
|
|
1962
1972
|
// `export *` passes no default on, and `import test from "@playwright/test"`
|