supercov 4.29.9 → 4.29.11
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
|
@@ -210,6 +210,11 @@ npx supercov mutants --diff origin/main --format markdown --output mutants.md
|
|
|
210
210
|
it has the mutation score and lists the survivors. `supercov mutants` takes
|
|
211
211
|
`--format markdown` and `--output <file>` too, and writes its own answer
|
|
212
212
|
that way.
|
|
213
|
+
- A survivor that only changes a log line (its change lies wholly inside the
|
|
214
|
+
arguments of `console.*`, or of a method named `info`, `warn`, `error`,
|
|
215
|
+
`debug`, `trace` or `log`) is still `survived`, but marked `(only changes a
|
|
216
|
+
log line)` (`logOnly` in JSON) and counted on its own: `survived 185 (109
|
|
217
|
+
only change a log line)`. Triage can set those aside.
|
|
213
218
|
- `--fail-on` exits `1` when a mutant asked about has one of the statuses
|
|
214
219
|
given. On `runs latest mutants` they are weak statuses, from the run alone;
|
|
215
220
|
on `supercov mutants` and `mutants test` they are verdicts: `survived`,
|
|
@@ -440,7 +445,12 @@ no mutants shows none of this.
|
|
|
440
445
|
against the tests that read its value, which a run measured with the
|
|
441
446
|
mutants' probes records, not every test whose server loaded the module;
|
|
442
447
|
the plan says how many were narrowed and by how much
|
|
443
|
-
(`docs/design/strong-mutation.md`, Module-level values).
|
|
448
|
+
(`docs/design/strong-mutation.md`, Module-level values). A mutant whose
|
|
449
|
+
code ran only for requests that named no test (a webhook a mock server
|
|
450
|
+
sends while tests run) runs against the tests that were running then, not
|
|
451
|
+
every test. A test runs without a mutant only after a failure, to confirm
|
|
452
|
+
it; a failure before any such run passed on its server (a cold server)
|
|
453
|
+
runs the mutant again once one has. StrykerJS has no
|
|
444
454
|
Playwright runner, so Playwright's verdicts are checked by hand (see below).
|
|
445
455
|
A test run with a mutant gets StrykerJS's time limit: its baseline (the
|
|
446
456
|
longest of its measured run and its runs without a mutant in the pass)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supercov",
|
|
3
|
-
"version": "4.29.
|
|
3
|
+
"version": "4.29.11",
|
|
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.11",
|
|
129
|
+
"@supercov/cli-darwin-x64": "4.29.11",
|
|
130
|
+
"@supercov/cli-linux-arm64-gnu": "4.29.11",
|
|
131
|
+
"@supercov/cli-linux-arm64-musl": "4.29.11",
|
|
132
|
+
"@supercov/cli-linux-x64-gnu": "4.29.11",
|
|
133
|
+
"@supercov/cli-linux-x64-musl": "4.29.11",
|
|
134
|
+
"@supercov/cli-win32-arm64": "4.29.11",
|
|
135
|
+
"@supercov/cli-win32-x64": "4.29.11"
|
|
136
136
|
},
|
|
137
137
|
"peerDependencies": {
|
|
138
138
|
"@playwright/test": ">=1.55.0",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
// with every request (header, cookies, child processes) and the page through
|
|
32
32
|
// an init script. A mutant the server must start with (its code ran in work
|
|
33
33
|
// no request named, or is a server module's top level, or ran for a request
|
|
34
|
-
// that named no test
|
|
34
|
+
// that named no test, or its switch is evaluated as a server module loads)
|
|
35
|
+
// is run alone afterwards, in an invocation of its own
|
|
35
36
|
// with SUPERCOV_ACTIVE_MUTANT set, which the engine starts for each `restart`
|
|
36
37
|
// record the judge writes (javascript_run.rs). So do a kill (or a timeout)
|
|
37
38
|
// that ran beside another mutant's attempt or whose control failed (one test
|
|
@@ -66,6 +67,9 @@ const COPIES_PER_INVOCATION = 20_000;
|
|
|
66
67
|
// A test whose control fails this often in one invocation is not run again
|
|
67
68
|
// there: its mutants wait for a later invocation.
|
|
68
69
|
const CONTROL_FAILURES = 2;
|
|
70
|
+
// The copies a test gets for a cold failure's retry: the control after it
|
|
71
|
+
// and the attempt again.
|
|
72
|
+
const COLD_RETRY_COPIES = 2;
|
|
69
73
|
|
|
70
74
|
/** What a page writes to its console when its mutant passed the hit limit. */
|
|
71
75
|
export const PAGE_TIMEOUT_MARKER = "SUPERCOV_MUTANT_TIMEOUT";
|
|
@@ -384,11 +388,16 @@ function buildPass(pass, root, config) {
|
|
|
384
388
|
const infected = [...new Set(own.filter((test) => test.infected).map((test) => test.id))];
|
|
385
389
|
const ordered = [...new Set(own.map((test) => test.id))];
|
|
386
390
|
const switched = `${mutant.file}#${found.index}`;
|
|
387
|
-
|
|
388
|
-
|
|
391
|
+
// A switch the copy evaluates as its module loads (an arrow
|
|
392
|
+
// mutated whole at a module's top level), in a module a server
|
|
393
|
+
// ran: the server made the original once, for every request,
|
|
394
|
+
// whatever mutant a request names.
|
|
395
|
+
const serverWide = mutant.serverWide ?? (found.entry.static && mutant.serverRan ? "module-level" : undefined);
|
|
396
|
+
if (serverWide) {
|
|
397
|
+
restarts.push({ id: mutant.id, mutant: switched, tests: ordered, reason: serverWide });
|
|
389
398
|
continue;
|
|
390
399
|
}
|
|
391
|
-
mutants.push({ id: mutant.id, mutant: switched, tests: ordered, infected });
|
|
400
|
+
mutants.push({ id: mutant.id, mutant: switched, tests: ordered, infected, ...(mutant.passedBefore ? { passedBefore: mutant.passedBefore } : {}) });
|
|
392
401
|
}
|
|
393
402
|
}
|
|
394
403
|
// What a survivor's verdict says of the candidates it was not run with.
|
|
@@ -406,8 +415,9 @@ function buildPass(pass, root, config) {
|
|
|
406
415
|
for (const entry of mutants) {
|
|
407
416
|
// Two copies a candidate (an attempt, and a control should it
|
|
408
417
|
// kill), one more where it is not the first (a sweep it may wait
|
|
409
|
-
// out), and each test's first run
|
|
410
|
-
|
|
418
|
+
// out), and each test's first run and a cold failure's retry (its
|
|
419
|
+
// control and the attempt again).
|
|
420
|
+
const added = entry.tests.reduce((sum, id, at) => sum + 2 + (at > 0 ? 1 : 0) + (queues.has(id) ? 0 : COLD_RETRY_COPIES + 1), 0);
|
|
411
421
|
if (copies && copies + added > limit && kind === "main") {
|
|
412
422
|
deferred.push({ id: entry.id });
|
|
413
423
|
continue;
|
|
@@ -432,9 +442,9 @@ function buildPass(pass, root, config) {
|
|
|
432
442
|
test.queue = queue.map((job) => job.id);
|
|
433
443
|
const where = declarationKey(resolve(root, test.file), test.title);
|
|
434
444
|
// A copy for each sweep the test may wait out: one for each mutant
|
|
435
|
-
// with a candidate before it.
|
|
445
|
+
// with a candidate before it; and a cold failure's retry.
|
|
436
446
|
const later = queue.filter((job) => job.at > 0).length;
|
|
437
|
-
declared[where] = Math.max(declared[where] ?? 0, 2 * queue.length + later + 1);
|
|
447
|
+
declared[where] = Math.max(declared[where] ?? 0, 2 * queue.length + later + 1 + COLD_RETRY_COPIES);
|
|
438
448
|
costs[where] = Math.max(costs[where] ?? 0, test.durationMs ?? DEFAULT_DURATION_MS);
|
|
439
449
|
}
|
|
440
450
|
return {
|
|
@@ -634,10 +644,56 @@ export function spreadSerialFiles(argv, root) {
|
|
|
634
644
|
if (!fileFilters(argv.slice(3)).length)
|
|
635
645
|
return [];
|
|
636
646
|
const files = spreadFiles(pass, root);
|
|
647
|
+
// The files the command did not name itself: this invocation runs them
|
|
648
|
+
// for the pass, after the harness gave them to another.
|
|
649
|
+
const named = fileFilters(argv.slice(3)).map((filter) => resolve(filter.replace(/(:\d+)+$/, "")));
|
|
650
|
+
const own = (file) => {
|
|
651
|
+
const path = resolve(root, file);
|
|
652
|
+
return named.some((filter) => path === filter || path.startsWith(`${filter}${sep}`));
|
|
653
|
+
};
|
|
654
|
+
globalThis[SPREAD_ONLY] = { files: files.filter((file) => !own(file)), named };
|
|
637
655
|
argv.splice(3, 0, ...files.map(specFilter));
|
|
638
656
|
return files;
|
|
639
657
|
}
|
|
640
658
|
|
|
659
|
+
const SPREAD_ONLY = Symbol.for("supercov.spreadOnly");
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Which spread files this invocation runs for the pass only (its command
|
|
663
|
+
* did not name them), written for its workers once the round's work is
|
|
664
|
+
* known: none where no mutant no candidate let live yet waits for a test of
|
|
665
|
+
* the invocation's own files (a later round's survivors-to-be), where
|
|
666
|
+
* running them in every invocation is what spreading is for.
|
|
667
|
+
*/
|
|
668
|
+
function writeSpreadOnly(pass, work, root) {
|
|
669
|
+
const said = globalThis[SPREAD_ONLY];
|
|
670
|
+
let files = said?.files ?? [];
|
|
671
|
+
if (files.length) {
|
|
672
|
+
const spread = new Set(files);
|
|
673
|
+
const ownTest = (id) => {
|
|
674
|
+
const file = work.tests[id]?.file;
|
|
675
|
+
if (!file || spread.has(file))
|
|
676
|
+
return false;
|
|
677
|
+
const path = resolve(root, file);
|
|
678
|
+
return said.named.some((filter) => path === filter || path.startsWith(`${filter}${sep}`));
|
|
679
|
+
};
|
|
680
|
+
const freshOwnWork = Object.values(work.entries).some((entry) => !entry.passedBefore && entry.tests.some(ownTest));
|
|
681
|
+
if (!freshOwnWork)
|
|
682
|
+
files = [];
|
|
683
|
+
}
|
|
684
|
+
writeJson(`${pass.round}/spread-only/${process.pid}.json`, files);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* The spread files this invocation runs though its command did not name
|
|
689
|
+
* them (`spreadSerialFiles`), by their path from the project root.
|
|
690
|
+
*/
|
|
691
|
+
let spreadOnlyFiles;
|
|
692
|
+
function spreadOnly(pass, file) {
|
|
693
|
+
spreadOnlyFiles ??= new Set(readJsonOr(`${pass.round}/spread-only/${invocation()}.json`, []));
|
|
694
|
+
return spreadOnlyFiles.has(file);
|
|
695
|
+
}
|
|
696
|
+
|
|
641
697
|
/**
|
|
642
698
|
* Whether this process lists the tests (`playwright test --list`) rather
|
|
643
699
|
* than run them: it reads no plan and writes nothing, and lists the
|
|
@@ -673,6 +729,8 @@ export function strongConfig(normalized, root, reporterPath) {
|
|
|
673
729
|
process.env["SUPERCOV_PLAYWRIGHT_INVOCATION"] = String(process.pid);
|
|
674
730
|
writeJson(`${pass.round}/pass.json`, work);
|
|
675
731
|
writeRoundFiles(pass, work);
|
|
732
|
+
if (work.kind === "main")
|
|
733
|
+
writeSpreadOnly(pass, work, root);
|
|
676
734
|
passCache = work;
|
|
677
735
|
if (work.batch)
|
|
678
736
|
takeAloneMutant(pass, work, root);
|
|
@@ -944,13 +1002,67 @@ export function invocation() {
|
|
|
944
1002
|
}
|
|
945
1003
|
|
|
946
1004
|
/**
|
|
947
|
-
* Whether a test's next run in this invocation has no mutant:
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
1005
|
+
* Whether a test's next run in this invocation has no mutant: a kill of it
|
|
1006
|
+
* here waits for one to confirm it, or a run of it without one failed here
|
|
1007
|
+
* and none passed since. A test's first run here takes a mutant: an attempt
|
|
1008
|
+
* that passes needs no run without it, and one that fails is judged by the
|
|
1009
|
+
* control after it (`settleAttempt`), so a test whose mutants all live costs
|
|
1010
|
+
* no control at all (docs/design/strong-mutation.md, "Controls").
|
|
951
1011
|
*/
|
|
952
1012
|
function needsControl(pass, test) {
|
|
953
|
-
|
|
1013
|
+
if (entries(`${pass.round}/pending/${invocation()}/${key(test)}`).length > 0)
|
|
1014
|
+
return true;
|
|
1015
|
+
return !ready(pass, test) && entries(`${pass.round}/unreliable/${invocation()}/${key(test)}`).length > 0;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/** Whether a run of `test` without a mutant passed on this invocation's server. */
|
|
1019
|
+
function ready(pass, test) {
|
|
1020
|
+
return existsSync(readyPath(pass, invocation(), test));
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/** Whether a run of `test` passed on this invocation's server, with a mutant or without. */
|
|
1024
|
+
function warm(pass, test) {
|
|
1025
|
+
return ready(pass, test) || existsSync(`${pass.round}/warm/${invocation()}/${key(test)}`);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/** Whether no copy of any test took a mutant yet in this round, and no earlier pass ran it. */
|
|
1029
|
+
function untried(pass, id, entry) {
|
|
1030
|
+
return !entry.passedBefore && entries(`${pass.round}/claims/${key(id)}`).length === 0;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/** Whether no candidate let a mutant live yet, in this pass or an earlier one. */
|
|
1034
|
+
function fresh(pass, id, entry) {
|
|
1035
|
+
return !entry.passedBefore && passedWith(pass, id).size === 0;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Where a mutant is held while a cold attempt's failure waits for its
|
|
1040
|
+
* control (`settleAttempt`): no other copy takes it meanwhile.
|
|
1041
|
+
*/
|
|
1042
|
+
function heldPath(pass, id, test) {
|
|
1043
|
+
return `${pass.round}/held/${key(id)}/${key(test)}`;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/** A mutant a test runs again in this invocation, its cold attempt's failure released by the control after it. */
|
|
1047
|
+
function retryPath(pass, at, test, id) {
|
|
1048
|
+
return `${pass.round}/retry/${at}/${key(test)}/${key(id)}`;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* The mutant a copy of `test` runs again, once, where its cold attempt
|
|
1053
|
+
* failed and the control after it ran: its claim on the test stays, and its
|
|
1054
|
+
* mark (`.again`) is what takes it.
|
|
1055
|
+
*/
|
|
1056
|
+
function takeRetry(pass, test) {
|
|
1057
|
+
const retries = `${pass.round}/retry/${invocation()}/${key(test)}`;
|
|
1058
|
+
for (const name of entries(retries)) {
|
|
1059
|
+
const id = readJsonOr(`${retries}/${name}/id`, undefined);
|
|
1060
|
+
if (id === undefined || settled(pass, id))
|
|
1061
|
+
continue;
|
|
1062
|
+
if (mark(`${retries}/${name}/again`))
|
|
1063
|
+
return id;
|
|
1064
|
+
}
|
|
1065
|
+
return undefined;
|
|
954
1066
|
}
|
|
955
1067
|
|
|
956
1068
|
function readyPath(pass, at, test) {
|
|
@@ -961,10 +1073,14 @@ function claimPath(pass, id, test) {
|
|
|
961
1073
|
return `${pass.round}/claims/${key(id)}/${key(test)}`;
|
|
962
1074
|
}
|
|
963
1075
|
|
|
964
|
-
/**
|
|
1076
|
+
/**
|
|
1077
|
+
* Whether a mutant needs no more attempts: a verdict given, killed, or held
|
|
1078
|
+
* for a later round, or for now while a cold attempt's failure waits for its
|
|
1079
|
+
* control.
|
|
1080
|
+
*/
|
|
965
1081
|
function settled(pass, id) {
|
|
966
1082
|
const at = key(id);
|
|
967
|
-
return existsSync(`${pass.shared}/verdicts/${at}`) || existsSync(`${pass.round}/killed/${at}`);
|
|
1083
|
+
return existsSync(`${pass.shared}/verdicts/${at}`) || existsSync(`${pass.round}/killed/${at}`) || entries(`${pass.round}/held/${at}`).length > 0;
|
|
968
1084
|
}
|
|
969
1085
|
|
|
970
1086
|
/**
|
|
@@ -1001,7 +1117,7 @@ function inFlightSince(pass, id) {
|
|
|
1001
1117
|
* candidates let live, and it runs every mutant all the same before its
|
|
1002
1118
|
* copies are spent.
|
|
1003
1119
|
*/
|
|
1004
|
-
function takeJob(pass, shape, test, only, limitMs, copiesLeft) {
|
|
1120
|
+
function takeJob(pass, shape, test, only, limitMs, copiesLeft, freshOnly = false) {
|
|
1005
1121
|
const queue = queueOf(pass, test);
|
|
1006
1122
|
// A test that fails without any mutant is no candidate: it holds back
|
|
1007
1123
|
// no later one.
|
|
@@ -1026,6 +1142,15 @@ function takeJob(pass, shape, test, only, limitMs, copiesLeft) {
|
|
|
1026
1142
|
queue.done += 1;
|
|
1027
1143
|
continue;
|
|
1028
1144
|
}
|
|
1145
|
+
// A spread file in an invocation the harness did not give it to
|
|
1146
|
+
// takes only mutants no copy took yet, anywhere, with no
|
|
1147
|
+
// progress from an earlier pass (likely to fail it, soon
|
|
1148
|
+
// decided); the rest wait for the invocation that runs it as its
|
|
1149
|
+
// own, so that this one reaches its own files. Its first claim is
|
|
1150
|
+
// what it looks at, not a candidate passing, which a run without
|
|
1151
|
+
// the mutant first (a cold test) would leave unseen for a while.
|
|
1152
|
+
if (freshOnly && !untried(pass, id, mutantOf(pass, id)))
|
|
1153
|
+
continue;
|
|
1029
1154
|
waiting += 1;
|
|
1030
1155
|
const since = inFlightSince(pass, id);
|
|
1031
1156
|
if (since !== undefined) {
|
|
@@ -1042,7 +1167,9 @@ function takeJob(pass, shape, test, only, limitMs, copiesLeft) {
|
|
|
1042
1167
|
if (!best)
|
|
1043
1168
|
break;
|
|
1044
1169
|
const controls = entries(`${pass.round}/pending/${invocation()}/${key(test)}`).length;
|
|
1045
|
-
|
|
1170
|
+
// The copies kept back cover each mutant waiting and a control for
|
|
1171
|
+
// each, and a cold failure's retry.
|
|
1172
|
+
if (only === undefined && best.standing[0] > 0 && copiesLeft >= 2 * waiting + controls + COLD_RETRY_COPIES)
|
|
1046
1173
|
return undefined;
|
|
1047
1174
|
if (mark(claimPath(pass, best.id, test)))
|
|
1048
1175
|
return best.id;
|
|
@@ -1051,7 +1178,7 @@ function takeJob(pass, shape, test, only, limitMs, copiesLeft) {
|
|
|
1051
1178
|
// Every mutant left runs elsewhere now: one of them here too, rather
|
|
1052
1179
|
// than leave this test's copies unused while its attempt runs.
|
|
1053
1180
|
for (const id of busy) {
|
|
1054
|
-
if (only === undefined && !settled(pass, id) && mark(claimPath(pass, id, test)))
|
|
1181
|
+
if (only === undefined && !settled(pass, id) && (!freshOnly || untried(pass, id, mutantOf(pass, id))) && mark(claimPath(pass, id, test)))
|
|
1055
1182
|
return id;
|
|
1056
1183
|
}
|
|
1057
1184
|
return undefined;
|
|
@@ -1092,6 +1219,9 @@ function before(a, b) {
|
|
|
1092
1219
|
function workLeft(pass, test) {
|
|
1093
1220
|
if (entries(`${pass.round}/pending/${invocation()}/${key(test)}`).length)
|
|
1094
1221
|
return true;
|
|
1222
|
+
const retries = `${pass.round}/retry/${invocation()}/${key(test)}`;
|
|
1223
|
+
if (entries(retries).some((name) => !existsSync(`${retries}/${name}/again`)))
|
|
1224
|
+
return true;
|
|
1095
1225
|
const queue = queueOf(pass, test);
|
|
1096
1226
|
for (let at = queue.done; at < queue.ids.length; at++) {
|
|
1097
1227
|
const id = queue.ids[at];
|
|
@@ -1242,13 +1372,34 @@ export async function strongClaim(testInfo) {
|
|
|
1242
1372
|
// invocation: what a copy that waits a sweep may spend.
|
|
1243
1373
|
const copy = withoutCopy(testInfo.titlePath).copy;
|
|
1244
1374
|
const copiesLeft = copiesOf(testInfo.file, testInfo.title) - 1 - copy;
|
|
1245
|
-
const
|
|
1375
|
+
const only = shape.batch ? invocationMutant(pass) ?? null : undefined;
|
|
1376
|
+
const again = only === undefined ? takeRetry(pass, original) : undefined;
|
|
1377
|
+
const freshOnly = !shape.everywhere && only === undefined && spreadOnly(pass, test.file);
|
|
1378
|
+
const id = again ?? takeJob(pass, shape, original, only, limitMs, copiesLeft, freshOnly);
|
|
1246
1379
|
if (!id)
|
|
1247
1380
|
return null;
|
|
1248
1381
|
const entry = mutantOf(pass, id);
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1382
|
+
// Cold: no run of the test passed on this server yet, with or
|
|
1383
|
+
// without a mutant. Its failure may be the server's first request
|
|
1384
|
+
// to a page, not the mutant's: it is tried again once a control has
|
|
1385
|
+
// passed.
|
|
1386
|
+
const cold = !shape.everywhere && !warm(pass, original);
|
|
1387
|
+
if (cold && again === undefined && copiesLeft >= 1 && fresh(pass, id, entry)) {
|
|
1388
|
+
// A mutant no candidate let live yet is as likely as not to fail
|
|
1389
|
+
// its first (its cheapest likely killer): a failure there, cold,
|
|
1390
|
+
// would run it twice. The test runs without it first, and takes
|
|
1391
|
+
// it next (`takeRetry`), where a copy is left for that.
|
|
1392
|
+
mark(retryPath(pass, invocation(), original, id));
|
|
1393
|
+
writeJson(`${retryPath(pass, invocation(), original, id)}/id`, id);
|
|
1394
|
+
attempt = shape.baselines && baselineOf(pass, original) === undefined
|
|
1395
|
+
? { kind: "baseline", id: null, mutant: "-" }
|
|
1396
|
+
: { kind: "control", id: null, mutant: "-" };
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
attempt = { kind: "mutant", id, mutant: entry.mutant, baselineMs, limitMs, timeoutFactor: shape.timeoutFactor, ...(cold ? { cold } : {}) };
|
|
1400
|
+
mark(`${pass.round}/inflight/${key(id)}`);
|
|
1401
|
+
writeFileSync(`${pass.round}/inflight/${key(id)}/${process.pid}-${key(testInfo.testId)}`, String(Date.now()));
|
|
1402
|
+
}
|
|
1252
1403
|
}
|
|
1253
1404
|
const lock = shape.concurrency.workers !== 1 && shape.concurrency.serialFiles.includes(test.file)
|
|
1254
1405
|
? await lockFile(pass, test.file)
|
|
@@ -1270,7 +1421,7 @@ export async function strongClaim(testInfo) {
|
|
|
1270
1421
|
kind: attempt.kind,
|
|
1271
1422
|
id: attempt.id,
|
|
1272
1423
|
mutant: attempt.mutant,
|
|
1273
|
-
...(attempt.kind === "mutant" ? { baselineMs: attempt.baselineMs, limitMs: attempt.limitMs, timeoutFactor: attempt.timeoutFactor } : {}),
|
|
1424
|
+
...(attempt.kind === "mutant" ? { baselineMs: attempt.baselineMs, limitMs: attempt.limitMs, timeoutFactor: attempt.timeoutFactor, ...(attempt.cold ? { cold: true } : {}) } : {}),
|
|
1274
1425
|
startedAt: Date.now(),
|
|
1275
1426
|
lock,
|
|
1276
1427
|
running,
|
|
@@ -1408,6 +1559,7 @@ export function settleAttempt(pass, attempt) {
|
|
|
1408
1559
|
}
|
|
1409
1560
|
if (ended.outcome === "passed") {
|
|
1410
1561
|
mark(`${pass.round}/passed/${key(attempt.id)}/${key(test)}`);
|
|
1562
|
+
mark(`${pass.round}/warm/${attempt.invocation}/${key(test)}`);
|
|
1411
1563
|
// One mutant an invocation: a survivor waits for the judge, who
|
|
1412
1564
|
// knows whether its server ran it.
|
|
1413
1565
|
if (!shape.batch)
|
|
@@ -1416,6 +1568,15 @@ export function settleAttempt(pass, attempt) {
|
|
|
1416
1568
|
}
|
|
1417
1569
|
if (ended.outcome !== "failed" && ended.outcome !== "timed-out")
|
|
1418
1570
|
return ended;
|
|
1571
|
+
// A cold attempt's failure (no run of the test without a mutant had
|
|
1572
|
+
// passed on this server before it): the next control says whether the
|
|
1573
|
+
// test passes here at all, and the mutant runs it again after, warm. It
|
|
1574
|
+
// decides nothing itself; meanwhile no other copy takes the mutant.
|
|
1575
|
+
if (attempt.cold && !shape.everywhere) {
|
|
1576
|
+
mark(heldPath(pass, attempt.id, test));
|
|
1577
|
+
writeJson(`${pass.round}/pending/${attempt.invocation}/${key(test)}/${key(attempt.id)}`, { id: attempt.id, test, cold: true, endedAt: ended.endedAt });
|
|
1578
|
+
return ended;
|
|
1579
|
+
}
|
|
1419
1580
|
// A kill, or a timeout (it ran out of its limit): no other copy takes
|
|
1420
1581
|
// the mutant now, and either is confirmed alike.
|
|
1421
1582
|
const { status, reason } = verdictOf(ended);
|
|
@@ -1468,6 +1629,14 @@ function settleControl(pass, ended, shape) {
|
|
|
1468
1629
|
if (!kill || kill.endedAt > ended.startedAt)
|
|
1469
1630
|
continue;
|
|
1470
1631
|
rmSync(`${pending}/${name}`, { force: true });
|
|
1632
|
+
if (kill.cold) {
|
|
1633
|
+
// Its test runs it again (`takeJob`), after this control: warm,
|
|
1634
|
+
// or where the test fails here without any mutant.
|
|
1635
|
+
mark(retryPath(pass, ended.invocation, test, kill.id));
|
|
1636
|
+
writeJson(`${retryPath(pass, ended.invocation, test, kill.id)}/id`, kill.id);
|
|
1637
|
+
rmSync(heldPath(pass, kill.id, test), { recursive: true, force: true });
|
|
1638
|
+
continue;
|
|
1639
|
+
}
|
|
1471
1640
|
if (passed && !ended.beside) {
|
|
1472
1641
|
const entry = mutantOf(pass, kill.id);
|
|
1473
1642
|
giveVerdict(pass, { id: kill.id, status: kill.status, killedBy: kill.test, reason: `${kill.message}${suffix(shape, entry)}`, tests: 1, durationMs: kill.durationMs });
|
|
@@ -175,7 +175,10 @@ export default class SupercovPlaywrightStrongReporter {
|
|
|
175
175
|
"failed": "fails",
|
|
176
176
|
"timed-out": `ran out of its ${seconds(attempt.limitMs)} limit (its baseline ${seconds(attempt.baselineMs)})`,
|
|
177
177
|
}[attempt.outcome] ?? attempt.outcome;
|
|
178
|
-
|
|
178
|
+
// A cold attempt's failure decides nothing: it runs again once a
|
|
179
|
+
// control has passed on its server.
|
|
180
|
+
const cold = attempt.cold && (attempt.outcome === "failed" || attempt.outcome === "timed-out") ? ", before any control here: runs again after one" : "";
|
|
181
|
+
console.log(`[supercov] ${attempt.id}: ${JSON.stringify(attempt.title)} ${said} (${took}${cold})`);
|
|
179
182
|
}
|
|
180
183
|
/**
|
|
181
184
|
* What this invocation is doing, for the engine's progress line: the
|
|
@@ -379,7 +382,9 @@ export default class SupercovPlaywrightStrongReporter {
|
|
|
379
382
|
// A kill no control came after (the round ended first): as sure as a
|
|
380
383
|
// kill on a server no other mutant's attempt shared, where it ended
|
|
381
384
|
// before the round began to stop.
|
|
382
|
-
|
|
385
|
+
// A cold attempt's failure (no control had passed before it on
|
|
386
|
+
// its server) is no kill: the round ended before it ran again.
|
|
387
|
+
const killer = failed.find((attempt) => !attempt.beside && !attempt.cold && attempt.endedAt < trustedUntil);
|
|
383
388
|
if (killer) {
|
|
384
389
|
const { status, reason } = verdictOf(killer);
|
|
385
390
|
verdict({ status, killedBy: killer.original, reason: `${reason}${suffix}` });
|
|
@@ -628,6 +628,22 @@ else {
|
|
|
628
628
|
return print.apply(this, [kept.join("\\n"), ...message.slice(1)]);
|
|
629
629
|
})(warnOnce)); } catch {}
|
|
630
630
|
`.replace(/\n\s*/g, " ");
|
|
631
|
+
// A strong pass's `next build` does not check types. The check emits
|
|
632
|
+
// nothing the server runs, and says nothing of a mutant: its worker reads
|
|
633
|
+
// the sources as their authors wrote them (`installAuthoredSourceView`
|
|
634
|
+
// above), switches and all left out, so it checks the checkout the
|
|
635
|
+
// measured run built already. It took 12 s of a 30 s build, in every job
|
|
636
|
+
// of a pass split across jobs. A measured run still checks: whether its
|
|
637
|
+
// command passes is the project's.
|
|
638
|
+
const unchecked = process.env.SUPERCOV_STRONG === "1" ? `
|
|
639
|
+
;try { loadConfig = ((load) => async function loadConfig(...args) {
|
|
640
|
+
const config = await load.apply(this, args);
|
|
641
|
+
try {
|
|
642
|
+
if (config && typeof config === "object") config.typescript = { ...(config.typescript || {}), ignoreBuildErrors: true };
|
|
643
|
+
} catch {}
|
|
644
|
+
return config;
|
|
645
|
+
})(loadConfig); } catch {}
|
|
646
|
+
`.replace(/\n\s*/g, " ") : "";
|
|
631
647
|
// A project's `turbopack.root`, set to its own directory, names the copy
|
|
632
648
|
// here, while the copy's dependencies are links into the project's
|
|
633
649
|
// node_modules. Turbopack resolves no package outside its root and
|
|
@@ -677,7 +693,7 @@ else {
|
|
|
677
693
|
}
|
|
678
694
|
else if (filename.endsWith("config.js") &&
|
|
679
695
|
/[\\/]next[\\/]dist[\\/]server[\\/]config\.js$/.test(filename)) {
|
|
680
|
-
content = append(content, widened);
|
|
696
|
+
content = append(content, `${widened}${unchecked}`);
|
|
681
697
|
}
|
|
682
698
|
}
|
|
683
699
|
return Reflect.apply(compile, this, [content, filename, ...rest]);
|