@mark1russell7/rigor-mutation 0.2.5 → 0.2.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 +7 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -3
- package/build/{reporter-BYC384h-.js → reporter-D8cUJUhN.js} +53 -4
- package/build/reporter-D8cUJUhN.js.map +1 -0
- package/build/{reporter-BS3LIodv.d.ts → reporter-unJLMWXg.d.ts} +33 -10
- package/build/reporter-unJLMWXg.d.ts.map +1 -0
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +1 -1
- package/build/{run-DYF5roXk.js → run-BEUhSals.js} +27 -7
- package/build/run-BEUhSals.js.map +1 -0
- package/package.json +5 -4
- package/build/reporter-BS3LIodv.d.ts.map +0 -1
- package/build/reporter-BYC384h-.js.map +0 -1
- package/build/run-DYF5roXk.js.map +0 -1
package/README.md
CHANGED
|
@@ -105,6 +105,7 @@ After the run of the tests without mutants, Stryker makes a plan of the mutants.
|
|
|
105
105
|
|
|
106
106
|
- `files` gives the plan of each file: its mutants, the runs, the static runs, the planned net time and the time limits in milliseconds. `lines` gives the runs, the static runs and the net time of each line.
|
|
107
107
|
- `tests` gives the 40 tests of the largest cost. The cost of a test is its time, times the runs that start it.
|
|
108
|
+
- `dryRun` gives the run of the tests without mutants: the count of its tests and the sum of their times. A plan before 0.2.6 has no `dryRun`.
|
|
108
109
|
|
|
109
110
|
Each line of a mutant in `partial.jsonl` also gives its planned net time and its time limit.
|
|
110
111
|
|
|
@@ -148,6 +149,12 @@ The cut reads only the files on the disk and the cost maps. Thus each job of a r
|
|
|
148
149
|
|
|
149
150
|
`rigor-mutation costs <run> --reports <dir>` writes the cost maps from the plans of the run `<run>`. It reads `<dir>/mutation-<selection>/plan.json` of each selection. It adds the plan lines of a file over the parts, and a file with no plan line gets a map of 0. The maps of the other files stay. Write the maps again after a large change of a file or of its tests, and commit them.
|
|
150
151
|
|
|
152
|
+
Each part runs on its own runner, and the speed of the runners differs. In a run of Vex, the same 1191 tests took from 83 s to 149 s. Thus `costs` divides the net time of each part by the speed factor of its runner, and it prints the factors:
|
|
153
|
+
|
|
154
|
+
- When each plan of a group has a `dryRun` with the same count of tests, the factor uses the dry runs. It is the time of the dry run over the median of the group.
|
|
155
|
+
- Otherwise the factor is the median ratio of the time of a shared test to its median time in the group. A shared test takes 200 ms or more (`SPEED_MIN_MS`). At least half of the plans of the group name it, and at least 2 plans.
|
|
156
|
+
- A selection alone in its group, or with no shared test, has the factor 1. A factor over 1 is a slow runner.
|
|
157
|
+
|
|
151
158
|
`rigor-mutation cost-check [<selection>...]` gives the estimate of the clock of each numbered part under the committed maps. A part over `targetMinutes` fails, and so does a group with no map. The check reads no plan, so each commit gives one result. Thus a check of the pull request can hold each part under its target.
|
|
152
159
|
|
|
153
160
|
`rigor-mutation minutes` gives `target=<minutes>` and `stop=<minutes>` for `GITHUB_OUTPUT`. Thus a workflow can stop Stryker at `stopMinutes` of the lane, and the lane is the one source of the stop.
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as staticFaults, S as
|
|
1
|
+
import { C as dryRunOf, D as speedFactors, E as readPlan, O as staticFaults, S as clockMinutes, T as parsePlan, _ as STOP_MINUTES, b as TestOfDryRun, c as FilePlan, d as PLAN_PER_CLOCK, f as PlanLimits, g as SPEED_MIN_MS, h as RunnerPlan, i as ReporterOptions, k as testPlans, l as LinePlan, m as PlanRead, n as PartialLine, p as PlanOfMutant, r as PartialReporter, s as DryRun, t as PARTIAL_FILE, u as PLAN_FILE, v as SelectionPlan, w as filePlans, x as TestPlan, y as TARGET_MINUTES } from "./reporter-unJLMWXg.js";
|
|
2
2
|
/**
|
|
3
3
|
* The lane file of a repository (`mutation.json`) names the packages that the mutation tests mutate. A package has
|
|
4
4
|
* its folder, its globs and an optional gate. A big package has parts, so that each part has its own runner.
|
|
@@ -552,5 +552,5 @@ interface CliIo {
|
|
|
552
552
|
export declare const HELP: string;
|
|
553
553
|
/** This function starts the CLI with its arguments and gives the exit code. */
|
|
554
554
|
export declare function runCli(argv: readonly string[], io: CliIo): number;
|
|
555
|
-
export { type CliIo, type Collected, type CollectedFile, type ComputedImport, type ConfigOptions, type CostMap, type CostMaps, type CutGroup, type CutOf, type CutPart, type Disable, type DisableCheck, type FilePlan, type Lane, type LeavingPath, type LinePlan, type Mutant, type MutationReport, PARTIAL_FILE, PLAN_FILE, PLAN_PER_CLOCK, type PackageFile, type PackageLane, type PartialCosts, type PartialLine, PartialReporter, type PartialRun, type PlanLimits, type PlanOfMutant, type PlanRead, type ReporterOptions, STOP_MINUTES, type Score, type ScoreOutcome, type Segment, type Selection, type SelectionPlan, type StrykerConfig, TARGET_MINUTES, type TestOfDryRun, type TestPlan, type WeightedFile, clockMinutes, filePlans, parsePlan, readPlan, staticFaults, testPlans };
|
|
555
|
+
export { type CliIo, type Collected, type CollectedFile, type ComputedImport, type ConfigOptions, type CostMap, type CostMaps, type CutGroup, type CutOf, type CutPart, type Disable, type DisableCheck, type DryRun, type FilePlan, type Lane, type LeavingPath, type LinePlan, type Mutant, type MutationReport, PARTIAL_FILE, PLAN_FILE, PLAN_PER_CLOCK, type PackageFile, type PackageLane, type PartialCosts, type PartialLine, PartialReporter, type PartialRun, type PlanLimits, type PlanOfMutant, type PlanRead, type ReporterOptions, type RunnerPlan, SPEED_MIN_MS, STOP_MINUTES, type Score, type ScoreOutcome, type Segment, type Selection, type SelectionPlan, type StrykerConfig, TARGET_MINUTES, type TestOfDryRun, type TestPlan, type WeightedFile, clockMinutes, dryRunOf, filePlans, parsePlan, readPlan, speedFactors, staticFaults, testPlans };
|
|
556
556
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/lane.ts","../src/cut.ts","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B;;UAoCnE;;WAEN;;WAEA;;;;;;;;;;wBAWK,gBAAgB,gBAAgB,eAAe,wBAAwB;;;;;;;;;wBAwBvE,iBAAiB,gBAAgB,eAAe,WAAW;;UA0B1D;;WAEN;;WAEA;;WAEA;;;UAIM;;WAEN;;WAEA;WACA,gBAAgB;;WAEhB;;WAEA,YAAY,SAAS;;;;;;;wBAkBhB,cAAc,WAAW;;UCpMxB;WACN;WACA,SAAS;WACT,SAAS;;WAET,MAAM,SAAS;;;qBAIb;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/lane.ts","../src/cut.ts","../src/config.ts","../src/score.ts","../src/disables.ts","../src/load.ts","../src/run.ts"],"mappings":";;;;;;UASiB;;WAEN;;;;;WAKA;;;;;;WAMA,QAAQ,SAAS;;WAEjB;;;;;WAKA;;WAEA;;;;;WAKA;;WAEA;;;;;WAKA,UAAU,SAAS;;;;;WAKnB,UAAU,SAAS;;;;;WAKnB,kBAAkB,SAAS;;;;;WAK3B,eAAe,SAAS;;;;;WAKxB,OAAO,SAAS,eAAe;;;UAIzB;WACN;WACA;;;qBAIE;;UAGI;WACN,UAAU,SAAS,eAAe;;WAElC;;;;;WAKA;;WAEA,eAAe,SAAS;;WAExB;;WAEA;;WAEA;;WAEA;;;UAOM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,SAAS,SAAS;;WAElB,MAAM;;;UAIA;WACN;WACA;WACA;;;;;;KAOC,SAAS,aAAa,KAAK,SAAS;;;;;;wBA8EhC,UAAU,gBAAgB;;;;;wBAmC1B,eAAe,MAAM;;;;;wBAYrB,cAAc,MAAM;;wBASpB,YAAY,MAAM,MAAM;;;;;;;wBAUxB,OAAO,MAAM,MAAM,cAAc,QAAQ,QAAQ;;;;;;;;;wBAuEjD,aAAa,WAAW,WAAW,4BAA4B,UAAS;;;;;;;;;;;;wBAkDxE,WAAW,MAAM,MAAM,aAAa,0BAA0B,SAAS;;UCrXtE;WACN;;WAEA;;WAEA;;;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4C9G,aAAa,cAAc,0BAA0B,gBAAgB,SAAS,8BAAkC;;wBA2BhH,YAAY,GAAG;;wBASf,gBAAgB,iBAAiB;;;;;;;UCpUhC;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;;UAoCnE;;WAEN;;WAEA;;;;;;;;;;wBAWK,gBAAgB,gBAAgB,eAAe,wBAAwB;;;;;;;;;wBAwBvE,iBAAiB,gBAAgB,eAAe,WAAW;;UA0B1D;;WAEN;;WAEA;;WAEA;;;UAIM;;WAEN;;WAEA;WACA,gBAAgB;;WAEhB;;WAEA,YAAY,SAAS;;;;;;;wBAkBhB,cAAc,WAAW;;UCpMxB;WACN;WACA,SAAS;WACT,SAAS;;WAET,MAAM,SAAS;;;qBAIb;;wBAgpBG,OAAO,yBAAyB,IAAI"}
|
package/build/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
export { DRY_RUN_TIMEOUT_MINUTES, HELP, NO_TSCONFIG, PARTIAL_FILE, PARTIAL_PLUGIN, PLAN_FILE, PLAN_PER_CLOCK, PartialReporter, REPORT_DIR, STOP_MINUTES, STRYKER_OWNED, TARGET_MINUTES, TIMEOUT_MS, changedFiles, clockMinutes, collectFaults, compareDisables, computedImports, costMapOf, cutByCost, filePlans, findDisables, formatScore, isConfigFile, isHitLimit, leavingPaths, lineWeights, packageRuns, packageScore, parseCostMaps, parseLane, parsePartial, parsePlan, parseReport, partErrors, partialScore, plannedMs, readPlan, relatedTestFiles, rewritesTsconfig, runCli, runSelections, scoreReport, segmentsOf, select, selectionNames, staticFaults, strykerConfig, summaryMarkdown, testPlans, weightedFiles };
|
|
1
|
+
import { A as segmentsOf, C as rewritesTsconfig, D as lineWeights, E as cutByCost, F as parseLane, I as partErrors, L as runSelections, M as STRYKER_OWNED, N as changedFiles, O as parseCostMaps, P as packageRuns, R as select, S as TIMEOUT_MS, T as costMapOf, _ as summaryMarkdown, a as isConfigFile, b as PARTIAL_PLUGIN, c as compareDisables, d as isHitLimit, f as packageScore, g as scoreReport, h as partialScore, i as computedImports, j as weightedFiles, k as plannedMs, l as findDisables, m as parseReport, n as runCli, o as leavingPaths, p as parsePartial, r as collectFaults, s as relatedTestFiles, t as HELP, u as formatScore, v as DRY_RUN_TIMEOUT_MINUTES, w as strykerConfig, x as REPORT_DIR, y as NO_TSCONFIG, z as selectionNames } from "./run-BEUhSals.js";
|
|
2
|
+
import { _ as testPlans, a as PLAN_FILE, c as STOP_MINUTES, d as dryRunOf, f as filePlans, g as staticFaults, h as speedFactors, l as TARGET_MINUTES, m as readPlan, n as PartialReporter, o as PLAN_PER_CLOCK, p as parsePlan, s as SPEED_MIN_MS, t as PARTIAL_FILE, u as clockMinutes } from "./reporter-D8cUJUhN.js";
|
|
3
|
+
export { DRY_RUN_TIMEOUT_MINUTES, HELP, NO_TSCONFIG, PARTIAL_FILE, PARTIAL_PLUGIN, PLAN_FILE, PLAN_PER_CLOCK, PartialReporter, REPORT_DIR, SPEED_MIN_MS, STOP_MINUTES, STRYKER_OWNED, TARGET_MINUTES, TIMEOUT_MS, changedFiles, clockMinutes, collectFaults, compareDisables, computedImports, costMapOf, cutByCost, dryRunOf, filePlans, findDisables, formatScore, isConfigFile, isHitLimit, leavingPaths, lineWeights, packageRuns, packageScore, parseCostMaps, parseLane, parsePartial, parsePlan, parseReport, partErrors, partialScore, plannedMs, readPlan, relatedTestFiles, rewritesTsconfig, runCli, runSelections, scoreReport, segmentsOf, select, selectionNames, speedFactors, staticFaults, strykerConfig, summaryMarkdown, testPlans, weightedFiles };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { dirname, join, relative, sep } from "node:path";
|
|
2
|
+
import { median } from "@mark1russell7/rigor-statistics";
|
|
2
3
|
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
4
|
// src/plan.ts
|
|
4
5
|
/**
|
|
@@ -22,6 +23,51 @@ const TARGET_MINUTES = 100;
|
|
|
22
23
|
* job, so it cannot give a full score. The estimate has an error of 28 minutes in the mean, so the target only warns.
|
|
23
24
|
*/
|
|
24
25
|
const STOP_MINUTES = 140;
|
|
26
|
+
/** This function gives the run of the tests without mutants: the count of the tests and the sum of their times. */
|
|
27
|
+
function dryRunOf(tests) {
|
|
28
|
+
return {
|
|
29
|
+
tests: tests.length,
|
|
30
|
+
netMs: Math.round(tests.reduce((sum, test) => sum + test.timeSpentMs, 0))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** A test of a plan counts for the speed of a runner only from this time in milliseconds. A short time is mostly noise. */
|
|
34
|
+
const SPEED_MIN_MS = 200;
|
|
35
|
+
/**
|
|
36
|
+
* This function gives the speed of the runner of each selection, relative to the other selections of its group. Each part
|
|
37
|
+
* runs on its own runner, and in Vex the same tests took from 83 s to 149 s on the runners of one group.
|
|
38
|
+
*
|
|
39
|
+
* - When each plan of a group has a `dryRun` with the same count of tests, the factor uses the dry runs. It is the
|
|
40
|
+
* net time of the dry run over the median of the group.
|
|
41
|
+
* - Otherwise the factor is the median of the ratios of the shared tests. The ratio of a test is its time over its
|
|
42
|
+
* median time in the group. A shared test takes `SPEED_MIN_MS` or more. At least half of the plans of the group
|
|
43
|
+
* name it, and at least 2 plans.
|
|
44
|
+
* - A selection with no shared test, or alone in its group, has the factor 1. A factor over 1 is a slow runner.
|
|
45
|
+
*/
|
|
46
|
+
function speedFactors(plans) {
|
|
47
|
+
const out = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const group of new Set(plans.map((p) => p.group))) {
|
|
49
|
+
const members = plans.filter((p) => p.group === group);
|
|
50
|
+
const runs = members.map((p) => p.plan.dryRun);
|
|
51
|
+
const counts = new Set(runs.map((r) => r?.tests));
|
|
52
|
+
if (members.length > 1 && counts.size === 1 && runs.every((r) => r !== void 0 && r.tests > 0 && r.netMs > 0)) {
|
|
53
|
+
const middle = median(runs.map((r) => r?.netMs ?? 0));
|
|
54
|
+
for (const p of members) out.set(p.name, (p.plan.dryRun?.netMs ?? middle) / middle);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const times = members.map((p) => new Map(p.plan.tests.filter((t) => t[2] >= 200).map((t) => [`${t[1]}|${t[0]}`, t[2]])));
|
|
58
|
+
const need = Math.max(2, Math.ceil(members.length / 2));
|
|
59
|
+
const shared = [...new Set(times.flatMap((m) => [...m.keys()]))].filter((key) => times.filter((m) => m.has(key)).length >= need);
|
|
60
|
+
const middles = new Map(shared.map((key) => [key, median(times.flatMap((m) => m.get(key) ?? []))]));
|
|
61
|
+
members.forEach((p, i) => {
|
|
62
|
+
const ratios = shared.flatMap((key) => {
|
|
63
|
+
const ms = times[i]?.get(key);
|
|
64
|
+
return ms === void 0 ? [] : [ms / (middles.get(key) ?? ms)];
|
|
65
|
+
});
|
|
66
|
+
out.set(p.name, ratios.length === 0 ? 1 : median(ratios));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
25
71
|
/** This function gives the planned times of each mutant that Stryker starts, by the id of the mutant. */
|
|
26
72
|
function plannedRuns(plans, path = (f) => f) {
|
|
27
73
|
const runs = /* @__PURE__ */ new Map();
|
|
@@ -139,11 +185,13 @@ function readPlan(name, plan, limits = {}) {
|
|
|
139
185
|
/**
|
|
140
186
|
* This function reads the JSON of `plan.json`.
|
|
141
187
|
*
|
|
142
|
-
* @throws Error when the JSON has no object `files` or no list `tests`
|
|
188
|
+
* @throws Error when the JSON has no object `files` or no list `tests`, or a `dryRun` with no numbers
|
|
143
189
|
*/
|
|
144
190
|
function parsePlan(json) {
|
|
145
191
|
const plan = json;
|
|
146
192
|
if (typeof plan !== "object" || plan === null || typeof plan.files !== "object" || plan.files === null || !Array.isArray(plan.tests)) throw new Error(`the plan has no object "files" or no list "tests"`);
|
|
193
|
+
const run = plan.dryRun;
|
|
194
|
+
if (run !== void 0 && (typeof run !== "object" || run === null || !Number.isFinite(run.tests) || !Number.isFinite(run.netMs))) throw new Error(`the field "dryRun" of the plan has no numbers "tests" and "netMs"`);
|
|
147
195
|
return plan;
|
|
148
196
|
}
|
|
149
197
|
// src/reporter.ts
|
|
@@ -195,7 +243,8 @@ var PartialReporter = class {
|
|
|
195
243
|
this.runs = plannedRuns(plans, this.path);
|
|
196
244
|
writeFileSync(this.planFile, `${JSON.stringify({
|
|
197
245
|
files: filePlans(plans, this.path),
|
|
198
|
-
tests: testPlans(plans, this.tests, this.path)
|
|
246
|
+
tests: testPlans(plans, this.tests, this.path),
|
|
247
|
+
dryRun: dryRunOf(this.tests)
|
|
199
248
|
}, null, 2)}\n`);
|
|
200
249
|
if (this.stopAfterPlan) this.exit(0);
|
|
201
250
|
}
|
|
@@ -252,6 +301,6 @@ const strykerPlugins = [{
|
|
|
252
301
|
name: "rigor-partial",
|
|
253
302
|
injectableClass: PartialReporter
|
|
254
303
|
}];
|
|
255
|
-
export { PLAN_FILE as a,
|
|
304
|
+
export { testPlans as _, PLAN_FILE as a, STOP_MINUTES as c, dryRunOf as d, filePlans as f, staticFaults as g, speedFactors as h, strykerValidationSchema as i, TARGET_MINUTES as l, readPlan as m, PartialReporter as n, PLAN_PER_CLOCK as o, parsePlan as p, strykerPlugins as r, SPEED_MIN_MS as s, PARTIAL_FILE as t, clockMinutes as u };
|
|
256
305
|
|
|
257
|
-
//# sourceMappingURL=reporter-
|
|
306
|
+
//# sourceMappingURL=reporter-D8cUJUhN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter-D8cUJUhN.js","names":[],"sources":["../src/plan.ts","../src/reporter.ts"],"sourcesContent":["/**\n * The cost plan of a selection. Stryker makes a plan of the mutants after the run of the tests without mutants. The\n * reporter `rigor-partial` writes the plan of each file and each line into `plan.json`. `plan-check` reads the file and\n * gives the estimate of the clock of the selection. It warns of a selection over its target. It fails a selection over\n * its stop, and a file over its limit of static runs. The cut of the parts can then follow the cost of the lines, and\n * not the size of the files.\n */\nimport { median } from \"@mark1russell7/rigor-statistics\";\n\n/** The name of the file of the plan, in the folder of the JSON report. */\nexport const PLAN_FILE = \"plan.json\";\n\n/**\n * The default planned net time of one minute of the clock. In a nightly run of Vex (GitHub Actions, 2 test processes),\n * the mutants that ended had 9.8 to 11.7 times the planned time of their clock. The lower value gives the longer estimate.\n */\nexport const PLAN_PER_CLOCK = 9.8;\n\n/** The default target of the estimate of a selection, in minutes. A slow runner then ends a job of 150 minutes. */\nexport const TARGET_MINUTES = 100;\n\n/**\n * The default stop of the estimate of a selection, in minutes. A selection over it does not end before the limit of the\n * job, so it cannot give a full score. The estimate has an error of 28 minutes in the mean, so the target only warns.\n */\nexport const STOP_MINUTES = 140;\n\n/** The count of the tests of the largest cost that the plan keeps. */\nexport const TOP_TESTS = 40;\n\n/** The parts of a plan of Stryker for one mutant that the reporter reads. */\nexport interface PlanOfMutant {\n readonly plan: string;\n readonly mutant: {\n readonly id: string;\n readonly fileName: string;\n readonly static?: boolean;\n /** The start of the mutant. In a plan, Stryker counts the lines from 0. */\n readonly location?: { readonly start: { readonly line: number } };\n };\n readonly netTime?: number;\n /** The tests that Stryker starts for the mutant. With no filter, Stryker starts all tests, as for a static mutant. */\n readonly runOptions?: { readonly timeout?: number; readonly testFilter?: readonly string[] };\n}\n\n/** The parts of a test of the run without mutants that the reporter reads. */\nexport interface TestOfDryRun {\n readonly id: string;\n readonly name: string;\n readonly fileName?: string;\n readonly timeSpentMs: number;\n}\n\n/** The planned times of one mutant that Stryker starts. */\nexport interface PlannedRun {\n readonly file: string;\n /** The line of the start of the mutant, counted from 1. The value 0 is a mutant with no location. */\n readonly line: number;\n readonly static: boolean;\n readonly netMs: number;\n readonly limitMs: number;\n}\n\n/** The plan of one line: the line from 1, the runs that start on it, the static runs of them, and their planned net time. */\nexport type LinePlan = readonly [line: number, runs: number, staticRuns: number, netMs: number];\n\n/** The plan of one file of a selection. */\nexport interface FilePlan {\n /** The mutants of the file, with the mutants that have an early result. */\n readonly mutants: number;\n readonly runs: number;\n readonly static: number;\n readonly netMs: number;\n readonly limitMs: number;\n /** The plan of each line with a run, in the order of the lines. */\n readonly lines: readonly LinePlan[];\n}\n\n/** The plan of one test: its name, its file, its time without mutants, the runs that start it, and their product. */\nexport type TestPlan = readonly [name: string, file: string, ms: number, runs: number, costMs: number];\n\n/** The run of the tests without mutants: the count of its tests and the sum of their times in milliseconds. */\nexport interface DryRun {\n readonly tests: number;\n readonly netMs: number;\n}\n\n/** The content of `plan.json`. The paths of the files are from the folder where Stryker starts. */\nexport interface SelectionPlan {\n readonly files: Readonly<Record<string, FilePlan>>;\n readonly tests: readonly TestPlan[];\n /** The run of the tests without mutants. A plan of a version before 0.2.6 has no `dryRun`. */\n readonly dryRun?: DryRun;\n}\n\n/** This function gives the run of the tests without mutants: the count of the tests and the sum of their times. */\nexport function dryRunOf(tests: readonly TestOfDryRun[]): DryRun {\n return { tests: tests.length, netMs: Math.round(tests.reduce((sum, test) => sum + test.timeSpentMs, 0)) };\n}\n\n/** A test of a plan counts for the speed of a runner only from this time in milliseconds. A short time is mostly noise. */\nexport const SPEED_MIN_MS = 200;\n\n/** The plan of one selection for the speed of its runner. */\nexport interface RunnerPlan {\n readonly name: string;\n /** The selections of one group run the same tests. A selection that is not a part of a group is a group of its own. */\n readonly group: string;\n readonly plan: SelectionPlan;\n}\n\n/**\n * This function gives the speed of the runner of each selection, relative to the other selections of its group. Each part\n * runs on its own runner, and in Vex the same tests took from 83 s to 149 s on the runners of one group.\n *\n * - When each plan of a group has a `dryRun` with the same count of tests, the factor uses the dry runs. It is the\n * net time of the dry run over the median of the group.\n * - Otherwise the factor is the median of the ratios of the shared tests. The ratio of a test is its time over its\n * median time in the group. A shared test takes `SPEED_MIN_MS` or more. At least half of the plans of the group\n * name it, and at least 2 plans.\n * - A selection with no shared test, or alone in its group, has the factor 1. A factor over 1 is a slow runner.\n */\nexport function speedFactors(plans: readonly RunnerPlan[]): Map<string, number> {\n const out = new Map<string, number>();\n for (const group of new Set(plans.map((p) => p.group))) {\n const members = plans.filter((p) => p.group === group);\n const runs = members.map((p) => p.plan.dryRun);\n const counts = new Set(runs.map((r) => r?.tests));\n if (members.length > 1 && counts.size === 1 && runs.every((r) => r !== undefined && r.tests > 0 && r.netMs > 0)) {\n const middle = median(runs.map((r) => r?.netMs ?? 0));\n for (const p of members) out.set(p.name, (p.plan.dryRun?.netMs ?? middle) / middle);\n continue;\n }\n const times = members.map((p) => new Map(p.plan.tests.filter((t) => t[2] >= SPEED_MIN_MS).map((t) => [`${t[1]}|${t[0]}`, t[2]])));\n const need = Math.max(2, Math.ceil(members.length / 2));\n const shared = [...new Set(times.flatMap((m) => [...m.keys()]))].filter((key) => times.filter((m) => m.has(key)).length >= need);\n const middles = new Map(shared.map((key) => [key, median(times.flatMap((m) => m.get(key) ?? []))]));\n members.forEach((p, i) => {\n const ratios = shared.flatMap((key) => {\n const ms = times[i]?.get(key);\n return ms === undefined ? [] : [ms / (middles.get(key) ?? ms)];\n });\n out.set(p.name, ratios.length === 0 ? 1 : median(ratios));\n });\n }\n return out;\n}\n\n/** This function gives the planned times of each mutant that Stryker starts, by the id of the mutant. */\nexport function plannedRuns(plans: readonly PlanOfMutant[], path: (fileName: string) => string = (f) => f): Map<string, PlannedRun> {\n const runs = new Map<string, PlannedRun>();\n for (const { plan, mutant, netTime, runOptions } of plans) {\n if (plan !== \"Run\") continue;\n const line = mutant.location === undefined ? 0 : mutant.location.start.line + 1;\n runs.set(mutant.id, { file: path(mutant.fileName), line, static: mutant.static === true, netMs: Math.round(netTime ?? 0), limitMs: Math.round(runOptions?.timeout ?? 0) });\n }\n return runs;\n}\n\n/** This function gives the plan of each file: its mutants, the mutants that Stryker starts, and their planned times. */\nexport function filePlans(plans: readonly PlanOfMutant[], path: (fileName: string) => string = (f) => f): Record<string, FilePlan> {\n const runs = plannedRuns(plans, path);\n type Row = { mutants: number; runs: number; static: number; netMs: number; limitMs: number; byLine: Map<number, [number, number, number, number]> };\n const files = new Map<string, Row>();\n for (const { mutant } of plans) {\n const file = path(mutant.fileName);\n const row = files.get(file) ?? { mutants: 0, runs: 0, static: 0, netMs: 0, limitMs: 0, byLine: new Map() };\n files.set(file, row);\n row.mutants += 1;\n const run = runs.get(mutant.id);\n if (run === undefined) continue;\n row.runs += 1;\n row.static += run.static ? 1 : 0;\n row.netMs += run.netMs;\n row.limitMs += run.limitMs;\n const line = row.byLine.get(run.line) ?? [run.line, 0, 0, 0];\n line[1] += 1;\n line[2] += run.static ? 1 : 0;\n line[3] += run.netMs;\n row.byLine.set(run.line, line);\n }\n const plan = ({ byLine, ...row }: Row): FilePlan => ({ ...row, lines: [...byLine.values()].toSorted((a, b) => a[0] - b[0]) });\n return Object.fromEntries([...files].toSorted(([a], [b]) => a.localeCompare(b)).map(([file, row]) => [file, plan(row)]));\n}\n\n/**\n * This function gives the tests of the largest planned cost, the largest first. The cost of a test is its time without\n * mutants, times the runs that start it. A test with a large cost is the first place to make the selection faster.\n */\nexport function testPlans(plans: readonly PlanOfMutant[], tests: readonly TestOfDryRun[], path: (fileName: string) => string = (f) => f, top: number = TOP_TESTS): TestPlan[] {\n const runs = new Map<string, number>(tests.map((test) => [test.id, 0]));\n let all = 0;\n for (const { plan, runOptions } of plans) {\n if (plan !== \"Run\") continue;\n if (runOptions?.testFilter === undefined) all += 1;\n else for (const id of runOptions.testFilter) runs.set(id, (runs.get(id) ?? 0) + 1);\n }\n const rows = tests.map((test): TestPlan => {\n const count = (runs.get(test.id) ?? 0) + all;\n return [test.name, test.fileName === undefined ? \"\" : path(test.fileName), Math.round(test.timeSpentMs), count, Math.round(count * test.timeSpentMs)];\n });\n return rows.toSorted((a, b) => b[4] - a[4] || a[0].localeCompare(b[0])).slice(0, top);\n}\n\n/** This function gives the estimate of the minutes of the clock of a planned net time. */\nexport function clockMinutes(netMs: number, planPerClock: number = PLAN_PER_CLOCK): number {\n return netMs / planPerClock / 60_000;\n}\n\n/** The read of the plan of a selection. */\nexport interface PlanRead {\n readonly runs: number;\n readonly static: number;\n readonly netMs: number;\n /** The estimate of the clock of the selection, in minutes. */\n readonly minutes: number;\n /** One line for a selection over its stop, and one for each file over its limit of static runs. */\n readonly faults: readonly string[];\n /** One line for a selection over its target and under its stop. */\n readonly warnings: readonly string[];\n /** The line of the plan of the selection, with its estimate. */\n readonly line: string;\n}\n\n/** The limits of the read of a plan. */\nexport interface PlanLimits {\n readonly planPerClock?: number;\n readonly targetMinutes?: number;\n readonly stopMinutes?: number;\n /** The most static runs of each file. The key `*` gives the limit of each file that the field does not name. */\n readonly staticLimits?: Readonly<Record<string, number>>;\n}\n\n/**\n * This function gives the faults of the static runs of a plan. A static run starts each test, so it costs the time of\n * all tests. Code outside a function gives a static mutant.\n */\nexport function staticFaults(files: Readonly<Record<string, FilePlan>>, limits: Readonly<Record<string, number>> = {}): string[] {\n return Object.entries(files).flatMap(([file, plan]) => {\n const limit = limits[file] ?? limits[\"*\"];\n if (limit === undefined || plan.static <= limit) return [];\n return [`${file}: the plan has ${String(plan.static)} static runs, and the limit is ${String(limit)}. Each static run starts each test. Move the code outside a function into a function.`];\n });\n}\n\n/** This function reads the plan of a selection: its estimate of the clock, against the target and the stop, and its static runs. */\nexport function readPlan(name: string, plan: SelectionPlan, limits: PlanLimits = {}): PlanRead {\n const rows = Object.values(plan.files);\n const sum = (key: \"runs\" | \"static\" | \"netMs\"): number => rows.reduce((n, row) => n + row[key], 0);\n const minutes = clockMinutes(sum(\"netMs\"), limits.planPerClock);\n const target = limits.targetMinutes ?? TARGET_MINUTES;\n const stop = limits.stopMinutes ?? STOP_MINUTES;\n const estimate = `${name}: the estimate of ${minutes.toFixed(0)} minutes`;\n const head = `${name}: ${String(sum(\"runs\"))} runs, ${String(sum(\"static\"))} of them static, with a planned net time of ${(sum(\"netMs\") / 3_600_000).toFixed(1)} h.`;\n const line = `${head} The estimate is ${minutes.toFixed(0)} minutes of the clock, the target is ${String(target)} and the stop is ${String(stop)}.`;\n const overStop = minutes > stop ? [`${estimate} is over the stop of ${String(stop)}. The run cannot end before the stop, so it cannot give a full score. Cut the selection into more parts.`] : [];\n const warnings = minutes > target && minutes <= stop ? [`${estimate} is over the target of ${String(target)}. Cut the selection into more parts.`] : [];\n return { runs: sum(\"runs\"), static: sum(\"static\"), netMs: sum(\"netMs\"), minutes, faults: [...overStop, ...staticFaults(plan.files, limits.staticLimits)], warnings, line };\n}\n\n/**\n * This function reads the JSON of `plan.json`.\n *\n * @throws Error when the JSON has no object `files` or no list `tests`, or a `dryRun` with no numbers\n */\nexport function parsePlan(json: unknown): SelectionPlan {\n const plan = json as Partial<SelectionPlan> | null;\n if (typeof plan !== \"object\" || plan === null || typeof plan.files !== \"object\" || plan.files === null || !Array.isArray(plan.tests)) {\n throw new Error(`the plan has no object \"files\" or no list \"tests\"`);\n }\n const run = plan.dryRun as Partial<DryRun> | null | undefined;\n if (run !== undefined && (typeof run !== \"object\" || run === null || !Number.isFinite(run.tests) || !Number.isFinite(run.netMs))) {\n throw new Error(`the field \"dryRun\" of the plan has no numbers \"tests\" and \"netMs\"`);\n }\n return plan as SelectionPlan;\n}\n","/**\n * The Stryker reporter `rigor-partial`. It appends the plan and each tested mutant to `partial.jsonl`, next to the JSON\n * report, at the time of each event. When a time limit stops Stryker, `scores` reads this file for a partial score. It\n * also writes the cost plan into `plan.json`, and with `rigorPartial.stopAfterPlan` it stops Stryker after the plan.\n */\nimport { appendFileSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative, sep } from \"node:path\";\nimport { dryRunOf, filePlans, PLAN_FILE, plannedRuns, testPlans, type PlannedRun, type PlanOfMutant, type TestOfDryRun } from \"./plan.ts\";\n\n/** The name of the file of the reporter, in the folder of the JSON report. */\nexport const PARTIAL_FILE = \"partial.jsonl\";\n\n/** A line of `partial.jsonl`. The field `at` gives the time in milliseconds since 1970. */\nexport type PartialLine =\n | { readonly event: \"start\"; readonly at: number }\n | { readonly event: \"plan\"; readonly at: number; readonly mutants: number; readonly run: number }\n | {\n readonly event: \"mutant\";\n readonly at: number;\n readonly file: string;\n readonly status: string;\n readonly statusReason?: string;\n readonly mutatorName: string;\n readonly line: number;\n /** The planned net time of the mutant in milliseconds. A mutant with an early result has none. */\n readonly netMs?: number;\n /** The time limit of the mutant in milliseconds. A mutant that the clock stops costs this time. */\n readonly limitMs?: number;\n readonly static?: boolean;\n }\n | { readonly event: \"done\"; readonly at: number };\n\n/** The parts of a Stryker mutant result that the reporter reads. */\ninterface TestedMutant {\n readonly id?: string;\n readonly fileName: string;\n readonly status: string;\n readonly statusReason?: string;\n readonly mutatorName: string;\n readonly location: { readonly start: { readonly line: number } };\n}\n\n/** The options of Stryker that the reporter reads. */\nexport interface ReporterOptions {\n readonly jsonReporter?: { readonly fileName?: string };\n /** With `stopAfterPlan` at true, the reporter stops Stryker after it writes the plan, before the first mutant. */\n readonly rigorPartial?: { readonly stopAfterPlan?: boolean };\n}\n\n/** The reporter. Stryker gives it its options, and `now`, `cwd` and `exit` are for the tests. */\nexport class PartialReporter {\n static readonly inject = [\"options\"] as const;\n readonly file: string;\n /** The file of the cost plan, in the folder of the JSON report. */\n readonly planFile: string;\n private readonly now: () => number;\n private readonly cwd: string;\n private readonly exit: (code: number) => void;\n private readonly stopAfterPlan: boolean;\n private tests: readonly TestOfDryRun[] = [];\n private runs = new Map<string, PlannedRun>();\n\n constructor(options: ReporterOptions, now: () => number = Date.now, cwd: string = process.cwd(), exit: (code: number) => void = (code) => process.exit(code)) {\n this.now = now;\n this.cwd = cwd;\n this.exit = exit;\n this.stopAfterPlan = options.rigorPartial?.stopAfterPlan === true;\n const dir = join(cwd, dirname(options.jsonReporter?.fileName ?? \"reports/mutation/mutation.json\"));\n this.file = join(dir, PARTIAL_FILE);\n this.planFile = join(dir, PLAN_FILE);\n mkdirSync(dir, { recursive: true });\n writeFileSync(this.file, \"\");\n this.write({ event: \"start\", at: this.now() });\n }\n\n onDryRunCompleted(event: { readonly result: { readonly tests: readonly TestOfDryRun[] } }): void {\n this.tests = event.result.tests;\n }\n\n onMutationTestingPlanReady(event: { readonly mutantPlans: readonly PlanOfMutant[] }): void {\n const plans = event.mutantPlans;\n this.write({ event: \"plan\", at: this.now(), mutants: plans.length, run: plans.filter((p) => p.plan === \"Run\").length });\n this.runs = plannedRuns(plans, this.path);\n writeFileSync(this.planFile, `${JSON.stringify({ files: filePlans(plans, this.path), tests: testPlans(plans, this.tests, this.path), dryRun: dryRunOf(this.tests) }, null, 2)}\\n`);\n // The test processes of Stryker stop with this process.\n if (this.stopAfterPlan) this.exit(0);\n }\n\n onMutantTested(result: TestedMutant): void {\n const reason = result.statusReason === undefined ? {} : { statusReason: result.statusReason };\n const run = result.id === undefined ? undefined : this.runs.get(result.id);\n const planned = run === undefined ? {} : { netMs: run.netMs, limitMs: run.limitMs, static: run.static };\n this.write({ event: \"mutant\", at: this.now(), file: this.path(result.fileName), status: result.status, ...reason, mutatorName: result.mutatorName, line: result.location.start.line, ...planned });\n }\n\n onMutationTestReportReady(): void {\n this.write({ event: \"done\", at: this.now() });\n }\n\n /** This function gives the path of a file from the folder where Stryker starts, with `/`. */\n private readonly path = (fileName: string): string => relative(this.cwd, fileName).split(sep).join(\"/\");\n\n // A synchronous append: a stop of the process loses no line of a mutant that was tested.\n private write(line: PartialLine): void {\n appendFileSync(this.file, `${JSON.stringify(line)}\\n`);\n }\n}\n\n/** The schema of the option of the reporter. Stryker adds it to its own schema, so the option gives no warning. */\nexport const strykerValidationSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n type: \"object\",\n properties: {\n rigorPartial: {\n description: \"The options of the reporter rigor-partial.\",\n type: \"object\",\n properties: { stopAfterPlan: { description: \"Stop Stryker after the reporter writes the plan.\", type: \"boolean\", default: false } },\n additionalProperties: false,\n default: {},\n },\n },\n} as const;\n\n/** The plugins of this module, in the form of `declareClassPlugin` of `@stryker-mutator/api/plugin`. */\nexport const strykerPlugins: readonly { readonly kind: \"Reporter\"; readonly name: string; readonly injectableClass: typeof PartialReporter }[] = [\n { kind: \"Reporter\", name: \"rigor-partial\", injectableClass: PartialReporter },\n];\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,YAAY;;;;;AAMzB,MAAa,iBAAiB;;AAG9B,MAAa,iBAAiB;;;;;AAM9B,MAAa,eAAe;;AAuE5B,SAAgB,SAAS,OAAwC;CAC/D,OAAO;EAAE,OAAO,MAAM;EAAQ,OAAO,KAAK,MAAM,MAAM,QAAQ,KAAK,SAAS,MAAM,KAAK,aAAa,CAAC,CAAC;CAAE;AAC1G;;AAGA,MAAa,eAAe;;;;;;;;;;;;AAqB5B,SAAgB,aAAa,OAAmD;CAC9E,MAAM,sBAAM,IAAI,IAAoB;CACpC,KAAK,MAAM,SAAS,IAAI,IAAI,MAAM,KAAK,MAAM,EAAE,KAAK,CAAC,GAAG;EACtD,MAAM,UAAU,MAAM,QAAQ,MAAM,EAAE,UAAU,KAAK;EACrD,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,KAAK,MAAM;EAC7C,MAAM,SAAS,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,KAAK,CAAC;EAChD,IAAI,QAAQ,SAAS,KAAK,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,MAAM,KAAA,KAAa,EAAE,QAAQ,KAAK,EAAE,QAAQ,CAAC,GAAG;GAC/G,MAAM,SAAS,OAAO,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;GACpD,KAAK,MAAM,KAAK,SAAS,IAAI,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,SAAS,UAAU,MAAM;GAClF;EACF;EACA,MAAM,QAAQ,QAAQ,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,QAAQ,MAAM,EAAE,MAAA,GAAkB,CA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or-partial` writes the plan of each file and each line into `plan.json`. `plan-check` reads the file and
|
|
4
|
-
* gives the estimate of the clock of the selection. It warns of a selection over its target. It fails a selection over
|
|
5
|
-
* its stop, and a file over its limit of static runs. The cut of the parts can then follow the cost of the lines, and
|
|
6
|
-
* not the size of the files.
|
|
7
|
-
*/
|
|
8
1
|
/** The name of the file of the plan, in the folder of the JSON report. */
|
|
9
2
|
declare const PLAN_FILE = "plan.json";
|
|
10
3
|
/**
|
|
@@ -62,11 +55,41 @@ interface FilePlan {
|
|
|
62
55
|
}
|
|
63
56
|
/** The plan of one test: its name, its file, its time without mutants, the runs that start it, and their product. */
|
|
64
57
|
type TestPlan = readonly [name: string, file: string, ms: number, runs: number, costMs: number];
|
|
58
|
+
/** The run of the tests without mutants: the count of its tests and the sum of their times in milliseconds. */
|
|
59
|
+
interface DryRun {
|
|
60
|
+
readonly tests: number;
|
|
61
|
+
readonly netMs: number;
|
|
62
|
+
}
|
|
65
63
|
/** The content of `plan.json`. The paths of the files are from the folder where Stryker starts. */
|
|
66
64
|
interface SelectionPlan {
|
|
67
65
|
readonly files: Readonly<Record<string, FilePlan>>;
|
|
68
66
|
readonly tests: readonly TestPlan[];
|
|
67
|
+
/** The run of the tests without mutants. A plan of a version before 0.2.6 has no `dryRun`. */
|
|
68
|
+
readonly dryRun?: DryRun;
|
|
69
69
|
}
|
|
70
|
+
/** This function gives the run of the tests without mutants: the count of the tests and the sum of their times. */
|
|
71
|
+
declare function dryRunOf(tests: readonly TestOfDryRun[]): DryRun;
|
|
72
|
+
/** A test of a plan counts for the speed of a runner only from this time in milliseconds. A short time is mostly noise. */
|
|
73
|
+
declare const SPEED_MIN_MS = 200;
|
|
74
|
+
/** The plan of one selection for the speed of its runner. */
|
|
75
|
+
interface RunnerPlan {
|
|
76
|
+
readonly name: string;
|
|
77
|
+
/** The selections of one group run the same tests. A selection that is not a part of a group is a group of its own. */
|
|
78
|
+
readonly group: string;
|
|
79
|
+
readonly plan: SelectionPlan;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This function gives the speed of the runner of each selection, relative to the other selections of its group. Each part
|
|
83
|
+
* runs on its own runner, and in Vex the same tests took from 83 s to 149 s on the runners of one group.
|
|
84
|
+
*
|
|
85
|
+
* - When each plan of a group has a `dryRun` with the same count of tests, the factor uses the dry runs. It is the
|
|
86
|
+
* net time of the dry run over the median of the group.
|
|
87
|
+
* - Otherwise the factor is the median of the ratios of the shared tests. The ratio of a test is its time over its
|
|
88
|
+
* median time in the group. A shared test takes `SPEED_MIN_MS` or more. At least half of the plans of the group
|
|
89
|
+
* name it, and at least 2 plans.
|
|
90
|
+
* - A selection with no shared test, or alone in its group, has the factor 1. A factor over 1 is a slow runner.
|
|
91
|
+
*/
|
|
92
|
+
declare function speedFactors(plans: readonly RunnerPlan[]): Map<string, number>;
|
|
70
93
|
/** This function gives the plan of each file: its mutants, the mutants that Stryker starts, and their planned times. */
|
|
71
94
|
declare function filePlans(plans: readonly PlanOfMutant[], path?: (fileName: string) => string): Record<string, FilePlan>;
|
|
72
95
|
/**
|
|
@@ -108,7 +131,7 @@ declare function readPlan(name: string, plan: SelectionPlan, limits?: PlanLimits
|
|
|
108
131
|
/**
|
|
109
132
|
* This function reads the JSON of `plan.json`.
|
|
110
133
|
*
|
|
111
|
-
* @throws Error when the JSON has no object `files` or no list `tests`
|
|
134
|
+
* @throws Error when the JSON has no object `files` or no list `tests`, or a `dryRun` with no numbers
|
|
112
135
|
*/
|
|
113
136
|
declare function parsePlan(json: unknown): SelectionPlan;
|
|
114
137
|
/** The name of the file of the reporter, in the folder of the JSON report. */
|
|
@@ -215,5 +238,5 @@ declare const strykerPlugins: readonly {
|
|
|
215
238
|
readonly name: string;
|
|
216
239
|
readonly injectableClass: typeof PartialReporter;
|
|
217
240
|
}[];
|
|
218
|
-
export {
|
|
219
|
-
//# sourceMappingURL=reporter-
|
|
241
|
+
export { dryRunOf as C, speedFactors as D, readPlan as E, staticFaults as O, clockMinutes as S, parsePlan as T, STOP_MINUTES as _, strykerPlugins as a, TestOfDryRun as b, FilePlan as c, PLAN_PER_CLOCK as d, PlanLimits as f, SPEED_MIN_MS as g, RunnerPlan as h, ReporterOptions as i, testPlans as k, LinePlan as l, PlanRead as m, PartialLine as n, strykerValidationSchema as o, PlanOfMutant as p, PartialReporter as r, DryRun as s, PARTIAL_FILE as t, PLAN_FILE as u, SelectionPlan as v, filePlans as w, TestPlan as x, TARGET_MINUTES as y };
|
|
242
|
+
//# sourceMappingURL=reporter-unJLMWXg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter-unJLMWXg.d.ts","names":[],"sources":["../src/plan.ts","../src/reporter.ts"],"mappings":";cAUa;;;;;cAMA;;cAGA;;;;;cAMA;;UAMI;WACN;WACA;aACE;aACA;aACA;;aAEA;eAAsB;iBAAkB;;;;WAE1C;;WAEA;aAAwB;aAA2B;;;;UAI7C;WACN;WACA;WACA;WACA;;;KAcC,qBAAqB,cAAc,cAAc,oBAAoB;;UAGhE;;WAEN;WACA;WACA;WACA;WACA;;WAEA,gBAAgB;;;KAIf,qBAAqB,cAAc,cAAc,YAAY,cAAc;;UAGtE;WACN;WACA;;;UAIM;WACN,OAAO,SAAS,eAAe;WAC/B,gBAAgB;;WAEhB,SAAS;;;iBAIJ,SAAS,gBAAgB,iBAAiB;;cAK7C;;UAGI;WACN;;WAEA;WACA,MAAM;;;;;;;;;;;;;iBAcD,aAAa,gBAAgB,eAAe;;iBAsC5C,UAAU,gBAAgB,gBAAgB,QAAO,8BAAyC,eAAe;;;;;iBA6BzG,UAAU,gBAAgB,gBAAgB,gBAAgB,gBAAgB,QAAO,6BAAwC,eAA0B;;iBAgBnJ,aAAa,eAAe;;UAK3B;WACN;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;;WAEA,eAAe,SAAS;;;;;;iBAOnB,aAAa,OAAO,SAAS,eAAe,YAAY,SAAQ,SAAS;;iBASzE,SAAS,cAAc,MAAM,eAAe,SAAQ,aAAkB;;;;;;iBAmBtE,UAAU,gBAAgB;;cC/P7B;;KAGD;WACG;WAAyB;;WACzB;WAAwB;WAAqB;WAA0B;;WAEvE;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;WACA;;WAEA;WAAwB;;;UAG7B;WACC;WACA;WACA;WACA;WACA;WACA;aAAqB;eAAkB;;;;;UAIjC;WACN;aAA0B;;;WAE1B;aAA0B;;;;cAIxB;kBACK;WACP;;WAEA;mBACQ;mBACA;mBACA;mBACA;UACT;UACA;EAER,YAAY,SAAS,iBAAiB,oBAA8B,cAA6B,QAAO;EAaxG,kBAAkB;aAAkB;eAAmB,gBAAgB;;;EAIvE,2BAA2B;aAAkB,sBAAsB;;EASnE,eAAe,QAAQ;EAOvB;;mBAKiB;UAGT;;;cAMG;WACX;WACA;WACA;aACE;eACE;eACA;eACA;iBAAc;mBAAiB;mBAAiE;mBAAiB;;;eACjH;eACA;;;;;cAMO;WAAoC;WAA2B;WAAuB,wBAAwB"}
|
package/build/reporter.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as strykerPlugins, i as ReporterOptions, n as PartialLine, o as strykerValidationSchema, r as PartialReporter, t as PARTIAL_FILE } from "./reporter-
|
|
1
|
+
import { a as strykerPlugins, i as ReporterOptions, n as PartialLine, o as strykerValidationSchema, r as PartialReporter, t as PARTIAL_FILE } from "./reporter-unJLMWXg.js";
|
|
2
2
|
export { PARTIAL_FILE, PartialLine, PartialReporter, ReporterOptions, strykerPlugins, strykerValidationSchema };
|
package/build/reporter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as PARTIAL_FILE, n as PartialReporter, r as strykerPlugins, i as strykerValidationSchema } from "./reporter-
|
|
1
|
+
export { t as PARTIAL_FILE, n as PartialReporter, r as strykerPlugins, i as strykerValidationSchema } from "./reporter-D8cUJUhN.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PLAN_FILE,
|
|
1
|
+
import { a as PLAN_FILE, h as speedFactors, m as readPlan, p as parsePlan, t as PARTIAL_FILE, u as clockMinutes } from "./reporter-D8cUJUhN.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { dirname, join, matchesGlob, posix, relative, resolve } from "node:path";
|
|
4
4
|
import { appendFileSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
@@ -1659,25 +1659,43 @@ function planCheck(lane, laneDir, names, o, io) {
|
|
|
1659
1659
|
/**
|
|
1660
1660
|
* This function writes the cost maps of the lane from the plans of a run (`costs`). It adds the plan lines of each file
|
|
1661
1661
|
* over the selections, so a file in two parts gets one map. A file that a selection mutates with no plan gets a map of
|
|
1662
|
-
* 0. The maps of the files of the other selections stay.
|
|
1662
|
+
* 0. The maps of the files of the other selections stay. The function divides the net time of each part by the speed factor
|
|
1663
|
+
* of its runner (`speedFactors`). Thus a slow runner does not make its files look slow.
|
|
1663
1664
|
*/
|
|
1664
1665
|
function writeCosts(lane, laneDir, run, reports, io) {
|
|
1665
1666
|
if (lane.costs === void 0) throw new Error(`the lane has no field "costs" for the file of the cost maps`);
|
|
1666
1667
|
if (reports === void 0) throw new Error(`"costs" takes --reports <dir>`);
|
|
1667
|
-
const lines = /* @__PURE__ */ new Map();
|
|
1668
1668
|
const read = [];
|
|
1669
1669
|
for (const name of selectionNames(lane)) {
|
|
1670
1670
|
const file = resolve(io.cwd, reports, `mutation-${name}`, PLAN_FILE);
|
|
1671
1671
|
if (!existsSync(file)) continue;
|
|
1672
|
-
|
|
1672
|
+
const s = selectIn(lane, laneDir, name);
|
|
1673
|
+
read.push({
|
|
1674
|
+
name,
|
|
1675
|
+
group: s.cut === void 0 ? name : `${s.pkg}.${s.cut.group}`,
|
|
1676
|
+
plan: parsePlan(readJson(file))
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
if (read.length === 0) throw new Error(`there is no plan of a selection of the lane in ${reports}`);
|
|
1680
|
+
const factors = speedFactors(read);
|
|
1681
|
+
const lines = /* @__PURE__ */ new Map();
|
|
1682
|
+
for (const { name, plan } of read) {
|
|
1673
1683
|
const s = selectIn(lane, laneDir, name);
|
|
1674
1684
|
const dir = resolve(laneDir, s.dir);
|
|
1685
|
+
const factor = factors.get(name) ?? 1;
|
|
1675
1686
|
const files = lines.get(s.pkg) ?? /* @__PURE__ */ new Map();
|
|
1676
1687
|
lines.set(s.pkg, files);
|
|
1677
1688
|
for (const source of sourcesOf(dir, dir).filter((f) => globsSelect(s.mutate, f))) files.set(source, files.get(source) ?? []);
|
|
1678
|
-
for (const [source,
|
|
1689
|
+
for (const [source, row] of Object.entries(plan.files)) {
|
|
1690
|
+
const scaled = row.lines.map(([line, runs, staticRuns, netMs]) => [
|
|
1691
|
+
line,
|
|
1692
|
+
runs,
|
|
1693
|
+
staticRuns,
|
|
1694
|
+
Math.round(netMs / factor)
|
|
1695
|
+
]);
|
|
1696
|
+
files.set(source, [...files.get(source) ?? [], ...scaled]);
|
|
1697
|
+
}
|
|
1679
1698
|
}
|
|
1680
|
-
if (read.length === 0) throw new Error(`there is no plan of a selection of the lane in ${reports}`);
|
|
1681
1699
|
const maps = Object.fromEntries(Object.entries(costMapsOf(lane, laneDir)).map(([pkg, files]) => [pkg, { ...files }]));
|
|
1682
1700
|
let count = 0;
|
|
1683
1701
|
for (const [pkg, files] of lines) {
|
|
@@ -1695,6 +1713,8 @@ function writeCosts(lane, laneDir, run, reports, io) {
|
|
|
1695
1713
|
mkdirSync(dirname(out), { recursive: true });
|
|
1696
1714
|
writeFileSync(out, `${JSON.stringify(sorted(Object.fromEntries(Object.entries(maps).map(([pkg, files]) => [pkg, sorted(files)]))), null, 2)}\n`);
|
|
1697
1715
|
io.stdout(`costs: ${String(count)} files from the plans of ${String(read.length)} selections of the run ${run}, in ${relative(io.cwd, out).replaceAll("\\", "/")}\n`);
|
|
1716
|
+
const grouped = read.filter((p) => read.filter((q) => q.group === p.group).length > 1);
|
|
1717
|
+
if (grouped.length > 0) io.stdout(`costs: the speed factors of the runners: ${grouped.map((p) => `${p.name} ${(factors.get(p.name) ?? 1).toFixed(2)}`).join(", ")}\n`);
|
|
1698
1718
|
return 0;
|
|
1699
1719
|
}
|
|
1700
1720
|
/**
|
|
@@ -1889,4 +1909,4 @@ function runCli(argv, io) {
|
|
|
1889
1909
|
}
|
|
1890
1910
|
export { segmentsOf as A, rewritesTsconfig as C, lineWeights as D, cutByCost as E, parseLane as F, partErrors as I, runSelections as L, STRYKER_OWNED as M, changedFiles as N, parseCostMaps as O, packageRuns as P, select as R, TIMEOUT_MS as S, costMapOf as T, summaryMarkdown as _, isConfigFile as a, PARTIAL_PLUGIN as b, compareDisables as c, isHitLimit as d, packageScore as f, scoreReport as g, partialScore as h, computedImports as i, weightedFiles as j, plannedMs as k, findDisables as l, parseReport as m, runCli as n, leavingPaths as o, parsePartial as p, collectFaults as r, relatedTestFiles as s, HELP as t, formatScore as u, DRY_RUN_TIMEOUT_MINUTES as v, strykerConfig as w, REPORT_DIR as x, NO_TSCONFIG as y, selectionNames as z };
|
|
1891
1911
|
|
|
1892
|
-
//# sourceMappingURL=run-
|
|
1912
|
+
//# sourceMappingURL=run-BEUhSals.js.map
|