@mark1russell7/rigor-mutation 0.2.2 → 0.2.3
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 +29 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +21 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -3
- package/build/reporter-BS3LIodv.d.ts +219 -0
- package/build/reporter-BS3LIodv.d.ts.map +1 -0
- package/build/reporter-BYC384h-.js +257 -0
- package/build/reporter-BYC384h-.js.map +1 -0
- package/build/reporter.d.ts +2 -2
- package/build/reporter.js +1 -1
- package/build/{run-BvctkYlJ.js → run-DcH6lUvo.js} +72 -6
- package/build/run-DcH6lUvo.js.map +1 -0
- package/package.json +1 -1
- package/build/reporter-CkdX8IPx.d.ts +0 -63
- package/build/reporter-CkdX8IPx.d.ts.map +0 -1
- package/build/reporter-Cypwcaj9.js +0 -66
- package/build/reporter-Cypwcaj9.js.map +0 -1
- package/build/run-BvctkYlJ.js.map +0 -1
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ The lane file `mutation.json` is at the root of the repository:
|
|
|
45
45
|
- `dryRunTimeoutMinutes` is the time in minutes for the run of the tests without mutants. The default is 15.
|
|
46
46
|
- `stryker` has more options for the Stryker config of each selection of the package, for example `{ "ignoreStatic": true }`. Its keys replace the keys of the config, but `--concurrency` replaces its `concurrency`. The lane owns `mutate`, `thresholds`, `jsonReporter`, `htmlReporter`, `timeoutMS` and `dryRunTimeoutMinutes`, so `stryker` cannot have them.
|
|
47
47
|
- `disables` (at the root of the lane) names the list of the disabled mutants. The default is `mutation-disables.json`.
|
|
48
|
+
- `staticLimits` gives the most static runs of each file of the package, from the folder where Stryker starts. The key `*` gives the limit of the other files. `plan-check` reads it.
|
|
49
|
+
- `targetMinutes` (at the root of the lane) is the target of the estimate of each selection, in minutes. The default is 100.
|
|
50
|
+
- `stopMinutes` (at the root of the lane) is the stop of the estimate of each selection, in minutes. The default is 140. It is not less than `targetMinutes`.
|
|
51
|
+
- `planPerClock` (at the root of the lane) is the planned net time of one minute of the clock. The default is 9.8, from a nightly run of Vex.
|
|
48
52
|
|
|
49
53
|
A selection is one Stryker run: a package (`collections`) or a part (`collections.impl`). `rigor-mutation list --runs` gives the selections of a full run: the parts of each package with parts, else the package.
|
|
50
54
|
|
|
@@ -93,6 +97,31 @@ A partial score is a no read, because it does not read all the mutants. Its fiel
|
|
|
93
97
|
|
|
94
98
|
The workflow `stryker-stop.yml` checks the reporter in a real run. It stops Stryker on the fixture lane `test/stryker/mutation.json` and examines the partial score.
|
|
95
99
|
|
|
100
|
+
### The cost plan
|
|
101
|
+
|
|
102
|
+
After the run of the tests without mutants, Stryker makes a plan of the mutants. The reporter `rigor-partial` writes it to `plan.json`, next to `mutation.json`:
|
|
103
|
+
|
|
104
|
+
- `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.
|
|
105
|
+
- `tests` gives the 40 tests of the largest cost. The cost of a test is its time, times the runs that start it.
|
|
106
|
+
|
|
107
|
+
Each line of a mutant in `partial.jsonl` also gives its planned net time and its time limit.
|
|
108
|
+
|
|
109
|
+
`rigor-mutation config <selection> --plan` gives a config that stops Stryker after the plan. Stryker starts no mutant, so the plan costs only the run of the tests.
|
|
110
|
+
|
|
111
|
+
`rigor-mutation plan-check <selection>...` reads the plan of each selection. It gives the estimate of the clock. It gives a warning when the estimate is over `targetMinutes`, and in GitHub Actions also a warning annotation. The estimate has an error of 28 minutes in the mean, so the target does not fail. These conditions fail a selection:
|
|
112
|
+
|
|
113
|
+
- The estimate is over `stopMinutes`. Stryker cannot end the selection before the stop, so it cannot give a full score.
|
|
114
|
+
- A file has more static runs than its limit in `staticLimits`.
|
|
115
|
+
|
|
116
|
+
A static run starts each test, so it costs the time of all the tests. Code outside a function gives a static mutant.
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
vex.kernel: 812 runs, 3 of them static, with a planned net time of 12.4 h. The estimate is 76 minutes of the clock, the target is 100 and the stop is 140.
|
|
120
|
+
plan-check: each plan of 1 selections is in its limits
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`--report <file>` reads the plan of one selection from a file. `--reports <dir>` reads `<dir>/mutation-<selection>/plan.json`. The workflow `stryker-stop.yml` checks the plan in a real run.
|
|
124
|
+
|
|
96
125
|
## The score
|
|
97
126
|
|
|
98
127
|
The score counts the detected mutants, out of the mutants that a test covers or that survive. Compile errors, runtime errors and ignored mutants do not count.
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PartialLine, r as PartialReporter, t as PARTIAL_FILE } from "./reporter-
|
|
1
|
+
import { C as staticFaults, S as readPlan, _ as TestOfDryRun, b as filePlans, c as LinePlan, d as PlanLimits, f as PlanOfMutant, g as TARGET_MINUTES, h as SelectionPlan, i as ReporterOptions, l as PLAN_FILE, m as STOP_MINUTES, n as PartialLine, p as PlanRead, r as PartialReporter, s as FilePlan, t as PARTIAL_FILE, u as PLAN_PER_CLOCK, v as TestPlan, w as testPlans, x as parsePlan, y as clockMinutes } from "./reporter-BS3LIodv.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.
|
|
@@ -49,6 +49,11 @@ interface PackageLane {
|
|
|
49
49
|
* of Vitest does not follow this type of import. `load-check --collect` fails for each other file of the run with one.
|
|
50
50
|
*/
|
|
51
51
|
readonly computedImports?: Readonly<Record<string, string>>;
|
|
52
|
+
/**
|
|
53
|
+
* This field gives the most static runs in the plan of each file, from `dir`. The key `*` gives the limit of each other
|
|
54
|
+
* file. A static run starts each test. `plan-check` fails a file over its limit.
|
|
55
|
+
*/
|
|
56
|
+
readonly staticLimits?: Readonly<Record<string, number>>;
|
|
52
57
|
}
|
|
53
58
|
/** The keys of the Stryker config that the lane owns. The field `stryker` of a package cannot have them. */
|
|
54
59
|
export declare const STRYKER_OWNED: readonly string[];
|
|
@@ -64,6 +69,12 @@ interface Lane {
|
|
|
64
69
|
readonly maxTestFall?: number;
|
|
65
70
|
/** Each selection of this field can have a higher fall of its test count. The value gives the reason. */
|
|
66
71
|
readonly plannedFalls?: Readonly<Record<string, string>>;
|
|
72
|
+
/** This field gives the planned net time of one minute of the clock, for the estimate of `plan-check`. The default is 9.8. */
|
|
73
|
+
readonly planPerClock?: number;
|
|
74
|
+
/** This field gives the target of the estimate of a selection, in minutes. `plan-check` warns of a selection over it. The default is 100. */
|
|
75
|
+
readonly targetMinutes?: number;
|
|
76
|
+
/** This field gives the stop of the estimate of a selection, in minutes. `plan-check` fails a selection over it. The default is 140. */
|
|
77
|
+
readonly stopMinutes?: number;
|
|
67
78
|
}
|
|
68
79
|
/** A selection is one Stryker run: a package (`collections`) or a part of a package (`collections.impl`). */
|
|
69
80
|
interface Selection {
|
|
@@ -125,6 +136,11 @@ interface ConfigOptions {
|
|
|
125
136
|
* test. Use it to see if the tests pass under Stryker before a long run.
|
|
126
137
|
*/
|
|
127
138
|
readonly dryRun?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* When this option is true, Stryker starts the tests without mutants and makes its plan. The reporter `rigor-partial`
|
|
141
|
+
* writes the plan into `plan.json` and stops Stryker. No mutant runs. `plan-check` reads the plan.
|
|
142
|
+
*/
|
|
143
|
+
readonly plan?: boolean;
|
|
128
144
|
/**
|
|
129
145
|
* When this option is false, Stryker does not rewrite the tsconfig of the package in its sandbox. The default is true.
|
|
130
146
|
* The rewrite uses `parseConfigFileTextToJson`, and TypeScript 7 does not have it. Refer to `rewritesTsconfig`.
|
|
@@ -159,6 +175,9 @@ interface StrykerConfig {
|
|
|
159
175
|
readonly tsconfigFile?: string;
|
|
160
176
|
readonly dryRunOnly?: true;
|
|
161
177
|
readonly disableBail?: true;
|
|
178
|
+
readonly rigorPartial?: {
|
|
179
|
+
readonly stopAfterPlan: true;
|
|
180
|
+
};
|
|
162
181
|
}
|
|
163
182
|
/**
|
|
164
183
|
* The file URL of the module of the reporter `rigor-partial`: the source in the workspace, the build in the package of
|
|
@@ -440,5 +459,5 @@ interface CliIo {
|
|
|
440
459
|
export declare const HELP: string;
|
|
441
460
|
/** This function starts the CLI with its arguments and gives the exit code. */
|
|
442
461
|
export declare function runCli(argv: readonly string[], io: CliIo): number;
|
|
443
|
-
export { type CliIo, type Collected, type CollectedFile, type ComputedImport, type ConfigOptions, type Disable, type DisableCheck, type Lane, type LeavingPath, type Mutant, type MutationReport, PARTIAL_FILE, type PackageFile, type PackageLane, type PartialCosts, type PartialLine, PartialReporter, type PartialRun, type Score, type ScoreOutcome, type Selection, type StrykerConfig };
|
|
462
|
+
export { type CliIo, type Collected, type CollectedFile, type ComputedImport, type ConfigOptions, 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 Selection, type SelectionPlan, type StrykerConfig, TARGET_MINUTES, type TestOfDryRun, type TestPlan, clockMinutes, filePlans, parsePlan, readPlan, staticFaults, testPlans };
|
|
444
463
|
//# 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/config.ts","../src/score.ts","../src/disables.ts","../src/load.ts","../src/run.ts"],"mappings":";;;;;;
|
|
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":";;;;;;UASiB;;WAEN;;;;;WAKA;;;;;;WAMA,QAAQ,SAAS;;WAEjB;;;;;WAKA;;WAEA;;;;;WAKA;;WAEA;;;;;WAKA,UAAU,SAAS;;;;;WAKnB,UAAU,SAAS;;;;;WAKnB,kBAAkB,SAAS;;;;;WAK3B,eAAe,SAAS;;;qBAItB;;UAGI;WACN,UAAU,SAAS,eAAe;;WAElC;;;;;WAKA;;WAEA,eAAe,SAAS;;WAExB;;WAEA;;WAEA;;;UAOM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,SAAS,SAAS;;;;;;;wBA8Db,UAAU,gBAAgB;;wBAyB1B,eAAe,MAAM;;wBAKrB,cAAc,MAAM;;;;;;wBASpB,OAAO,MAAM,MAAM,eAAe;;;;;;;;;wBAoElC,aAAa,WAAW,WAAW,4BAA4B,UAAS;;;;;;;;;;;;wBAkDxE,WAAW,MAAM,MAAM,aAAa,0BAA0B,SAAS;;UCzTtE;;WAEN;;WAEA;;;;;WAKA;;;;;WAKA;;;;;WAKA;;;UAIM;;WAEN;WACA;WACA;aAAoB;;WACpB;WACA;WACA;WACA;aAAyB;;WACzB;aAAyB;;WACzB;aAAuB;aAAuB;aAAsB;;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;aAA0B;;;;;;;qBAOxB;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;;wBAOG,iBAAiB;;qBAKpB;;;;;;wBAOG,cAAc,WAAW,WAAW,UAAS,gBAAqB;;;;;;;;;;UC1EjE;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;;WAEV,UAAU;;;UAIJ;;WAEN;;WAEA;;WAEA;;WAEA;;;UAIM,mBAAmB;WACzB,QAAQ;;WAER;;;;;;;;wBASK,aAAa,eAAe;;;;;wBAuC5B,aAAa,KAAK,YAAY;WAAsB;WAAuB;IAA6B;;qBAY3G,aAAc,GAAG;;;;;;wBAOd,YAAY,gBAAgB;;;;;;wBA4G5B,YAAY,QAAQ,gBAAgB;WAAsB;WAAuB;IAA6B;;;;;;;;wBA4C9G,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;;UCtMxB;WACN;WACA,SAAS;WACT,SAAS;;WAET,MAAM,SAAS;;;qBAIb;;wBAqhBG,OAAO,yBAAyB,IAAI"}
|
package/build/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
export { DRY_RUN_TIMEOUT_MINUTES, HELP, NO_TSCONFIG, PARTIAL_FILE, PARTIAL_PLUGIN, PartialReporter, REPORT_DIR, STRYKER_OWNED, TIMEOUT_MS, changedFiles, collectFaults, compareDisables, computedImports, findDisables, formatScore, isConfigFile, isHitLimit, leavingPaths, packageScore, parseLane, parsePartial, parseReport, partErrors, partialScore, relatedTestFiles, rewritesTsconfig, runCli, runSelections, scoreReport, select, selectionNames, strykerConfig, summaryMarkdown };
|
|
1
|
+
import { a as PLAN_FILE, c as TARGET_MINUTES, d as parsePlan, f as readPlan, l as clockMinutes, m as testPlans, n as PartialReporter, o as PLAN_PER_CLOCK, p as staticFaults, s as STOP_MINUTES, t as PARTIAL_FILE, u as filePlans } from "./reporter-BYC384h-.js";
|
|
2
|
+
import { A as select, C as rewritesTsconfig, D as parseLane, E as changedFiles, O as partErrors, S as TIMEOUT_MS, T as STRYKER_OWNED, _ 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 selectionNames, k as runSelections, 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 } from "./run-DcH6lUvo.js";
|
|
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, filePlans, findDisables, formatScore, isConfigFile, isHitLimit, leavingPaths, packageScore, parseLane, parsePartial, parsePlan, parseReport, partErrors, partialScore, readPlan, relatedTestFiles, rewritesTsconfig, runCli, runSelections, scoreReport, select, selectionNames, staticFaults, strykerConfig, summaryMarkdown, testPlans };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cost plan of a selection. Stryker makes a plan of the mutants after the run of the tests without mutants. The
|
|
3
|
+
* reporter `rigor-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
|
+
/** The name of the file of the plan, in the folder of the JSON report. */
|
|
9
|
+
declare const PLAN_FILE = "plan.json";
|
|
10
|
+
/**
|
|
11
|
+
* The default planned net time of one minute of the clock. In a nightly run of Vex (GitHub Actions, 2 test processes),
|
|
12
|
+
* the mutants that ended had 9.8 to 11.7 times the planned time of their clock. The lower value gives the longer estimate.
|
|
13
|
+
*/
|
|
14
|
+
declare const PLAN_PER_CLOCK = 9.8;
|
|
15
|
+
/** The default target of the estimate of a selection, in minutes. A slow runner then ends a job of 150 minutes. */
|
|
16
|
+
declare const TARGET_MINUTES = 100;
|
|
17
|
+
/**
|
|
18
|
+
* The default stop of the estimate of a selection, in minutes. A selection over it does not end before the limit of the
|
|
19
|
+
* job, so it cannot give a full score. The estimate has an error of 28 minutes in the mean, so the target only warns.
|
|
20
|
+
*/
|
|
21
|
+
declare const STOP_MINUTES = 140;
|
|
22
|
+
/** The parts of a plan of Stryker for one mutant that the reporter reads. */
|
|
23
|
+
interface PlanOfMutant {
|
|
24
|
+
readonly plan: string;
|
|
25
|
+
readonly mutant: {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly fileName: string;
|
|
28
|
+
readonly static?: boolean;
|
|
29
|
+
/** The start of the mutant. In a plan, Stryker counts the lines from 0. */
|
|
30
|
+
readonly location?: {
|
|
31
|
+
readonly start: {
|
|
32
|
+
readonly line: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly netTime?: number;
|
|
37
|
+
/** The tests that Stryker starts for the mutant. With no filter, Stryker starts all tests, as for a static mutant. */
|
|
38
|
+
readonly runOptions?: {
|
|
39
|
+
readonly timeout?: number;
|
|
40
|
+
readonly testFilter?: readonly string[];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The parts of a test of the run without mutants that the reporter reads. */
|
|
44
|
+
interface TestOfDryRun {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly fileName?: string;
|
|
48
|
+
readonly timeSpentMs: number;
|
|
49
|
+
}
|
|
50
|
+
/** 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. */
|
|
51
|
+
type LinePlan = readonly [line: number, runs: number, staticRuns: number, netMs: number];
|
|
52
|
+
/** The plan of one file of a selection. */
|
|
53
|
+
interface FilePlan {
|
|
54
|
+
/** The mutants of the file, with the mutants that have an early result. */
|
|
55
|
+
readonly mutants: number;
|
|
56
|
+
readonly runs: number;
|
|
57
|
+
readonly static: number;
|
|
58
|
+
readonly netMs: number;
|
|
59
|
+
readonly limitMs: number;
|
|
60
|
+
/** The plan of each line with a run, in the order of the lines. */
|
|
61
|
+
readonly lines: readonly LinePlan[];
|
|
62
|
+
}
|
|
63
|
+
/** The plan of one test: its name, its file, its time without mutants, the runs that start it, and their product. */
|
|
64
|
+
type TestPlan = readonly [name: string, file: string, ms: number, runs: number, costMs: number];
|
|
65
|
+
/** The content of `plan.json`. The paths of the files are from the folder where Stryker starts. */
|
|
66
|
+
interface SelectionPlan {
|
|
67
|
+
readonly files: Readonly<Record<string, FilePlan>>;
|
|
68
|
+
readonly tests: readonly TestPlan[];
|
|
69
|
+
}
|
|
70
|
+
/** This function gives the plan of each file: its mutants, the mutants that Stryker starts, and their planned times. */
|
|
71
|
+
declare function filePlans(plans: readonly PlanOfMutant[], path?: (fileName: string) => string): Record<string, FilePlan>;
|
|
72
|
+
/**
|
|
73
|
+
* This function gives the tests of the largest planned cost, the largest first. The cost of a test is its time without
|
|
74
|
+
* mutants, times the runs that start it. A test with a large cost is the first place to make the selection faster.
|
|
75
|
+
*/
|
|
76
|
+
declare function testPlans(plans: readonly PlanOfMutant[], tests: readonly TestOfDryRun[], path?: (fileName: string) => string, top?: number): TestPlan[];
|
|
77
|
+
/** This function gives the estimate of the minutes of the clock of a planned net time. */
|
|
78
|
+
declare function clockMinutes(netMs: number, planPerClock?: number): number;
|
|
79
|
+
/** The read of the plan of a selection. */
|
|
80
|
+
interface PlanRead {
|
|
81
|
+
readonly runs: number;
|
|
82
|
+
readonly static: number;
|
|
83
|
+
readonly netMs: number;
|
|
84
|
+
/** The estimate of the clock of the selection, in minutes. */
|
|
85
|
+
readonly minutes: number;
|
|
86
|
+
/** One line for a selection over its stop, and one for each file over its limit of static runs. */
|
|
87
|
+
readonly faults: readonly string[];
|
|
88
|
+
/** One line for a selection over its target and under its stop. */
|
|
89
|
+
readonly warnings: readonly string[];
|
|
90
|
+
/** The line of the plan of the selection, with its estimate. */
|
|
91
|
+
readonly line: string;
|
|
92
|
+
}
|
|
93
|
+
/** The limits of the read of a plan. */
|
|
94
|
+
interface PlanLimits {
|
|
95
|
+
readonly planPerClock?: number;
|
|
96
|
+
readonly targetMinutes?: number;
|
|
97
|
+
readonly stopMinutes?: number;
|
|
98
|
+
/** The most static runs of each file. The key `*` gives the limit of each file that the field does not name. */
|
|
99
|
+
readonly staticLimits?: Readonly<Record<string, number>>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* This function gives the faults of the static runs of a plan. A static run starts each test, so it costs the time of
|
|
103
|
+
* all tests. Code outside a function gives a static mutant.
|
|
104
|
+
*/
|
|
105
|
+
declare function staticFaults(files: Readonly<Record<string, FilePlan>>, limits?: Readonly<Record<string, number>>): string[];
|
|
106
|
+
/** This function reads the plan of a selection: its estimate of the clock, against the target and the stop, and its static runs. */
|
|
107
|
+
declare function readPlan(name: string, plan: SelectionPlan, limits?: PlanLimits): PlanRead;
|
|
108
|
+
/**
|
|
109
|
+
* This function reads the JSON of `plan.json`.
|
|
110
|
+
*
|
|
111
|
+
* @throws Error when the JSON has no object `files` or no list `tests`
|
|
112
|
+
*/
|
|
113
|
+
declare function parsePlan(json: unknown): SelectionPlan;
|
|
114
|
+
/** The name of the file of the reporter, in the folder of the JSON report. */
|
|
115
|
+
declare const PARTIAL_FILE = "partial.jsonl";
|
|
116
|
+
/** A line of `partial.jsonl`. The field `at` gives the time in milliseconds since 1970. */
|
|
117
|
+
type PartialLine = {
|
|
118
|
+
readonly event: "start";
|
|
119
|
+
readonly at: number;
|
|
120
|
+
} | {
|
|
121
|
+
readonly event: "plan";
|
|
122
|
+
readonly at: number;
|
|
123
|
+
readonly mutants: number;
|
|
124
|
+
readonly run: number;
|
|
125
|
+
} | {
|
|
126
|
+
readonly event: "mutant";
|
|
127
|
+
readonly at: number;
|
|
128
|
+
readonly file: string;
|
|
129
|
+
readonly status: string;
|
|
130
|
+
readonly statusReason?: string;
|
|
131
|
+
readonly mutatorName: string;
|
|
132
|
+
readonly line: number;
|
|
133
|
+
/** The planned net time of the mutant in milliseconds. A mutant with an early result has none. */
|
|
134
|
+
readonly netMs?: number;
|
|
135
|
+
/** The time limit of the mutant in milliseconds. A mutant that the clock stops costs this time. */
|
|
136
|
+
readonly limitMs?: number;
|
|
137
|
+
readonly static?: boolean;
|
|
138
|
+
} | {
|
|
139
|
+
readonly event: "done";
|
|
140
|
+
readonly at: number;
|
|
141
|
+
};
|
|
142
|
+
/** The parts of a Stryker mutant result that the reporter reads. */
|
|
143
|
+
interface TestedMutant {
|
|
144
|
+
readonly id?: string;
|
|
145
|
+
readonly fileName: string;
|
|
146
|
+
readonly status: string;
|
|
147
|
+
readonly statusReason?: string;
|
|
148
|
+
readonly mutatorName: string;
|
|
149
|
+
readonly location: {
|
|
150
|
+
readonly start: {
|
|
151
|
+
readonly line: number;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** The options of Stryker that the reporter reads. */
|
|
156
|
+
interface ReporterOptions {
|
|
157
|
+
readonly jsonReporter?: {
|
|
158
|
+
readonly fileName?: string;
|
|
159
|
+
};
|
|
160
|
+
/** With `stopAfterPlan` at true, the reporter stops Stryker after it writes the plan, before the first mutant. */
|
|
161
|
+
readonly rigorPartial?: {
|
|
162
|
+
readonly stopAfterPlan?: boolean;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** The reporter. Stryker gives it its options, and `now`, `cwd` and `exit` are for the tests. */
|
|
166
|
+
declare class PartialReporter {
|
|
167
|
+
static readonly inject: readonly ["options"];
|
|
168
|
+
readonly file: string;
|
|
169
|
+
/** The file of the cost plan, in the folder of the JSON report. */
|
|
170
|
+
readonly planFile: string;
|
|
171
|
+
private readonly now;
|
|
172
|
+
private readonly cwd;
|
|
173
|
+
private readonly exit;
|
|
174
|
+
private readonly stopAfterPlan;
|
|
175
|
+
private tests;
|
|
176
|
+
private runs;
|
|
177
|
+
constructor(options: ReporterOptions, now?: () => number, cwd?: string, exit?: (code: number) => void);
|
|
178
|
+
onDryRunCompleted(event: {
|
|
179
|
+
readonly result: {
|
|
180
|
+
readonly tests: readonly TestOfDryRun[];
|
|
181
|
+
};
|
|
182
|
+
}): void;
|
|
183
|
+
onMutationTestingPlanReady(event: {
|
|
184
|
+
readonly mutantPlans: readonly PlanOfMutant[];
|
|
185
|
+
}): void;
|
|
186
|
+
onMutantTested(result: TestedMutant): void;
|
|
187
|
+
onMutationTestReportReady(): void;
|
|
188
|
+
/** This function gives the path of a file from the folder where Stryker starts, with `/`. */
|
|
189
|
+
private readonly path;
|
|
190
|
+
private write;
|
|
191
|
+
}
|
|
192
|
+
/** The schema of the option of the reporter. Stryker adds it to its own schema, so the option gives no warning. */
|
|
193
|
+
declare const strykerValidationSchema: {
|
|
194
|
+
readonly $schema: "http://json-schema.org/draft-07/schema";
|
|
195
|
+
readonly type: "object";
|
|
196
|
+
readonly properties: {
|
|
197
|
+
readonly rigorPartial: {
|
|
198
|
+
readonly description: "The options of the reporter rigor-partial.";
|
|
199
|
+
readonly type: "object";
|
|
200
|
+
readonly properties: {
|
|
201
|
+
readonly stopAfterPlan: {
|
|
202
|
+
readonly description: "Stop Stryker after the reporter writes the plan.";
|
|
203
|
+
readonly type: "boolean";
|
|
204
|
+
readonly default: false;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
readonly additionalProperties: false;
|
|
208
|
+
readonly default: {};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
/** The plugins of this module, in the form of `declareClassPlugin` of `@stryker-mutator/api/plugin`. */
|
|
213
|
+
declare const strykerPlugins: readonly {
|
|
214
|
+
readonly kind: "Reporter";
|
|
215
|
+
readonly name: string;
|
|
216
|
+
readonly injectableClass: typeof PartialReporter;
|
|
217
|
+
}[];
|
|
218
|
+
export { staticFaults as C, readPlan as S, TestOfDryRun as _, strykerPlugins as a, filePlans as b, LinePlan as c, PlanLimits as d, PlanOfMutant as f, TARGET_MINUTES as g, SelectionPlan as h, ReporterOptions as i, PLAN_FILE as l, STOP_MINUTES as m, PartialLine as n, strykerValidationSchema as o, PlanRead as p, PartialReporter as r, FilePlan as s, PARTIAL_FILE as t, PLAN_PER_CLOCK as u, TestPlan as v, testPlans as w, parsePlan as x, clockMinutes as y };
|
|
219
|
+
//# sourceMappingURL=reporter-BS3LIodv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter-BS3LIodv.d.ts","names":[],"sources":["../src/plan.ts","../src/reporter.ts"],"mappings":";;;;;;;;cASa;;;;;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,OAAO,SAAS,eAAe;WAC/B,gBAAgB;;;iBAeX,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;;cCjM7B;;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"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
2
|
+
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
// src/plan.ts
|
|
4
|
+
/**
|
|
5
|
+
* The cost plan of a selection. Stryker makes a plan of the mutants after the run of the tests without mutants. The
|
|
6
|
+
* reporter `rigor-partial` writes the plan of each file and each line into `plan.json`. `plan-check` reads the file and
|
|
7
|
+
* gives the estimate of the clock of the selection. It warns of a selection over its target. It fails a selection over
|
|
8
|
+
* 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
|
|
9
|
+
* not the size of the files.
|
|
10
|
+
*/
|
|
11
|
+
/** The name of the file of the plan, in the folder of the JSON report. */
|
|
12
|
+
const PLAN_FILE = "plan.json";
|
|
13
|
+
/**
|
|
14
|
+
* The default planned net time of one minute of the clock. In a nightly run of Vex (GitHub Actions, 2 test processes),
|
|
15
|
+
* the mutants that ended had 9.8 to 11.7 times the planned time of their clock. The lower value gives the longer estimate.
|
|
16
|
+
*/
|
|
17
|
+
const PLAN_PER_CLOCK = 9.8;
|
|
18
|
+
/** The default target of the estimate of a selection, in minutes. A slow runner then ends a job of 150 minutes. */
|
|
19
|
+
const TARGET_MINUTES = 100;
|
|
20
|
+
/**
|
|
21
|
+
* The default stop of the estimate of a selection, in minutes. A selection over it does not end before the limit of the
|
|
22
|
+
* 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
|
+
const STOP_MINUTES = 140;
|
|
25
|
+
/** This function gives the planned times of each mutant that Stryker starts, by the id of the mutant. */
|
|
26
|
+
function plannedRuns(plans, path = (f) => f) {
|
|
27
|
+
const runs = /* @__PURE__ */ new Map();
|
|
28
|
+
for (const { plan, mutant, netTime, runOptions } of plans) {
|
|
29
|
+
if (plan !== "Run") continue;
|
|
30
|
+
const line = mutant.location === void 0 ? 0 : mutant.location.start.line + 1;
|
|
31
|
+
runs.set(mutant.id, {
|
|
32
|
+
file: path(mutant.fileName),
|
|
33
|
+
line,
|
|
34
|
+
static: mutant.static === true,
|
|
35
|
+
netMs: Math.round(netTime ?? 0),
|
|
36
|
+
limitMs: Math.round(runOptions?.timeout ?? 0)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return runs;
|
|
40
|
+
}
|
|
41
|
+
/** This function gives the plan of each file: its mutants, the mutants that Stryker starts, and their planned times. */
|
|
42
|
+
function filePlans(plans, path = (f) => f) {
|
|
43
|
+
const runs = plannedRuns(plans, path);
|
|
44
|
+
const files = /* @__PURE__ */ new Map();
|
|
45
|
+
for (const { mutant } of plans) {
|
|
46
|
+
const file = path(mutant.fileName);
|
|
47
|
+
const row = files.get(file) ?? {
|
|
48
|
+
mutants: 0,
|
|
49
|
+
runs: 0,
|
|
50
|
+
static: 0,
|
|
51
|
+
netMs: 0,
|
|
52
|
+
limitMs: 0,
|
|
53
|
+
byLine: /* @__PURE__ */ new Map()
|
|
54
|
+
};
|
|
55
|
+
files.set(file, row);
|
|
56
|
+
row.mutants += 1;
|
|
57
|
+
const run = runs.get(mutant.id);
|
|
58
|
+
if (run === void 0) continue;
|
|
59
|
+
row.runs += 1;
|
|
60
|
+
row.static += run.static ? 1 : 0;
|
|
61
|
+
row.netMs += run.netMs;
|
|
62
|
+
row.limitMs += run.limitMs;
|
|
63
|
+
const line = row.byLine.get(run.line) ?? [
|
|
64
|
+
run.line,
|
|
65
|
+
0,
|
|
66
|
+
0,
|
|
67
|
+
0
|
|
68
|
+
];
|
|
69
|
+
line[1] += 1;
|
|
70
|
+
line[2] += run.static ? 1 : 0;
|
|
71
|
+
line[3] += run.netMs;
|
|
72
|
+
row.byLine.set(run.line, line);
|
|
73
|
+
}
|
|
74
|
+
const plan = ({ byLine, ...row }) => ({
|
|
75
|
+
...row,
|
|
76
|
+
lines: [...byLine.values()].toSorted((a, b) => a[0] - b[0])
|
|
77
|
+
});
|
|
78
|
+
return Object.fromEntries([...files].toSorted(([a], [b]) => a.localeCompare(b)).map(([file, row]) => [file, plan(row)]));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* This function gives the tests of the largest planned cost, the largest first. The cost of a test is its time without
|
|
82
|
+
* mutants, times the runs that start it. A test with a large cost is the first place to make the selection faster.
|
|
83
|
+
*/
|
|
84
|
+
function testPlans(plans, tests, path = (f) => f, top = 40) {
|
|
85
|
+
const runs = new Map(tests.map((test) => [test.id, 0]));
|
|
86
|
+
let all = 0;
|
|
87
|
+
for (const { plan, runOptions } of plans) {
|
|
88
|
+
if (plan !== "Run") continue;
|
|
89
|
+
if (runOptions?.testFilter === void 0) all += 1;
|
|
90
|
+
else for (const id of runOptions.testFilter) runs.set(id, (runs.get(id) ?? 0) + 1);
|
|
91
|
+
}
|
|
92
|
+
return tests.map((test) => {
|
|
93
|
+
const count = (runs.get(test.id) ?? 0) + all;
|
|
94
|
+
return [
|
|
95
|
+
test.name,
|
|
96
|
+
test.fileName === void 0 ? "" : path(test.fileName),
|
|
97
|
+
Math.round(test.timeSpentMs),
|
|
98
|
+
count,
|
|
99
|
+
Math.round(count * test.timeSpentMs)
|
|
100
|
+
];
|
|
101
|
+
}).toSorted((a, b) => b[4] - a[4] || a[0].localeCompare(b[0])).slice(0, top);
|
|
102
|
+
}
|
|
103
|
+
/** This function gives the estimate of the minutes of the clock of a planned net time. */
|
|
104
|
+
function clockMinutes(netMs, planPerClock = PLAN_PER_CLOCK) {
|
|
105
|
+
return netMs / planPerClock / 6e4;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* This function gives the faults of the static runs of a plan. A static run starts each test, so it costs the time of
|
|
109
|
+
* all tests. Code outside a function gives a static mutant.
|
|
110
|
+
*/
|
|
111
|
+
function staticFaults(files, limits = {}) {
|
|
112
|
+
return Object.entries(files).flatMap(([file, plan]) => {
|
|
113
|
+
const limit = limits[file] ?? limits["*"];
|
|
114
|
+
if (limit === void 0 || plan.static <= limit) return [];
|
|
115
|
+
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.`];
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** This function reads the plan of a selection: its estimate of the clock, against the target and the stop, and its static runs. */
|
|
119
|
+
function readPlan(name, plan, limits = {}) {
|
|
120
|
+
const rows = Object.values(plan.files);
|
|
121
|
+
const sum = (key) => rows.reduce((n, row) => n + row[key], 0);
|
|
122
|
+
const minutes = clockMinutes(sum("netMs"), limits.planPerClock);
|
|
123
|
+
const target = limits.targetMinutes ?? 100;
|
|
124
|
+
const stop = limits.stopMinutes ?? 140;
|
|
125
|
+
const estimate = `${name}: the estimate of ${minutes.toFixed(0)} minutes`;
|
|
126
|
+
const line = `${`${name}: ${String(sum("runs"))} runs, ${String(sum("static"))} of them static, with a planned net time of ${(sum("netMs") / 36e5).toFixed(1)} h.`} The estimate is ${minutes.toFixed(0)} minutes of the clock, the target is ${String(target)} and the stop is ${String(stop)}.`;
|
|
127
|
+
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.`] : [];
|
|
128
|
+
const warnings = minutes > target && minutes <= stop ? [`${estimate} is over the target of ${String(target)}. Cut the selection into more parts.`] : [];
|
|
129
|
+
return {
|
|
130
|
+
runs: sum("runs"),
|
|
131
|
+
static: sum("static"),
|
|
132
|
+
netMs: sum("netMs"),
|
|
133
|
+
minutes,
|
|
134
|
+
faults: [...overStop, ...staticFaults(plan.files, limits.staticLimits)],
|
|
135
|
+
warnings,
|
|
136
|
+
line
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* This function reads the JSON of `plan.json`.
|
|
141
|
+
*
|
|
142
|
+
* @throws Error when the JSON has no object `files` or no list `tests`
|
|
143
|
+
*/
|
|
144
|
+
function parsePlan(json) {
|
|
145
|
+
const plan = json;
|
|
146
|
+
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"`);
|
|
147
|
+
return plan;
|
|
148
|
+
}
|
|
149
|
+
// src/reporter.ts
|
|
150
|
+
/**
|
|
151
|
+
* The Stryker reporter `rigor-partial`. It appends the plan and each tested mutant to `partial.jsonl`, next to the JSON
|
|
152
|
+
* report, at the time of each event. When a time limit stops Stryker, `scores` reads this file for a partial score. It
|
|
153
|
+
* also writes the cost plan into `plan.json`, and with `rigorPartial.stopAfterPlan` it stops Stryker after the plan.
|
|
154
|
+
*/
|
|
155
|
+
/** The name of the file of the reporter, in the folder of the JSON report. */
|
|
156
|
+
const PARTIAL_FILE = "partial.jsonl";
|
|
157
|
+
/** The reporter. Stryker gives it its options, and `now`, `cwd` and `exit` are for the tests. */
|
|
158
|
+
var PartialReporter = class {
|
|
159
|
+
static inject = ["options"];
|
|
160
|
+
file;
|
|
161
|
+
/** The file of the cost plan, in the folder of the JSON report. */
|
|
162
|
+
planFile;
|
|
163
|
+
now;
|
|
164
|
+
cwd;
|
|
165
|
+
exit;
|
|
166
|
+
stopAfterPlan;
|
|
167
|
+
tests = [];
|
|
168
|
+
runs = /* @__PURE__ */ new Map();
|
|
169
|
+
constructor(options, now = Date.now, cwd = process.cwd(), exit = (code) => process.exit(code)) {
|
|
170
|
+
this.now = now;
|
|
171
|
+
this.cwd = cwd;
|
|
172
|
+
this.exit = exit;
|
|
173
|
+
this.stopAfterPlan = options.rigorPartial?.stopAfterPlan === true;
|
|
174
|
+
const dir = join(cwd, dirname(options.jsonReporter?.fileName ?? "reports/mutation/mutation.json"));
|
|
175
|
+
this.file = join(dir, PARTIAL_FILE);
|
|
176
|
+
this.planFile = join(dir, PLAN_FILE);
|
|
177
|
+
mkdirSync(dir, { recursive: true });
|
|
178
|
+
writeFileSync(this.file, "");
|
|
179
|
+
this.write({
|
|
180
|
+
event: "start",
|
|
181
|
+
at: this.now()
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
onDryRunCompleted(event) {
|
|
185
|
+
this.tests = event.result.tests;
|
|
186
|
+
}
|
|
187
|
+
onMutationTestingPlanReady(event) {
|
|
188
|
+
const plans = event.mutantPlans;
|
|
189
|
+
this.write({
|
|
190
|
+
event: "plan",
|
|
191
|
+
at: this.now(),
|
|
192
|
+
mutants: plans.length,
|
|
193
|
+
run: plans.filter((p) => p.plan === "Run").length
|
|
194
|
+
});
|
|
195
|
+
this.runs = plannedRuns(plans, this.path);
|
|
196
|
+
writeFileSync(this.planFile, `${JSON.stringify({
|
|
197
|
+
files: filePlans(plans, this.path),
|
|
198
|
+
tests: testPlans(plans, this.tests, this.path)
|
|
199
|
+
}, null, 2)}\n`);
|
|
200
|
+
if (this.stopAfterPlan) this.exit(0);
|
|
201
|
+
}
|
|
202
|
+
onMutantTested(result) {
|
|
203
|
+
const reason = result.statusReason === void 0 ? {} : { statusReason: result.statusReason };
|
|
204
|
+
const run = result.id === void 0 ? void 0 : this.runs.get(result.id);
|
|
205
|
+
const planned = run === void 0 ? {} : {
|
|
206
|
+
netMs: run.netMs,
|
|
207
|
+
limitMs: run.limitMs,
|
|
208
|
+
static: run.static
|
|
209
|
+
};
|
|
210
|
+
this.write({
|
|
211
|
+
event: "mutant",
|
|
212
|
+
at: this.now(),
|
|
213
|
+
file: this.path(result.fileName),
|
|
214
|
+
status: result.status,
|
|
215
|
+
...reason,
|
|
216
|
+
mutatorName: result.mutatorName,
|
|
217
|
+
line: result.location.start.line,
|
|
218
|
+
...planned
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
onMutationTestReportReady() {
|
|
222
|
+
this.write({
|
|
223
|
+
event: "done",
|
|
224
|
+
at: this.now()
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/** This function gives the path of a file from the folder where Stryker starts, with `/`. */
|
|
228
|
+
path = (fileName) => relative(this.cwd, fileName).split(sep).join("/");
|
|
229
|
+
write(line) {
|
|
230
|
+
appendFileSync(this.file, `${JSON.stringify(line)}\n`);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
/** The schema of the option of the reporter. Stryker adds it to its own schema, so the option gives no warning. */
|
|
234
|
+
const strykerValidationSchema = {
|
|
235
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
236
|
+
type: "object",
|
|
237
|
+
properties: { rigorPartial: {
|
|
238
|
+
description: "The options of the reporter rigor-partial.",
|
|
239
|
+
type: "object",
|
|
240
|
+
properties: { stopAfterPlan: {
|
|
241
|
+
description: "Stop Stryker after the reporter writes the plan.",
|
|
242
|
+
type: "boolean",
|
|
243
|
+
default: false
|
|
244
|
+
} },
|
|
245
|
+
additionalProperties: false,
|
|
246
|
+
default: {}
|
|
247
|
+
} }
|
|
248
|
+
};
|
|
249
|
+
/** The plugins of this module, in the form of `declareClassPlugin` of `@stryker-mutator/api/plugin`. */
|
|
250
|
+
const strykerPlugins = [{
|
|
251
|
+
kind: "Reporter",
|
|
252
|
+
name: "rigor-partial",
|
|
253
|
+
injectableClass: PartialReporter
|
|
254
|
+
}];
|
|
255
|
+
export { PLAN_FILE as a, TARGET_MINUTES as c, parsePlan as d, readPlan as f, strykerValidationSchema as i, clockMinutes as l, testPlans as m, PartialReporter as n, PLAN_PER_CLOCK as o, staticFaults as p, strykerPlugins as r, STOP_MINUTES as s, PARTIAL_FILE as t, filePlans as u };
|
|
256
|
+
|
|
257
|
+
//# sourceMappingURL=reporter-BYC384h-.js.map
|