@systemfsoftware/stryker-js 4.0.0 → 6.0.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +3 -15
  3. package/README.md +172 -13
  4. package/dist/Plugins-DF95m9KO.d.mts +1400 -0
  5. package/dist/builtin-reporters-BqePgAN0.mjs +671 -0
  6. package/dist/builtin-reporters.d.mts +312 -0
  7. package/dist/builtin-reporters.mjs +3 -0
  8. package/dist/compiler-Bq9Nelu8.mjs +48406 -0
  9. package/dist/compiler-C8aLIb5U.mjs +48406 -0
  10. package/dist/config.d.mts +12 -0
  11. package/dist/config.mjs +7 -0
  12. package/dist/dist-B3nT7z4G.mjs +5155 -0
  13. package/dist/dist-CWbipfGB.mjs +711 -0
  14. package/dist/execAsync-CfPZgJSD.mjs +10 -0
  15. package/dist/execAsync-DdCu5QLN.mjs +10 -0
  16. package/dist/getMachineId-bsd-C6bLIaiv.mjs +27 -0
  17. package/dist/getMachineId-bsd-CXSiHDga.mjs +27 -0
  18. package/dist/getMachineId-darwin-D3cIKeqx.mjs +24 -0
  19. package/dist/getMachineId-darwin-DPZ0kdKD.mjs +24 -0
  20. package/dist/getMachineId-linux-CQwLSlZk.mjs +20 -0
  21. package/dist/getMachineId-linux-Ci8OVJU0.mjs +20 -0
  22. package/dist/getMachineId-unsupported-PX0hnW6X.mjs +15 -0
  23. package/dist/getMachineId-unsupported-_ExL3Avl.mjs +15 -0
  24. package/dist/getMachineId-win-BCsS9pC_.mjs +26 -0
  25. package/dist/getMachineId-win-D9Tb0p7w.mjs +26 -0
  26. package/dist/index-BInJWa0x.d.mts +1148 -0
  27. package/dist/index.d.mts +2570 -938
  28. package/dist/index.mjs +4 -1034
  29. package/dist/main.mjs +102939 -0
  30. package/dist/merge-config-BrrNQWje.mjs +16 -0
  31. package/dist/mutation-test.cell-Cw1ZzDnb.d.mts +561 -0
  32. package/dist/output-mode-CfGHDpi5.d.mts +17 -0
  33. package/dist/parser.wasm32-wasi.wasm +0 -0
  34. package/dist/plugin-loader.d.mts +1673 -0
  35. package/dist/plugin-loader.mjs +3 -0
  36. package/dist/plugin-worker-entry-D00fedxV.mjs +1585 -0
  37. package/dist/promises.d.mts +5 -0
  38. package/dist/promises.mjs +14 -0
  39. package/dist/rolldown-runtime-Dr7-SnC6.mjs +45 -0
  40. package/dist/rolldown-runtime-XITHOX9H.mjs +15 -0
  41. package/dist/src-fju4cI5I.mjs +12466 -0
  42. package/dist/src-js-DRK8boNV.mjs +1009 -0
  43. package/dist/stryker-config-DIGmQrm1.d.mts +14 -0
  44. package/dist/wasm-Dr7kZatW.mjs +13017 -0
  45. package/package.json +101 -39
