@mark1russell7/rigor-mutation 0.1.5 → 0.1.6
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/README.md +4 -2
- package/build/cli.js +1 -1
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/{run-C2STezvC.js → run-c2Mlztay.js} +59 -11
- package/build/run-c2Mlztay.js.map +1 -0
- package/package.json +1 -1
- package/build/run-C2STezvC.js.map +0 -1
package/README.md
CHANGED
|
@@ -102,7 +102,9 @@ The gate of a package with parts applies to each part. Each part must have a sco
|
|
|
102
102
|
A score is a read of the tests only when the run read all of them. A run that read half of the tests gives a score with no meaning. Two options of `scores` find such a run. They need the field `testFiles` of the report, which the Vitest runner gives.
|
|
103
103
|
|
|
104
104
|
- Each score line gives the count of the tests of the run. `--last <file>` compares it with the last good count of the selection in the file. A fall of more than `maxTestFall` percent fails, also above the gate. The default of `maxTestFall` is 20. `--write-last <file>` writes the counts of the selections that pass.
|
|
105
|
-
- `--test-files` compares the test files
|
|
105
|
+
- `--test-files` compares the test files that the run starts with the test files of the report. A test file that the run starts and that the report does not read fails.
|
|
106
|
+
- The Vitest runner of Stryker starts the test files that load a file of the selection, directly or through other files. So a part does not start the test files of the other parts.
|
|
107
|
+
- The check reads the relative imports of the package, and not its type imports. With `vitest.related` false in the field `stryker`, it expects each test file.
|
|
106
108
|
|
|
107
109
|
The lane states each exception with its reason:
|
|
108
110
|
|
|
@@ -145,4 +147,4 @@ const score = scoreReport(parseReport(JSON.parse(reportText)), selection);
|
|
|
145
147
|
console.log(formatScore(score)); // collections.impl: 91.20 % (456 of 500, 44 survived), gate 80 %: pass
|
|
146
148
|
```
|
|
147
149
|
|
|
148
|
-
The package also exports `selectionNames`, `runSelections`, `summaryMarkdown`, `findDisables`, `compareDisables`, `leavingPaths`, `isConfigFile`, `testCount`, `testFall`, `unreadTestFiles`, `failScore` and `runCli`.
|
|
150
|
+
The package also exports `selectionNames`, `runSelections`, `summaryMarkdown`, `findDisables`, `compareDisables`, `leavingPaths`, `relatedTestFiles`, `isConfigFile`, `testCount`, `testFall`, `unreadTestFiles`, `failScore` and `runCli`.
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -308,6 +308,15 @@ export declare function isConfigFile(file: string, vitestConfig?: string): boole
|
|
|
308
308
|
* @param vitestConfig - the field `vitestConfig` of the lane
|
|
309
309
|
*/
|
|
310
310
|
export declare function leavingPaths(files: readonly PackageFile[], vitestConfig?: string): LeavingPath[];
|
|
311
|
+
/**
|
|
312
|
+
* This function gives the test files that the related mode of the Vitest runner starts for a selection. A test file
|
|
313
|
+
* is related when it loads a file of the selection, directly or through other files of the package. The function
|
|
314
|
+
* does not read comments and type imports. The order is the order of `files`.
|
|
315
|
+
*
|
|
316
|
+
* @param files - the files of the package, from its folder
|
|
317
|
+
* @param selected - the function that tells if a file is a file of the selection
|
|
318
|
+
*/
|
|
319
|
+
export declare function relatedTestFiles(files: readonly PackageFile[], selected: (file: string) => boolean): string[];
|
|
311
320
|
/** The input and the output of the CLI. */
|
|
312
321
|
interface CliIo {
|
|
313
322
|
readonly cwd: string;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/lane.ts","../src/config.ts","../src/score.ts","../src/disables.ts","../src/load.ts","../src/run.ts"],"mappings":";;;;;UAQiB;;WAEN;;WAEA;;;;;WAKA,QAAQ,SAAS;;WAEjB;;WAEA;;;;;WAKA;;WAEA;;;;;WAKA,UAAU,SAAS;;;;;WAKnB,UAAU,SAAS;;;qBAIjB;;UAGI;WACN,UAAU,SAAS,eAAe;;WAElC;;;;;WAKA;;WAEA,eAAe,SAAS;;;UAOlB;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,SAAS,SAAS;;;;;;;wBAsDb,UAAU,gBAAgB;;wBAkB1B,eAAe,MAAM;;wBAKrB,cAAc,MAAM;;;;;;wBASpB,OAAO,MAAM,MAAM,eAAe;;;;;;;wBAgClC,aAAa,WAAW,WAAW;;;;;;;;wBAcnC,WAAW,MAAM,MAAM,aAAa;;UCxMnC;;WAEN;;WAEA;;;;;WAKA;;;;;WAKA;;;UAIM;;WAEN;WACA;WACA;aAAoB;;WACpB;WACA;WACA;WACA;aAAyB;;WACzB;aAAyB;;WACzB;aAAuB;aAAuB;aAAsB;;WACpE;WACA;WACA;WACA;WACA;WACA;;;qBAIE;;;;;qBAMA;;;;;qBAMA;;;;;;wBAOG,iBAAiB;;qBAKpB;;;;;;wBAOG,cAAc,WAAW,WAAW,UAAS,gBAAqB;;;;;;;;;;UC9DjE;WACN;WACA;;WAEA;WACA;aAAqB;eAAkB;;;;;UAIjC;WACN,OAAO,SAAS;aAA0B,kBAAkB;;;WAE5D,YAAY,SAAS;aAA0B;eAA2B;;;;;;;;KAOzE;;UAGK;WACN;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;;WAEA;;WAEA,UAAU;;;qBAMR,aAAc,GAAG;;;;;;wBAOd,YAAY,gBAAgB;;;;;;wBAkE5B,YAAY,QAAQ,gBAAgB;WAAsB;WAAuB;IAA6B;;wBA0C9G,YAAY,GAAG;;wBASf,gBAAgB,iBAAiB;;;;;;;UClLhC;WACN;WACA;;;UAIM;;WAEN;;WAEA;;WAEA,mBAAmB;WACnB;;;wBAIK,aAAa;WAA2B;WAAuB;MAAmB;;wBA+BlF,gBAAgB,gBAAgB,WAAW,iBAAiB,YAAY;;UC9CvE;;WAEN;;WAEA;;WAEA;;;UAIM;;WAEN;WACA;;;;;;;;wBAoBK,aAAa,cAAc;;;;;;;;;;wBAsC3B,aAAa,gBAAgB,eAAe,wBAAwB;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/lane.ts","../src/config.ts","../src/score.ts","../src/disables.ts","../src/load.ts","../src/run.ts"],"mappings":";;;;;UAQi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a;WAA2B;WAAuB;MAAmB;;wBA+BlF,gBAAgB,gBAAgB,WAAW,iBAAiB,YAAY;;UC9CvE;;WAEN;;WAEA;;WAEA;;;UAIM;;WAEN;WACA;;;;;;;;wBAoBK,aAAa,cAAc;;;;;;;;;;wBAsC3B,aAAa,gBAAgB,eAAe,wBAAwB;;;;;;;;;wBAqCpE,iBAAiB,gBAAgB,eAAe,WAAW;;UCvG1D;WACN;WACA,SAAS;WACT,SAAS;;WAET,MAAM,SAAS;;;qBAIb;;wBAiSG,OAAO,yBAAyB,IAAI"}
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { p as DRY_RUN_TIMEOUT_MINUTES, t as HELP, m as NO_TSCONFIG, h as REPORT_DIR, y as STRYKER_OWNED, g as TIMEOUT_MS, b as changedFiles, o as compareDisables, s as findDisables, c as formatScore, r as isConfigFile, l as isHitLimit, i as leavingPaths, x as parseLane, u as parseReport, S as partErrors, a as relatedTestFiles, _ as rewritesTsconfig, n as runCli, C as runSelections, d as scoreReport, w as select, T as selectionNames, v as strykerConfig, f as summaryMarkdown } from "./run-c2Mlztay.js";
|
|
@@ -465,6 +465,40 @@ function leavingPaths(files, vitestConfig) {
|
|
|
465
465
|
}
|
|
466
466
|
return found.toSorted((a, b) => a.file === b.file ? a.line - b.line : a.file < b.file ? -1 : 1);
|
|
467
467
|
}
|
|
468
|
+
const TYPE_STATEMENT = /^[ \t]*(?:import|export)[ \t]+type\b[^;]*;/gm;
|
|
469
|
+
/** This function replaces each type import and export with its line ends, so the lines of the other paths stay. */
|
|
470
|
+
function withoutTypeStatements(text) {
|
|
471
|
+
return text.replace(TYPE_STATEMENT, (statement) => statement.replace(/[^\n]/g, ""));
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* This function gives the test files that the related mode of the Vitest runner starts for a selection. A test file
|
|
475
|
+
* is related when it loads a file of the selection, directly or through other files of the package. The function
|
|
476
|
+
* does not read comments and type imports. The order is the order of `files`.
|
|
477
|
+
*
|
|
478
|
+
* @param files - the files of the package, from its folder
|
|
479
|
+
* @param selected - the function that tells if a file is a file of the selection
|
|
480
|
+
*/
|
|
481
|
+
function relatedTestFiles(files, selected) {
|
|
482
|
+
const texts = new Map(files.map((f) => [f.file, withoutTypeStatements(f.text)]));
|
|
483
|
+
const known = new Set(texts.keys());
|
|
484
|
+
const loads = (file) => pathsOf(file, texts.get(file) ?? "", void 0).flatMap(({ path }) => {
|
|
485
|
+
const t = target(file, path, known);
|
|
486
|
+
return t === void 0 ? [] : [t];
|
|
487
|
+
});
|
|
488
|
+
const reaches = (test) => {
|
|
489
|
+
const queue = [test];
|
|
490
|
+
const loaded = new Set(queue);
|
|
491
|
+
for (let next = queue.shift(); next !== void 0; next = queue.shift()) for (const t of loads(next)) {
|
|
492
|
+
if (!TEST$1.test(t) && selected(t)) return true;
|
|
493
|
+
if (!loaded.has(t)) {
|
|
494
|
+
loaded.add(t);
|
|
495
|
+
queue.push(t);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return false;
|
|
499
|
+
};
|
|
500
|
+
return files.map((f) => f.file).filter((f) => TEST$1.test(f) && reaches(f));
|
|
501
|
+
}
|
|
468
502
|
// src/run.ts
|
|
469
503
|
/**
|
|
470
504
|
* The CLI `rigor-mutation`. The work is in `runCli`, so a test can start the CLI in a fixture folder.
|
|
@@ -487,8 +521,8 @@ const HELP = `rigor-mutation: the mutation tests of a repository, with Stryker a
|
|
|
487
521
|
of tests. With --last, a fall of the count of more than
|
|
488
522
|
maxTestFall % (default 20) against the file fails. With
|
|
489
523
|
--write-last, the counts of the passed selections go in
|
|
490
|
-
the file. With --test-files, a test file
|
|
491
|
-
the report does not read fails.
|
|
524
|
+
the file. With --test-files, a test file that the run
|
|
525
|
+
starts and that the report does not read fails.
|
|
492
526
|
rigor-mutation disables [--write] compare the disable comments with their list
|
|
493
527
|
rigor-mutation load-check [<selection>...] refuse each relative path of a package that leaves its folder.
|
|
494
528
|
Stryker starts the tests in a copy of the folder, so such a
|
|
@@ -610,7 +644,7 @@ function disables(lane, laneDir, write, io) {
|
|
|
610
644
|
}
|
|
611
645
|
/**
|
|
612
646
|
* This function gives the score of each selection (`scores`). With `last`, it compares the test count with the last
|
|
613
|
-
* good count (LANE.TESTS of Vex). With `testFiles`, it compares the test files
|
|
647
|
+
* good count (LANE.TESTS of Vex). With `testFiles`, it compares the test files that the run starts with the report (LANE.FILES).
|
|
614
648
|
*/
|
|
615
649
|
function scores(lane, laneDir, names, o, io) {
|
|
616
650
|
if (names.length === 0) throw new Error(`"scores" takes one or more selections`);
|
|
@@ -663,7 +697,7 @@ function scores(lane, laneDir, names, o, io) {
|
|
|
663
697
|
}
|
|
664
698
|
}
|
|
665
699
|
}
|
|
666
|
-
if (o.testFiles) score = checkTestFiles(lane, laneDir, s
|
|
700
|
+
if (o.testFiles) score = checkTestFiles(lane, laneDir, s, report, score, (line) => note(name, line));
|
|
667
701
|
return score;
|
|
668
702
|
});
|
|
669
703
|
for (const s of results) {
|
|
@@ -718,16 +752,30 @@ function readCounts(file) {
|
|
|
718
752
|
if (!(typeof json === "object" && json !== null && !Array.isArray(json) && Object.values(json).every((n) => Number.isInteger(n) && n >= 0))) throw new Error(`the file ${file} is not an object of test counts`);
|
|
719
753
|
return json;
|
|
720
754
|
}
|
|
721
|
-
/** This function
|
|
722
|
-
function
|
|
723
|
-
const
|
|
755
|
+
/** This function tells if the Vitest runner of a selection starts all the tests: the lane sets `vitest.related` to false. */
|
|
756
|
+
function runsAllTests(s) {
|
|
757
|
+
const vitest = s.stryker?.["vitest"];
|
|
758
|
+
return typeof vitest === "object" && vitest !== null && vitest["related"] === false;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* This function fails a score when the report does not read a test file that the run starts. The related mode of the
|
|
762
|
+
* Vitest runner starts each test file that loads a file of the selection (LANE.FILES). So a part does not start the
|
|
763
|
+
* test files of the other parts. With `vitest.related` false, the run starts each test file on the disk.
|
|
764
|
+
*/
|
|
765
|
+
function checkTestFiles(lane, laneDir, s, report, score, note) {
|
|
766
|
+
const p = lane.packages[s.pkg];
|
|
724
767
|
if (p === void 0) return score;
|
|
725
768
|
const dir = resolve(laneDir, p.dir);
|
|
726
769
|
if (report.testFiles === void 0) return failScore(score, `the report has no "testFiles", so the test files that it read are not known`);
|
|
727
|
-
const
|
|
770
|
+
const files = sourcesOf(dir, dir, true).filter((f) => !f.endsWith(".d.ts"));
|
|
771
|
+
const onDisk = files.filter((f) => TEST.test(f));
|
|
772
|
+
const unread = unreadTestFiles(report, runsAllTests(s) ? onDisk : relatedTestFiles(files.map((file) => ({
|
|
773
|
+
file,
|
|
774
|
+
text: readFileSync(resolve(dir, file), "utf8")
|
|
775
|
+
})), (file) => globsSelect(s.mutate, file)), p.notRead, dir);
|
|
728
776
|
for (const f of unread) note(` not read: ${p.dir}/${f}`);
|
|
729
777
|
if (unread.length === 0) return score;
|
|
730
|
-
return failScore(score, `the report does not read ${String(unread.length)} test files
|
|
778
|
+
return failScore(score, `the report does not read ${String(unread.length)} test files that the run starts. Each one is no read, unless "notRead" of the package gives its reason`);
|
|
731
779
|
}
|
|
732
780
|
/** This function starts the CLI with its arguments and gives the exit code. */
|
|
733
781
|
function runCli(argv, io) {
|
|
@@ -832,6 +880,6 @@ function runCli(argv, io) {
|
|
|
832
880
|
return 1;
|
|
833
881
|
}
|
|
834
882
|
}
|
|
835
|
-
export {
|
|
883
|
+
export { runSelections as C, partErrors as S, selectionNames as T, rewritesTsconfig as _, relatedTestFiles as a, changedFiles as b, formatScore as c, scoreReport as d, summaryMarkdown as f, TIMEOUT_MS as g, REPORT_DIR as h, leavingPaths as i, isHitLimit as l, NO_TSCONFIG as m, runCli as n, compareDisables as o, DRY_RUN_TIMEOUT_MINUTES as p, isConfigFile as r, findDisables as s, HELP as t, parseReport as u, strykerConfig as v, select as w, parseLane as x, STRYKER_OWNED as y };
|
|
836
884
|
|
|
837
|
-
//# sourceMappingURL=run-
|
|
885
|
+
//# sourceMappingURL=run-c2Mlztay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-c2Mlztay.js","names":["TEST"],"sources":["../src/lane.ts","../src/config.ts","../src/score.ts","../src/disables.ts","../src/load.ts","../src/run.ts"],"sourcesContent":["import { matchesGlob, posix } from \"node:path\";\n\n/**\n * The lane file of a repository (`mutation.json`) names the packages that the mutation tests mutate. A package has\n * its folder, its globs and an optional gate. A big package has parts, so that each part has its own runner.\n */\n\n/** The mutation tests of one package. */\nexport interface PackageLane {\n /** This field gives the folder of the package, from the folder of the lane file. Stryker starts in this folder. */\n readonly dir: string;\n /** These globs give the files to mutate, from `dir`. A glob with `!` removes the files of the globs before it. */\n readonly mutate: readonly string[];\n /**\n * Each part has its own globs. The `!` globs of `mutate` also apply to each part. Each file of `mutate` must be in\n * exactly one part, so that a full run mutates each file one time. `partErrors` examines this.\n */\n readonly parts?: Readonly<Record<string, readonly string[]>>;\n /** This field gives the lowest mutation score in percent that passes. Without a gate, the lane only reports the score. */\n readonly gate?: number;\n /** This field gives the Vitest config file, from `dir`. Without it, Vitest finds its config in `dir`. */\n readonly vitestConfig?: string;\n /**\n * This field gives the time in milliseconds that the clock adds to the time of the tests for each mutant. The\n * default is 120000. A short time on a loaded runner stops mutants that the tests detect later.\n */\n readonly timeoutMS?: number;\n /** This field gives the time in minutes for the run of the tests without mutants. The default is 15. */\n readonly dryRunTimeoutMinutes?: number;\n /**\n * These options go into the Stryker config of each selection of the package, for example `ignoreStatic`. The lane\n * owns the keys of `STRYKER_OWNED`, so the field cannot have them.\n */\n readonly stryker?: Readonly<Record<string, unknown>>;\n /**\n * Each test file of this field is on the disk, and no report reads it. The value gives the reason. `scores\n * --test-files` fails for each other test file on the disk that the report does not read. The file is from `dir`.\n */\n readonly notRead?: Readonly<Record<string, string>>;\n}\n\n/** The keys of the Stryker config that the lane owns. The field `stryker` of a package cannot have them. */\nexport const STRYKER_OWNED: readonly string[] = [\"mutate\", \"thresholds\", \"jsonReporter\", \"htmlReporter\", \"timeoutMS\", \"dryRunTimeoutMinutes\"];\n\n/** The lane file: the packages of the mutation tests, and the list of the disabled mutants. */\nexport interface Lane {\n readonly packages: Readonly<Record<string, PackageLane>>;\n /** This field gives the list of the disabled mutants, from the folder of the lane file. The default is `mutation-disables.json`. */\n readonly disables?: string;\n /**\n * This field gives the highest fall of the test count in percent against the last good count. The default is 20.\n * `scores --last` fails a selection with a higher fall: the report did not read all the tests.\n */\n readonly maxTestFall?: number;\n /** Each selection of this field can have a higher fall of its test count. The value gives the reason. */\n readonly plannedFalls?: Readonly<Record<string, string>>;\n}\n\n/** The default of `maxTestFall` of the lane, in percent. */\nexport const MAX_TEST_FALL = 20;\n\n/** A selection is one Stryker run: a package (`collections`) or a part of a package (`collections.impl`). */\nexport interface Selection {\n readonly name: string;\n readonly pkg: string;\n readonly dir: string;\n readonly mutate: readonly string[];\n readonly gate: number | undefined;\n readonly vitestConfig: string | undefined;\n readonly timeoutMS: number | undefined;\n readonly dryRunTimeoutMinutes: number | undefined;\n readonly stryker: Readonly<Record<string, unknown>> | undefined;\n}\n\nconst NAME = /^[\\w-]+$/;\n\nconst isRecord = (x: unknown): x is Record<string, unknown> => typeof x === \"object\" && x !== null && !Array.isArray(x);\n\n/** This function tells if a value is an object of names, each with a reason that is not empty. */\nconst isReasons = (x: unknown): x is Record<string, string> => isRecord(x) && Object.values(x).every((r) => typeof r === \"string\" && r.trim() !== \"\");\n\nconst isGlobs = (x: unknown): x is string[] => Array.isArray(x) && x.length > 0 && x.every((g) => typeof g === \"string\" && g !== \"\");\n\n/** This function examines a package of the lane file. It gives the errors, with the name of the package. */\nfunction packageErrors(name: string, p: unknown): string[] {\n if (!NAME.test(name)) return [`the package name \"${name}\" has a character that is not a letter, a digit, \"_\" or \"-\"`];\n if (!isRecord(p)) return [`${name}: the package is not an object`];\n const errors: string[] = [];\n if (typeof p[\"dir\"] !== \"string\" || p[\"dir\"] === \"\") errors.push(`${name}: \"dir\" is not a folder name`);\n if (!isGlobs(p[\"mutate\"])) errors.push(`${name}: \"mutate\" is not a list of globs`);\n else if (p[\"mutate\"].every((g) => g.startsWith(\"!\"))) errors.push(`${name}: \"mutate\" has only \"!\" globs`);\n const gate = p[\"gate\"];\n if (gate !== undefined && (typeof gate !== \"number\" || !(gate >= 0 && gate <= 100))) errors.push(`${name}: \"gate\" is not a percent from 0 to 100`);\n if (p[\"vitestConfig\"] !== undefined && typeof p[\"vitestConfig\"] !== \"string\") errors.push(`${name}: \"vitestConfig\" is not a file name`);\n for (const field of [\"timeoutMS\", \"dryRunTimeoutMinutes\"]) {\n const v = p[field];\n if (v !== undefined && !(typeof v === \"number\" && Number.isInteger(v) && v > 0)) errors.push(`${name}: \"${field}\" is not a positive integer`);\n }\n const stryker = p[\"stryker\"];\n if (stryker !== undefined) {\n if (!isRecord(stryker)) errors.push(`${name}: \"stryker\" is not an object`);\n else {\n const owned = Object.keys(stryker).filter((k) => STRYKER_OWNED.includes(k));\n if (owned.length > 0) errors.push(`${name}: \"stryker\" has ${owned.map((k) => `\"${k}\"`).join(\", \")}, but the lane owns these keys`);\n }\n }\n if (p[\"notRead\"] !== undefined && !isReasons(p[\"notRead\"])) errors.push(`${name}: \"notRead\" is not an object of files, each with a reason`);\n const parts = p[\"parts\"];\n if (parts !== undefined) {\n if (!isRecord(parts) || Object.keys(parts).length === 0) errors.push(`${name}: \"parts\" is not an object with parts`);\n else {\n for (const [part, globs] of Object.entries(parts)) {\n if (!NAME.test(part)) errors.push(`${name}: the part name \"${part}\" has a character that is not a letter, a digit, \"_\" or \"-\"`);\n if (!isGlobs(globs) || globs.some((g) => g.startsWith(\"!\"))) errors.push(`${name}.${part}: the part is not a list of globs without \"!\"`);\n }\n }\n }\n return errors;\n}\n\n/**\n * This function examines the JSON of a lane file and gives the lane.\n *\n * @throws Error with each problem of the file\n */\nexport function parseLane(json: unknown): Lane {\n if (!isRecord(json) || !isRecord(json[\"packages\"])) throw new Error(`the lane has no object \"packages\"`);\n const errors = Object.entries(json[\"packages\"]).flatMap(([name, p]) => packageErrors(name, p));\n if (Object.keys(json[\"packages\"]).length === 0) errors.push(`the lane has no packages`);\n if (json[\"disables\"] !== undefined && typeof json[\"disables\"] !== \"string\") errors.push(`\"disables\" is not a file name`);\n const fall = json[\"maxTestFall\"];\n if (fall !== undefined && (typeof fall !== \"number\" || !(fall >= 0 && fall <= 100))) errors.push(`\"maxTestFall\" is not a percent from 0 to 100`);\n const planned = json[\"plannedFalls\"];\n if (planned !== undefined && !isReasons(planned)) errors.push(`\"plannedFalls\" is not an object of selections, each with a reason`);\n if (errors.length > 0) throw new Error(`the lane is not valid:\\n ${errors.join(\"\\n \")}`);\n const lane = json as unknown as Lane;\n const names = new Set(selectionNames(lane));\n const unknown = Object.keys(lane.plannedFalls ?? {}).filter((n) => !names.has(n));\n if (unknown.length > 0) throw new Error(`the lane is not valid:\\n \"plannedFalls\" names no selection of the lane: ${unknown.join(\", \")}`);\n return lane;\n}\n\n/** This function gives the names of all the selections of a lane: each package, then each part of the package. */\nexport function selectionNames(lane: Lane): string[] {\n return Object.entries(lane.packages).flatMap(([name, p]) => [name, ...Object.keys(p.parts ?? {}).map((part) => `${name}.${part}`)]);\n}\n\n/** This function gives the selections of a full run: the parts of each package with parts, else the package. Each file is in one run. */\nexport function runSelections(lane: Lane): string[] {\n return Object.entries(lane.packages).flatMap(([name, p]) => (p.parts === undefined ? [name] : Object.keys(p.parts).map((part) => `${name}.${part}`)));\n}\n\n/**\n * This function gives the selection of a name: a package, or a part of a package.\n *\n * @throws Error when the lane has no package or part of that name\n */\nexport function select(lane: Lane, name: string): Selection {\n const [pkg = \"\", part, ...rest] = name.split(\".\");\n const p = lane.packages[pkg];\n const globs = part === undefined ? undefined : p?.parts?.[part];\n if (p === undefined || rest.length > 0 || (part !== undefined && globs === undefined)) {\n throw new Error(`the lane has no package or part \"${name}\". It has: ${selectionNames(lane).join(\", \")}`);\n }\n // Stryker applies a \"!\" glob to the globs before it, so the \"!\" globs of the package go after the globs of the part.\n const mutate = globs === undefined ? p.mutate : [...globs, ...p.mutate.filter((g) => g.startsWith(\"!\"))];\n return { name, pkg, dir: p.dir, mutate, gate: p.gate, vitestConfig: p.vitestConfig, timeoutMS: p.timeoutMS, dryRunTimeoutMinutes: p.dryRunTimeoutMinutes, stryker: p.stryker };\n}\n\n/**\n * This function tells if globs select a file. It reads the globs as Stryker does. A glob adds its files. A glob with\n * `!` removes its files from the files of the globs before it.\n */\nexport function globsSelect(globs: readonly string[], file: string): boolean {\n let selected = false;\n for (const g of globs) {\n if (g.startsWith(\"!\")) {\n if (selected && matchesGlob(file, g.slice(1))) selected = false;\n } else if (!selected && matchesGlob(file, g)) selected = true;\n }\n return selected;\n}\n\n/**\n * This function gives the changed files of a selection, from the folder of its package. The globs of the selection\n * select the files.\n *\n * @param changed - the changed paths, from the folder of the lane file, with `/`\n */\nexport function changedFiles(selection: Selection, changed: readonly string[]): string[] {\n const dir = posix.normalize(selection.dir.replaceAll(\"\\\\\", \"/\"));\n return changed\n .map((f) => posix.relative(dir, posix.normalize(f.replaceAll(\"\\\\\", \"/\"))))\n .filter((f) => f !== \"\" && !f.startsWith(\"../\") && !posix.isAbsolute(f) && globsSelect(selection.mutate, f));\n}\n\n/**\n * This function examines the parts of a package against its files. It gives an error for each file of `mutate` in no\n * part. It also gives an error for each file in two parts, and for each file of a part that is not in `mutate`. A\n * package with no parts has no errors.\n *\n * @param files - the source files of the package, from its folder, with `/`\n */\nexport function partErrors(lane: Lane, pkg: string, files: readonly string[]): string[] {\n const p = lane.packages[pkg];\n if (p?.parts === undefined) return [];\n const parts = Object.keys(p.parts).map((part) => ({ part, mutate: select(lane, `${pkg}.${part}`).mutate }));\n const errors: string[] = [];\n for (const file of files) {\n const inMutate = globsSelect(p.mutate, file);\n const inParts = parts.filter((x) => globsSelect(x.mutate, file)).map((x) => x.part);\n if (inMutate && inParts.length === 0) errors.push(`${pkg}: the file ${file} is in no part, so a full run does not mutate it`);\n else if (inParts.length > 1) errors.push(`${pkg}: the file ${file} is in more than one part: ${inParts.join(\", \")}`);\n else if (!inMutate && inParts.length === 1) errors.push(`${pkg}: the file ${file} is in the part ${inParts.join(\"\")}, but not in \"mutate\"`);\n }\n return errors;\n}\n","import type { Selection } from \"./lane.ts\";\n\n/** The options of `strykerConfig`. */\nexport interface ConfigOptions {\n /** This option gives the number of test processes. The default is 2. */\n readonly concurrency?: number;\n /** This option gives the folder of the reports, from the folder of the package. The default is `reports/mutation`. */\n readonly reportDir?: string;\n /**\n * When this option is true, Stryker starts only the tests without mutants, and it does not stop at the first failed\n * test. Use it to see if the tests pass under Stryker before a long run.\n */\n readonly dryRun?: boolean;\n /**\n * When this option is false, Stryker does not rewrite the tsconfig of the package in its sandbox. The default is true.\n * The rewrite uses `parseConfigFileTextToJson`, and TypeScript 7 does not have it. Refer to `rewritesTsconfig`.\n */\n readonly tsconfigRewrite?: boolean;\n}\n\n/** The Stryker config of one selection, as JSON. Stryker starts in the folder of the package. The field `stryker` of the lane adds keys. */\nexport interface StrykerConfig {\n readonly [key: string]: unknown;\n readonly testRunner: \"vitest\";\n readonly plugins: readonly string[];\n readonly vitest?: { readonly configFile: string };\n readonly mutate: readonly string[];\n readonly coverageAnalysis: \"perTest\";\n readonly reporters: readonly string[];\n readonly htmlReporter: { readonly fileName: string };\n readonly jsonReporter: { readonly fileName: string };\n readonly thresholds: { readonly high: number; readonly low: number; readonly break: null };\n readonly concurrency: number;\n readonly timeoutMS: number;\n readonly dryRunTimeoutMinutes: number;\n readonly tsconfigFile?: string;\n readonly dryRunOnly?: true;\n readonly disableBail?: true;\n}\n\n/** The default folder of the reports, from the folder of the package. */\nexport const REPORT_DIR = \"reports/mutation\";\n\n/**\n * The default time in milliseconds that the clock adds to the time of the tests for each mutant. The default of\n * Stryker is 5000. On a loaded CI runner that time stopped mutants that the tests detected later.\n */\nexport const TIMEOUT_MS = 120_000;\n\n/**\n * The value of `tsconfigFile` when the rewrite of the tsconfig is off. No project has this file, so Stryker finds no\n * tsconfig to rewrite.\n */\nexport const NO_TSCONFIG = \"tsconfig.no-stryker-rewrite.json\";\n\n/**\n * This function tells if Stryker can rewrite a tsconfig with a TypeScript of the major version `major`. Stryker 10.1\n * parses the tsconfig with `parseConfigFileTextToJson`, and TypeScript 7 removed it. When no TypeScript is found, the\n * answer is true, and the config keeps the default of Stryker.\n */\nexport function rewritesTsconfig(major: number | undefined): boolean {\n return major === undefined || major < 7;\n}\n\n/** The default time in minutes for the run of the tests without mutants. The default of Stryker is 5. */\nexport const DRY_RUN_TIMEOUT_MINUTES = 15;\n\n/**\n * This function gives the Stryker config of a selection. The break of Stryker is off, because the gate of each\n * package is in `scoreReport`. Stryker 10.1.0 or later is necessary with Vitest 5: version 10.0 started no test on each\n * mutant (stryker-js issue 6210).\n */\nexport function strykerConfig(selection: Selection, options: ConfigOptions = {}): StrykerConfig {\n const reportDir = options.reportDir ?? REPORT_DIR;\n const low = selection.gate ?? 60;\n return {\n testRunner: \"vitest\",\n plugins: [\"@stryker-mutator/vitest-runner\"],\n ...(selection.vitestConfig === undefined ? {} : { vitest: { configFile: selection.vitestConfig } }),\n mutate: selection.mutate,\n coverageAnalysis: \"perTest\",\n reporters: [\"clear-text\", \"progress\", \"html\", \"json\"],\n htmlReporter: { fileName: `${reportDir}/index.html` },\n jsonReporter: { fileName: `${reportDir}/mutation.json` },\n thresholds: { high: Math.max(low, 90), low, break: null },\n concurrency: options.concurrency ?? 2,\n timeoutMS: selection.timeoutMS ?? TIMEOUT_MS,\n dryRunTimeoutMinutes: selection.dryRunTimeoutMinutes ?? DRY_RUN_TIMEOUT_MINUTES,\n ...(options.tsconfigRewrite === false ? { tsconfigFile: NO_TSCONFIG } : {}),\n // The keys of the lane field \"stryker\" replace the keys above, but \"--concurrency\" replaces its \"concurrency\".\n ...selection.stryker,\n ...(options.concurrency === undefined ? {} : { concurrency: options.concurrency }),\n ...(options.dryRun === true ? { dryRunOnly: true, disableBail: true } : {}),\n };\n}\n","/**\n * The score of a Stryker report, with the gate of the package. The score counts the detected mutants, out of the\n * mutants that a test covers or that survive. Compile errors, runtime errors and ignored mutants do not count.\n *\n * Stryker gives the status `Timeout` for two events. The hit limit stops a mutant with an endless loop: its\n * `statusReason` starts with `Hit limit`, and the mutant is detected. The clock stops a mutant that took too long. The\n * load of the runner can cause this. Thus the mutant is not detected for certain, and it counts as not detected.\n */\n\n/** A mutant of the JSON report of Stryker (the schema of mutation-testing-elements). */\nexport interface Mutant {\n readonly status: string;\n readonly mutatorName: string;\n /** Stryker gives the reason of some statuses here. A `Timeout` of the hit limit has a reason that starts with `Hit limit`. */\n readonly statusReason?: string | undefined;\n readonly location: { readonly start: { readonly line: number } };\n}\n\n/** The JSON report of Stryker: the mutants of each mutated file, and the tests of each test file that the run read. */\nexport interface MutationReport {\n readonly files: Readonly<Record<string, { readonly mutants: readonly Mutant[] }>>;\n /** Stryker gives this field when the test runner tells the tests, as the Vitest runner does. */\n readonly testFiles?: Readonly<Record<string, { readonly tests: readonly { readonly name: string }[] }>> | undefined;\n}\n\n/**\n * The three reads of a score. A `block` is a score under its gate. A `no read` is a score that does not read the tests.\n * Its cause is no report, no mutant that counts, no detected mutant, or a run that did not read all the tests. A no read is not a pass.\n */\nexport type ScoreOutcome = \"pass\" | \"block\" | \"no read\";\n\n/** The score of one selection. */\nexport interface Score {\n readonly name: string;\n readonly gate: number | undefined;\n /** The mutants with the status `Killed`, and the mutants that the hit limit stopped. */\n readonly detected: number;\n /** The mutants that the hit limit stopped. They are in `detected`. */\n readonly hitLimit: number;\n /** The mutants that the clock stopped. They count as not detected, and they are in `survived`. */\n readonly clockTimeouts: number;\n /** The mutants that count: detected, survived or with no coverage. */\n readonly valid: number;\n /** Each mutant that survived, had no coverage or was stopped by the clock, as `file:line Mutator`. */\n readonly survived: readonly string[];\n /** The score in percent. It is 0 when no mutant counts. */\n readonly percent: number;\n /** The score in percent with the clock time-outs counted as detected, as Stryker counts them. The gate does not read it. */\n readonly percentWithClock: number;\n /** The count of the tests that the run read, from `testFiles` of the report. It is undefined when the report has no `testFiles`. */\n readonly tests: number | undefined;\n readonly pass: boolean;\n /** The reason of a failure. */\n readonly reason: string | undefined;\n /** The read of the score. The functions of this package always give it. A score from an older version has no outcome. */\n readonly outcome?: ScoreOutcome;\n}\n\nconst UNDETECTED = new Set([\"Survived\", \"NoCoverage\"]);\n\n/** This function tells if the hit limit of Stryker stopped a mutant. Then the mutant has an endless loop, and it is detected. */\nexport const isHitLimit = (m: Mutant): boolean => m.status === \"Timeout\" && (m.statusReason ?? \"\").startsWith(\"Hit limit\");\n\n/**\n * This function examines the JSON of a Stryker report and gives the report.\n *\n * @throws Error when the JSON has no files with mutants\n */\nexport function parseReport(json: unknown): MutationReport {\n const files = typeof json === \"object\" && json !== null ? (json as { files?: unknown }).files : undefined;\n if (typeof files !== \"object\" || files === null) throw new Error(`the report has no object \"files\"`);\n for (const [file, data] of Object.entries(files)) {\n if (!Array.isArray((data as { mutants?: unknown } | null)?.mutants)) throw new Error(`the report has no list \"mutants\" for ${file}`);\n }\n const testFiles = (json as { testFiles?: unknown }).testFiles;\n if (testFiles !== undefined) {\n if (typeof testFiles !== \"object\" || testFiles === null) throw new Error(`the field \"testFiles\" of the report is not an object`);\n for (const [file, data] of Object.entries(testFiles)) {\n if (!Array.isArray((data as { tests?: unknown } | null)?.tests)) throw new Error(`the report has no list \"tests\" for the test file ${file}`);\n }\n }\n return json as MutationReport;\n}\n\n/** This function gives the count of the tests of a report, or undefined when the report has no `testFiles`. */\nexport function testCount(report: MutationReport): number | undefined {\n if (report.testFiles === undefined) return undefined;\n return Object.values(report.testFiles).reduce((sum, f) => sum + f.tests.length, 0);\n}\n\n/**\n * This function compares a test count with the last good count. It gives the reason of a failure when the count fell\n * by more than `maxFall` percent, else undefined. A report that reads fewer tests is no read of the score.\n *\n * @param maxFall - the highest fall in percent that passes\n */\nexport function testFall(tests: number, last: number, maxFall: number): string | undefined {\n if (last <= 0 || tests >= last) return undefined;\n const fall = (100 * (last - tests)) / last;\n if (fall <= maxFall) return undefined;\n return `the run read ${String(tests)} tests, ${fall.toFixed(1)} % fewer than the last good count ${String(last)} (the limit is ${String(maxFall)} %), so the score is no read`;\n}\n\n/**\n * This function gives each test file on the disk that the report does not read, and that `notRead` does not name.\n * The files of the report and of the disk are from the folder of the package.\n *\n * @param onDisk - the test files of the package, from its folder, with `/`\n * @param dir - the folder of the package, to make a full path of the report relative\n */\nexport function unreadTestFiles(report: MutationReport, onDisk: readonly string[], notRead: Readonly<Record<string, string>> = {}, dir = \"\"): string[] {\n const root = dir.replaceAll(\"\\\\\", \"/\").replace(/\\/?$/, \"/\");\n const read = new Set(\n Object.keys(report.testFiles ?? {}).map((f) => {\n const file = f.replaceAll(\"\\\\\", \"/\");\n return dir !== \"\" && file.startsWith(root) ? file.slice(root.length) : file.replace(/^\\.\\//, \"\");\n }),\n );\n return onDisk.filter((f) => !read.has(f) && notRead[f] === undefined);\n}\n\n/**\n * This function gives a score that fails for a reason, with the outcome `no read`. A score that failed already keeps its\n * first reason, and gets the new one after it. A score under its gate with a second reason is also a no read.\n */\nexport function failScore(score: Score, reason: string): Score {\n return { ...score, pass: false, outcome: \"no read\", reason: score.reason === undefined ? reason : `${score.reason}. Also ${reason}` };\n}\n\n/**\n * This function gives the score of a report and applies the gate. A report with no mutants that count fails, also\n * without a gate: Stryker found no files. A report with mutants that count and none detected also fails: the test\n * runner started no test on the mutants. Stryker 10.0 with Vitest 5 gave this result.\n */\nexport function scoreReport(report: MutationReport, selection: { readonly name: string; readonly gate: number | undefined }): Score {\n let detected = 0;\n let valid = 0;\n let hitLimit = 0;\n let clockTimeouts = 0;\n const survived: string[] = [];\n for (const [file, data] of Object.entries(report.files)) {\n for (const m of data.mutants) {\n const at = `${file}:${String(m.location.start.line)} ${m.mutatorName}`;\n if (m.status === \"Killed\" || isHitLimit(m)) {\n detected++;\n valid++;\n if (m.status === \"Timeout\") hitLimit++;\n } else if (m.status === \"Timeout\") {\n clockTimeouts++;\n valid++;\n survived.push(`${at} (the clock stopped it)`);\n } else if (UNDETECTED.has(m.status)) {\n valid++;\n survived.push(at);\n }\n }\n }\n const percent = valid === 0 ? 0 : (100 * detected) / valid;\n const percentWithClock = valid === 0 ? 0 : (100 * (detected + clockTimeouts)) / valid;\n const { name, gate } = selection;\n const [outcome, reason]: [ScoreOutcome, string | undefined] =\n valid === 0\n ? [\"no read\", \"the report has no mutants that count: Stryker found no files to mutate, or it did not start\"]\n : detected === 0\n ? [\"no read\", `the tests detected none of the ${String(valid)} mutants: the test runner started no test on the mutants`]\n : gate !== undefined && percent < gate\n ? [\"block\", `the score ${percent.toFixed(2)} % is under the gate ${String(gate)} %`]\n : [\"pass\", undefined];\n return { name, gate, detected, hitLimit, clockTimeouts, valid, survived, percent, percentWithClock, tests: testCount(report), pass: reason === undefined, reason, outcome };\n}\n\n/** This function gives the time-outs of a score as text: the count of each kind, and the score that counts the clock time-outs as detected. */\nconst timeouts = (s: Score): string =>\n `time-outs: ${String(s.hitLimit)} hit limit, ${String(s.clockTimeouts)} clock (${s.percentWithClock.toFixed(2)} % with the clock time-outs as detected)`;\n\n/** This function gives one line for a score, with the name of the selection and its result. The time-outs are in it when the report has some. */\nexport function formatScore(s: Score): string {\n const gate = s.gate === undefined ? \"no gate\" : `gate ${String(s.gate)} %`;\n const result = s.pass ? \"pass\" : `FAIL: ${s.reason ?? \"\"}`;\n const time = s.hitLimit + s.clockTimeouts === 0 ? \"\" : `, ${timeouts(s)}`;\n const tests = s.tests === undefined ? \"\" : `, ${String(s.tests)} tests`;\n return `${s.name}: ${s.percent.toFixed(2)} % (${String(s.detected)} of ${String(s.valid)}, ${String(s.survived.length)} survived${time}${tests}), ${gate}: ${result}`;\n}\n\n/** This function gives a Markdown table of scores, for the summary of a CI job. */\nexport function summaryMarkdown(scores: readonly Score[]): string {\n const rows = scores.map(\n (s) =>\n `| ${s.name} | ${s.percent.toFixed(2)} % | ${String(s.detected)} | ${String(s.valid)} | ${String(s.survived.length)} | ${String(s.clockTimeouts)} | ${s.percentWithClock.toFixed(2)} % | ${s.gate === undefined ? \"none\" : `${String(s.gate)} %`} | ${s.pass ? \"pass\" : `fail: ${s.reason ?? \"\"}`} | ${s.tests === undefined ? \"?\" : String(s.tests)} |`,\n );\n return [\n \"| Selection | Score | Detected | Valid | Survived | Clock time-outs | Score with them | Gate | Result | Tests |\",\n \"| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | ---: |\",\n ...rows,\n \"\",\n ].join(\"\\n\");\n}\n","/**\n * A comment `// Stryker disable next-line <Mutator>: <reason>` disables a mutant that is equivalent. The disable\n * raises the score, so each one is also in a list with its reason. These functions find the comments in the\n * sources and compare them with the list.\n */\n\n/** One disable comment of a source file. */\nexport interface Disable {\n readonly file: string;\n readonly comment: string;\n}\n\n/** The result of `compareDisables`. */\nexport interface DisableCheck {\n /** The comments of the sources that are not in the list, as `file: comment`. */\n readonly added: readonly string[];\n /** The comments of the list that are not in the sources, as `file: comment`. */\n readonly removed: readonly string[];\n /** The comments with no reason after a colon. */\n readonly noReason: readonly Disable[];\n readonly ok: boolean;\n}\n\n/** This function finds each `Stryker disable` comment of the files. A file name uses `/`. */\nexport function findDisables(files: readonly { readonly file: string; readonly text: string }[]): Disable[] {\n return files.flatMap(({ file, text }) =>\n text\n .split(\"\\n\")\n .filter((line) => line.includes(\"Stryker disable\"))\n .map((line) => ({ file, comment: line.trim() })),\n );\n}\n\nconst counts = (xs: readonly Disable[]): Map<string, number> => {\n const m = new Map<string, number>();\n for (const x of xs) {\n const k = `${x.file}: ${x.comment}`;\n m.set(k, (m.get(k) ?? 0) + 1);\n }\n return m;\n};\n\n/**\n * This function tells if a comment has a reason: a mutator name, a colon, a space and a text. It reads the text by\n * index, so its time is linear in the length of the comment (a regular expression here was quadratic).\n */\nfunction hasReason(comment: string): boolean {\n const start = comment.indexOf(\"Stryker disable \");\n if (start < 0) return false;\n const rest = comment.slice(start + \"Stryker disable \".length);\n const colon = rest.indexOf(\":\");\n return colon > 0 && rest[colon + 1] === \" \" && /\\S/.test(rest[colon + 2] ?? \"\");\n}\n\n/** This function compares the comments of the sources with the list. A file with the same comment two times needs it two times in the list. */\nexport function compareDisables(found: readonly Disable[], listed: readonly Disable[]): DisableCheck {\n const noReason = found.filter((d) => !hasReason(d.comment));\n const a = counts(found);\n const b = counts(listed);\n const added = [...a].filter(([k, n]) => n > (b.get(k) ?? 0)).map(([k]) => k);\n const removed = [...b].filter(([k, n]) => n > (a.get(k) ?? 0)).map(([k]) => k);\n return { added, removed, noReason, ok: added.length === 0 && removed.length === 0 && noReason.length === 0 };\n}\n","/**\n * The load check. Stryker copies the folder of a package to `<dir>/.stryker-tmp/sandbox-*` and starts the tests there.\n * A relative path that leaves the folder then finds no file. A test file that does not load gives no failed test, so\n * each mutant that it detects survives with no error (V-072 of Vex). This check finds these paths before Stryker. It\n * reads only the files that the run loads, so a script of the folder that no test loads can leave the folder.\n */\nimport { posix } from \"node:path\";\n\n/** A relative path in a file of a package that leaves the folder of the package. */\nexport interface LeavingPath {\n /** The file, from the folder of the package, with `/`. */\n readonly file: string;\n /** The line of the path, from 1. */\n readonly line: number;\n /** The path as the file writes it. */\n readonly path: string;\n}\n\n/** A file of a package and its text. */\nexport interface PackageFile {\n /** The file, from the folder of the package, with `/`. */\n readonly file: string;\n readonly text: string;\n}\n\n// The paths that a module loads: import and export from, import(), require(), vi.mock() and the other vi functions,\n// and new URL(path, import.meta.url).\n// The optional \"(\" and its spaces are one group, so that each space has one match (no slow backtracking).\nconst LOADED = /(?:\\bfrom|\\bimport|\\brequire|\\bvi\\.\\w+|\\bnew\\s+URL)\\s*(?:\\(\\s*)?([\"'`])([^\"'`\\r\\n]*)\\1/g;\n// Each relative path string of a config file, for example setupFiles: [\"../testkit/setup.ts\"].\nconst CONFIG_PATH = /([\"'`])(\\.\\.?\\/[^\"'`\\r\\n]*)\\1/g;\n// A type import or export: the test runner removes it, so it loads no file.\nconst TYPE_ONLY = /^\\s*(?:import|export)\\s+type\\b/;\nconst COMMENT = /^\\s*(?:\\/\\/|\\/\\*|\\*)/;\nconst CONFIG_FILE = /(?:^|\\/)vite(?:st)?\\.(?:config|workspace)\\.[cm]?[jt]s$/;\n\n/**\n * This function tells if a file is a config file of Vitest or Vite. Each relative path string of a config file must\n * stay in the folder.\n *\n * @param vitestConfig - the field `vitestConfig` of the lane, from the folder of the package\n */\nexport function isConfigFile(file: string, vitestConfig?: string): boolean {\n return CONFIG_FILE.test(file) || (vitestConfig !== undefined && posix.normalize(vitestConfig.replaceAll(\"\\\\\", \"/\")) === file);\n}\n\nfunction leaves(file: string, path: string): boolean {\n if (!(path === \".\" || path === \"..\" || path.startsWith(\"./\") || path.startsWith(\"../\")) || path.includes(\"${\")) return false;\n const target = posix.normalize(posix.join(posix.dirname(file), path));\n return target === \"..\" || target.startsWith(\"../\");\n}\n\nconst TEST = /\\.(?:test|spec)\\.[cm]?[jt]sx?$/;\nconst EXTENSIONS = [\"\", \".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".mjs\", \".cjs\", \"/index.ts\", \"/index.js\"];\n\n/** This function gives each relative path of one file, with its line. It does not read comments and type imports. */\nfunction pathsOf(file: string, text: string, vitestConfig: string | undefined): { line: number; path: string }[] {\n const pattern = isConfigFile(file, vitestConfig) ? CONFIG_PATH : LOADED;\n return text.split(\"\\n\").flatMap((lineText, i) => {\n if (COMMENT.test(lineText) || TYPE_ONLY.test(lineText)) return [];\n return [...lineText.matchAll(pattern)].map((m) => ({ line: i + 1, path: m[2] ?? \"\" })).filter((p) => p.path.startsWith(\".\"));\n });\n}\n\n/** This function gives the file of the package that a relative path in the folder loads, or undefined. */\nfunction target(file: string, path: string, known: ReadonlySet<string>): string | undefined {\n const base = posix.normalize(posix.join(posix.dirname(file), path));\n const stem = base.replace(/\\.(?:[cm]?js|jsx)$/, \"\");\n return [...EXTENSIONS.map((e) => base + e), ...EXTENSIONS.slice(1).map((e) => stem + e)].find((f) => known.has(f));\n}\n\n/**\n * This function gives each relative path of the files that leaves the folder of the package. It reads the files that\n * the run loads. These are the test files, the config files, and each file that they load in the folder.\n * In a config file it reads each relative path string, for example a setup file. It does not read comments and type\n * imports.\n *\n * @param files - the files of the package, from its folder\n * @param vitestConfig - the field `vitestConfig` of the lane\n */\nexport function leavingPaths(files: readonly PackageFile[], vitestConfig?: string): LeavingPath[] {\n const texts = new Map(files.map((f) => [f.file, f.text]));\n const known = new Set(texts.keys());\n const queue = files.map((f) => f.file).filter((f) => TEST.test(f) || isConfigFile(f, vitestConfig));\n const loaded = new Set(queue);\n const found: LeavingPath[] = [];\n for (let next = queue.shift(); next !== undefined; next = queue.shift()) {\n for (const { line, path } of pathsOf(next, texts.get(next) ?? \"\", vitestConfig)) {\n if (leaves(next, path)) found.push({ file: next, line, path });\n else {\n const t = target(next, path, known);\n if (t !== undefined && !loaded.has(t)) {\n loaded.add(t);\n queue.push(t);\n }\n }\n }\n }\n return found.toSorted((a, b) => (a.file === b.file ? a.line - b.line : a.file < b.file ? -1 : 1));\n}\n\n// A type import or export to its semicolon, also on more than one line. The test runner removes it.\nconst TYPE_STATEMENT = /^[ \\t]*(?:import|export)[ \\t]+type\\b[^;]*;/gm;\n\n/** This function replaces each type import and export with its line ends, so the lines of the other paths stay. */\nfunction withoutTypeStatements(text: string): string {\n return text.replace(TYPE_STATEMENT, (statement) => statement.replace(/[^\\n]/g, \"\"));\n}\n\n/**\n * This function gives the test files that the related mode of the Vitest runner starts for a selection. A test file\n * is related when it loads a file of the selection, directly or through other files of the package. The function\n * does not read comments and type imports. The order is the order of `files`.\n *\n * @param files - the files of the package, from its folder\n * @param selected - the function that tells if a file is a file of the selection\n */\nexport function relatedTestFiles(files: readonly PackageFile[], selected: (file: string) => boolean): string[] {\n const texts = new Map(files.map((f) => [f.file, withoutTypeStatements(f.text)]));\n const known = new Set(texts.keys());\n const loads = (file: string): string[] =>\n pathsOf(file, texts.get(file) ?? \"\", undefined).flatMap(({ path }) => {\n const t = target(file, path, known);\n return t === undefined ? [] : [t];\n });\n const reaches = (test: string): boolean => {\n const queue = [test];\n const loaded = new Set(queue);\n for (let next = queue.shift(); next !== undefined; next = queue.shift()) {\n for (const t of loads(next)) {\n if (!TEST.test(t) && selected(t)) return true;\n if (!loaded.has(t)) {\n loaded.add(t);\n queue.push(t);\n }\n }\n }\n return false;\n };\n return files.map((f) => f.file).filter((f) => TEST.test(f) && reaches(f));\n}\n","/**\n * The CLI `rigor-mutation`. The work is in `runCli`, so a test can start the CLI in a fixture folder.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, appendFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { REPORT_DIR, rewritesTsconfig, strykerConfig } from \"./config.ts\";\nimport { compareDisables, findDisables, type Disable } from \"./disables.ts\";\nimport { leavingPaths, relatedTestFiles } from \"./load.ts\";\nimport { changedFiles, globsSelect, MAX_TEST_FALL, parseLane, partErrors, runSelections, select, selectionNames, type Lane, type Selection } from \"./lane.ts\";\nimport { failScore, formatScore, parseReport, scoreReport, summaryMarkdown, testFall, unreadTestFiles, type MutationReport, type Score } from \"./score.ts\";\n\n/** The input and the output of the CLI. */\nexport interface CliIo {\n readonly cwd: string;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n /** The environment. With `GITHUB_ACTIONS` set to `true`, `scores` writes an annotation for each score that does not pass and each planned fall. */\n readonly env?: Readonly<Record<string, string | undefined>>;\n}\n\n/** The help text of the CLI. */\nexport const HELP: string = `rigor-mutation: the mutation tests of a repository, with Stryker and a gate for each package.\n\n rigor-mutation list [--runs] [--changed <file>]\n the packages and the parts of the lane. With --runs, the\n selections of a full run: the parts of a package with parts.\n With --changed, only the runs with a changed file.\n rigor-mutation dir <selection> the folder of the package of a selection\n rigor-mutation config <selection> [--out <file>] [--concurrency <n>] [--dry-run] [--changed <file>]\n the Stryker config of a selection, as JSON. With --dry-run,\n Stryker starts only the tests. With --changed, it mutates only\n the changed files of the selection.\n rigor-mutation scores <selection>... [--report <file>] [--summary <file>] [--last <file>]\n [--write-last <file>] [--test-files]\n the score of each selection, with its gate and its count\n of tests. With --last, a fall of the count of more than\n maxTestFall % (default 20) against the file fails. With\n --write-last, the counts of the passed selections go in\n the file. With --test-files, a test file that the run\n starts and that the report does not read fails.\n rigor-mutation disables [--write] compare the disable comments with their list\n rigor-mutation load-check [<selection>...] refuse each relative path of a package that leaves its folder.\n Stryker starts the tests in a copy of the folder, so such a\n path finds no file. No selection checks each package.\n\n --lane <file> the lane file. The default is mutation.json.\n --changed <file> a file with one changed path on each line, from the folder of the lane file,\n for example the output of git diff --name-only.\n\nA selection is a package (\"collections\") or a part of a package (\"collections.impl\").\nEach file of a package with parts must be in exactly one part. list --runs, and config and scores\nof a part, fail when it is not.\nThe score of a selection reads <dir>/${REPORT_DIR}/mutation.json, or the file of --report.\n`;\n\nconst SOURCE = /\\.(?:[cm]?[jt]s|tsx)$/;\nconst TEST = /\\.(?:test|spec)\\.[^.]+$/;\nconst SKIP = new Set([\"node_modules\", \"build\", \"dist\", \"reports\", \"coverage\"]);\n\n/**\n * This function gives each source file of a folder, from `root`, with `/`. It skips the outputs and the dot folders,\n * and the tests when `tests` is false.\n */\nfunction sourcesOf(root: string, dir: string, tests = false): string[] {\n return readdirSync(dir, { withFileTypes: true })\n .toSorted((x, y) => x.name.localeCompare(y.name))\n .flatMap((e) => {\n const path = resolve(dir, e.name);\n if (e.isDirectory()) return e.name.startsWith(\".\") || SKIP.has(e.name) ? [] : sourcesOf(root, path, tests);\n return e.isFile() && SOURCE.test(e.name) && (tests || !TEST.test(e.name)) ? [relative(root, path).replaceAll(\"\\\\\", \"/\")] : [];\n });\n}\n\n/** This function checks the relative paths of the package of each selection (`load-check`). */\nfunction loadCheck(lane: Lane, laneDir: string, names: readonly string[], io: CliIo): number {\n const pkgs = [...new Set((names.length === 0 ? Object.keys(lane.packages) : names.map((n) => select(lane, n).pkg)))];\n let failed = 0;\n for (const pkg of pkgs) {\n const s = select(lane, pkg);\n const dir = resolve(laneDir, s.dir);\n if (!existsSync(dir)) throw new Error(`${pkg}: the folder ${s.dir} does not exist`);\n const files = sourcesOf(dir, dir, true)\n .filter((f) => !f.endsWith(\".d.ts\"))\n .map((file) => ({ file, text: readFileSync(resolve(dir, file), \"utf8\") }));\n const found = leavingPaths(files, s.vitestConfig);\n for (const p of found) {\n io.stderr(`${s.dir}/${p.file}:${String(p.line)}: \"${p.path}\" leaves the folder ${s.dir}. In the copy of Stryker it finds no file.\n`);\n }\n if (found.length === 0) io.stdout(`load-check ${pkg}: ${String(files.length)} files, no relative path leaves ${s.dir}\n`);\n else failed += 1;\n }\n if (failed > 0) io.stderr(`load-check: ${String(failed)} packages have a relative path that leaves their folder. Import the file from its package, or move it into the folder.\n`);\n return failed > 0 ? 1 : 0;\n}\n\nconst readJson = (file: string): unknown => JSON.parse(readFileSync(file, \"utf8\"));\n\n/**\n * This function gives the major version of the `typescript` that the folder `dir` resolves, or undefined when the\n * folder resolves none. In a usual install, Stryker resolves the same version, because it starts in that folder.\n */\nfunction typescriptMajor(dir: string): number | undefined {\n let file: string;\n try {\n file = createRequire(join(dir, \"package.json\")).resolve(\"typescript/package.json\");\n } catch {\n return undefined;\n }\n const version: unknown = (readJson(file) as { version?: unknown }).version;\n const major = typeof version === \"string\" ? Number.parseInt(version, 10) : Number.NaN;\n return Number.isInteger(major) ? major : undefined;\n}\n\n/**\n * This function examines the parts of the packages against their source files.\n *\n * @throws Error with each file that is in no part, in more than one part, or in a part and not in `mutate`\n */\nfunction checkParts(lane: Lane, laneDir: string, pkgs: readonly string[]): void {\n const errors = pkgs.flatMap((pkg) => {\n const p = lane.packages[pkg];\n if (p?.parts === undefined) return [];\n const dir = resolve(laneDir, p.dir);\n if (!existsSync(dir)) return [`${pkg}: the folder ${p.dir} does not exist`];\n return partErrors(lane, pkg, sourcesOf(dir, dir));\n });\n if (errors.length > 0) throw new Error(`the parts do not cover each file exactly one time:\\n ${errors.join(\"\\n \")}`);\n}\n\n/** This function examines the parts of the package of each selection that is a part. */\nconst checkPartsOf = (lane: Lane, laneDir: string, names: readonly string[]): void =>\n checkParts(lane, laneDir, [...new Set(names.map((n) => select(lane, n)).filter((s) => s.name !== s.pkg).map((s) => s.pkg))]);\n\nfunction disables(lane: Lane, laneDir: string, write: boolean, io: CliIo): number {\n const files = new Set<string>();\n for (const [name, p] of Object.entries(lane.packages)) {\n const dir = resolve(laneDir, p.dir);\n if (!existsSync(dir)) throw new Error(`${name}: the folder ${p.dir} does not exist`);\n for (const f of sourcesOf(laneDir, dir)) files.add(f);\n }\n const found = findDisables([...files].map((file) => ({ file, text: readFileSync(resolve(laneDir, file), \"utf8\") })));\n const listFile = resolve(laneDir, lane.disables ?? \"mutation-disables.json\");\n const listed = existsSync(listFile) ? (readJson(listFile) as Disable[]) : [];\n const check = compareDisables(found, listed);\n for (const d of check.noReason) io.stderr(`a disable without a reason after a colon: ${d.file}: ${d.comment}\\n`);\n if (write) {\n if (check.noReason.length > 0) return 1;\n writeFileSync(listFile, `${JSON.stringify(found, null, 2)}\\n`);\n io.stdout(`disables: wrote ${String(found.length)} comments to ${relative(io.cwd, listFile).replaceAll(\"\\\\\", \"/\")}\\n`);\n return 0;\n }\n const perFile = new Map<string, number>();\n for (const d of found) perFile.set(d.file, (perFile.get(d.file) ?? 0) + 1);\n io.stdout(`disables: ${String(found.length)} in ${String(perFile.size)} files\\n`);\n for (const [file, n] of perFile) io.stdout(` ${file}: ${String(n)}\\n`);\n for (const k of check.added) io.stderr(`not in the list: ${k}\\n`);\n for (const k of check.removed) io.stderr(`in the list, not in the sources: ${k}\\n`);\n if (check.added.length > 0 || check.removed.length > 0) {\n io.stderr(\"disables: the sources and the list are not the same. Add each new disable with its reason, or start with --write and examine the diff.\\n\");\n }\n return check.ok ? 0 : 1;\n}\n\n/** The options of `scores`. */\ninterface ScoresOptions {\n readonly report: string | undefined;\n readonly summary: string | undefined;\n readonly last: string | undefined;\n readonly writeLast: string | undefined;\n readonly testFiles: boolean;\n}\n\n/**\n * This function gives the score of each selection (`scores`). With `last`, it compares the test count with the last\n * good count (LANE.TESTS of Vex). With `testFiles`, it compares the test files that the run starts with the report (LANE.FILES).\n */\nfunction scores(lane: Lane, laneDir: string, names: readonly string[], o: ScoresOptions, io: CliIo): number {\n if (names.length === 0) throw new Error(`\"scores\" takes one or more selections`);\n if (o.report !== undefined && names.length > 1) throw new Error(`--report takes one selection`);\n checkPartsOf(lane, laneDir, names);\n const lastFile = o.last === undefined ? undefined : resolve(io.cwd, o.last);\n const last = lastFile === undefined || !existsSync(lastFile) ? {} : readCounts(lastFile);\n if (lastFile !== undefined && !existsSync(lastFile)) io.stdout(`scores: the file ${o.last ?? \"\"} does not exist, so no count is compared\n`);\n const notes = new Map<string, string[]>(names.map((n) => [n, []]));\n const note = (name: string, line: string): void => void notes.get(name)?.push(line);\n const falls: PlannedFall[] = [];\n const results: Score[] = names.map((name) => {\n const s = select(lane, name);\n const file = o.report === undefined ? resolve(laneDir, s.dir, REPORT_DIR, \"mutation.json\") : resolve(io.cwd, o.report);\n if (!existsSync(file)) {\n const reason = `the report ${relative(io.cwd, file)} does not exist`;\n return { name, gate: s.gate, detected: 0, hitLimit: 0, clockTimeouts: 0, valid: 0, survived: [], percent: 0, percentWithClock: 0, tests: undefined, pass: false, reason, outcome: \"no read\" };\n }\n const report = parseReport(readJson(file));\n let score = scoreReport(report, s);\n const before = last[name];\n if (lastFile !== undefined && before !== undefined) {\n if (score.tests === undefined) score = failScore(score, `the report has no \"testFiles\", so the count of the tests is not known`);\n else {\n const fall = testFall(score.tests, before, lane.maxTestFall ?? MAX_TEST_FALL);\n const planned = lane.plannedFalls?.[name];\n if (fall !== undefined && planned === undefined) score = failScore(score, fall);\n else if (fall !== undefined) {\n const text = `${fall.replace(/, so the score is no read$/, \"\")}. The reason: ${planned ?? \"\"}`;\n note(name, ` a planned fall: ${text}`);\n falls.push({ name, text });\n }\n }\n }\n if (o.testFiles) score = checkTestFiles(lane, laneDir, s, report, score, (line) => note(name, line));\n return score;\n });\n for (const s of results) {\n io.stdout(`${formatScore(s)}\n`);\n for (const line of notes.get(s.name) ?? []) io.stdout(`${line}\n`);\n if (!s.pass) for (const m of s.survived) io.stdout(` survived: ${m}\n`);\n }\n if (o.summary !== undefined) appendFileSync(resolve(io.cwd, o.summary), `### Mutation scores\n\n${summaryMarkdown(results)}\n`);\n if (o.writeLast !== undefined) {\n const out = resolve(io.cwd, o.writeLast);\n const counts = { ...(existsSync(out) ? readCounts(out) : {}) };\n for (const s of results) if (s.pass && s.tests !== undefined) counts[s.name] = s.tests;\n mkdirSync(dirname(out), { recursive: true });\n writeFileSync(out, `${JSON.stringify(Object.fromEntries(Object.entries(counts).toSorted(([a], [b]) => (a < b ? -1 : 1))), null, 2)}\n`);\n }\n if (io.env?.[\"GITHUB_ACTIONS\"] === \"true\") for (const line of annotations(results, falls)) io.stdout(`${line}\n`);\n const failed = results.filter((s) => !s.pass).map((s) => s.name);\n if (failed.length > 0) io.stderr(`The gate failed for ${failed.join(\", \")}.\n`);\n return failed.length > 0 ? 1 : 0;\n}\n\n/** A fall of the test count that the lane plans, with its text. The score passes, and its annotation tells the fall. */\ninterface PlannedFall {\n readonly name: string;\n readonly text: string;\n}\n\n/** This function escapes the text of a workflow command of GitHub Actions. A property escapes also `:` and `,`. */\nconst escapeCommand = (text: string, property = false): string => {\n const data = text.replaceAll(\"%\", \"%25\").replaceAll(\"\\r\", \"%0D\").replaceAll(\"\\n\", \"%0A\");\n return property ? data.replaceAll(\":\", \"%3A\").replaceAll(\",\", \"%2C\") : data;\n};\n\n/**\n * This function gives a warning annotation for each score that does not pass and each planned fall. The annotation is on\n * the check line, so a no read is not a green check with the reason only in the log. This is true also for a run that\n * only reports. The title of a no read gives the count of the no reads and of the selections.\n */\nfunction annotations(results: readonly Score[], falls: readonly PlannedFall[]): string[] {\n const noReads = results.filter((s) => !s.pass && s.outcome !== \"block\");\n const line = (title: string, message: string): string => `::warning title=${escapeCommand(title, true)}::${escapeCommand(message)}`;\n return [\n ...noReads.map((s) => line(`Mutation gate: no read, ${String(noReads.length)} of ${String(results.length)} selections`, `${s.name}: ${s.reason ?? \"\"}`)),\n ...results.filter((s) => !s.pass && s.outcome === \"block\").map((s) => line(\"Mutation gate: under the gate\", `${s.name}: ${s.reason ?? \"\"}`)),\n ...falls.map((f) => line(\"Mutation gate: a planned fall of the tests\", `${f.name}: ${f.text}`)),\n ];\n}\n\n/** This function reads a file of test counts: an object from each selection to its count. */\nfunction readCounts(file: string): Record<string, number> {\n const json = readJson(file);\n const ok = typeof json === \"object\" && json !== null && !Array.isArray(json) && Object.values(json).every((n) => Number.isInteger(n) && (n as number) >= 0);\n if (!ok) throw new Error(`the file ${file} is not an object of test counts`);\n return json as Record<string, number>;\n}\n\n/** This function tells if the Vitest runner of a selection starts all the tests: the lane sets `vitest.related` to false. */\nfunction runsAllTests(s: Selection): boolean {\n const vitest = s.stryker?.[\"vitest\"];\n return typeof vitest === \"object\" && vitest !== null && (vitest as Record<string, unknown>)[\"related\"] === false;\n}\n\n/**\n * This function fails a score when the report does not read a test file that the run starts. The related mode of the\n * Vitest runner starts each test file that loads a file of the selection (LANE.FILES). So a part does not start the\n * test files of the other parts. With `vitest.related` false, the run starts each test file on the disk.\n */\nfunction checkTestFiles(lane: Lane, laneDir: string, s: Selection, report: MutationReport, score: Score, note: (line: string) => void): Score {\n const p = lane.packages[s.pkg];\n if (p === undefined) return score;\n const dir = resolve(laneDir, p.dir);\n if (report.testFiles === undefined) return failScore(score, `the report has no \"testFiles\", so the test files that it read are not known`);\n const files = sourcesOf(dir, dir, true).filter((f) => !f.endsWith(\".d.ts\"));\n const onDisk = files.filter((f) => TEST.test(f));\n const started = runsAllTests(s)\n ? onDisk\n : relatedTestFiles(\n files.map((file) => ({ file, text: readFileSync(resolve(dir, file), \"utf8\") })),\n (file) => globsSelect(s.mutate, file),\n );\n const unread = unreadTestFiles(report, started, p.notRead, dir);\n for (const f of unread) note(` not read: ${p.dir}/${f}`);\n if (unread.length === 0) return score;\n return failScore(score, `the report does not read ${String(unread.length)} test files that the run starts. Each one is no read, unless \"notRead\" of the package gives its reason`);\n}\n\n/** This function starts the CLI with its arguments and gives the exit code. */\nexport function runCli(argv: readonly string[], io: CliIo): number {\n const { values, positionals } = parseArgs({\n args: [...argv],\n allowPositionals: true,\n options: {\n lane: { type: \"string\", default: \"mutation.json\" },\n out: { type: \"string\" },\n concurrency: { type: \"string\" },\n report: { type: \"string\" },\n summary: { type: \"string\" },\n write: { type: \"boolean\", default: false },\n runs: { type: \"boolean\", default: false },\n \"dry-run\": { type: \"boolean\", default: false },\n changed: { type: \"string\" },\n last: { type: \"string\" },\n \"write-last\": { type: \"string\" },\n \"test-files\": { type: \"boolean\", default: false },\n help: { type: \"boolean\", default: false },\n },\n });\n const [command, ...names] = positionals;\n if (values.help || command === undefined) {\n io.stdout(HELP);\n return command === undefined && !values.help ? 1 : 0;\n }\n const laneFile = resolve(io.cwd, values.lane);\n const laneDir = dirname(laneFile);\n const lane = parseLane(readJson(laneFile));\n const changed =\n values.changed === undefined\n ? undefined\n : readFileSync(resolve(io.cwd, values.changed), \"utf8\")\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line !== \"\");\n const one = (): string => {\n if (names.length !== 1 || names[0] === undefined) throw new Error(`\"${command}\" takes one selection`);\n return names[0];\n };\n switch (command) {\n case \"list\": {\n if (values.runs) checkParts(lane, laneDir, Object.keys(lane.packages));\n if (changed !== undefined && !values.runs) throw new Error(`--changed of \"list\" takes --runs`);\n const runs = values.runs ? runSelections(lane) : selectionNames(lane);\n const shown = changed === undefined ? runs : runs.filter((n) => changedFiles(select(lane, n), changed).length > 0);\n io.stdout(shown.length === 0 ? \"\" : `${shown.join(\"\\n\")}\\n`);\n return 0;\n }\n case \"dir\":\n io.stdout(`${relative(io.cwd, resolve(laneDir, select(lane, one()).dir)).replaceAll(\"\\\\\", \"/\") || \".\"}\\n`);\n return 0;\n case \"config\": {\n const concurrency = values.concurrency === undefined ? undefined : Number(values.concurrency);\n if (concurrency !== undefined && !(Number.isInteger(concurrency) && concurrency > 0)) throw new Error(`--concurrency is not a positive integer`);\n checkPartsOf(lane, laneDir, [one()]);\n const all = select(lane, one());\n const files = changed === undefined ? undefined : changedFiles(all, changed);\n if (files?.length === 0) throw new Error(`the selection ${all.name} has no changed file`);\n const selection = files === undefined ? all : { ...all, mutate: files };\n const tsconfigRewrite = rewritesTsconfig(typescriptMajor(resolve(laneDir, all.dir)));\n const options = { ...(concurrency === undefined ? {} : { concurrency }), dryRun: values[\"dry-run\"], tsconfigRewrite };\n const text = `${JSON.stringify(strykerConfig(selection, options), null, 2)}\\n`;\n if (values.out === undefined) io.stdout(text);\n else {\n mkdirSync(dirname(resolve(io.cwd, values.out)), { recursive: true });\n writeFileSync(resolve(io.cwd, values.out), text);\n }\n return 0;\n }\n case \"scores\":\n return scores(lane, laneDir, names, { report: values.report, summary: values.summary, last: values.last, writeLast: values[\"write-last\"], testFiles: values[\"test-files\"] }, io);\n case \"disables\":\n return disables(lane, laneDir, values.write, io);\n case \"load-check\":\n return loadCheck(lane, laneDir, names, io);\n default:\n io.stderr(`unknown command \"${command}\"\\n\\n${HELP}`);\n return 1;\n }\n}\n"],"mappings":";;;;;;AA0CA,MAAa,gBAAmC;CAAC;CAAU;CAAc;CAAgB;CAAgB;CAAa;AAAsB;AAgC5I,MAAM,OAAO;AAEb,MAAM,YAAY,MAA6C,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;;AAGtH,MAAM,aAAa,MAA4C,SAAS,CAAC,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,MAAM,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,EAAE;AAEpJ,MAAM,WAAW,MAA8B,MAAM,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,OAAO,MAAM,OAAO,MAAM,YAAY,MAAM,EAAE;;AAGnI,SAAS,cAAc,MAAc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M;IAAE,GAAG;IAAK,QAAQ;GAAM;GACtE,MAAM,kBAAkB,iBAAiB,gBAAgB,QAAQ,SAAS,IAAI,GAAG,CAAC,CAAC;GACnF,MAAM,UAAU;IAAE,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;IAAI,QAAQ,OAAO;IAAY;GAAgB;GACpH,MAAM,OAAO,GAAG,KAAK,UAAU,cAAc,WAAW,OAAO,GAAG,MAAM,CAAC,EAAE;GAC3E,IAAI,OAAO,QAAQ,KAAA,GAAW,GAAG,OAAO,IAAI;QACvC;IACH,UAAU,QAAQ,QAAQ,GAAG,KAAK,OAAO,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,CAAC;IACnE,cAAc,QAAQ,GAAG,KAAK,OAAO,GAAG,GAAG,IAAI;GACjD;GACA,OAAO;EACT;EACA,KAAK,UACH,OAAO,OAAO,MAAM,SAAS,OAAO;GAAE,QAAQ,OAAO;GAAQ,SAAS,OAAO;GAAS,MAAM,OAAO;GAAM,WAAW,OAAO;GAAe,WAAW,OAAO;EAAc,GAAG,EAAE;EACjL,KAAK,YACH,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO,EAAE;EACjD,KAAK,cACH,OAAO,UAAU,MAAM,SAAS,OAAO,EAAE;EAC3C;GACE,GAAG,OAAO,oBAAoB,QAAQ,OAAO,MAAM;GACnD,OAAO;CACX;AACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/rigor-mutation",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"description": "Mutation tests with Stryker and Vitest for each package of a repository: the Stryker config of each package or part, a score with a gate for each package, and a check of the disabled mutants.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mutation",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-C2STezvC.js","names":["TEST"],"sources":["../src/lane.ts","../src/config.ts","../src/score.ts","../src/disables.ts","../src/load.ts","../src/run.ts"],"sourcesContent":["import { matchesGlob, posix } from \"node:path\";\n\n/**\n * The lane file of a repository (`mutation.json`) names the packages that the mutation tests mutate. A package has\n * its folder, its globs and an optional gate. A big package has parts, so that each part has its own runner.\n */\n\n/** The mutation tests of one package. */\nexport interface PackageLane {\n /** This field gives the folder of the package, from the folder of the lane file. Stryker starts in this folder. */\n readonly dir: string;\n /** These globs give the files to mutate, from `dir`. A glob with `!` removes the files of the globs before it. */\n readonly mutate: readonly string[];\n /**\n * Each part has its own globs. The `!` globs of `mutate` also apply to each part. Each file of `mutate` must be in\n * exactly one part, so that a full run mutates each file one time. `partErrors` examines this.\n */\n readonly parts?: Readonly<Record<string, readonly string[]>>;\n /** This field gives the lowest mutation score in percent that passes. Without a gate, the lane only reports the score. */\n readonly gate?: number;\n /** This field gives the Vitest config file, from `dir`. Without it, Vitest finds its config in `dir`. */\n readonly vitestConfig?: string;\n /**\n * This field gives the time in milliseconds that the clock adds to the time of the tests for each mutant. The\n * default is 120000. A short time on a loaded runner stops mutants that the tests detect later.\n */\n readonly timeoutMS?: number;\n /** This field gives the time in minutes for the run of the tests without mutants. The default is 15. */\n readonly dryRunTimeoutMinutes?: number;\n /**\n * These options go into the Stryker config of each selection of the package, for example `ignoreStatic`. The lane\n * owns the keys of `STRYKER_OWNED`, so the field cannot have them.\n */\n readonly stryker?: Readonly<Record<string, unknown>>;\n /**\n * Each test file of this field is on the disk, and no report reads it. The value gives the reason. `scores\n * --test-files` fails for each other test file on the disk that the report does not read. The file is from `dir`.\n */\n readonly notRead?: Readonly<Record<string, string>>;\n}\n\n/** The keys of the Stryker config that the lane owns. The field `stryker` of a package cannot have them. */\nexport const STRYKER_OWNED: readonly string[] = [\"mutate\", \"thresholds\", \"jsonReporter\", \"htmlReporter\", \"timeoutMS\", \"dryRunTimeoutMinutes\"];\n\n/** The lane file: the packages of the mutation tests, and the list of the disabled mutants. */\nexport interface Lane {\n readonly packages: Readonly<Record<string, PackageLane>>;\n /** This field gives the list of the disabled mutants, from the folder of the lane file. The default is `mutation-disables.json`. */\n readonly disables?: string;\n /**\n * This field gives the highest fall of the test count in percent against the last good count. The default is 20.\n * `scores --last` fails a selection with a higher fall: the report did not read all the tests.\n */\n readonly maxTestFall?: number;\n /** Each selection of this field can have a higher fall of its test count. The value gives the reason. */\n readonly plannedFalls?: Readonly<Record<string, string>>;\n}\n\n/** The default of `maxTestFall` of the lane, in percent. */\nexport const MAX_TEST_FALL = 20;\n\n/** A selection is one Stryker run: a package (`collections`) or a part of a package (`collections.impl`). */\nexport interface Selection {\n readonly name: string;\n readonly pkg: string;\n readonly dir: string;\n readonly mutate: readonly string[];\n readonly gate: number | undefined;\n readonly vitestConfig: string | undefined;\n readonly timeoutMS: number | undefined;\n readonly dryRunTimeoutMinutes: number | undefined;\n readonly stryker: Readonly<Record<string, unknown>> | undefined;\n}\n\nconst NAME = /^[\\w-]+$/;\n\nconst isRecord = (x: unknown): x is Record<string, unknown> => typeof x === \"object\" && x !== null && !Array.isArray(x);\n\n/** This function tells if a value is an object of names, each with a reason that is not empty. */\nconst isReasons = (x: unknown): x is Record<string, string> => isRecord(x) && Object.values(x).every((r) => typeof r === \"string\" && r.trim() !== \"\");\n\nconst isGlobs = (x: unknown): x is string[] => Array.isArray(x) && x.length > 0 && x.every((g) => typeof g === \"string\" && g !== \"\");\n\n/** This function examines a package of the lane file. It gives the errors, with the name of the package. */\nfunction packageErrors(name: string, p: unknown): string[] {\n if (!NAME.test(name)) return [`the package name \"${name}\" has a character that is not a letter, a digit, \"_\" or \"-\"`];\n if (!isRecord(p)) return [`${name}: the package is not an object`];\n const errors: string[] = [];\n if (typeof p[\"dir\"] !== \"string\" || p[\"dir\"] === \"\") errors.push(`${name}: \"dir\" is not a folder name`);\n if (!isGlobs(p[\"mutate\"])) errors.push(`${name}: \"mutate\" is not a list of globs`);\n else if (p[\"mutate\"].every((g) => g.startsWith(\"!\"))) errors.push(`${name}: \"mutate\" has only \"!\" globs`);\n const gate = p[\"gate\"];\n if (gate !== undefined && (typeof gate !== \"number\" || !(gate >= 0 && gate <= 100))) errors.push(`${name}: \"gate\" is not a percent from 0 to 100`);\n if (p[\"vitestConfig\"] !== undefined && typeof p[\"vitestConfig\"] !== \"string\") errors.push(`${name}: \"vitestConfig\" is not a file name`);\n for (const field of [\"timeoutMS\", \"dryRunTimeoutMinutes\"]) {\n const v = p[field];\n if (v !== undefined && !(typeof v === \"number\" && Number.isInteger(v) && v > 0)) errors.push(`${name}: \"${field}\" is not a positive integer`);\n }\n const stryker = p[\"stryker\"];\n if (stryker !== undefined) {\n if (!isRecord(stryker)) errors.push(`${name}: \"stryker\" is not an object`);\n else {\n const owned = Object.keys(stryker).filter((k) => STRYKER_OWNED.includes(k));\n if (owned.length > 0) errors.push(`${name}: \"stryker\" has ${owned.map((k) => `\"${k}\"`).join(\", \")}, but the lane owns these keys`);\n }\n }\n if (p[\"notRead\"] !== undefined && !isReasons(p[\"notRead\"])) errors.push(`${name}: \"notRead\" is not an object of files, each with a reason`);\n const parts = p[\"parts\"];\n if (parts !== undefined) {\n if (!isRecord(parts) || Object.keys(parts).length === 0) errors.push(`${name}: \"parts\" is not an object with parts`);\n else {\n for (const [part, globs] of Object.entries(parts)) {\n if (!NAME.test(part)) errors.push(`${name}: the part name \"${part}\" has a character that is not a letter, a digit, \"_\" or \"-\"`);\n if (!isGlobs(globs) || globs.some((g) => g.startsWith(\"!\"))) errors.push(`${name}.${part}: the part is not a list of globs without \"!\"`);\n }\n }\n }\n return errors;\n}\n\n/**\n * This function examines the JSON of a lane file and gives the lane.\n *\n * @throws Error with each problem of the file\n */\nexport function parseLane(json: unknown): Lane {\n if (!isRecord(json) || !isRecord(json[\"packages\"])) throw new Error(`the lane has no object \"packages\"`);\n const errors = Object.entries(json[\"packages\"]).flatMap(([name, p]) => packageErrors(name, p));\n if (Object.keys(json[\"packages\"]).length === 0) errors.push(`the lane has no packages`);\n if (json[\"disables\"] !== undefined && typeof json[\"disables\"] !== \"string\") errors.push(`\"disables\" is not a file name`);\n const fall = json[\"maxTestFall\"];\n if (fall !== undefined && (typeof fall !== \"number\" || !(fall >= 0 && fall <= 100))) errors.push(`\"maxTestFall\" is not a percent from 0 to 100`);\n const planned = json[\"plannedFalls\"];\n if (planned !== undefined && !isReasons(planned)) errors.push(`\"plannedFalls\" is not an object of selections, each with a reason`);\n if (errors.length > 0) throw new Error(`the lane is not valid:\\n ${errors.join(\"\\n \")}`);\n const lane = json as unknown as Lane;\n const names = new Set(selectionNames(lane));\n const unknown = Object.keys(lane.plannedFalls ?? {}).filter((n) => !names.has(n));\n if (unknown.length > 0) throw new Error(`the lane is not valid:\\n \"plannedFalls\" names no selection of the lane: ${unknown.join(\", \")}`);\n return lane;\n}\n\n/** This function gives the names of all the selections of a lane: each package, then each part of the package. */\nexport function selectionNames(lane: Lane): string[] {\n return Object.entries(lane.packages).flatMap(([name, p]) => [name, ...Object.keys(p.parts ?? {}).map((part) => `${name}.${part}`)]);\n}\n\n/** This function gives the selections of a full run: the parts of each package with parts, else the package. Each file is in one run. */\nexport function runSelections(lane: Lane): string[] {\n return Object.entries(lane.packages).flatMap(([name, p]) => (p.parts === undefined ? [name] : Object.keys(p.parts).map((part) => `${name}.${part}`)));\n}\n\n/**\n * This function gives the selection of a name: a package, or a part of a package.\n *\n * @throws Error when the lane has no package or part of that name\n */\nexport function select(lane: Lane, name: string): Selection {\n const [pkg = \"\", part, ...rest] = name.split(\".\");\n const p = lane.packages[pkg];\n const globs = part === undefined ? undefined : p?.parts?.[part];\n if (p === undefined || rest.length > 0 || (part !== undefined && globs === undefined)) {\n throw new Error(`the lane has no package or part \"${name}\". It has: ${selectionNames(lane).join(\", \")}`);\n }\n // Stryker applies a \"!\" glob to the globs before it, so the \"!\" globs of the package go after the globs of the part.\n const mutate = globs === undefined ? p.mutate : [...globs, ...p.mutate.filter((g) => g.startsWith(\"!\"))];\n return { name, pkg, dir: p.dir, mutate, gate: p.gate, vitestConfig: p.vitestConfig, timeoutMS: p.timeoutMS, dryRunTimeoutMinutes: p.dryRunTimeoutMinutes, stryker: p.stryker };\n}\n\n/**\n * This function tells if globs select a file. It reads the globs as Stryker does. A glob adds its files. A glob with\n * `!` removes its files from the files of the globs before it.\n */\nexport function globsSelect(globs: readonly string[], file: string): boolean {\n let selected = false;\n for (const g of globs) {\n if (g.startsWith(\"!\")) {\n if (selected && matchesGlob(file, g.slice(1))) selected = false;\n } else if (!selected && matchesGlob(file, g)) selected = true;\n }\n return selected;\n}\n\n/**\n * This function gives the changed files of a selection, from the folder of its package. The globs of the selection\n * select the files.\n *\n * @param changed - the changed paths, from the folder of the lane file, with `/`\n */\nexport function changedFiles(selection: Selection, changed: readonly string[]): string[] {\n const dir = posix.normalize(selection.dir.replaceAll(\"\\\\\", \"/\"));\n return changed\n .map((f) => posix.relative(dir, posix.normalize(f.replaceAll(\"\\\\\", \"/\"))))\n .filter((f) => f !== \"\" && !f.startsWith(\"../\") && !posix.isAbsolute(f) && globsSelect(selection.mutate, f));\n}\n\n/**\n * This function examines the parts of a package against its files. It gives an error for each file of `mutate` in no\n * part. It also gives an error for each file in two parts, and for each file of a part that is not in `mutate`. A\n * package with no parts has no errors.\n *\n * @param files - the source files of the package, from its folder, with `/`\n */\nexport function partErrors(lane: Lane, pkg: string, files: readonly string[]): string[] {\n const p = lane.packages[pkg];\n if (p?.parts === undefined) return [];\n const parts = Object.keys(p.parts).map((part) => ({ part, mutate: select(lane, `${pkg}.${part}`).mutate }));\n const errors: string[] = [];\n for (const file of files) {\n const inMutate = globsSelect(p.mutate, file);\n const inParts = parts.filter((x) => globsSelect(x.mutate, file)).map((x) => x.part);\n if (inMutate && inParts.length === 0) errors.push(`${pkg}: the file ${file} is in no part, so a full run does not mutate it`);\n else if (inParts.length > 1) errors.push(`${pkg}: the file ${file} is in more than one part: ${inParts.join(\", \")}`);\n else if (!inMutate && inParts.length === 1) errors.push(`${pkg}: the file ${file} is in the part ${inParts.join(\"\")}, but not in \"mutate\"`);\n }\n return errors;\n}\n","import type { Selection } from \"./lane.ts\";\n\n/** The options of `strykerConfig`. */\nexport interface ConfigOptions {\n /** This option gives the number of test processes. The default is 2. */\n readonly concurrency?: number;\n /** This option gives the folder of the reports, from the folder of the package. The default is `reports/mutation`. */\n readonly reportDir?: string;\n /**\n * When this option is true, Stryker starts only the tests without mutants, and it does not stop at the first failed\n * test. Use it to see if the tests pass under Stryker before a long run.\n */\n readonly dryRun?: boolean;\n /**\n * When this option is false, Stryker does not rewrite the tsconfig of the package in its sandbox. The default is true.\n * The rewrite uses `parseConfigFileTextToJson`, and TypeScript 7 does not have it. Refer to `rewritesTsconfig`.\n */\n readonly tsconfigRewrite?: boolean;\n}\n\n/** The Stryker config of one selection, as JSON. Stryker starts in the folder of the package. The field `stryker` of the lane adds keys. */\nexport interface StrykerConfig {\n readonly [key: string]: unknown;\n readonly testRunner: \"vitest\";\n readonly plugins: readonly string[];\n readonly vitest?: { readonly configFile: string };\n readonly mutate: readonly string[];\n readonly coverageAnalysis: \"perTest\";\n readonly reporters: readonly string[];\n readonly htmlReporter: { readonly fileName: string };\n readonly jsonReporter: { readonly fileName: string };\n readonly thresholds: { readonly high: number; readonly low: number; readonly break: null };\n readonly concurrency: number;\n readonly timeoutMS: number;\n readonly dryRunTimeoutMinutes: number;\n readonly tsconfigFile?: string;\n readonly dryRunOnly?: true;\n readonly disableBail?: true;\n}\n\n/** The default folder of the reports, from the folder of the package. */\nexport const REPORT_DIR = \"reports/mutation\";\n\n/**\n * The default time in milliseconds that the clock adds to the time of the tests for each mutant. The default of\n * Stryker is 5000. On a loaded CI runner that time stopped mutants that the tests detected later.\n */\nexport const TIMEOUT_MS = 120_000;\n\n/**\n * The value of `tsconfigFile` when the rewrite of the tsconfig is off. No project has this file, so Stryker finds no\n * tsconfig to rewrite.\n */\nexport const NO_TSCONFIG = \"tsconfig.no-stryker-rewrite.json\";\n\n/**\n * This function tells if Stryker can rewrite a tsconfig with a TypeScript of the major version `major`. Stryker 10.1\n * parses the tsconfig with `parseConfigFileTextToJson`, and TypeScript 7 removed it. When no TypeScript is found, the\n * answer is true, and the config keeps the default of Stryker.\n */\nexport function rewritesTsconfig(major: number | undefined): boolean {\n return major === undefined || major < 7;\n}\n\n/** The default time in minutes for the run of the tests without mutants. The default of Stryker is 5. */\nexport const DRY_RUN_TIMEOUT_MINUTES = 15;\n\n/**\n * This function gives the Stryker config of a selection. The break of Stryker is off, because the gate of each\n * package is in `scoreReport`. Stryker 10.1.0 or later is necessary with Vitest 5: version 10.0 started no test on each\n * mutant (stryker-js issue 6210).\n */\nexport function strykerConfig(selection: Selection, options: ConfigOptions = {}): StrykerConfig {\n const reportDir = options.reportDir ?? REPORT_DIR;\n const low = selection.gate ?? 60;\n return {\n testRunner: \"vitest\",\n plugins: [\"@stryker-mutator/vitest-runner\"],\n ...(selection.vitestConfig === undefined ? {} : { vitest: { configFile: selection.vitestConfig } }),\n mutate: selection.mutate,\n coverageAnalysis: \"perTest\",\n reporters: [\"clear-text\", \"progress\", \"html\", \"json\"],\n htmlReporter: { fileName: `${reportDir}/index.html` },\n jsonReporter: { fileName: `${reportDir}/mutation.json` },\n thresholds: { high: Math.max(low, 90), low, break: null },\n concurrency: options.concurrency ?? 2,\n timeoutMS: selection.timeoutMS ?? TIMEOUT_MS,\n dryRunTimeoutMinutes: selection.dryRunTimeoutMinutes ?? DRY_RUN_TIMEOUT_MINUTES,\n ...(options.tsconfigRewrite === false ? { tsconfigFile: NO_TSCONFIG } : {}),\n // The keys of the lane field \"stryker\" replace the keys above, but \"--concurrency\" replaces its \"concurrency\".\n ...selection.stryker,\n ...(options.concurrency === undefined ? {} : { concurrency: options.concurrency }),\n ...(options.dryRun === true ? { dryRunOnly: true, disableBail: true } : {}),\n };\n}\n","/**\n * The score of a Stryker report, with the gate of the package. The score counts the detected mutants, out of the\n * mutants that a test covers or that survive. Compile errors, runtime errors and ignored mutants do not count.\n *\n * Stryker gives the status `Timeout` for two events. The hit limit stops a mutant with an endless loop: its\n * `statusReason` starts with `Hit limit`, and the mutant is detected. The clock stops a mutant that took too long. The\n * load of the runner can cause this. Thus the mutant is not detected for certain, and it counts as not detected.\n */\n\n/** A mutant of the JSON report of Stryker (the schema of mutation-testing-elements). */\nexport interface Mutant {\n readonly status: string;\n readonly mutatorName: string;\n /** Stryker gives the reason of some statuses here. A `Timeout` of the hit limit has a reason that starts with `Hit limit`. */\n readonly statusReason?: string | undefined;\n readonly location: { readonly start: { readonly line: number } };\n}\n\n/** The JSON report of Stryker: the mutants of each mutated file, and the tests of each test file that the run read. */\nexport interface MutationReport {\n readonly files: Readonly<Record<string, { readonly mutants: readonly Mutant[] }>>;\n /** Stryker gives this field when the test runner tells the tests, as the Vitest runner does. */\n readonly testFiles?: Readonly<Record<string, { readonly tests: readonly { readonly name: string }[] }>> | undefined;\n}\n\n/**\n * The three reads of a score. A `block` is a score under its gate. A `no read` is a score that does not read the tests.\n * Its cause is no report, no mutant that counts, no detected mutant, or a run that did not read all the tests. A no read is not a pass.\n */\nexport type ScoreOutcome = \"pass\" | \"block\" | \"no read\";\n\n/** The score of one selection. */\nexport interface Score {\n readonly name: string;\n readonly gate: number | undefined;\n /** The mutants with the status `Killed`, and the mutants that the hit limit stopped. */\n readonly detected: number;\n /** The mutants that the hit limit stopped. They are in `detected`. */\n readonly hitLimit: number;\n /** The mutants that the clock stopped. They count as not detected, and they are in `survived`. */\n readonly clockTimeouts: number;\n /** The mutants that count: detected, survived or with no coverage. */\n readonly valid: number;\n /** Each mutant that survived, had no coverage or was stopped by the clock, as `file:line Mutator`. */\n readonly survived: readonly string[];\n /** The score in percent. It is 0 when no mutant counts. */\n readonly percent: number;\n /** The score in percent with the clock time-outs counted as detected, as Stryker counts them. The gate does not read it. */\n readonly percentWithClock: number;\n /** The count of the tests that the run read, from `testFiles` of the report. It is undefined when the report has no `testFiles`. */\n readonly tests: number | undefined;\n readonly pass: boolean;\n /** The reason of a failure. */\n readonly reason: string | undefined;\n /** The read of the score. The functions of this package always give it. A score from an older version has no outcome. */\n readonly outcome?: ScoreOutcome;\n}\n\nconst UNDETECTED = new Set([\"Survived\", \"NoCoverage\"]);\n\n/** This function tells if the hit limit of Stryker stopped a mutant. Then the mutant has an endless loop, and it is detected. */\nexport const isHitLimit = (m: Mutant): boolean => m.status === \"Timeout\" && (m.statusReason ?? \"\").startsWith(\"Hit limit\");\n\n/**\n * This function examines the JSON of a Stryker report and gives the report.\n *\n * @throws Error when the JSON has no files with mutants\n */\nexport function parseReport(json: unknown): MutationReport {\n const files = typeof json === \"object\" && json !== null ? (json as { files?: unknown }).files : undefined;\n if (typeof files !== \"object\" || files === null) throw new Error(`the report has no object \"files\"`);\n for (const [file, data] of Object.entries(files)) {\n if (!Array.isArray((data as { mutants?: unknown } | null)?.mutants)) throw new Error(`the report has no list \"mutants\" for ${file}`);\n }\n const testFiles = (json as { testFiles?: unknown }).testFiles;\n if (testFiles !== undefined) {\n if (typeof testFiles !== \"object\" || testFiles === null) throw new Error(`the field \"testFiles\" of the report is not an object`);\n for (const [file, data] of Object.entries(testFiles)) {\n if (!Array.isArray((data as { tests?: unknown } | null)?.tests)) throw new Error(`the report has no list \"tests\" for the test file ${file}`);\n }\n }\n return json as MutationReport;\n}\n\n/** This function gives the count of the tests of a report, or undefined when the report has no `testFiles`. */\nexport function testCount(report: MutationReport): number | undefined {\n if (report.testFiles === undefined) return undefined;\n return Object.values(report.testFiles).reduce((sum, f) => sum + f.tests.length, 0);\n}\n\n/**\n * This function compares a test count with the last good count. It gives the reason of a failure when the count fell\n * by more than `maxFall` percent, else undefined. A report that reads fewer tests is no read of the score.\n *\n * @param maxFall - the highest fall in percent that passes\n */\nexport function testFall(tests: number, last: number, maxFall: number): string | undefined {\n if (last <= 0 || tests >= last) return undefined;\n const fall = (100 * (last - tests)) / last;\n if (fall <= maxFall) return undefined;\n return `the run read ${String(tests)} tests, ${fall.toFixed(1)} % fewer than the last good count ${String(last)} (the limit is ${String(maxFall)} %), so the score is no read`;\n}\n\n/**\n * This function gives each test file on the disk that the report does not read, and that `notRead` does not name.\n * The files of the report and of the disk are from the folder of the package.\n *\n * @param onDisk - the test files of the package, from its folder, with `/`\n * @param dir - the folder of the package, to make a full path of the report relative\n */\nexport function unreadTestFiles(report: MutationReport, onDisk: readonly string[], notRead: Readonly<Record<string, string>> = {}, dir = \"\"): string[] {\n const root = dir.replaceAll(\"\\\\\", \"/\").replace(/\\/?$/, \"/\");\n const read = new Set(\n Object.keys(report.testFiles ?? {}).map((f) => {\n const file = f.replaceAll(\"\\\\\", \"/\");\n return dir !== \"\" && file.startsWith(root) ? file.slice(root.length) : file.replace(/^\\.\\//, \"\");\n }),\n );\n return onDisk.filter((f) => !read.has(f) && notRead[f] === undefined);\n}\n\n/**\n * This function gives a score that fails for a reason, with the outcome `no read`. A score that failed already keeps its\n * first reason, and gets the new one after it. A score under its gate with a second reason is also a no read.\n */\nexport function failScore(score: Score, reason: string): Score {\n return { ...score, pass: false, outcome: \"no read\", reason: score.reason === undefined ? reason : `${score.reason}. Also ${reason}` };\n}\n\n/**\n * This function gives the score of a report and applies the gate. A report with no mutants that count fails, also\n * without a gate: Stryker found no files. A report with mutants that count and none detected also fails: the test\n * runner started no test on the mutants. Stryker 10.0 with Vitest 5 gave this result.\n */\nexport function scoreReport(report: MutationReport, selection: { readonly name: string; readonly gate: number | undefined }): Score {\n let detected = 0;\n let valid = 0;\n let hitLimit = 0;\n let clockTimeouts = 0;\n const survived: string[] = [];\n for (const [file, data] of Object.entries(report.files)) {\n for (const m of data.mutants) {\n const at = `${file}:${String(m.location.start.line)} ${m.mutatorName}`;\n if (m.status === \"Killed\" || isHitLimit(m)) {\n detected++;\n valid++;\n if (m.status === \"Timeout\") hitLimit++;\n } else if (m.status === \"Timeout\") {\n clockTimeouts++;\n valid++;\n survived.push(`${at} (the clock stopped it)`);\n } else if (UNDETECTED.has(m.status)) {\n valid++;\n survived.push(at);\n }\n }\n }\n const percent = valid === 0 ? 0 : (100 * detected) / valid;\n const percentWithClock = valid === 0 ? 0 : (100 * (detected + clockTimeouts)) / valid;\n const { name, gate } = selection;\n const [outcome, reason]: [ScoreOutcome, string | undefined] =\n valid === 0\n ? [\"no read\", \"the report has no mutants that count: Stryker found no files to mutate, or it did not start\"]\n : detected === 0\n ? [\"no read\", `the tests detected none of the ${String(valid)} mutants: the test runner started no test on the mutants`]\n : gate !== undefined && percent < gate\n ? [\"block\", `the score ${percent.toFixed(2)} % is under the gate ${String(gate)} %`]\n : [\"pass\", undefined];\n return { name, gate, detected, hitLimit, clockTimeouts, valid, survived, percent, percentWithClock, tests: testCount(report), pass: reason === undefined, reason, outcome };\n}\n\n/** This function gives the time-outs of a score as text: the count of each kind, and the score that counts the clock time-outs as detected. */\nconst timeouts = (s: Score): string =>\n `time-outs: ${String(s.hitLimit)} hit limit, ${String(s.clockTimeouts)} clock (${s.percentWithClock.toFixed(2)} % with the clock time-outs as detected)`;\n\n/** This function gives one line for a score, with the name of the selection and its result. The time-outs are in it when the report has some. */\nexport function formatScore(s: Score): string {\n const gate = s.gate === undefined ? \"no gate\" : `gate ${String(s.gate)} %`;\n const result = s.pass ? \"pass\" : `FAIL: ${s.reason ?? \"\"}`;\n const time = s.hitLimit + s.clockTimeouts === 0 ? \"\" : `, ${timeouts(s)}`;\n const tests = s.tests === undefined ? \"\" : `, ${String(s.tests)} tests`;\n return `${s.name}: ${s.percent.toFixed(2)} % (${String(s.detected)} of ${String(s.valid)}, ${String(s.survived.length)} survived${time}${tests}), ${gate}: ${result}`;\n}\n\n/** This function gives a Markdown table of scores, for the summary of a CI job. */\nexport function summaryMarkdown(scores: readonly Score[]): string {\n const rows = scores.map(\n (s) =>\n `| ${s.name} | ${s.percent.toFixed(2)} % | ${String(s.detected)} | ${String(s.valid)} | ${String(s.survived.length)} | ${String(s.clockTimeouts)} | ${s.percentWithClock.toFixed(2)} % | ${s.gate === undefined ? \"none\" : `${String(s.gate)} %`} | ${s.pass ? \"pass\" : `fail: ${s.reason ?? \"\"}`} | ${s.tests === undefined ? \"?\" : String(s.tests)} |`,\n );\n return [\n \"| Selection | Score | Detected | Valid | Survived | Clock time-outs | Score with them | Gate | Result | Tests |\",\n \"| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | ---: |\",\n ...rows,\n \"\",\n ].join(\"\\n\");\n}\n","/**\n * A comment `// Stryker disable next-line <Mutator>: <reason>` disables a mutant that is equivalent. The disable\n * raises the score, so each one is also in a list with its reason. These functions find the comments in the\n * sources and compare them with the list.\n */\n\n/** One disable comment of a source file. */\nexport interface Disable {\n readonly file: string;\n readonly comment: string;\n}\n\n/** The result of `compareDisables`. */\nexport interface DisableCheck {\n /** The comments of the sources that are not in the list, as `file: comment`. */\n readonly added: readonly string[];\n /** The comments of the list that are not in the sources, as `file: comment`. */\n readonly removed: readonly string[];\n /** The comments with no reason after a colon. */\n readonly noReason: readonly Disable[];\n readonly ok: boolean;\n}\n\n/** This function finds each `Stryker disable` comment of the files. A file name uses `/`. */\nexport function findDisables(files: readonly { readonly file: string; readonly text: string }[]): Disable[] {\n return files.flatMap(({ file, text }) =>\n text\n .split(\"\\n\")\n .filter((line) => line.includes(\"Stryker disable\"))\n .map((line) => ({ file, comment: line.trim() })),\n );\n}\n\nconst counts = (xs: readonly Disable[]): Map<string, number> => {\n const m = new Map<string, number>();\n for (const x of xs) {\n const k = `${x.file}: ${x.comment}`;\n m.set(k, (m.get(k) ?? 0) + 1);\n }\n return m;\n};\n\n/**\n * This function tells if a comment has a reason: a mutator name, a colon, a space and a text. It reads the text by\n * index, so its time is linear in the length of the comment (a regular expression here was quadratic).\n */\nfunction hasReason(comment: string): boolean {\n const start = comment.indexOf(\"Stryker disable \");\n if (start < 0) return false;\n const rest = comment.slice(start + \"Stryker disable \".length);\n const colon = rest.indexOf(\":\");\n return colon > 0 && rest[colon + 1] === \" \" && /\\S/.test(rest[colon + 2] ?? \"\");\n}\n\n/** This function compares the comments of the sources with the list. A file with the same comment two times needs it two times in the list. */\nexport function compareDisables(found: readonly Disable[], listed: readonly Disable[]): DisableCheck {\n const noReason = found.filter((d) => !hasReason(d.comment));\n const a = counts(found);\n const b = counts(listed);\n const added = [...a].filter(([k, n]) => n > (b.get(k) ?? 0)).map(([k]) => k);\n const removed = [...b].filter(([k, n]) => n > (a.get(k) ?? 0)).map(([k]) => k);\n return { added, removed, noReason, ok: added.length === 0 && removed.length === 0 && noReason.length === 0 };\n}\n","/**\n * The load check. Stryker copies the folder of a package to `<dir>/.stryker-tmp/sandbox-*` and starts the tests there.\n * A relative path that leaves the folder then finds no file. A test file that does not load gives no failed test, so\n * each mutant that it detects survives with no error (V-072 of Vex). This check finds these paths before Stryker. It\n * reads only the files that the run loads, so a script of the folder that no test loads can leave the folder.\n */\nimport { posix } from \"node:path\";\n\n/** A relative path in a file of a package that leaves the folder of the package. */\nexport interface LeavingPath {\n /** The file, from the folder of the package, with `/`. */\n readonly file: string;\n /** The line of the path, from 1. */\n readonly line: number;\n /** The path as the file writes it. */\n readonly path: string;\n}\n\n/** A file of a package and its text. */\nexport interface PackageFile {\n /** The file, from the folder of the package, with `/`. */\n readonly file: string;\n readonly text: string;\n}\n\n// The paths that a module loads: import and export from, import(), require(), vi.mock() and the other vi functions,\n// and new URL(path, import.meta.url).\n// The optional \"(\" and its spaces are one group, so that each space has one match (no slow backtracking).\nconst LOADED = /(?:\\bfrom|\\bimport|\\brequire|\\bvi\\.\\w+|\\bnew\\s+URL)\\s*(?:\\(\\s*)?([\"'`])([^\"'`\\r\\n]*)\\1/g;\n// Each relative path string of a config file, for example setupFiles: [\"../testkit/setup.ts\"].\nconst CONFIG_PATH = /([\"'`])(\\.\\.?\\/[^\"'`\\r\\n]*)\\1/g;\n// A type import or export: the test runner removes it, so it loads no file.\nconst TYPE_ONLY = /^\\s*(?:import|export)\\s+type\\b/;\nconst COMMENT = /^\\s*(?:\\/\\/|\\/\\*|\\*)/;\nconst CONFIG_FILE = /(?:^|\\/)vite(?:st)?\\.(?:config|workspace)\\.[cm]?[jt]s$/;\n\n/**\n * This function tells if a file is a config file of Vitest or Vite. Each relative path string of a config file must\n * stay in the folder.\n *\n * @param vitestConfig - the field `vitestConfig` of the lane, from the folder of the package\n */\nexport function isConfigFile(file: string, vitestConfig?: string): boolean {\n return CONFIG_FILE.test(file) || (vitestConfig !== undefined && posix.normalize(vitestConfig.replaceAll(\"\\\\\", \"/\")) === file);\n}\n\nfunction leaves(file: string, path: string): boolean {\n if (!(path === \".\" || path === \"..\" || path.startsWith(\"./\") || path.startsWith(\"../\")) || path.includes(\"${\")) return false;\n const target = posix.normalize(posix.join(posix.dirname(file), path));\n return target === \"..\" || target.startsWith(\"../\");\n}\n\nconst TEST = /\\.(?:test|spec)\\.[cm]?[jt]sx?$/;\nconst EXTENSIONS = [\"\", \".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".mjs\", \".cjs\", \"/index.ts\", \"/index.js\"];\n\n/** This function gives each relative path of one file, with its line. It does not read comments and type imports. */\nfunction pathsOf(file: string, text: string, vitestConfig: string | undefined): { line: number; path: string }[] {\n const pattern = isConfigFile(file, vitestConfig) ? CONFIG_PATH : LOADED;\n return text.split(\"\\n\").flatMap((lineText, i) => {\n if (COMMENT.test(lineText) || TYPE_ONLY.test(lineText)) return [];\n return [...lineText.matchAll(pattern)].map((m) => ({ line: i + 1, path: m[2] ?? \"\" })).filter((p) => p.path.startsWith(\".\"));\n });\n}\n\n/** This function gives the file of the package that a relative path in the folder loads, or undefined. */\nfunction target(file: string, path: string, known: ReadonlySet<string>): string | undefined {\n const base = posix.normalize(posix.join(posix.dirname(file), path));\n const stem = base.replace(/\\.(?:[cm]?js|jsx)$/, \"\");\n return [...EXTENSIONS.map((e) => base + e), ...EXTENSIONS.slice(1).map((e) => stem + e)].find((f) => known.has(f));\n}\n\n/**\n * This function gives each relative path of the files that leaves the folder of the package. It reads the files that\n * the run loads. These are the test files, the config files, and each file that they load in the folder.\n * In a config file it reads each relative path string, for example a setup file. It does not read comments and type\n * imports.\n *\n * @param files - the files of the package, from its folder\n * @param vitestConfig - the field `vitestConfig` of the lane\n */\nexport function leavingPaths(files: readonly PackageFile[], vitestConfig?: string): LeavingPath[] {\n const texts = new Map(files.map((f) => [f.file, f.text]));\n const known = new Set(texts.keys());\n const queue = files.map((f) => f.file).filter((f) => TEST.test(f) || isConfigFile(f, vitestConfig));\n const loaded = new Set(queue);\n const found: LeavingPath[] = [];\n for (let next = queue.shift(); next !== undefined; next = queue.shift()) {\n for (const { line, path } of pathsOf(next, texts.get(next) ?? \"\", vitestConfig)) {\n if (leaves(next, path)) found.push({ file: next, line, path });\n else {\n const t = target(next, path, known);\n if (t !== undefined && !loaded.has(t)) {\n loaded.add(t);\n queue.push(t);\n }\n }\n }\n }\n return found.toSorted((a, b) => (a.file === b.file ? a.line - b.line : a.file < b.file ? -1 : 1));\n}\n","/**\n * The CLI `rigor-mutation`. The work is in `runCli`, so a test can start the CLI in a fixture folder.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, appendFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { REPORT_DIR, rewritesTsconfig, strykerConfig } from \"./config.ts\";\nimport { compareDisables, findDisables, type Disable } from \"./disables.ts\";\nimport { leavingPaths } from \"./load.ts\";\nimport { changedFiles, MAX_TEST_FALL, parseLane, partErrors, runSelections, select, selectionNames, type Lane } from \"./lane.ts\";\nimport { failScore, formatScore, parseReport, scoreReport, summaryMarkdown, testFall, unreadTestFiles, type MutationReport, type Score } from \"./score.ts\";\n\n/** The input and the output of the CLI. */\nexport interface CliIo {\n readonly cwd: string;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n /** The environment. With `GITHUB_ACTIONS` set to `true`, `scores` writes an annotation for each score that does not pass and each planned fall. */\n readonly env?: Readonly<Record<string, string | undefined>>;\n}\n\n/** The help text of the CLI. */\nexport const HELP: string = `rigor-mutation: the mutation tests of a repository, with Stryker and a gate for each package.\n\n rigor-mutation list [--runs] [--changed <file>]\n the packages and the parts of the lane. With --runs, the\n selections of a full run: the parts of a package with parts.\n With --changed, only the runs with a changed file.\n rigor-mutation dir <selection> the folder of the package of a selection\n rigor-mutation config <selection> [--out <file>] [--concurrency <n>] [--dry-run] [--changed <file>]\n the Stryker config of a selection, as JSON. With --dry-run,\n Stryker starts only the tests. With --changed, it mutates only\n the changed files of the selection.\n rigor-mutation scores <selection>... [--report <file>] [--summary <file>] [--last <file>]\n [--write-last <file>] [--test-files]\n the score of each selection, with its gate and its count\n of tests. With --last, a fall of the count of more than\n maxTestFall % (default 20) against the file fails. With\n --write-last, the counts of the passed selections go in\n the file. With --test-files, a test file on the disk that\n the report does not read fails.\n rigor-mutation disables [--write] compare the disable comments with their list\n rigor-mutation load-check [<selection>...] refuse each relative path of a package that leaves its folder.\n Stryker starts the tests in a copy of the folder, so such a\n path finds no file. No selection checks each package.\n\n --lane <file> the lane file. The default is mutation.json.\n --changed <file> a file with one changed path on each line, from the folder of the lane file,\n for example the output of git diff --name-only.\n\nA selection is a package (\"collections\") or a part of a package (\"collections.impl\").\nEach file of a package with parts must be in exactly one part. list --runs, and config and scores\nof a part, fail when it is not.\nThe score of a selection reads <dir>/${REPORT_DIR}/mutation.json, or the file of --report.\n`;\n\nconst SOURCE = /\\.(?:[cm]?[jt]s|tsx)$/;\nconst TEST = /\\.(?:test|spec)\\.[^.]+$/;\nconst SKIP = new Set([\"node_modules\", \"build\", \"dist\", \"reports\", \"coverage\"]);\n\n/**\n * This function gives each source file of a folder, from `root`, with `/`. It skips the outputs and the dot folders,\n * and the tests when `tests` is false.\n */\nfunction sourcesOf(root: string, dir: string, tests = false): string[] {\n return readdirSync(dir, { withFileTypes: true })\n .toSorted((x, y) => x.name.localeCompare(y.name))\n .flatMap((e) => {\n const path = resolve(dir, e.name);\n if (e.isDirectory()) return e.name.startsWith(\".\") || SKIP.has(e.name) ? [] : sourcesOf(root, path, tests);\n return e.isFile() && SOURCE.test(e.name) && (tests || !TEST.test(e.name)) ? [relative(root, path).replaceAll(\"\\\\\", \"/\")] : [];\n });\n}\n\n/** This function checks the relative paths of the package of each selection (`load-check`). */\nfunction loadCheck(lane: Lane, laneDir: string, names: readonly string[], io: CliIo): number {\n const pkgs = [...new Set((names.length === 0 ? Object.keys(lane.packages) : names.map((n) => select(lane, n).pkg)))];\n let failed = 0;\n for (const pkg of pkgs) {\n const s = select(lane, pkg);\n const dir = resolve(laneDir, s.dir);\n if (!existsSync(dir)) throw new Error(`${pkg}: the folder ${s.dir} does not exist`);\n const files = sourcesOf(dir, dir, true)\n .filter((f) => !f.endsWith(\".d.ts\"))\n .map((file) => ({ file, text: readFileSync(resolve(dir, file), \"utf8\") }));\n const found = leavingPaths(files, s.vitestConfig);\n for (const p of found) {\n io.stderr(`${s.dir}/${p.file}:${String(p.line)}: \"${p.path}\" leaves the folder ${s.dir}. In the copy of Stryker it finds no file.\n`);\n }\n if (found.length === 0) io.stdout(`load-check ${pkg}: ${String(files.length)} files, no relative path leaves ${s.dir}\n`);\n else failed += 1;\n }\n if (failed > 0) io.stderr(`load-check: ${String(failed)} packages have a relative path that leaves their folder. Import the file from its package, or move it into the folder.\n`);\n return failed > 0 ? 1 : 0;\n}\n\nconst readJson = (file: string): unknown => JSON.parse(readFileSync(file, \"utf8\"));\n\n/**\n * This function gives the major version of the `typescript` that the folder `dir` resolves, or undefined when the\n * folder resolves none. In a usual install, Stryker resolves the same version, because it starts in that folder.\n */\nfunction typescriptMajor(dir: string): number | undefined {\n let file: string;\n try {\n file = createRequire(join(dir, \"package.json\")).resolve(\"typescript/package.json\");\n } catch {\n return undefined;\n }\n const version: unknown = (readJson(file) as { version?: unknown }).version;\n const major = typeof version === \"string\" ? Number.parseInt(version, 10) : Number.NaN;\n return Number.isInteger(major) ? major : undefined;\n}\n\n/**\n * This function examines the parts of the packages against their source files.\n *\n * @throws Error with each file that is in no part, in more than one part, or in a part and not in `mutate`\n */\nfunction checkParts(lane: Lane, laneDir: string, pkgs: readonly string[]): void {\n const errors = pkgs.flatMap((pkg) => {\n const p = lane.packages[pkg];\n if (p?.parts === undefined) return [];\n const dir = resolve(laneDir, p.dir);\n if (!existsSync(dir)) return [`${pkg}: the folder ${p.dir} does not exist`];\n return partErrors(lane, pkg, sourcesOf(dir, dir));\n });\n if (errors.length > 0) throw new Error(`the parts do not cover each file exactly one time:\\n ${errors.join(\"\\n \")}`);\n}\n\n/** This function examines the parts of the package of each selection that is a part. */\nconst checkPartsOf = (lane: Lane, laneDir: string, names: readonly string[]): void =>\n checkParts(lane, laneDir, [...new Set(names.map((n) => select(lane, n)).filter((s) => s.name !== s.pkg).map((s) => s.pkg))]);\n\nfunction disables(lane: Lane, laneDir: string, write: boolean, io: CliIo): number {\n const files = new Set<string>();\n for (const [name, p] of Object.entries(lane.packages)) {\n const dir = resolve(laneDir, p.dir);\n if (!existsSync(dir)) throw new Error(`${name}: the folder ${p.dir} does not exist`);\n for (const f of sourcesOf(laneDir, dir)) files.add(f);\n }\n const found = findDisables([...files].map((file) => ({ file, text: readFileSync(resolve(laneDir, file), \"utf8\") })));\n const listFile = resolve(laneDir, lane.disables ?? \"mutation-disables.json\");\n const listed = existsSync(listFile) ? (readJson(listFile) as Disable[]) : [];\n const check = compareDisables(found, listed);\n for (const d of check.noReason) io.stderr(`a disable without a reason after a colon: ${d.file}: ${d.comment}\\n`);\n if (write) {\n if (check.noReason.length > 0) return 1;\n writeFileSync(listFile, `${JSON.stringify(found, null, 2)}\\n`);\n io.stdout(`disables: wrote ${String(found.length)} comments to ${relative(io.cwd, listFile).replaceAll(\"\\\\\", \"/\")}\\n`);\n return 0;\n }\n const perFile = new Map<string, number>();\n for (const d of found) perFile.set(d.file, (perFile.get(d.file) ?? 0) + 1);\n io.stdout(`disables: ${String(found.length)} in ${String(perFile.size)} files\\n`);\n for (const [file, n] of perFile) io.stdout(` ${file}: ${String(n)}\\n`);\n for (const k of check.added) io.stderr(`not in the list: ${k}\\n`);\n for (const k of check.removed) io.stderr(`in the list, not in the sources: ${k}\\n`);\n if (check.added.length > 0 || check.removed.length > 0) {\n io.stderr(\"disables: the sources and the list are not the same. Add each new disable with its reason, or start with --write and examine the diff.\\n\");\n }\n return check.ok ? 0 : 1;\n}\n\n/** The options of `scores`. */\ninterface ScoresOptions {\n readonly report: string | undefined;\n readonly summary: string | undefined;\n readonly last: string | undefined;\n readonly writeLast: string | undefined;\n readonly testFiles: boolean;\n}\n\n/**\n * This function gives the score of each selection (`scores`). With `last`, it compares the test count with the last\n * good count (LANE.TESTS of Vex). With `testFiles`, it compares the test files on the disk with the report (LANE.FILES).\n */\nfunction scores(lane: Lane, laneDir: string, names: readonly string[], o: ScoresOptions, io: CliIo): number {\n if (names.length === 0) throw new Error(`\"scores\" takes one or more selections`);\n if (o.report !== undefined && names.length > 1) throw new Error(`--report takes one selection`);\n checkPartsOf(lane, laneDir, names);\n const lastFile = o.last === undefined ? undefined : resolve(io.cwd, o.last);\n const last = lastFile === undefined || !existsSync(lastFile) ? {} : readCounts(lastFile);\n if (lastFile !== undefined && !existsSync(lastFile)) io.stdout(`scores: the file ${o.last ?? \"\"} does not exist, so no count is compared\n`);\n const notes = new Map<string, string[]>(names.map((n) => [n, []]));\n const note = (name: string, line: string): void => void notes.get(name)?.push(line);\n const falls: PlannedFall[] = [];\n const results: Score[] = names.map((name) => {\n const s = select(lane, name);\n const file = o.report === undefined ? resolve(laneDir, s.dir, REPORT_DIR, \"mutation.json\") : resolve(io.cwd, o.report);\n if (!existsSync(file)) {\n const reason = `the report ${relative(io.cwd, file)} does not exist`;\n return { name, gate: s.gate, detected: 0, hitLimit: 0, clockTimeouts: 0, valid: 0, survived: [], percent: 0, percentWithClock: 0, tests: undefined, pass: false, reason, outcome: \"no read\" };\n }\n const report = parseReport(readJson(file));\n let score = scoreReport(report, s);\n const before = last[name];\n if (lastFile !== undefined && before !== undefined) {\n if (score.tests === undefined) score = failScore(score, `the report has no \"testFiles\", so the count of the tests is not known`);\n else {\n const fall = testFall(score.tests, before, lane.maxTestFall ?? MAX_TEST_FALL);\n const planned = lane.plannedFalls?.[name];\n if (fall !== undefined && planned === undefined) score = failScore(score, fall);\n else if (fall !== undefined) {\n const text = `${fall.replace(/, so the score is no read$/, \"\")}. The reason: ${planned ?? \"\"}`;\n note(name, ` a planned fall: ${text}`);\n falls.push({ name, text });\n }\n }\n }\n if (o.testFiles) score = checkTestFiles(lane, laneDir, s.pkg, report, score, (line) => note(name, line));\n return score;\n });\n for (const s of results) {\n io.stdout(`${formatScore(s)}\n`);\n for (const line of notes.get(s.name) ?? []) io.stdout(`${line}\n`);\n if (!s.pass) for (const m of s.survived) io.stdout(` survived: ${m}\n`);\n }\n if (o.summary !== undefined) appendFileSync(resolve(io.cwd, o.summary), `### Mutation scores\n\n${summaryMarkdown(results)}\n`);\n if (o.writeLast !== undefined) {\n const out = resolve(io.cwd, o.writeLast);\n const counts = { ...(existsSync(out) ? readCounts(out) : {}) };\n for (const s of results) if (s.pass && s.tests !== undefined) counts[s.name] = s.tests;\n mkdirSync(dirname(out), { recursive: true });\n writeFileSync(out, `${JSON.stringify(Object.fromEntries(Object.entries(counts).toSorted(([a], [b]) => (a < b ? -1 : 1))), null, 2)}\n`);\n }\n if (io.env?.[\"GITHUB_ACTIONS\"] === \"true\") for (const line of annotations(results, falls)) io.stdout(`${line}\n`);\n const failed = results.filter((s) => !s.pass).map((s) => s.name);\n if (failed.length > 0) io.stderr(`The gate failed for ${failed.join(\", \")}.\n`);\n return failed.length > 0 ? 1 : 0;\n}\n\n/** A fall of the test count that the lane plans, with its text. The score passes, and its annotation tells the fall. */\ninterface PlannedFall {\n readonly name: string;\n readonly text: string;\n}\n\n/** This function escapes the text of a workflow command of GitHub Actions. A property escapes also `:` and `,`. */\nconst escapeCommand = (text: string, property = false): string => {\n const data = text.replaceAll(\"%\", \"%25\").replaceAll(\"\\r\", \"%0D\").replaceAll(\"\\n\", \"%0A\");\n return property ? data.replaceAll(\":\", \"%3A\").replaceAll(\",\", \"%2C\") : data;\n};\n\n/**\n * This function gives a warning annotation for each score that does not pass and each planned fall. The annotation is on\n * the check line, so a no read is not a green check with the reason only in the log. This is true also for a run that\n * only reports. The title of a no read gives the count of the no reads and of the selections.\n */\nfunction annotations(results: readonly Score[], falls: readonly PlannedFall[]): string[] {\n const noReads = results.filter((s) => !s.pass && s.outcome !== \"block\");\n const line = (title: string, message: string): string => `::warning title=${escapeCommand(title, true)}::${escapeCommand(message)}`;\n return [\n ...noReads.map((s) => line(`Mutation gate: no read, ${String(noReads.length)} of ${String(results.length)} selections`, `${s.name}: ${s.reason ?? \"\"}`)),\n ...results.filter((s) => !s.pass && s.outcome === \"block\").map((s) => line(\"Mutation gate: under the gate\", `${s.name}: ${s.reason ?? \"\"}`)),\n ...falls.map((f) => line(\"Mutation gate: a planned fall of the tests\", `${f.name}: ${f.text}`)),\n ];\n}\n\n/** This function reads a file of test counts: an object from each selection to its count. */\nfunction readCounts(file: string): Record<string, number> {\n const json = readJson(file);\n const ok = typeof json === \"object\" && json !== null && !Array.isArray(json) && Object.values(json).every((n) => Number.isInteger(n) && (n as number) >= 0);\n if (!ok) throw new Error(`the file ${file} is not an object of test counts`);\n return json as Record<string, number>;\n}\n\n/** This function fails a score when a test file of its package is on the disk and the report does not read it. */\nfunction checkTestFiles(lane: Lane, laneDir: string, pkg: string, report: MutationReport, score: Score, note: (line: string) => void): Score {\n const p = lane.packages[pkg];\n if (p === undefined) return score;\n const dir = resolve(laneDir, p.dir);\n if (report.testFiles === undefined) return failScore(score, `the report has no \"testFiles\", so the test files that it read are not known`);\n const onDisk = sourcesOf(dir, dir, true).filter((f) => TEST.test(f) && !f.endsWith(\".d.ts\"));\n const unread = unreadTestFiles(report, onDisk, p.notRead, dir);\n for (const f of unread) note(` not read: ${p.dir}/${f}`);\n if (unread.length === 0) return score;\n return failScore(score, `the report does not read ${String(unread.length)} test files on the disk. Each one is no read, unless \"notRead\" of the package gives its reason`);\n}\n\n/** This function starts the CLI with its arguments and gives the exit code. */\nexport function runCli(argv: readonly string[], io: CliIo): number {\n const { values, positionals } = parseArgs({\n args: [...argv],\n allowPositionals: true,\n options: {\n lane: { type: \"string\", default: \"mutation.json\" },\n out: { type: \"string\" },\n concurrency: { type: \"string\" },\n report: { type: \"string\" },\n summary: { type: \"string\" },\n write: { type: \"boolean\", default: false },\n runs: { type: \"boolean\", default: false },\n \"dry-run\": { type: \"boolean\", default: false },\n changed: { type: \"string\" },\n last: { type: \"string\" },\n \"write-last\": { type: \"string\" },\n \"test-files\": { type: \"boolean\", default: false },\n help: { type: \"boolean\", default: false },\n },\n });\n const [command, ...names] = positionals;\n if (values.help || command === undefined) {\n io.stdout(HELP);\n return command === undefined && !values.help ? 1 : 0;\n }\n const laneFile = resolve(io.cwd, values.lane);\n const laneDir = dirname(laneFile);\n const lane = parseLane(readJson(laneFile));\n const changed =\n values.changed === undefined\n ? undefined\n : readFileSync(resolve(io.cwd, values.changed), \"utf8\")\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line !== \"\");\n const one = (): string => {\n if (names.length !== 1 || names[0] === undefined) throw new Error(`\"${command}\" takes one selection`);\n return names[0];\n };\n switch (command) {\n case \"list\": {\n if (values.runs) checkParts(lane, laneDir, Object.keys(lane.packages));\n if (changed !== undefined && !values.runs) throw new Error(`--changed of \"list\" takes --runs`);\n const runs = values.runs ? runSelections(lane) : selectionNames(lane);\n const shown = changed === undefined ? runs : runs.filter((n) => changedFiles(select(lane, n), changed).length > 0);\n io.stdout(shown.length === 0 ? \"\" : `${shown.join(\"\\n\")}\\n`);\n return 0;\n }\n case \"dir\":\n io.stdout(`${relative(io.cwd, resolve(laneDir, select(lane, one()).dir)).replaceAll(\"\\\\\", \"/\") || \".\"}\\n`);\n return 0;\n case \"config\": {\n const concurrency = values.concurrency === undefined ? undefined : Number(values.concurrency);\n if (concurrency !== undefined && !(Number.isInteger(concurrency) && concurrency > 0)) throw new Error(`--concurrency is not a positive integer`);\n checkPartsOf(lane, laneDir, [one()]);\n const all = select(lane, one());\n const files = changed === undefined ? undefined : changedFiles(all, changed);\n if (files?.length === 0) throw new Error(`the selection ${all.name} has no changed file`);\n const selection = files === undefined ? all : { ...all, mutate: files };\n const tsconfigRewrite = rewritesTsconfig(typescriptMajor(resolve(laneDir, all.dir)));\n const options = { ...(concurrency === undefined ? {} : { concurrency }), dryRun: values[\"dry-run\"], tsconfigRewrite };\n const text = `${JSON.stringify(strykerConfig(selection, options), null, 2)}\\n`;\n if (values.out === undefined) io.stdout(text);\n else {\n mkdirSync(dirname(resolve(io.cwd, values.out)), { recursive: true });\n writeFileSync(resolve(io.cwd, values.out), text);\n }\n return 0;\n }\n case \"scores\":\n return scores(lane, laneDir, names, { report: values.report, summary: values.summary, last: values.last, writeLast: values[\"write-last\"], testFiles: values[\"test-files\"] }, io);\n case \"disables\":\n return disables(lane, laneDir, values.write, io);\n case \"load-check\":\n return loadCheck(lane, laneDir, names, io);\n default:\n io.stderr(`unknown command \"${command}\"\\n\\n${HELP}`);\n return 1;\n }\n}\n"],"mappings":";;;;;;AA0CA,MAAa,gBAAmC;CAAC;CAAU;CAAc;CAAgB;CAAgB;CAAa;AAAsB;AAgC5I,MAAM,OAAO;AAEb,MAAM,YAAY,MAA6C,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;;AAGtH,MAAM,aAAa,MAA4C,SAAS,CAAC,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,MAAM,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,EAAE;AAEpJ,MAAM,WAAW,MAA8B,MAAM,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,OAAO,MAAM,OAAO,MAAM,YAAY,MAAM,EAAE;;AAGnI,SAAS,cAAc,MAAc,GAAsB;CACzD,IAAI,CAAC,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,qBAAqB,KAAK,4DAA4D;CACpH,IAAI,CAAC,SAAS,CAAC,GAAG,OAAO,CAA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