peaks-loop-mut 0.1.80 → 0.1.81
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/dist/services/mut/mut-runner.d.ts +3 -0
- package/dist/services/mut/mut-runner.d.ts.map +1 -1
- package/dist/services/mut/mut-runner.js +17 -9
- package/dist/services/mut/production-stryker.d.ts.map +1 -1
- package/dist/services/mut/production-stryker.js +42 -4
- package/dist/services/mut/stryker-options.d.ts +22 -0
- package/dist/services/mut/stryker-options.d.ts.map +1 -1
- package/dist/services/mut/stryker-options.js +28 -1
- package/package.json +1 -1
|
@@ -36,6 +36,8 @@ export interface StrykerInvokerInput {
|
|
|
36
36
|
readonly testFiles: ReadonlyArray<string>;
|
|
37
37
|
/** Source patterns to mutate. Empty means "let the project config decide". */
|
|
38
38
|
readonly mutate?: ReadonlyArray<string>;
|
|
39
|
+
/** Patterns NOT to copy into the Stryker sandbox. Empty means "copy all". */
|
|
40
|
+
readonly ignorePatterns?: ReadonlyArray<string>;
|
|
39
41
|
readonly tsconfigFile?: string;
|
|
40
42
|
readonly timeoutMs?: number;
|
|
41
43
|
readonly concurrency?: number;
|
|
@@ -45,6 +47,7 @@ export interface RunMutationInput {
|
|
|
45
47
|
readonly project: string;
|
|
46
48
|
readonly testFiles: ReadonlyArray<string>;
|
|
47
49
|
readonly mutate?: ReadonlyArray<string>;
|
|
50
|
+
readonly ignorePatterns?: ReadonlyArray<string>;
|
|
48
51
|
readonly tsconfigFile?: string;
|
|
49
52
|
readonly timeoutMs?: number;
|
|
50
53
|
readonly concurrency?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mut-runner.d.ts","sourceRoot":"","sources":["../../../src/services/mut/mut-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY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CAAC,CAAC;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEtF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+BrF"}
|
|
@@ -5,6 +5,7 @@ export async function runMutation(input) {
|
|
|
5
5
|
project: input.project,
|
|
6
6
|
testFiles: input.testFiles,
|
|
7
7
|
mutate: input.mutate,
|
|
8
|
+
ignorePatterns: input.ignorePatterns,
|
|
8
9
|
tsconfigFile: input.tsconfigFile,
|
|
9
10
|
timeoutMs: input.timeoutMs,
|
|
10
11
|
concurrency: input.concurrency
|
|
@@ -31,18 +32,25 @@ export async function runMutation(input) {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
|
-
* Wrap an invoker failure while KEEPING its machine-readable `code
|
|
35
|
-
* The production invoker raises named codes
|
|
36
|
-
* `MUT_NO_MUTANTS`, …) and the
|
|
37
|
-
*
|
|
35
|
+
* Wrap an invoker failure while KEEPING its machine-readable `code` and its
|
|
36
|
+
* `details`. The production invoker raises named codes
|
|
37
|
+
* (`MUT_TOOLCHAIN_UNAVAILABLE`, `MUT_NO_MUTANTS`, …) and attaches the
|
|
38
|
+
* captured Stryker log as `details.strykerLog`; the CLI envelope must surface
|
|
39
|
+
* both instead of collapsing every failure into one anonymous message.
|
|
38
40
|
*/
|
|
39
41
|
function wrapInvocationError(err) {
|
|
40
42
|
const message = err instanceof Error ? err.message : String(err);
|
|
41
|
-
const wrapped = new Error(`Stryker invocation failed: ${message}
|
|
42
|
-
if (err && typeof err === 'object'
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const wrapped = new Error(`Stryker invocation failed: ${message}`, { cause: err });
|
|
44
|
+
if (err && typeof err === 'object') {
|
|
45
|
+
if ('code' in err) {
|
|
46
|
+
const code = err.code;
|
|
47
|
+
if (typeof code === 'string') {
|
|
48
|
+
wrapped.code = code;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const details = err.details;
|
|
52
|
+
if (details && typeof details === 'object') {
|
|
53
|
+
wrapped.details = details;
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
return wrapped;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production-stryker.d.ts","sourceRoot":"","sources":["../../../src/services/mut/production-stryker.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAUzE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC;AAY9C,wBAAgB,8BAA8B,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"production-stryker.d.ts","sourceRoot":"","sources":["../../../src/services/mut/production-stryker.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAUzE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC;AAY9C,wBAAgB,8BAA8B,IAAI,cAAc,CAkD/D"}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* codes), `stryker-plugin.ts` (the plugin path) and `stryker-result.ts`
|
|
36
36
|
* (the report shaping). The names THIS module exports are unchanged.
|
|
37
37
|
*/
|
|
38
|
-
import { existsSync } from 'node:fs';
|
|
38
|
+
import { existsSync, readFileSync, rmSync, statSync } from 'node:fs';
|
|
39
39
|
import { resolve } from 'node:path';
|
|
40
40
|
import { MUT_ERROR_CODES, MutToolchainError } from './stryker-errors.js';
|
|
41
41
|
import { buildStrykerOptions, STRYKER_DEFAULTS } from './stryker-options.js';
|
|
@@ -75,8 +75,13 @@ export function createProductionStrykerInvoker() {
|
|
|
75
75
|
project,
|
|
76
76
|
mutate: input.mutate,
|
|
77
77
|
testFiles: input.testFiles,
|
|
78
|
+
ignorePatterns: input.ignorePatterns,
|
|
78
79
|
pluginDescriptors,
|
|
79
80
|
tsconfigFile: input.tsconfigFile,
|
|
81
|
+
// The console log stays 'off' (stdout belongs to --json), so this is
|
|
82
|
+
// the ONLY channel that records WHY Stryker failed. `runInProject`
|
|
83
|
+
// removes the file again unless the project already had one.
|
|
84
|
+
fileLogLevel: STRYKER_DEFAULTS.diagnosticFileLogLevel,
|
|
80
85
|
...projectOwned
|
|
81
86
|
});
|
|
82
87
|
const mutants = await runInProject(project, options);
|
|
@@ -108,23 +113,51 @@ function hasProjectStrykerConfig(project) {
|
|
|
108
113
|
/**
|
|
109
114
|
* Run Stryker with the project as the CWD, restoring the previous CWD
|
|
110
115
|
* afterwards. Serialised so concurrent invocations cannot interleave.
|
|
116
|
+
*
|
|
117
|
+
* THE FILE LOG. Stryker writes its file log to `stryker.log` in the CWD,
|
|
118
|
+
* which is the project root for the duration of the run (the path is fixed
|
|
119
|
+
* in `core/logging/logging-backend.js`). The console level is `off`, so that
|
|
120
|
+
* file is the only record of the real failure reason — `Something went wrong
|
|
121
|
+
* in the initial test run` is thrown bare. So on failure the bytes this run
|
|
122
|
+
* appended are read into the error's `details`, and unless the project
|
|
123
|
+
* ALREADY had a `stryker.log` (a developer's own), the file is removed
|
|
124
|
+
* afterwards so the working tree is left as it was found.
|
|
111
125
|
*/
|
|
112
126
|
async function runInProject(project, options) {
|
|
113
127
|
return runExclusive(async () => {
|
|
114
128
|
const previousCwd = process.cwd();
|
|
129
|
+
const logPath = resolve(project, 'stryker.log');
|
|
130
|
+
const logExistedBefore = existsSync(logPath);
|
|
131
|
+
const logBytesBefore = logExistedBefore ? statSync(logPath).size : 0;
|
|
115
132
|
try {
|
|
116
133
|
process.chdir(project);
|
|
117
134
|
const Stryker = (await import('@stryker-mutator/core')).Stryker;
|
|
118
135
|
return await new Stryker(options).runMutationTest();
|
|
119
136
|
}
|
|
120
137
|
catch (err) {
|
|
121
|
-
throw toMutError(err);
|
|
138
|
+
throw toMutError(err, readLogSince(logPath, logBytesBefore));
|
|
122
139
|
}
|
|
123
140
|
finally {
|
|
124
141
|
process.chdir(previousCwd);
|
|
142
|
+
if (!logExistedBefore) {
|
|
143
|
+
rmSync(logPath, { force: true });
|
|
144
|
+
}
|
|
125
145
|
}
|
|
126
146
|
});
|
|
127
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* The part of `stryker.log` this run wrote. The file is APPENDED to, so a
|
|
150
|
+
* project that already had one keeps its older lines out of the diagnostic.
|
|
151
|
+
* A missing file is not an error — it only means nothing was logged.
|
|
152
|
+
*/
|
|
153
|
+
function readLogSince(logPath, offset) {
|
|
154
|
+
try {
|
|
155
|
+
return readFileSync(logPath).subarray(offset).toString('utf8');
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
128
161
|
/** Queue a unit of work so only one Stryker run owns the CWD at a time. */
|
|
129
162
|
function runExclusive(fn) {
|
|
130
163
|
const result = runQueue.then(fn, fn);
|
|
@@ -132,12 +165,17 @@ function runExclusive(fn) {
|
|
|
132
165
|
return result;
|
|
133
166
|
}
|
|
134
167
|
/** Map a Stryker failure onto a named error code. */
|
|
135
|
-
function toMutError(err) {
|
|
168
|
+
function toMutError(err, strykerLog) {
|
|
136
169
|
if (err instanceof MutToolchainError) {
|
|
137
170
|
return err;
|
|
138
171
|
}
|
|
139
172
|
const message = err instanceof Error ? err.message : String(err);
|
|
140
|
-
return new MutToolchainError(classifyStrykerFailure(message), message, {
|
|
173
|
+
return new MutToolchainError(classifyStrykerFailure(message), message, {
|
|
174
|
+
cause: err,
|
|
175
|
+
// Only present when Stryker wrote something — an empty entry would make
|
|
176
|
+
// the caller think a log exists when it does not.
|
|
177
|
+
...(strykerLog.trim().length > 0 ? { details: { strykerLog } } : {})
|
|
178
|
+
});
|
|
141
179
|
}
|
|
142
180
|
/** A missing plugin / package / runner is a toolchain problem, not a generic failure. */
|
|
143
181
|
function classifyStrykerFailure(message) {
|
|
@@ -43,6 +43,21 @@ export declare const STRYKER_DEFAULTS: {
|
|
|
43
43
|
readonly logLevel: "off";
|
|
44
44
|
readonly fileLogLevel: "off";
|
|
45
45
|
readonly allowConsoleColors: false;
|
|
46
|
+
/** The caller's sandbox-ignore list is opt-in, so the default is empty. */
|
|
47
|
+
readonly ignorePatterns: ReadonlyArray<string>;
|
|
48
|
+
/**
|
|
49
|
+
* ALWAYS ignored, whatever the caller asked for: Stryker copies the
|
|
50
|
+
* project into `.stryker-tmp/sandbox-*`, so a sandbox directory that is
|
|
51
|
+
* itself copied is a copy of the sandbox into itself.
|
|
52
|
+
*/
|
|
53
|
+
readonly alwaysIgnoredPatterns: ReadonlyArray<string>;
|
|
54
|
+
/**
|
|
55
|
+
* The file-log level the PRODUCTION invoker turns on while a run is in
|
|
56
|
+
* flight (`production-stryker.ts` reads it). The console level stays
|
|
57
|
+
* `off` — stdout is reserved for the `--json` envelope — so the file log
|
|
58
|
+
* is the only place Stryker's real failure reason is written down.
|
|
59
|
+
*/
|
|
60
|
+
readonly diagnosticFileLogLevel: "debug";
|
|
46
61
|
};
|
|
47
62
|
export interface StrykerOptionsInput {
|
|
48
63
|
/** Project root — the scope of the mutation run. */
|
|
@@ -51,6 +66,12 @@ export interface StrykerOptionsInput {
|
|
|
51
66
|
readonly mutate?: ReadonlyArray<string>;
|
|
52
67
|
/** Test files to run. Empty means "let the runner discover them". */
|
|
53
68
|
readonly testFiles?: ReadonlyArray<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Patterns NOT to copy into the Stryker sandbox. Empty by default.
|
|
71
|
+
* Passed through verbatim (Stryker's own glob semantics) and always
|
|
72
|
+
* extended with the patterns in `STRYKER_DEFAULTS.alwaysIgnoredPatterns`.
|
|
73
|
+
*/
|
|
74
|
+
readonly ignorePatterns?: ReadonlyArray<string>;
|
|
54
75
|
/** Absolute paths (or file URLs) of Stryker plugins to load. */
|
|
55
76
|
readonly pluginDescriptors?: ReadonlyArray<string>;
|
|
56
77
|
readonly tsconfigFile?: string;
|
|
@@ -58,6 +79,7 @@ export interface StrykerOptionsInput {
|
|
|
58
79
|
readonly concurrency?: number;
|
|
59
80
|
readonly testRunner?: string;
|
|
60
81
|
readonly coverageAnalysis?: string;
|
|
82
|
+
readonly fileLogLevel?: string;
|
|
61
83
|
}
|
|
62
84
|
export interface BuiltStrykerOptions {
|
|
63
85
|
readonly options: StrykerCliOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stryker-options.d.ts","sourceRoot":"","sources":["../../../src/services/mut/stryker-options.ts"],"names":[],"mappings":"AAsEA,OA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STRYKER_DEFAULTS = {
|
|
|
77
77
|
reporters: [],
|
|
78
78
|
logLevel: 'off',
|
|
79
79
|
fileLogLevel: 'off',
|
|
80
|
-
allowConsoleColors: false
|
|
80
|
+
allowConsoleColors: false,
|
|
81
|
+
/** The caller's sandbox-ignore list is opt-in, so the default is empty. */
|
|
82
|
+
ignorePatterns: [],
|
|
83
|
+
/**
|
|
84
|
+
* ALWAYS ignored, whatever the caller asked for: Stryker copies the
|
|
85
|
+
* project into `.stryker-tmp/sandbox-*`, so a sandbox directory that is
|
|
86
|
+
* itself copied is a copy of the sandbox into itself.
|
|
87
|
+
*/
|
|
88
|
+
alwaysIgnoredPatterns: ['.stryker-tmp'],
|
|
89
|
+
/**
|
|
90
|
+
* The file-log level the PRODUCTION invoker turns on while a run is in
|
|
91
|
+
* flight (`production-stryker.ts` reads it). The console level stays
|
|
92
|
+
* `off` — stdout is reserved for the `--json` envelope — so the file log
|
|
93
|
+
* is the only place Stryker's real failure reason is written down.
|
|
94
|
+
*/
|
|
95
|
+
diagnosticFileLogLevel: 'debug'
|
|
81
96
|
};
|
|
82
97
|
/**
|
|
83
98
|
* Build the Stryker options for one mutation run.
|
|
@@ -105,6 +120,13 @@ export function buildStrykerOptions(input) {
|
|
|
105
120
|
// related-mode narrowing discard it. See the module header.
|
|
106
121
|
options.vitest = { related: false };
|
|
107
122
|
}
|
|
123
|
+
// Verbatim, like `mutate`: these are Stryker globs, not file paths.
|
|
124
|
+
// `.stryker-tmp` is appended unconditionally (see STRYKER_DEFAULTS).
|
|
125
|
+
options.ignorePatterns = [
|
|
126
|
+
...STRYKER_DEFAULTS.ignorePatterns,
|
|
127
|
+
...(input.ignorePatterns ?? []),
|
|
128
|
+
...STRYKER_DEFAULTS.alwaysIgnoredPatterns
|
|
129
|
+
];
|
|
108
130
|
if (pluginDescriptors.length > 0) {
|
|
109
131
|
// `appendPlugins` (not `plugins`) so a project `stryker.conf.js` keeps
|
|
110
132
|
// its own plugin list; ours is added on top.
|
|
@@ -142,6 +164,11 @@ function applyCallerOwnedOptions(options, input) {
|
|
|
142
164
|
if (input.tsconfigFile) {
|
|
143
165
|
options.tsconfigFile = input.tsconfigFile;
|
|
144
166
|
}
|
|
167
|
+
if (input.fileLogLevel) {
|
|
168
|
+
// The production invoker raises this to capture Stryker's own reason
|
|
169
|
+
// when a run fails; the console level stays untouched.
|
|
170
|
+
options.fileLogLevel = input.fileLogLevel;
|
|
171
|
+
}
|
|
145
172
|
}
|
|
146
173
|
/**
|
|
147
174
|
* Narrow the built options back to the type `new Stryker(...)` accepts.
|