package/dist/index.mjs CHANGED
@@ -1,1034 +1,4 @@
1
- import * as Context from "effect/Context";
2
- import * as S from "effect/Schema";
3
- import * as Match from "effect/Match";
4
- import * as Option from "effect/Option";
5
- import * as Arr from "effect/Array";
6
- import * as Predicate from "effect/Predicate";
7
- import * as Layer from "effect/Layer";
8
- import * as MutableHashMap from "effect/MutableHashMap";
9
- import * as Effect$1 from "effect/Effect";
10
- import * as Exit from "effect/Exit";
11
- import * as Result from "effect/Result";
12
- import { Effect } from "effect";
13
- //#region src/Checker.schema.ts
14
- const CheckStatus = S.Literals(["passed", "compileError"]);
15
- const CheckResultSchema = S.Union([S.Struct({ status: S.Literal("passed") }), S.Struct({
16
- status: S.Literal("compileError"),
17
- reason: S.String
18
- })]);
19
- var CheckerFailed = class extends S.TaggedError()("CheckerFailed", {
20
- cause: S.String,
21
- checkerName: S.String,
22
- mutantIds: S.Array(S.String)
23
- }) {};
24
- //#endregion
25
- //#region src/Checker.ts
26
- var Checker = class extends Context.Service()("~@systemfsoftware/stryker-js/Checker") {};
27
- //#endregion
28
- //#region src/Evaluator.schema.ts
29
- var EvaluatorFailed = class extends S.TaggedError()("EvaluatorFailed", { cause: S.Unknown }) {};
30
- //#endregion
31
- //#region src/Evaluator.ts
32
- var Evaluator = class extends Context.Service()("~@systemfsoftware/stryker-js/Evaluator") {};
33
- //#endregion
34
- //#region src/ExitClass.schema.ts
35
- const ExitClass = S.Literals([
36
- "VerdictFail",
37
- "ConfigError",
38
- "RuntimeError",
39
- "InternalError"
40
- ]);
41
- var ClassifyExitCommand = class extends S.TaggedClass()("ClassifyExitCommand", {
42
- pending: S.Array(ExitClass),
43
- signal: S.NullOr(S.Number),
44
- score: S.NullOr(S.Number),
45
- breakingThreshold: S.NullOr(S.Number)
46
- }) {};
47
- var ClassifyExitDecision = class extends S.TaggedClass()("ClassifyExitDecision", {
48
- highestClass: S.NullOr(ExitClass),
49
- verdictClass: S.NullOr(ExitClass)
50
- }) {};
51
- //#endregion
52
- //#region src/ExitClass.ts
53
- const EXIT_CODE = {
54
- VerdictFail: 1,
55
- ConfigError: 2,
56
- RuntimeError: 3,
57
- InternalError: 4
58
- };
59
- function highestExitClass(pending) {
60
- return Array.from(pending).reduce((incumbent, challenger) => Option.match(Option.fromNullishOr(incumbent), {
61
- onNone: () => challenger,
62
- onSome: (value) => Match.value(EXIT_CODE[value] < EXIT_CODE[challenger]).pipe(Match.when(true, () => challenger), Match.when(false, () => value), Match.exhaustive)
63
- }), null);
64
- }
65
- function resolveExitCode(pending, signal) {
66
- return Option.match(Option.fromNullishOr(signal), {
67
- onNone: () => Option.match(Option.fromNullishOr(highestExitClass(pending)), {
68
- onNone: () => 0,
69
- onSome: (exitClass) => EXIT_CODE[exitClass]
70
- }),
71
- onSome: (value) => 128 + value
72
- });
73
- }
74
- function verdictExitClass(score, breakingThreshold) {
75
- return Option.getOrNull(Option.zipWith(Option.fromNullishOr(score), Option.fromNullishOr(breakingThreshold), (value, threshold) => Match.value(value < threshold).pipe(Match.when(true, () => "VerdictFail"), Match.when(false, () => null), Match.exhaustive)));
76
- }
77
- const classifyExit = (command) => {
78
- const verdictClass = verdictExitClass(command.score, command.breakingThreshold);
79
- const highestClass = highestExitClass(Option.match(Option.fromNullishOr(verdictClass), {
80
- onNone: () => command.pending,
81
- onSome: (verdict) => Array.from(/* @__PURE__ */ new Set([...command.pending, verdict]))
82
- }));
83
- return ClassifyExitDecision.make({
84
- highestClass,
85
- verdictClass
86
- });
87
- };
88
- //#endregion
89
- //#region src/Ignorer.ts
90
- var Ignorer = class extends Context.Service()("~@systemfsoftware/stryker-js/Ignorer") {};
91
- //#endregion
92
- //#region src/Metrics.schema.ts
93
- const MetricsSchema = S.Struct({
94
- pending: S.Finite,
95
- killed: S.Finite,
96
- timeout: S.Finite,
97
- survived: S.Finite,
98
- noCoverage: S.Finite,
99
- runtimeErrors: S.Finite,
100
- compileErrors: S.Finite,
101
- ignored: S.Finite,
102
- totalDetected: S.Finite,
103
- totalUndetected: S.Finite,
104
- totalInvalid: S.Finite,
105
- totalValid: S.Finite,
106
- totalMutants: S.Finite,
107
- totalCovered: S.Finite,
108
- mutationScore: S.Finite,
109
- mutationScoreBasedOnCoveredCode: S.Finite
110
- });
111
- const MetricsResultSchema = S.Struct({
112
- name: S.String,
113
- metrics: MetricsSchema,
114
- childResults: S.Array(S.suspend(() => MetricsResultSchema))
115
- }).annotate({ identifier: "MetricsResult" });
116
- //#endregion
117
- //#region src/Metrics.ts
118
- const countStatus = (mutants, status) => mutants.filter((mutant) => mutant.status === status).length;
119
- const percentage = (numerator, denominator) => numerator / denominator * 100;
120
- /** A percentage whose denominator is zero is not 0%; `emptyDenominator` says what it is instead. */
121
- const percentOr = (emptyDenominator, numerator, denominator) => Match.value(denominator).pipe(Match.when(0, () => emptyDenominator), Match.orElse(() => percentage(numerator, denominator)));
122
- const coveredFraction = (totalDetected, totalCovered, totalValid) => Match.value(totalValid).pipe(Match.when(0, () => NaN), Match.orElse(() => percentOr(0, totalDetected, totalCovered)));
123
- const countMutants = (mutants) => {
124
- const pending = countStatus(mutants, "Pending");
125
- const killed = countStatus(mutants, "Killed");
126
- const timeout = countStatus(mutants, "Timeout");
127
- const survived = countStatus(mutants, "Survived");
128
- const noCoverage = countStatus(mutants, "NoCoverage");
129
- const runtimeErrors = countStatus(mutants, "RuntimeError");
130
- const compileErrors = countStatus(mutants, "CompileError");
131
- const ignored = countStatus(mutants, "Ignored");
132
- const totalDetected = timeout + killed;
133
- const totalUndetected = survived + noCoverage;
134
- const totalCovered = totalDetected + survived;
135
- const totalValid = totalUndetected + totalDetected;
136
- const totalInvalid = runtimeErrors + compileErrors;
137
- return {
138
- pending,
139
- killed,
140
- timeout,
141
- survived,
142
- noCoverage,
143
- runtimeErrors,
144
- compileErrors,
145
- ignored,
146
- totalDetected,
147
- totalUndetected,
148
- totalCovered,
149
- totalValid,
150
- totalInvalid,
151
- totalMutants: totalValid + totalInvalid + ignored + pending,
152
- mutationScore: percentOr(NaN, totalDetected, totalValid),
153
- mutationScoreBasedOnCoveredCode: coveredFraction(totalDetected, totalCovered, totalValid)
154
- };
155
- };
156
- const segmentOf = (fileName) => {
157
- const separator = fileName.indexOf("/");
158
- if (separator === -1) return fileName;
159
- return fileName.slice(0, separator);
160
- };
161
- const groupBySegment = (files) => Object.entries(files).reduce((groups, [fileName, file]) => {
162
- const segment = segmentOf(fileName);
163
- const group = groups[segment] ?? {};
164
- group[fileName] = file;
165
- groups[segment] = group;
166
- return groups;
167
- }, {});
168
- const metricsOf = (files) => countMutants(Object.values(files).flatMap((file) => file.mutants));
169
- const fileResultOf = (fileName, file) => ({
170
- name: fileName,
171
- metrics: countMutants(file.mutants),
172
- childResults: []
173
- });
174
- const nestedGroupResult = (segment, entries) => {
175
- const nested = Object.fromEntries(entries.map(([fileName, file]) => [fileName.slice(segment.length + 1), file]));
176
- return {
177
- name: segment,
178
- metrics: metricsOf(nested),
179
- childResults: childResultsOf(nested)
180
- };
181
- };
182
- const soleSegmentFileResult = (segment, entries) => Option.flatMap(Arr.head(entries), ([fileName, file]) => Match.value(fileName === segment && entries.length === 1).pipe(Match.when(true, () => Option.some(fileResultOf(fileName, file))), Match.orElse(() => Option.none())));
183
- const childResultOf = (segment, entries) => Option.getOrElse(soleSegmentFileResult(segment, entries), () => nestedGroupResult(segment, entries));
184
- const childResultsOf = (files) => Object.entries(groupBySegment(files)).map(([segment, grouped]) => childResultOf(segment, Object.entries(grouped))).sort((left, right) => left.name.localeCompare(right.name));
185
- const calculateMetrics = (files) => ({
186
- name: "All files",
187
- metrics: metricsOf(files),
188
- childResults: childResultsOf(files)
189
- });
190
- //#endregion
191
- //#region src/Module.ts
192
- /**
193
- * Port over the host module loader, shaped as the subset of `node:module`
194
- * feature code may use: `createRequire` and `isBuiltin`. Resolving a
195
- * specifier against a project directory, importing a plugin, and asking
196
- * whether a name is a builtin all go through this one tag; no feature module
197
- * touches the host module API. The Node implementation ships in the
198
- * composition-root package (`@systemfsoftware/stryker-js-cli`); tests that do
199
- * not need real plugin resolution substitute a layer returning fixed paths.
200
- *
201
- * @since 2.0.0
202
- */
203
- var Module = class extends Context.Service()("@systemfsoftware/stryker-js/Module") {};
204
- //#endregion
205
- //#region src/Report.schema.ts
206
- const PositionSchema = S.Struct({
207
- line: S.Finite,
208
- column: S.Finite
209
- });
210
- const LocationSchema = S.Struct({
211
- start: PositionSchema,
212
- end: PositionSchema
213
- });
214
- const OpenEndLocationSchema = S.Struct({
215
- start: PositionSchema,
216
- end: S.optional(PositionSchema)
217
- });
218
- const MutantStatusSchema = S.Literals([
219
- "Killed",
220
- "Survived",
221
- "NoCoverage",
222
- "CompileError",
223
- "RuntimeError",
224
- "Timeout",
225
- "Ignored",
226
- "Pending"
227
- ]);
228
- const MutantResultSchema = S.Struct({
229
- id: S.String,
230
- mutatorName: S.String,
231
- status: MutantStatusSchema,
232
- location: LocationSchema,
233
- replacement: S.optional(S.String),
234
- description: S.optional(S.String),
235
- statusReason: S.optional(S.String),
236
- static: S.optional(S.Boolean),
237
- coveredBy: S.optional(S.Array(S.String)),
238
- killedBy: S.optional(S.Array(S.String)),
239
- testsCompleted: S.optional(S.Finite),
240
- duration: S.optional(S.Finite)
241
- });
242
- const FileResultSchema = S.Struct({
243
- language: S.String,
244
- source: S.String,
245
- mutants: S.Array(MutantResultSchema)
246
- });
247
- const FileResultDictionarySchema = S.Record(S.String, FileResultSchema);
248
- const TestDefinitionSchema = S.Struct({
249
- id: S.String,
250
- name: S.String,
251
- location: S.optional(OpenEndLocationSchema)
252
- });
253
- const TestFileSchema = S.Struct({
254
- source: S.optional(S.String),
255
- tests: S.Array(TestDefinitionSchema)
256
- });
257
- const TestFileDefinitionDictionarySchema = S.Record(S.String, TestFileSchema);
258
- const ThresholdsSchema = S.Struct({
259
- high: S.Finite,
260
- low: S.Finite
261
- });
262
- const BrandingInformationSchema = S.Struct({
263
- homepageUrl: S.String,
264
- imageUrl: S.optional(S.String)
265
- });
266
- const DependenciesSchema = S.Record(S.String, S.String);
267
- const FrameworkInformationSchema = S.Struct({
268
- name: S.String,
269
- version: S.optional(S.String),
270
- branding: S.optional(BrandingInformationSchema),
271
- dependencies: S.optional(DependenciesSchema)
272
- });
273
- const MutationTestResultSchema = S.Struct({
274
- schemaVersion: S.String,
275
- files: FileResultDictionarySchema,
276
- thresholds: ThresholdsSchema,
277
- config: S.optional(S.Record(S.String, S.Unknown)),
278
- testFiles: S.optional(TestFileDefinitionDictionarySchema),
279
- projectRoot: S.optional(S.String),
280
- framework: S.optional(FrameworkInformationSchema)
281
- });
282
- //#endregion
283
- //#region src/Mutant.schema.ts
284
- var Mutant = class extends S.TaggedClass()("Mutant", {
285
- id: S.NonEmptyString,
286
- fileName: S.NonEmptyString,
287
- mutatorName: S.NonEmptyString,
288
- replacement: S.String,
289
- location: LocationSchema,
290
- status: S.optional(MutantStatusSchema),
291
- statusReason: S.optional(S.String),
292
- coveredBy: S.optional(S.Array(S.String)),
293
- static: S.optional(S.Boolean),
294
- testsCompleted: S.optional(S.Finite),
295
- description: S.optional(S.String)
296
- }) {};
297
- //#endregion
298
- //#region src/Mutant.ts
299
- const isMutant = (value) => value instanceof Mutant;
300
- const INSTRUMENTER_CONSTANTS = Object.freeze({
301
- NAMESPACE: "__stryker__",
302
- MUTATION_COVERAGE_OBJECT: "mutantCoverage",
303
- ACTIVE_MUTANT: "activeMutant",
304
- CURRENT_TEST_ID: "currentTestId",
305
- HIT_COUNT: "hitCount",
306
- HIT_LIMIT: "hitLimit",
307
- ACTIVE_MUTANT_ENV_VARIABLE: "__STRYKER_ACTIVE_MUTANT__"
308
- });
309
- function normalizeFileName(fileName) {
310
- return fileName.replace(/\\/g, "/");
311
- }
312
- const hasText = (value) => Predicate.isString(value) && value.length > 0;
313
- const textIfNonEmpty = (value) => Option.getOrUndefined(Option.filter(Option.fromUndefinedOr(value), hasText));
314
- const fieldOf = (value, key) => Match.value(key in value).pipe(Match.when(true, () => {
315
- return Reflect.get(value, key);
316
- }), Match.orElse(() => void 0));
317
- const hasStringCode = (error) => Match.value(fieldOf(error, "code")).pipe(Match.when(Match.string, () => true), Match.orElse(() => false));
318
- function isErrnoException(error) {
319
- return Match.value(error).pipe(Match.when(Match.instanceOf(Error), hasStringCode), Match.orElse(() => false));
320
- }
321
- const isEmptyNumber = (value) => Match.value(value).pipe(Match.when(0, () => true), Match.orElse(Number.isNaN));
322
- const isEmptyError = (error) => Match.value(error).pipe(Match.when(Match.undefined, () => true), Match.when(Match.null, () => true), Match.when(Match.string, (text) => text.length === 0), Match.when(Match.number, isEmptyNumber), Match.when(Match.boolean, (value) => !value), Match.orElse(() => false));
323
- const formatErrnoException = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.code} (${error.syscall}) ${stack}`), Match.orElse(() => `${error.name}: ${error.code} (${error.syscall})`));
324
- const formatError = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.message}\n${stack}`), Match.orElse(() => `${error.name}: ${error.message}`));
325
- const isJsonPrimitive = (value) => Match.value(value).pipe(Match.when(Match.number, () => true), Match.when(Match.boolean, () => true), Match.when(Match.bigint, () => true), Match.orElse(() => false));
326
- const jsonText = (error) => {
327
- try {
328
- return textIfNonEmpty(JSON.stringify(error));
329
- } catch {
330
- return;
331
- }
332
- };
333
- const isNonPlaceholderText = (text) => Match.value({
334
- hasLength: text.length > 0,
335
- isPlaceholder: text === "[object Object]"
336
- }).pipe(Match.when({
337
- hasLength: true,
338
- isPlaceholder: false
339
- }, () => true), Match.orElse(() => false));
340
- const isUsableText = (value) => Match.value(value).pipe(Match.when(Match.string, isNonPlaceholderText), Match.orElse(() => false));
341
- const usableText = (value) => Match.value(value).pipe(Match.when(isUsableText, (text) => text), Match.orElse(() => ""));
342
- const objectToStringText = (value) => Match.value(fieldOf(value, "toString")).pipe(Match.when(Match.instanceOf(Function), (callable) => {
343
- try {
344
- return usableText(Reflect.apply(callable, value, []));
345
- } catch {
346
- return "";
347
- }
348
- }), Match.orElse(() => ""));
349
- const isObjectType = (cause) => typeof cause === "object";
350
- const toStringText = (error) => Match.value(error).pipe(Match.when(Match.null, () => ""), Match.when(isObjectType, (value) => objectToStringText(value)), Match.orElse(() => ""));
351
- const stringifyRest = (error) => Match.value(jsonText(error)).pipe(Match.when(hasText, (json) => json), Match.orElse(() => toStringText(error)));
352
- const stringifyNonError = (error) => Match.value(error).pipe(Match.when(Match.string, (text) => text), Match.when(isJsonPrimitive, (primitive) => JSON.stringify(primitive)), Match.orElse(() => stringifyRest(error)));
353
- const errorText = (error) => Match.value(error).pipe(Match.when(isErrnoException, formatErrnoException), Match.orElse(() => formatError(error)));
354
- function errorToString(error) {
355
- return Match.value(error).pipe(Match.when(isEmptyError, () => ""), Match.when(Match.instanceOf(Error), errorText), Match.orElse(() => stringifyNonError(error)));
356
- }
357
- const ERROR_CODES = Object.freeze({ NoSuchFileOrDirectory: "ENOENT" });
358
- const errorNameOf = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), (error) => textIfNonEmpty(error.name)), Match.orElse(() => void 0));
359
- const tagOf = (value) => Match.value(textIfNonEmpty(fieldOf(value, "_tag"))).pipe(Match.when(hasText, (tag) => tag), Match.orElse(() => errorNameOf(value)));
360
- const textWithNested = (own, nested) => Match.value(own).pipe(Match.when(hasText, (text) => appendNested(text, nested)), Match.orElse(() => nested));
361
- const appendNested = (own, nested) => Match.value(nested).pipe(Match.when(hasText, (text) => `${own}: ${text}`), Match.orElse(() => own));
362
- const errorMessage = (error) => Match.value(error.message.length > 0).pipe(Match.when(true, () => error.message), Match.orElse(() => tagOf(error)));
363
- const errorMessageOrTag = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), errorMessage), Match.orElse(() => tagOf(value)));
364
- const messageText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "message"))).pipe(Match.when(hasText, (message) => message), Match.orElse(() => errorMessageOrTag(value)));
365
- const ownCauseText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "reason"))).pipe(Match.when(hasText, (reason) => reason), Match.orElse(() => messageText(value)));
366
- const causeText = (cause, depth) => Match.value(cause).pipe(Match.when(() => depth > 4, () => void 0), Match.when(Match.undefined, () => void 0), Match.when(Match.null, () => void 0), Match.when(Match.string, textIfNonEmpty), Match.when(isObjectType, (value) => textWithNested(ownCauseText(value), causeText(fieldOf(value, "cause"), depth + 1))), Match.orElse(() => void 0));
367
- //#endregion
368
- //#region src/Plugin.schema.ts
369
- const PluginKind = S.Literals([
370
- "Checker",
371
- "TestRunner",
372
- "Reporter",
373
- "Ignore",
374
- "Evaluator"
375
- ]);
376
- const PluginLayerKind = S.Literals([
377
- "Checker",
378
- "TestRunner",
379
- "Ignore",
380
- "Evaluator"
381
- ]);
382
- var PluginLayerContribution = class extends S.TaggedClass()("PluginContribution", {
383
- kind: PluginLayerKind,
384
- name: S.String,
385
- layer: S.Unknown
386
- }) {};
387
- var PluginReporterContribution = class extends S.TaggedClass()("PluginContribution", {
388
- kind: PluginKind,
389
- name: S.String,
390
- make: S.Unknown
391
- }) {};
392
- var Shadowing = class extends S.TaggedClass()("Shadowing", {
393
- kind: S.String,
394
- name: S.String,
395
- shadowedIndex: S.Finite,
396
- winnerIndex: S.Finite
397
- }) {};
398
- //#endregion
399
- //#region src/Plugin.ts
400
- var RunConfiguration = class extends Context.Service()("~@systemfsoftware/stryker-js/RunConfiguration") {};
401
- var SandboxDirectory = class extends Context.Service()("~@systemfsoftware/stryker-js/SandboxDirectory") {};
402
- function declarePlugin(kind, name, payload) {
403
- if (kind === "Reporter") return new PluginReporterContribution({
404
- kind,
405
- name,
406
- make: payload
407
- });
408
- return new PluginLayerContribution({
409
- kind,
410
- name,
411
- layer: payload
412
- });
413
- }
414
- function foldContributions(contributions) {
415
- const resolved = MutableHashMap.empty();
416
- const shadowings = [];
417
- const lastSeen = MutableHashMap.empty();
418
- for (const [index, contribution] of contributions.entries()) {
419
- const key = `${contribution.kind}:${contribution.name}`;
420
- const previous = MutableHashMap.get(lastSeen, key);
421
- shadowings.push(...Option.match(previous, {
422
- onNone: () => [],
423
- onSome: (shadowedIndex) => [new Shadowing({
424
- kind: String(contribution.kind),
425
- name: contribution.name,
426
- shadowedIndex,
427
- winnerIndex: index
428
- })]
429
- }));
430
- MutableHashMap.set(resolved, key, contribution);
431
- MutableHashMap.set(lastSeen, key, index);
432
- }
433
- return {
434
- resolved,
435
- shadowings
436
- };
437
- }
438
- const reporterFactoryOf = (contribution) => Match.value(contribution).pipe(Match.discriminator("kind")("Reporter", (reporter) => [{
439
- name: reporter.name,
440
- make: reporter.make
441
- }]), Match.orElse(() => []));
442
- const layerOf = (contribution) => Match.value(contribution).pipe(Match.discriminator("kind")("Reporter", () => []), Match.orElse((nonReporter) => [nonReporter.layer]));
443
- const mergedLayer = (layers) => layers.reduce((accumulated, next) => Layer.merge(accumulated, next));
444
- function composePlugins(contributions) {
445
- const { resolved, shadowings } = foldContributions(contributions);
446
- const allResolved = Array.from(MutableHashMap.values(resolved));
447
- const layers = allResolved.flatMap(layerOf);
448
- return {
449
- layer: Option.map(Option.fromUndefinedOr(layers.at(0)), () => mergedLayer(layers)),
450
- reporterFactories: allResolved.flatMap(reporterFactoryOf),
451
- shadowings
452
- };
453
- }
454
- //#endregion
455
- //#region src/TestRunner.schema.ts
456
- const DryRunStatus = S.Literals([
457
- "complete",
458
- "error",
459
- "timeout"
460
- ]);
461
- const TestStatus = S.Literals([
462
- "success",
463
- "failed",
464
- "skipped"
465
- ]);
466
- const MutantRunStatus = S.Literals([
467
- "killed",
468
- "survived",
469
- "timeout",
470
- "error"
471
- ]);
472
- const TestResultBase = {
473
- id: S.String,
474
- name: S.String,
475
- timeSpentMs: S.Finite,
476
- fileName: S.optionalKey(S.String),
477
- startPosition: S.optionalKey(PositionSchema)
478
- };
479
- const TestResultSchema = S.Union([
480
- S.Struct({
481
- ...TestResultBase,
482
- status: S.Literal("failed"),
483
- failureMessage: S.String
484
- }),
485
- S.Struct({
486
- ...TestResultBase,
487
- status: S.Literal("skipped")
488
- }),
489
- S.Struct({
490
- ...TestResultBase,
491
- status: S.Literal("success")
492
- })
493
- ]);
494
- const MutantCoverageSchema = S.Struct({
495
- perTest: S.Record(S.String, S.Record(S.String, S.Finite)),
496
- static: S.Record(S.String, S.Finite)
497
- });
498
- const DryRunResultSchema = S.Union([
499
- S.Struct({
500
- status: S.Literal("complete"),
501
- tests: S.Array(TestResultSchema),
502
- mutantCoverage: S.optionalKey(MutantCoverageSchema)
503
- }),
504
- S.Struct({
505
- status: S.Literal("timeout"),
506
- reason: S.optionalKey(S.String)
507
- }),
508
- S.Struct({
509
- status: S.Literal("error"),
510
- errorMessage: S.String
511
- })
512
- ]);
513
- const MutantRunResultSchema = S.Union([
514
- S.Struct({
515
- status: S.Literal("killed"),
516
- killedBy: S.Array(S.String),
517
- failureMessage: S.String,
518
- nrOfTests: S.Finite
519
- }),
520
- S.Struct({
521
- status: S.Literal("survived"),
522
- nrOfTests: S.Finite
523
- }),
524
- S.Struct({
525
- status: S.Literal("timeout"),
526
- reason: S.optionalKey(S.String)
527
- }),
528
- S.Struct({
529
- status: S.Literal("error"),
530
- errorMessage: S.String
531
- })
532
- ]);
533
- const CoverageAnalysisSchema = S.Literals([
534
- "off",
535
- "all",
536
- "perTest"
537
- ]);
538
- const RunOptionsFields = {
539
- timeout: S.Finite,
540
- disableBail: S.Boolean
541
- };
542
- const DryRunOptionsSchema = S.Struct({
543
- ...RunOptionsFields,
544
- coverageAnalysis: CoverageAnalysisSchema,
545
- files: S.optionalKey(S.Array(S.String)),
546
- testFiles: S.optionalKey(S.Array(S.String))
547
- });
548
- const MutantActivationSchema = S.Literals(["runtime", "static"]);
549
- const MutantRunOptionsSchema = S.Struct({
550
- ...RunOptionsFields,
551
- activeMutant: Mutant,
552
- sandboxFileName: S.String,
553
- mutantActivation: MutantActivationSchema,
554
- reloadEnvironment: S.Boolean,
555
- testFilter: S.optionalKey(S.Array(S.String)),
556
- hitLimit: S.optionalKey(S.Finite)
557
- });
558
- const TestRunnerCapabilitiesSchema = S.Struct({ reloadEnvironment: S.Boolean });
559
- var TestRunnerFailed = class extends S.TaggedError()("TestRunnerFailed", {
560
- cause: S.String,
561
- phase: S.Literals([
562
- "capabilities",
563
- "dispose",
564
- "dryRun",
565
- "init",
566
- "mutantRun"
567
- ]),
568
- runnerName: S.String
569
- }) {};
570
- //#endregion
571
- //#region src/ReporterEvent.schema.ts
572
- const ReporterEventKind = S.Literals([
573
- "dryRunCompleted",
574
- "mutationTestingPlanReady",
575
- "mutantTested",
576
- "mutationTestReportReady"
577
- ]);
578
- const RunTimingSchema = S.Struct({
579
- net: S.Finite,
580
- overhead: S.Finite
581
- });
582
- const ReporterPlanKind = S.Literals(["EarlyResult", "Run"]);
583
- const ReporterPlanDescriptorSchema = S.Struct({
584
- mutantId: S.String,
585
- plan: ReporterPlanKind,
586
- netTime: S.Finite,
587
- reloadEnvironment: S.Boolean
588
- });
589
- var DryRunCompleted = class extends S.TaggedClass()("dryRunCompleted", {
590
- timing: RunTimingSchema,
591
- capabilities: TestRunnerCapabilitiesSchema,
592
- testCount: S.Finite,
593
- tests: S.Array(TestResultSchema)
594
- }) {};
595
- var MutationTestingPlanReady = class extends S.TaggedClass()("mutationTestingPlanReady", {
596
- total: S.Finite,
597
- plans: S.Array(ReporterPlanDescriptorSchema)
598
- }) {};
599
- var MutantTested = class extends S.TaggedClass()("mutantTested", {
600
- id: S.String,
601
- status: MutantStatusSchema,
602
- file: S.String,
603
- location: LocationSchema,
604
- mutator: S.String,
605
- replacement: S.NullOr(S.String),
606
- completed: S.Finite,
607
- total: S.Finite
608
- }) {};
609
- var MutationTestReportReady = class extends S.TaggedClass()("mutationTestReportReady", {
610
- report: MutationTestResultSchema,
611
- metrics: MetricsResultSchema
612
- }) {};
613
- const ReporterEventUnion = S.Union([
614
- DryRunCompleted,
615
- MutationTestingPlanReady,
616
- MutantTested,
617
- MutationTestReportReady
618
- ]);
619
- const ReporterEventSchema = S.toStandardSchemaV1(ReporterEventUnion);
620
- var ReporterFailed = class extends S.TaggedError()("ReporterFailed", {
621
- cause: S.String,
622
- event: ReporterEventKind,
623
- reporterName: S.String
624
- }) {};
625
- //#endregion
626
- //#region src/Run.schema.ts
627
- const RunPhase = S.Literals([
628
- "prepare",
629
- "instrument",
630
- "dry-run",
631
- "mutation-test"
632
- ]);
633
- const OutputMode = S.Literals(["human", "machine"]);
634
- const ModeSignal = S.Literals([
635
- "flag",
636
- "env",
637
- "tty",
638
- "agent",
639
- "tool"
640
- ]);
641
- var RunStarted = class extends S.TaggedClass()("stream", {
642
- schemaVersion: S.String,
643
- runId: S.String,
644
- mode: OutputMode,
645
- signal: ModeSignal
646
- }) {};
647
- var PhaseEntered = class extends S.TaggedClass()("phase", {
648
- phase: RunPhase,
649
- elapsedMs: S.Finite
650
- }) {};
651
- var PlanKnown = class extends S.TaggedClass()("plan", { total: S.Finite }) {};
652
- var RunMutantTested = class extends S.TaggedClass()("mutant", {
653
- id: S.String,
654
- status: MutantStatusSchema,
655
- file: S.String,
656
- location: LocationSchema,
657
- mutator: S.String,
658
- replacement: S.NullOr(S.String),
659
- completed: S.Finite,
660
- total: S.Finite
661
- }) {};
662
- var Heartbeat = class extends S.TaggedClass()("tick", {
663
- elapsedMs: S.Finite,
664
- completed: S.Finite,
665
- total: S.NullOr(S.Finite)
666
- }) {};
667
- const VerdictThresholds = S.Struct({
668
- high: S.Finite,
669
- low: S.Finite,
670
- break: S.NullOr(S.Finite)
671
- });
672
- const VerdictMutant = S.Struct({
673
- id: S.String,
674
- file: S.String,
675
- location: LocationSchema,
676
- mutator: S.String,
677
- replacement: S.NullOr(S.String),
678
- status: MutantStatusSchema
679
- });
680
- const VerdictCounts = S.Struct({
681
- killed: S.Finite,
682
- timeout: S.Finite,
683
- survived: S.Finite,
684
- noCoverage: S.Finite,
685
- runtimeErrors: S.Finite,
686
- compileErrors: S.Finite,
687
- ignored: S.Finite,
688
- pending: S.Finite
689
- });
690
- var VerdictReached = class extends S.TaggedClass()("verdict", {
691
- schemaVersion: S.String,
692
- runId: S.String,
693
- mode: OutputMode,
694
- signal: ModeSignal,
695
- score: S.NullOr(S.Finite),
696
- thresholds: VerdictThresholds,
697
- reportFile: S.NullOr(S.String),
698
- counts: VerdictCounts,
699
- mutants: S.Array(VerdictMutant)
700
- }) {};
701
- var RunFailed = class extends S.TaggedClass()("error", {
702
- schemaVersion: S.String,
703
- code: S.Finite,
704
- error: S.String,
705
- remediation: S.String
706
- }) {};
707
- var HelpRendered = class extends S.TaggedClass()("help", {
708
- schemaVersion: S.String,
709
- code: S.Literals([0]),
710
- help: S.String
711
- }) {};
712
- S.Union([
713
- RunStarted,
714
- PhaseEntered,
715
- PlanKnown,
716
- RunMutantTested,
717
- Heartbeat,
718
- VerdictReached,
719
- RunFailed,
720
- HelpRendered
721
- ]);
722
- var RunCommand = class extends S.TaggedClass()("RunCommand", {
723
- cliOptionsJson: S.String,
724
- targetMutatePatterns: S.Array(S.String)
725
- }) {};
726
- var RunOutput = class extends S.TaggedClass()("RunOutput", {
727
- verdictJson: S.String,
728
- exitCode: S.Finite
729
- }) {};
730
- S.TaggedError()("RunDecodeError", { message: S.String });
731
- S.TaggedError()("RunReadError", { message: S.String });
732
- S.TaggedError()("RunWriteError", { message: S.String });
733
- var PlanMutationRunCommand = class extends S.TaggedClass()("PlanMutationRunCommand", {
734
- configMutatePatterns: S.Array(S.String),
735
- configMutatorNames: S.Array(S.String),
736
- targetMutatePatterns: S.Array(S.String),
737
- availableMutators: S.Array(S.String)
738
- }) {};
739
- var MutationRunPlan = class extends S.TaggedClass()("MutationRunPlan", {
740
- mutatePatterns: S.Array(S.String),
741
- mutatorNames: S.Array(S.String)
742
- }) {};
743
- //#endregion
744
- //#region src/Run.ts
745
- const firstNonEmpty = (preferred, fallback) => {
746
- if (preferred.length > 0) return [...preferred];
747
- return [...fallback];
748
- };
749
- const planMutationRun = (command) => MutationRunPlan.make({
750
- mutatePatterns: firstNonEmpty(command.targetMutatePatterns, command.configMutatePatterns),
751
- mutatorNames: firstNonEmpty(command.availableMutators, command.configMutatorNames)
752
- });
753
- var RunEvents = class extends Context.Service()("~@systemfsoftware/stryker-js/RunEvents") {};
754
- var RunIdentity = class extends Context.Service()("~@systemfsoftware/stryker-js/RunIdentity") {};
755
- const runMutationTest = (io, command) => Effect$1.gen(function* () {
756
- const raw = yield* io.read(command);
757
- const planCommand = yield* Result.match(S.decodeUnknownResult(PlanMutationRunCommand)(raw), {
758
- onFailure: (error) => Effect$1.fail(error),
759
- onSuccess: (decoded) => Effect$1.succeed(decoded)
760
- });
761
- const plan = planMutationRun(planCommand);
762
- return yield* io.write(new RunOutput({
763
- verdictJson: JSON.stringify({
764
- mutate: plan.mutatePatterns,
765
- mutatorNames: plan.mutatorNames
766
- }),
767
- exitCode: 0
768
- }));
769
- });
770
- const shouldKeepTempDir = (exit, cleanTempDir) => Exit.isFailure(exit) && cleanTempDir !== "always";
771
- //#endregion
772
- //#region src/Schema.schema.ts
773
- const RENDERED_OPTION_DEFAULTS$1 = {
774
- coverageAnalysis: "perTest",
775
- fileLogLevel: "off",
776
- logLevel: "info",
777
- tempDirName: ".stryker-tmp"
778
- };
779
- /**
780
- * The Stryker option set, declared as ONE Effect Schema.
781
- *
782
- * Replaces the vendored `schema/stryker-core.json` codegen chain
783
- * (`tasks/generate-stryker-core.mjs` → `src-generated/stryker-core.ts`): every
784
- * option name, type, optionality and default is preserved, and
785
- * `strykerCoreSchema` is the JSON Schema document **derived** from
786
- * `StrykerOptionsSchema` (no file read).
787
- *
788
- * Layering mirrors the original document:
789
- * - objects without `additionalProperties: false` there (the option set
790
- * itself, `commandRunner`, `clearTextReporter`, `warnings`) are open here —
791
- * `S.StructWithRest` with a `Record<string, unknown>` index keeps arbitrary
792
- * plugin-proposed keys and makes the decoded type carry
793
- * `[k: string]: unknown`;
794
- * - objects with `additionalProperties: false` (`htmlReporter`, `jsonReporter`,
795
- * `thresholds`, `mutator`) are closed here.
796
- *
797
- * `dashboard` and `eventReporter` are absent: the reporters they configured were
798
- * removed, and the removed-option check rejects both names. Declaring them here
799
- * with defaults meant the default option set carried two options the very next
800
- * validation step refused - invisible only while the defaults were filled by a
801
- * separate engine that happened not to inject them.
802
- */
803
- /** Open object: fixed fields plus an index signature accepting arbitrary plugin keys. */
804
- const openStruct = (fields) => S.StructWithRest(S.Struct(fields), [S.Record(S.String, S.Unknown)]);
805
- /**
806
- * Field that decodes to a value but defaults when the key is absent.
807
- *
808
- * The default is typed by the schema's ENCODED side, which is what
809
- * `withDecodingDefaultKey` consumes: a whole-object option can therefore default
810
- * to `{}` exactly when every field inside it carries its own default, and
811
- * the compiler decides that rather than the author asserting it.
812
- *
813
- * The annotation is applied to the schema BEFORE the default transform wraps it.
814
- * Annotating the wrapper instead leaves `default` off the derived JSON Schema
815
- * document, so a consumer filling defaults from that document (ajv
816
- * `useDefaults`) silently injects nothing.
817
- */
818
- const defaulted = (schema, defaultValue) => {
819
- const annotated = schema.annotate({ default: defaultValue });
820
- return S.withDecodingDefaultKey(Effect.succeed(defaultValue))(annotated);
821
- };
822
- const LogLevel = S.Literals([
823
- "off",
824
- "fatal",
825
- "error",
826
- "warn",
827
- "info",
828
- "debug",
829
- "trace"
830
- ]);
831
- const CoverageAnalysisMode = S.Literals([
832
- "off",
833
- "all",
834
- "perTest"
835
- ]);
836
- S.Literals(["full", "mutationScore"]);
837
- const PackageManager = S.Literals([
838
- "npm",
839
- "yarn",
840
- "pnpm"
841
- ]);
842
- /** 0–100 percentage used by the mutation-score thresholds. */
843
- const Percentage = S.Finite.pipe(S.check(S.isBetween({
844
- minimum: 0,
845
- maximum: 100
846
- })));
847
- const CommandRunnerOptionsSchema = openStruct({ command: defaulted(S.String, "npm test") });
848
- const ClearTextReporterOptions = openStruct({
849
- allowColor: defaulted(S.Boolean, true),
850
- allowEmojis: defaulted(S.Boolean, false),
851
- logTests: defaulted(S.Boolean, true),
852
- maxTestsToLog: defaulted(S.Finite.pipe(S.check(S.isGreaterThanOrEqualTo(0))), 3),
853
- reportTests: defaulted(S.Boolean, true),
854
- reportMutants: defaulted(S.Boolean, true),
855
- reportScoreTable: defaulted(S.Boolean, true),
856
- skipFull: defaulted(S.Boolean, false)
857
- });
858
- const HtmlReporterOptions = S.Struct({ fileName: defaulted(S.String, "reports/mutation/mutation.html") });
859
- const JsonReporterOptions = S.Struct({ fileName: defaulted(S.String, "reports/mutation/mutation.json") });
860
- const MutationScoreThresholdsSchema = S.Struct({
861
- high: defaulted(Percentage, 80),
862
- low: defaulted(Percentage, 60),
863
- break: defaulted(S.NullOr(Percentage), null)
864
- });
865
- const MutatorDescriptor = S.Struct({ excludedMutations: defaulted(S.Array(S.String), []) });
866
- const WarningOptions = openStruct({
867
- unknownOptions: defaulted(S.Boolean, true),
868
- preprocessorErrors: defaulted(S.Boolean, true),
869
- unserializableOptions: defaulted(S.Boolean, true),
870
- slow: defaulted(S.Boolean, true)
871
- });
872
- const ConcurrencyCount = S.Finite.pipe(S.check(S.isGreaterThanOrEqualTo(1)));
873
- const ConcurrencyPercent = S.String.pipe(S.check(S.isPattern(/^(100|[1-9]?[0-9])%$/)));
874
- const StrykerOptionsSchema = S.StructWithRest(S.Struct({
875
- allowConsoleColors: defaulted(S.Boolean, true),
876
- buildCommand: S.optional(S.String),
877
- checkers: defaulted(S.Array(S.String), []),
878
- checkerNodeArgs: defaulted(S.Array(S.String), []),
879
- concurrency: S.optional(S.Union([ConcurrencyCount, ConcurrencyPercent])),
880
- commandRunner: defaulted(CommandRunnerOptionsSchema, { command: "npm test" }),
881
- coverageAnalysis: defaulted(CoverageAnalysisMode, RENDERED_OPTION_DEFAULTS$1.coverageAnalysis),
882
- clearTextReporter: defaulted(ClearTextReporterOptions, {
883
- allowColor: true,
884
- allowEmojis: false,
885
- logTests: true,
886
- maxTestsToLog: 3,
887
- reportTests: true,
888
- reportMutants: true,
889
- reportScoreTable: true,
890
- skipFull: false
891
- }),
892
- dryRunOnly: defaulted(S.Boolean, false),
893
- ignorePatterns: defaulted(S.Array(S.String), []),
894
- ignoreStatic: defaulted(S.Boolean, false),
895
- incremental: defaulted(S.Boolean, false),
896
- incrementalFile: defaulted(S.String, "reports/stryker-incremental.json"),
897
- progressStreamFile: defaulted(S.String, "reports/mutation-stream.jsonl"),
898
- force: defaulted(S.Boolean, false),
899
- fileLogLevel: defaulted(LogLevel, RENDERED_OPTION_DEFAULTS$1.fileLogLevel),
900
- inPlace: defaulted(S.Boolean, false),
901
- logLevel: defaulted(LogLevel, RENDERED_OPTION_DEFAULTS$1.logLevel),
902
- maxConcurrentTestRunners: defaulted(S.Finite, 9007199254740991),
903
- maxTestRunnerReuse: defaulted(S.Finite, 0),
904
- mutate: defaulted(S.Array(S.String), ["{src,lib}/**/!(*.+(s|S)pec|*.+(t|T)est).+(cjs|mjs|js|ts|mts|cts|jsx|tsx|html|vue|svelte)", "!{src,lib}/**/__tests__/**/*.+(cjs|mjs|js|ts|mts|cts|jsx|tsx|html|vue|svelte)"]),
905
- mutator: defaulted(MutatorDescriptor, { excludedMutations: [] }),
906
- packageManager: S.optional(PackageManager),
907
- plugins: defaulted(S.Array(S.String), ["@systemfsoftware/stryker-js-*"]),
908
- appendPlugins: defaulted(S.Array(S.String), []),
909
- reporters: defaulted(S.Array(S.String), [
910
- "clear-text",
911
- "progress",
912
- "html"
913
- ]),
914
- htmlReporter: defaulted(HtmlReporterOptions, { fileName: "reports/mutation/mutation.html" }),
915
- jsonReporter: defaulted(JsonReporterOptions, { fileName: "reports/mutation/mutation.json" }),
916
- disableTypeChecks: defaulted(S.Union([S.Boolean, S.String]), true),
917
- symlinkNodeModules: defaulted(S.Boolean, true),
918
- tempDirName: defaulted(S.String, RENDERED_OPTION_DEFAULTS$1.tempDirName),
919
- cleanTempDir: defaulted(S.Literals([
920
- "always",
921
- false,
922
- true
923
- ]), true),
924
- testRunner: defaulted(S.String, "command"),
925
- testRunnerNodeArgs: defaulted(S.Array(S.String), []),
926
- thresholds: defaulted(MutationScoreThresholdsSchema, {
927
- high: 80,
928
- low: 60,
929
- break: null
930
- }),
931
- timeoutFactor: defaulted(S.Finite, 1.5),
932
- timeoutMS: defaulted(S.Finite, 5e3),
933
- dryRunTimeoutMinutes: defaulted(S.Finite.pipe(S.check(S.isGreaterThanOrEqualTo(0))), 5),
934
- tsconfigFile: defaulted(S.String, "tsconfig.json"),
935
- warnings: defaulted(S.Union([S.Boolean, WarningOptions]), true),
936
- disableBail: defaulted(S.Boolean, false),
937
- allowEmpty: defaulted(S.Boolean, false),
938
- ignorers: defaulted(S.Array(S.String), []),
939
- testFiles: defaulted(S.Array(S.String), [])
940
- }), [S.Record(S.String, S.Unknown)]);
941
- //#endregion
942
- //#region src/Schema.ts
943
- /**
944
- * The four option defaults a human reads about in help text.
945
- *
946
- * `Schema.schema.ts` declares every default, and a CLI that wants to
947
- * name one in a `--help` description must read it from here rather than type
948
- * the literal a second time: a restated default drifts the moment the schema
949
- * moves, and no gate compares a help string against a schema annotation.
950
- *
951
- * Only these four are here because only these four are rendered. A default
952
- * nobody prints has one declaration site already, which is the schema.
953
- */
954
- const RENDERED_OPTION_DEFAULTS = {
955
- coverageAnalysis: "perTest",
956
- fileLogLevel: "off",
957
- logLevel: "info",
958
- tempDirName: ".stryker-tmp"
959
- };
960
- /**
961
- * Given a base type, allows type safe access to the name of a property.
962
- * @param prop - The property name
963
- */
964
- function propertyPath() {
965
- const fn = (...args) => args.join(".");
966
- return fn;
967
- }
968
- /**
969
- * Creates a URL to the page where a consumer can report a bug against this
970
- * project.
971
- *
972
- * The tracker is ours. The ported original addressed the upstream StrykerJS
973
- * repository, along with its label and issue-template parameters, so every bug
974
- * a consumer filed from a Stryker run arrived at a project that does not own
975
- * this code (`REPO-O1`) and prefilled a template that does not exist here.
976
- *
977
- * @param titleSuggestion - The title to be prefilled in.
978
- */
979
- function strykerReportBugUrl(titleSuggestion) {
980
- return `https://github.com/systemfsoftware/systemfsoftware/issues/new?title=${encodeURIComponent(titleSuggestion)}`;
981
- }
982
- /**
983
- * The JSON Schema document derived from `StrykerOptionsSchema`, self-contained.
984
- *
985
- * It lives beside the schema module rather than inside it because it is a *use*
986
- * of that schema, not a declaration of one: `S.toJsonSchemaDocument` consumes a
987
- * schema and returns a plain document. Keeping uses out of a `*.schema.ts` is
988
- * what lets a tool read every exported schema in a package and trust that each
989
- * one is a schema - the generated law suite does exactly that, and a document
990
- * handed to `toEncoded` takes the whole suite down with it.
991
- */
992
- const strykerCoreSchema = (() => {
993
- const { schema, definitions } = S.toJsonSchemaDocument(StrykerOptionsSchema);
994
- if (Object.keys(definitions).length === 0) return schema;
995
- return {
996
- ...schema,
997
- definitions
998
- };
999
- })();
1000
- //#endregion
1001
- //#region src/TestRunner.ts
1002
- function toMutantRunResult(dryRunResult, reportAllKillers) {
1003
- return Match.value(dryRunResult).pipe(Match.discriminator("status")("complete", (complete) => {
1004
- const failed = complete.tests.filter((t) => t.status === "failed");
1005
- const nrOfTests = complete.tests.filter((t) => t.status !== "skipped").length;
1006
- return Option.match(Option.fromUndefinedOr(failed.at(0)), {
1007
- onNone: () => ({
1008
- nrOfTests,
1009
- status: "survived"
1010
- }),
1011
- onSome: (firstFailed) => ({
1012
- failureMessage: firstFailed.failureMessage,
1013
- killedBy: Match.value(reportAllKillers).pipe(Match.when(true, () => failed.map((t) => t.id)), Match.when(false, () => [firstFailed.id]), Match.exhaustive),
1014
- nrOfTests,
1015
- status: "killed"
1016
- })
1017
- });
1018
- }), Match.discriminator("status")("error", (errored) => ({
1019
- errorMessage: errored.errorMessage,
1020
- status: "error"
1021
- })), Match.discriminator("status")("timeout", (timedOut) => Option.match(Option.fromUndefinedOr(timedOut.reason), {
1022
- onNone: () => ({ status: "timeout" }),
1023
- onSome: (reason) => ({
1024
- reason,
1025
- status: "timeout"
1026
- })
1027
- })), Match.exhaustive);
1028
- }
1029
- var TestRunner = class extends Context.Service()("~@systemfsoftware/stryker-js/TestRunner") {};
1030
- function testFilesProvided(options) {
1031
- return options.testFiles !== void 0 && options.testFiles.length > 0;
1032
- }
1033
- //#endregion
1034
- export { BrandingInformationSchema, CheckResultSchema, CheckStatus, Checker, CheckerFailed, ClassifyExitCommand, ClassifyExitDecision, CommandRunnerOptionsSchema, CoverageAnalysisMode, CoverageAnalysisSchema, DependenciesSchema, DryRunCompleted, DryRunOptionsSchema, DryRunResultSchema, DryRunStatus, ERROR_CODES, EXIT_CODE, Evaluator, EvaluatorFailed, ExitClass, FileResultDictionarySchema, FileResultSchema, FrameworkInformationSchema, Heartbeat, HelpRendered, INSTRUMENTER_CONSTANTS, Ignorer, LocationSchema, LogLevel, MetricsResultSchema, MetricsSchema, ModeSignal, Module, Mutant, MutantActivationSchema, MutantCoverageSchema, MutantResultSchema, MutantRunOptionsSchema, MutantRunResultSchema, MutantRunStatus, MutantStatusSchema, MutantTested, MutationRunPlan, MutationScoreThresholdsSchema, MutationTestReportReady, MutationTestResultSchema, MutationTestingPlanReady, OpenEndLocationSchema, OutputMode, PackageManager, PhaseEntered, PlanKnown, PlanMutationRunCommand, PluginKind, PluginLayerContribution, PluginReporterContribution, PositionSchema, RENDERED_OPTION_DEFAULTS, ReporterEventKind, ReporterEventSchema, ReporterEventUnion, ReporterFailed, ReporterPlanDescriptorSchema, ReporterPlanKind, RunCommand, RunConfiguration, RunEvents, RunFailed, RunIdentity, RunMutantTested, RunOutput, RunPhase, RunStarted, RunTimingSchema, SandboxDirectory, Shadowing, StrykerOptionsSchema, TestDefinitionSchema, TestFileDefinitionDictionarySchema, TestFileSchema, TestResultSchema, TestRunner, TestRunnerCapabilitiesSchema, TestRunnerFailed, TestStatus, ThresholdsSchema, VerdictReached, calculateMetrics, causeText, classifyExit, composePlugins, countMutants, declarePlugin, errorToString, highestExitClass, isErrnoException, isMutant, normalizeFileName, planMutationRun, propertyPath, resolveExitCode, runMutationTest, shouldKeepTempDir, strykerCoreSchema, strykerReportBugUrl, testFilesProvided, toMutantRunResult, verdictExitClass };
1
+ import { F as LocationSchema, L as MutantActivationSchema, O as WorkerPluginKind, R as MutantStatusSchema, S as TestRunnerConfigSchema, T as TraceContextMiddleware, _ as ReporterInitOptions, c as MutantTested, d as MutationTestingPlanReady, h as ReporterEventBatch, i as FileResultSchema, l as MutationTestReportReady, m as ReporterDrained, n as DryRunCompleted, o as MetricsSchema, p as ReporterAck, r as ExitClass, s as MutantResultSchema, u as MutationTestResultSchema, v as ReporterRpcs, y as StrykerOptionsSchema, z as PositionSchema } from "./dist-CWbipfGB.mjs";
2
+ import { A as PlanKnown, B as CONFIG_SYNTAX_HELP, C as spawnReporterWorker, D as Heartbeat, E as RunIdentity, F as VerdictReached, G as findUnserializables, H as createDefaultOptions, I as EXIT_CODE, J as optionsPath, K as isModuleSpecifier, L as highestExitClass, M as RunMutantTested, N as RunPhase, O as HelpRendered, P as RunStarted, R as resolveExitCode, S as reporterWorkerFactory, T as RunEvents, U as deepFreeze, V as SUPPORTED_CONFIG_FILE_NAMES, W as defaultOptions, _ as createFileMatcher, a as shouldKeepTempDir, b as RunEnvironment, c as buildVerdictEnvelope, d as strykerVersion, f as calculateMetrics, g as CheckerSkippedRequested, h as CheckerAnsweredUnrequested, i as mutationTestCell, j as RunFailed, k as PhaseEntered, l as generateRunId, m as checkGroupedPlans, n as RUN_EVENTS_QUEUE_BOUND, o as ACTIONABLE_STATUSES, p as countMutants, q as isWarningEnabled, r as makeRunLayer, s as VERDICT_ENVELOPE_SCHEMA_VERSION, t as strykerCell, u as isActionableStatus, v as matchesFile, w as toRelativeNormalizedFileName, x as REPORTER_EVENT_BATCH_BOUND, y as IncrementalReportSchema, z as verdictExitClass } from "./src-fju4cI5I.mjs";
3
+ import { $ as ExtendsStepRefused, D as IdGenerator, E as makeWorkerClient, F as isVmRunner, G as ConfigError, I as vmRunnerCapabilities, J as ConfigFileUnreadableError, K as ConfigFileInvalidError, L as vmRunnerName, M as OutOfMemoryError, N as WorkerBootTimeoutError, O as classifyWorkerExit, P as VmRunner, Q as ExtendsStepRead, R as vmTestRunner, T as connectRetry, V as StrykerError, W as ConfigDocumentSchema, X as ExtendsStepDocumentSchema, Y as ConfigFileUnsupportedError, Z as ExtendsStepDone, _ as readConfig, at as ReadConfigCommand, b as buildTestRunner, ct as survivorsPriorReport, d as describeErrors, et as ExtendsStepResolve, f as forkCoreSchema, ft as StageError, g as mergeConfigs, h as loadConfigCell, it as MergeResult, j as ChildProcessCrashedError, m as initialExtendsStepState, nt as ImportedModuleSchema, ot as extendsPropertySchema, p as importModule, q as ConfigFileNotFoundError, rt as MergeCommand, st as forkOptionsSchema, tt as ExtendsStepStateSchema, u as decideExtendsStep, v as resolveExtends, w as WorkerLauncher, x as isCommandRunner, y as validateOptions } from "./plugin-worker-entry-D00fedxV.mjs";
4
+ export { ACTIONABLE_STATUSES, CONFIG_SYNTAX_HELP, CheckerAnsweredUnrequested, CheckerSkippedRequested, ChildProcessCrashedError, ConfigDocumentSchema, ConfigError, ConfigFileInvalidError, ConfigFileNotFoundError, ConfigFileUnreadableError, ConfigFileUnsupportedError, DryRunCompleted, EXIT_CODE, ExitClass, ExtendsStepDocumentSchema, ExtendsStepDone, ExtendsStepRead, ExtendsStepRefused, ExtendsStepResolve, ExtendsStepStateSchema, FileResultSchema, Heartbeat, HelpRendered, IdGenerator, ImportedModuleSchema, IncrementalReportSchema, LocationSchema, MergeCommand, MergeResult, MetricsSchema, MutantActivationSchema, MutantResultSchema, MutantStatusSchema, MutantTested, MutationTestReportReady, MutationTestResultSchema, MutationTestingPlanReady, OutOfMemoryError, PhaseEntered, PlanKnown, PositionSchema, REPORTER_EVENT_BATCH_BOUND, RUN_EVENTS_QUEUE_BOUND, ReadConfigCommand, ReporterAck, ReporterDrained, ReporterEventBatch, ReporterInitOptions, ReporterRpcs, RunEnvironment, RunEvents, RunFailed, RunIdentity, RunMutantTested, RunPhase, RunStarted, SUPPORTED_CONFIG_FILE_NAMES, StageError, StrykerError, StrykerOptionsSchema, TestRunnerConfigSchema, TraceContextMiddleware, VERDICT_ENVELOPE_SCHEMA_VERSION, VerdictReached, VmRunner, WorkerBootTimeoutError, WorkerLauncher, WorkerPluginKind, buildTestRunner, buildVerdictEnvelope, calculateMetrics, checkGroupedPlans, classifyWorkerExit, connectRetry, countMutants, createDefaultOptions, createFileMatcher, decideExtendsStep, deepFreeze, defaultOptions, describeErrors, extendsPropertySchema, findUnserializables, forkCoreSchema, forkOptionsSchema, generateRunId, highestExitClass, importModule, initialExtendsStepState, isActionableStatus, isCommandRunner, isModuleSpecifier, isVmRunner, isWarningEnabled, loadConfigCell, makeRunLayer, makeWorkerClient, matchesFile, mergeConfigs, mutationTestCell, optionsPath, readConfig, reporterWorkerFactory, resolveExitCode, resolveExtends, shouldKeepTempDir, spawnReporterWorker, strykerCell, strykerVersion, survivorsPriorReport, toRelativeNormalizedFileName, validateOptions, verdictExitClass, vmRunnerCapabilities, vmRunnerName, vmTestRunner };