@systemfsoftware/stryker-js-plugin-interface 6.0.1 → 7.1.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.
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +94 -76
- package/dist/index.mjs +143 -39
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-plugin-interface
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- A checker that fails now fails mutation testing with that checker's cause, instead of crashing with an empty error. The TypeScript checker type-checks each mutant, so compile errors appear in the report. Verdict counts are non-negative integers; `Metrics` is a class you can build from mutant statuses; a threshold `low` may not exceed `high`.
|
|
8
|
+
|
|
9
|
+
## 7.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- The checker request carries a plain data record, not the instrumenter's `Mutant` class. `CheckerRequest.mutants` and `CheckerService.check`/`group` now speak `CheckerMutantWire` - `id`, `fileName`, `mutatorName`, `replacement`, and `location`. A mutant that cannot be described to a checker is skipped instead of reaching it.
|
|
14
|
+
|
|
15
|
+
With `OTEL_ENABLED=true` the CLI now exports its OpenTelemetry metrics to `OTEL_EXPORTER_OTLP_ENDPOINT`, and `OTEL_METRIC_EXPORT_INTERVAL` sets the export interval in milliseconds. Checker timings, mutant counts, and worker crashes now reach a metrics backend.
|
|
16
|
+
|
|
17
|
+
`ConfigEnv` and `resolveExtends` are no longer exported. Import `ConfigEnv` from the config entry point of the package, and read merged options with `loadConfigCell` or `readConfig` from the package root - either performs the `extends` walk, validation and merge in order.
|
|
18
|
+
|
|
3
19
|
## 6.0.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -97,9 +97,43 @@ declare const CheckerFailed_base: S.Class<CheckerFailed, S.TaggedStruct<"Checker
|
|
|
97
97
|
|
|
98
98
|
export declare const CheckerGroupResult: S.$Array<S.$Array<S.String>>;
|
|
99
99
|
|
|
100
|
+
export declare const CheckerMutantWire: S.Struct<{
|
|
101
|
+
readonly id: S.NonEmptyString;
|
|
102
|
+
readonly fileName: S.NonEmptyString;
|
|
103
|
+
readonly mutatorName: S.NonEmptyString;
|
|
104
|
+
readonly replacement: S.String;
|
|
105
|
+
readonly location: S.Struct<{
|
|
106
|
+
readonly start: S.Struct<{
|
|
107
|
+
readonly line: S.Finite;
|
|
108
|
+
readonly column: S.Finite;
|
|
109
|
+
}>;
|
|
110
|
+
readonly end: S.Struct<{
|
|
111
|
+
readonly line: S.Finite;
|
|
112
|
+
readonly column: S.Finite;
|
|
113
|
+
}>;
|
|
114
|
+
}>;
|
|
115
|
+
}>;
|
|
116
|
+
|
|
117
|
+
export declare type CheckerMutantWire = typeof CheckerMutantWire.Type;
|
|
118
|
+
|
|
100
119
|
export declare const CheckerRequest: S.Struct<{
|
|
101
120
|
readonly checkerName: S.String;
|
|
102
|
-
readonly mutants: S.$Array<
|
|
121
|
+
readonly mutants: S.$Array<S.Struct<{
|
|
122
|
+
readonly id: S.NonEmptyString;
|
|
123
|
+
readonly fileName: S.NonEmptyString;
|
|
124
|
+
readonly mutatorName: S.NonEmptyString;
|
|
125
|
+
readonly replacement: S.String;
|
|
126
|
+
readonly location: S.Struct<{
|
|
127
|
+
readonly start: S.Struct<{
|
|
128
|
+
readonly line: S.Finite;
|
|
129
|
+
readonly column: S.Finite;
|
|
130
|
+
}>;
|
|
131
|
+
readonly end: S.Struct<{
|
|
132
|
+
readonly line: S.Finite;
|
|
133
|
+
readonly column: S.Finite;
|
|
134
|
+
}>;
|
|
135
|
+
}>;
|
|
136
|
+
}>>;
|
|
103
137
|
}>;
|
|
104
138
|
|
|
105
139
|
export declare type CheckerRequest = typeof CheckerRequest.Type;
|
|
@@ -108,8 +142,8 @@ export declare const CheckerRpcs: RpcGroup.RpcGroup<TracedRpc<'check', typeof Ch
|
|
|
108
142
|
|
|
109
143
|
export declare interface CheckerService {
|
|
110
144
|
readonly init: Effect$1.Effect<void, CheckerFailed>;
|
|
111
|
-
readonly check: (mutants: readonly
|
|
112
|
-
readonly group: (mutants: readonly
|
|
145
|
+
readonly check: (mutants: readonly CheckerMutantWire[]) => Effect$1.Effect<HashMap.HashMap<string, CheckResult>, CheckerFailed>;
|
|
146
|
+
readonly group: (mutants: readonly CheckerMutantWire[]) => Effect$1.Effect<readonly (readonly string[])[], CheckerFailed>;
|
|
113
147
|
}
|
|
114
148
|
|
|
115
149
|
export declare type CheckResult = FailedCheckResult | PassedCheckResult;
|
|
@@ -158,6 +192,8 @@ export declare type Dependencies = typeof DependenciesSchema.Type;
|
|
|
158
192
|
|
|
159
193
|
export declare const DependenciesSchema: S.$Record<S.String, S.String>;
|
|
160
194
|
|
|
195
|
+
export declare const DetectedStatus: S.Union<readonly [S.Literal<"Killed">, S.Literal<"Timeout">]>;
|
|
196
|
+
|
|
161
197
|
export declare class DryRunCompleted extends DryRunCompleted_base {}
|
|
162
198
|
|
|
163
199
|
declare const DryRunCompleted_base: S.Class<DryRunCompleted, S.TaggedStruct<"dryRunCompleted", {
|
|
@@ -168,7 +204,7 @@ declare const DryRunCompleted_base: S.Class<DryRunCompleted, S.TaggedStruct<"dry
|
|
|
168
204
|
readonly capabilities: S.Struct<{
|
|
169
205
|
readonly reloadEnvironment: S.Boolean;
|
|
170
206
|
}>;
|
|
171
|
-
readonly testCount: S.
|
|
207
|
+
readonly testCount: S.Int;
|
|
172
208
|
readonly tests: S.$Array<S.Union<readonly [S.Struct<{
|
|
173
209
|
readonly id: S.String;
|
|
174
210
|
readonly name: S.String;
|
|
@@ -336,7 +372,7 @@ export declare const FileResultDictionarySchema: S.$Record<S.String, S.Struct<{
|
|
|
336
372
|
readonly static: S.optional<S.Boolean>;
|
|
337
373
|
readonly coveredBy: S.optional<S.$Array<S.String>>;
|
|
338
374
|
readonly killedBy: S.optional<S.$Array<S.String>>;
|
|
339
|
-
readonly testsCompleted: S.optional<S.
|
|
375
|
+
readonly testsCompleted: S.optional<S.Int>;
|
|
340
376
|
readonly duration: S.optional<S.Finite>;
|
|
341
377
|
}>>;
|
|
342
378
|
}>>;
|
|
@@ -364,7 +400,7 @@ export declare const FileResultSchema: S.Struct<{
|
|
|
364
400
|
readonly static: S.optional<S.Boolean>;
|
|
365
401
|
readonly coveredBy: S.optional<S.$Array<S.String>>;
|
|
366
402
|
readonly killedBy: S.optional<S.$Array<S.String>>;
|
|
367
|
-
readonly testsCompleted: S.optional<S.
|
|
403
|
+
readonly testsCompleted: S.optional<S.Int>;
|
|
368
404
|
readonly duration: S.optional<S.Finite>;
|
|
369
405
|
}>>;
|
|
370
406
|
}>;
|
|
@@ -383,6 +419,8 @@ export declare const FrameworkInformationSchema: S.Struct<{
|
|
|
383
419
|
readonly dependencies: S.optional<S.$Record<S.String, S.String>>;
|
|
384
420
|
}>;
|
|
385
421
|
|
|
422
|
+
export declare const InvalidStatus: S.Union<readonly [S.Literal<"CompileError">, S.Literal<"RuntimeError">]>;
|
|
423
|
+
|
|
386
424
|
export declare const isCustomTestRunner: (value: TestRunnerConfig) => value is TestRunnerCustomConfig;
|
|
387
425
|
|
|
388
426
|
export declare interface KilledMutantRunResult {
|
|
@@ -409,7 +447,30 @@ declare type LogLevel = typeof LogLevel.Type;
|
|
|
409
447
|
export { LogLevel }
|
|
410
448
|
export { LogLevel as LogLevelType }
|
|
411
449
|
|
|
412
|
-
export declare
|
|
450
|
+
export declare class Metrics extends Metrics_base {
|
|
451
|
+
get totalDetected(): number;
|
|
452
|
+
get totalUndetected(): number;
|
|
453
|
+
get totalCovered(): number;
|
|
454
|
+
get totalValid(): number;
|
|
455
|
+
get totalInvalid(): number;
|
|
456
|
+
get totalMutants(): number;
|
|
457
|
+
get mutationScore(): number;
|
|
458
|
+
get mutationScoreBasedOnCoveredCode(): number;
|
|
459
|
+
static fromMutants(mutants: readonly {
|
|
460
|
+
readonly status: string;
|
|
461
|
+
}[]): Metrics;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
declare const Metrics_base: S.Class<Metrics, S.Struct<{
|
|
465
|
+
readonly pending: S.Int;
|
|
466
|
+
readonly killed: S.Int;
|
|
467
|
+
readonly timeout: S.Int;
|
|
468
|
+
readonly survived: S.Int;
|
|
469
|
+
readonly noCoverage: S.Int;
|
|
470
|
+
readonly runtimeErrors: S.Int;
|
|
471
|
+
readonly compileErrors: S.Int;
|
|
472
|
+
readonly ignored: S.Int;
|
|
473
|
+
}>, {}>;
|
|
413
474
|
|
|
414
475
|
export declare interface MetricsResult {
|
|
415
476
|
readonly name: string;
|
|
@@ -417,47 +478,15 @@ export declare interface MetricsResult {
|
|
|
417
478
|
readonly childResults: readonly MetricsResult[];
|
|
418
479
|
}
|
|
419
480
|
|
|
420
|
-
export declare
|
|
421
|
-
readonly name:
|
|
422
|
-
readonly metrics:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
readonly timeout: S.Finite;
|
|
426
|
-
readonly survived: S.Finite;
|
|
427
|
-
readonly noCoverage: S.Finite;
|
|
428
|
-
readonly runtimeErrors: S.Finite;
|
|
429
|
-
readonly compileErrors: S.Finite;
|
|
430
|
-
readonly ignored: S.Finite;
|
|
431
|
-
readonly totalDetected: S.Finite;
|
|
432
|
-
readonly totalUndetected: S.Finite;
|
|
433
|
-
readonly totalInvalid: S.Finite;
|
|
434
|
-
readonly totalValid: S.Finite;
|
|
435
|
-
readonly totalMutants: S.Finite;
|
|
436
|
-
readonly totalCovered: S.Finite;
|
|
437
|
-
readonly mutationScore: S.Finite;
|
|
438
|
-
readonly mutationScoreBasedOnCoveredCode: S.Finite;
|
|
439
|
-
}>;
|
|
440
|
-
readonly childResults: S.$Array<S.suspend<S.Codec<MetricsResult, MetricsResult, never, never>>>;
|
|
441
|
-
}>;
|
|
481
|
+
export declare interface MetricsResultEncoded {
|
|
482
|
+
readonly name: string;
|
|
483
|
+
readonly metrics: typeof Metrics.Encoded;
|
|
484
|
+
readonly childResults: readonly MetricsResultEncoded[];
|
|
485
|
+
}
|
|
442
486
|
|
|
443
|
-
export declare const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
readonly timeout: S.Finite;
|
|
447
|
-
readonly survived: S.Finite;
|
|
448
|
-
readonly noCoverage: S.Finite;
|
|
449
|
-
readonly runtimeErrors: S.Finite;
|
|
450
|
-
readonly compileErrors: S.Finite;
|
|
451
|
-
readonly ignored: S.Finite;
|
|
452
|
-
readonly totalDetected: S.Finite;
|
|
453
|
-
readonly totalUndetected: S.Finite;
|
|
454
|
-
readonly totalInvalid: S.Finite;
|
|
455
|
-
readonly totalValid: S.Finite;
|
|
456
|
-
readonly totalMutants: S.Finite;
|
|
457
|
-
readonly totalCovered: S.Finite;
|
|
458
|
-
readonly mutationScore: S.Finite;
|
|
459
|
-
readonly mutationScoreBasedOnCoveredCode: S.Finite;
|
|
460
|
-
}>;
|
|
487
|
+
export declare const MetricsResultSchema: S.Codec<MetricsResult, MetricsResultEncoded>;
|
|
488
|
+
|
|
489
|
+
export declare const MetricsSchema: typeof Metrics;
|
|
461
490
|
|
|
462
491
|
export { MutantActivation }
|
|
463
492
|
|
|
@@ -492,7 +521,7 @@ export declare const MutantResultSchema: S.Struct<{
|
|
|
492
521
|
readonly static: S.optional<S.Boolean>;
|
|
493
522
|
readonly coveredBy: S.optional<S.$Array<S.String>>;
|
|
494
523
|
readonly killedBy: S.optional<S.$Array<S.String>>;
|
|
495
|
-
readonly testsCompleted: S.optional<S.
|
|
524
|
+
readonly testsCompleted: S.optional<S.Int>;
|
|
496
525
|
readonly duration: S.optional<S.Finite>;
|
|
497
526
|
}>;
|
|
498
527
|
|
|
@@ -544,8 +573,8 @@ declare const MutantTested_base: S.Class<MutantTested, S.TaggedStruct<"mutantTes
|
|
|
544
573
|
}>;
|
|
545
574
|
readonly mutator: S.String;
|
|
546
575
|
readonly replacement: S.NullOr<S.String>;
|
|
547
|
-
readonly completed: S.
|
|
548
|
-
readonly total: S.
|
|
576
|
+
readonly completed: S.Int;
|
|
577
|
+
readonly total: S.Int;
|
|
549
578
|
}>, {}>;
|
|
550
579
|
|
|
551
580
|
export declare type MutationScoreThresholds = typeof MutationScoreThresholdsSchema.Type;
|
|
@@ -559,7 +588,7 @@ export declare const MutationScoreThresholdsSchema: S.Struct<{
|
|
|
559
588
|
export declare class MutationTestingPlanReady extends MutationTestingPlanReady_base {}
|
|
560
589
|
|
|
561
590
|
declare const MutationTestingPlanReady_base: S.Class<MutationTestingPlanReady, S.TaggedStruct<"mutationTestingPlanReady", {
|
|
562
|
-
readonly total: S.
|
|
591
|
+
readonly total: S.Int;
|
|
563
592
|
readonly plans: S.$Array<S.Struct<{
|
|
564
593
|
readonly mutantId: S.String;
|
|
565
594
|
readonly plan: S.Literals<readonly ["EarlyResult", "Run"]>;
|
|
@@ -596,7 +625,7 @@ declare const MutationTestReportReady_base: S.Class<MutationTestReportReady, S.T
|
|
|
596
625
|
readonly static: S.optional<S.Boolean>;
|
|
597
626
|
readonly coveredBy: S.optional<S.$Array<S.String>>;
|
|
598
627
|
readonly killedBy: S.optional<S.$Array<S.String>>;
|
|
599
|
-
readonly testsCompleted: S.optional<S.
|
|
628
|
+
readonly testsCompleted: S.optional<S.Int>;
|
|
600
629
|
readonly duration: S.optional<S.Finite>;
|
|
601
630
|
}>>;
|
|
602
631
|
}>>;
|
|
@@ -633,28 +662,7 @@ declare const MutationTestReportReady_base: S.Class<MutationTestReportReady, S.T
|
|
|
633
662
|
readonly dependencies: S.optional<S.$Record<S.String, S.String>>;
|
|
634
663
|
}>>;
|
|
635
664
|
}>;
|
|
636
|
-
readonly metrics: S.
|
|
637
|
-
readonly name: S.String;
|
|
638
|
-
readonly metrics: S.Struct<{
|
|
639
|
-
readonly pending: S.Finite;
|
|
640
|
-
readonly killed: S.Finite;
|
|
641
|
-
readonly timeout: S.Finite;
|
|
642
|
-
readonly survived: S.Finite;
|
|
643
|
-
readonly noCoverage: S.Finite;
|
|
644
|
-
readonly runtimeErrors: S.Finite;
|
|
645
|
-
readonly compileErrors: S.Finite;
|
|
646
|
-
readonly ignored: S.Finite;
|
|
647
|
-
readonly totalDetected: S.Finite;
|
|
648
|
-
readonly totalUndetected: S.Finite;
|
|
649
|
-
readonly totalInvalid: S.Finite;
|
|
650
|
-
readonly totalValid: S.Finite;
|
|
651
|
-
readonly totalMutants: S.Finite;
|
|
652
|
-
readonly totalCovered: S.Finite;
|
|
653
|
-
readonly mutationScore: S.Finite;
|
|
654
|
-
readonly mutationScoreBasedOnCoveredCode: S.Finite;
|
|
655
|
-
}>;
|
|
656
|
-
readonly childResults: S.$Array<S.suspend<S.Codec<MetricsResult, MetricsResult, never, never>>>;
|
|
657
|
-
}>;
|
|
665
|
+
readonly metrics: S.Codec<MetricsResult, MetricsResultEncoded, never, never>;
|
|
658
666
|
}>, {}>;
|
|
659
667
|
|
|
660
668
|
export declare type MutationTestResult = typeof MutationTestResultSchema.Type;
|
|
@@ -684,7 +692,7 @@ export declare const MutationTestResultSchema: S.Struct<{
|
|
|
684
692
|
readonly static: S.optional<S.Boolean>;
|
|
685
693
|
readonly coveredBy: S.optional<S.$Array<S.String>>;
|
|
686
694
|
readonly killedBy: S.optional<S.$Array<S.String>>;
|
|
687
|
-
readonly testsCompleted: S.optional<S.
|
|
695
|
+
readonly testsCompleted: S.optional<S.Int>;
|
|
688
696
|
readonly duration: S.optional<S.Finite>;
|
|
689
697
|
}>>;
|
|
690
698
|
}>>;
|
|
@@ -722,6 +730,10 @@ export declare const MutationTestResultSchema: S.Struct<{
|
|
|
722
730
|
}>>;
|
|
723
731
|
}>;
|
|
724
732
|
|
|
733
|
+
export declare const NonNegativeFinite: S.Finite;
|
|
734
|
+
|
|
735
|
+
export declare const NonNegativeInt: S.Int;
|
|
736
|
+
|
|
725
737
|
export declare type OnlyObject<T> = Exclude<T, Primitive>;
|
|
726
738
|
|
|
727
739
|
export { OpenEndLocation }
|
|
@@ -746,6 +758,8 @@ export declare interface PassedCheckResult {
|
|
|
746
758
|
readonly status: 'passed';
|
|
747
759
|
}
|
|
748
760
|
|
|
761
|
+
export declare const Percentage: S.Finite;
|
|
762
|
+
|
|
749
763
|
export declare const PluginFileUrl: S.String;
|
|
750
764
|
|
|
751
765
|
export { Position }
|
|
@@ -1126,7 +1140,7 @@ export declare const TestRunnerMutantRunRequest: S.Struct<{
|
|
|
1126
1140
|
readonly options: S.Struct<{
|
|
1127
1141
|
readonly timeout: S.Finite;
|
|
1128
1142
|
readonly disableBail: S.Boolean;
|
|
1129
|
-
readonly activeMutant:
|
|
1143
|
+
readonly activeMutant: Mutant;
|
|
1130
1144
|
readonly sandboxFileName: S.String;
|
|
1131
1145
|
readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
|
|
1132
1146
|
readonly reloadEnvironment: S.Boolean;
|
|
@@ -1194,6 +1208,10 @@ export declare const TRACEPARENT_HEADER = "traceparent";
|
|
|
1194
1208
|
|
|
1195
1209
|
export declare const TRACESTATE_HEADER = "tracestate";
|
|
1196
1210
|
|
|
1211
|
+
export declare const UndetectedStatus: S.Union<readonly [S.Literal<"Survived">, S.Literal<"NoCoverage">]>;
|
|
1212
|
+
|
|
1213
|
+
export declare const UntestedStatus: S.Union<readonly [S.Literal<"Ignored">, S.Literal<"Pending">]>;
|
|
1214
|
+
|
|
1197
1215
|
export declare const WorkerEntryUrl: S.String;
|
|
1198
1216
|
|
|
1199
1217
|
export declare type WorkerEntryUrl = typeof WorkerEntryUrl.Type;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LocationSchema, LocationSchema as LocationSchema$1,
|
|
1
|
+
import { LocationSchema, LocationSchema as LocationSchema$1, MutantActivationSchema, MutantRunOptionsSchema, MutantRunOptionsSchema as MutantRunOptionsSchema$1, MutantStatusSchema, MutantStatusSchema as MutantStatusSchema$1, OpenEndLocationSchema, OpenEndLocationSchema as OpenEndLocationSchema$1, PositionSchema, PositionSchema as PositionSchema$1, RunOptionsFields } from "@systemfsoftware/stryker-js-instrumenter";
|
|
2
2
|
import * as Context from "effect/Context";
|
|
3
3
|
import * as S from "effect/Schema";
|
|
4
4
|
import * as Rpc from "effect/unstable/rpc/Rpc";
|
|
@@ -8,6 +8,22 @@ import { Effect } from "effect";
|
|
|
8
8
|
import * as Match from "effect/Match";
|
|
9
9
|
import * as Option from "effect/Option";
|
|
10
10
|
//#region src/Checker.schema.ts
|
|
11
|
+
/** A position inside a file, in the coordinates the wire carries — 0-based line and column. */
|
|
12
|
+
const CheckerPositionWire = S.Struct({
|
|
13
|
+
line: S.Finite,
|
|
14
|
+
column: S.Finite
|
|
15
|
+
});
|
|
16
|
+
const CheckerLocationWire = S.Struct({
|
|
17
|
+
start: CheckerPositionWire,
|
|
18
|
+
end: CheckerPositionWire
|
|
19
|
+
});
|
|
20
|
+
const CheckerMutantWire = S.Struct({
|
|
21
|
+
id: S.NonEmptyString,
|
|
22
|
+
fileName: S.NonEmptyString,
|
|
23
|
+
mutatorName: S.NonEmptyString,
|
|
24
|
+
replacement: S.String,
|
|
25
|
+
location: CheckerLocationWire
|
|
26
|
+
});
|
|
11
27
|
const CheckStatus = S.Literals(["passed", "compileError"]);
|
|
12
28
|
const CheckResultSchema = S.Union([S.Struct({ status: S.Literal("passed") }), S.Struct({
|
|
13
29
|
status: S.Literal("compileError"),
|
|
@@ -55,27 +71,87 @@ const EXIT_CODE = {
|
|
|
55
71
|
};
|
|
56
72
|
//#endregion
|
|
57
73
|
//#region src/Metrics.schema.ts
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
const DetectedStatus = S.Union([S.Literal("Killed"), S.Literal("Timeout")]);
|
|
75
|
+
const UndetectedStatus = S.Union([S.Literal("Survived"), S.Literal("NoCoverage")]);
|
|
76
|
+
const InvalidStatus = S.Union([S.Literal("CompileError"), S.Literal("RuntimeError")]);
|
|
77
|
+
const UntestedStatus = S.Union([S.Literal("Ignored"), S.Literal("Pending")]);
|
|
78
|
+
const NonNegativeInt = S.Int.pipe(S.check(S.isGreaterThanOrEqualTo(0)));
|
|
79
|
+
const NonNegativeFinite = S.Finite.pipe(S.check(S.isGreaterThanOrEqualTo(0)));
|
|
80
|
+
const Percentage = S.Finite.pipe(S.check(S.isBetween({
|
|
81
|
+
minimum: 0,
|
|
82
|
+
maximum: 100
|
|
83
|
+
})));
|
|
84
|
+
var Metrics = class Metrics extends S.Class("Metrics")({
|
|
85
|
+
pending: NonNegativeInt,
|
|
86
|
+
killed: NonNegativeInt,
|
|
87
|
+
timeout: NonNegativeInt,
|
|
88
|
+
survived: NonNegativeInt,
|
|
89
|
+
noCoverage: NonNegativeInt,
|
|
90
|
+
runtimeErrors: NonNegativeInt,
|
|
91
|
+
compileErrors: NonNegativeInt,
|
|
92
|
+
ignored: NonNegativeInt
|
|
93
|
+
}) {
|
|
94
|
+
get totalDetected() {
|
|
95
|
+
return this.timeout + this.killed;
|
|
96
|
+
}
|
|
97
|
+
get totalUndetected() {
|
|
98
|
+
return this.survived + this.noCoverage;
|
|
99
|
+
}
|
|
100
|
+
get totalCovered() {
|
|
101
|
+
return this.totalDetected + this.survived;
|
|
102
|
+
}
|
|
103
|
+
get totalValid() {
|
|
104
|
+
return this.totalUndetected + this.totalDetected;
|
|
105
|
+
}
|
|
106
|
+
get totalInvalid() {
|
|
107
|
+
return this.runtimeErrors + this.compileErrors;
|
|
108
|
+
}
|
|
109
|
+
get totalMutants() {
|
|
110
|
+
return this.totalValid + this.totalInvalid + this.ignored + this.pending;
|
|
111
|
+
}
|
|
112
|
+
get mutationScore() {
|
|
113
|
+
if (this.totalValid === 0) return NaN;
|
|
114
|
+
return Math.min(100, Math.max(0, this.totalDetected / this.totalValid * 100));
|
|
115
|
+
}
|
|
116
|
+
get mutationScoreBasedOnCoveredCode() {
|
|
117
|
+
if (this.totalCovered === 0) return NaN;
|
|
118
|
+
return Math.min(100, Math.max(0, this.totalDetected / this.totalCovered * 100));
|
|
119
|
+
}
|
|
120
|
+
static fromMutants(mutants) {
|
|
121
|
+
const counts = emptyMetricCounts();
|
|
122
|
+
for (const mutant of mutants) incrementMetricStatus(counts, mutant.status);
|
|
123
|
+
return Metrics.make(counts);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const emptyMetricCounts = () => ({
|
|
127
|
+
pending: 0,
|
|
128
|
+
killed: 0,
|
|
129
|
+
timeout: 0,
|
|
130
|
+
survived: 0,
|
|
131
|
+
noCoverage: 0,
|
|
132
|
+
runtimeErrors: 0,
|
|
133
|
+
compileErrors: 0,
|
|
134
|
+
ignored: 0
|
|
75
135
|
});
|
|
136
|
+
const METRIC_STATUS_KEYS = {
|
|
137
|
+
Pending: "pending",
|
|
138
|
+
Killed: "killed",
|
|
139
|
+
Timeout: "timeout",
|
|
140
|
+
Survived: "survived",
|
|
141
|
+
NoCoverage: "noCoverage",
|
|
142
|
+
RuntimeError: "runtimeErrors",
|
|
143
|
+
CompileError: "compileErrors",
|
|
144
|
+
Ignored: "ignored"
|
|
145
|
+
};
|
|
146
|
+
const incrementMetricStatus = (counts, status) => {
|
|
147
|
+
const key = METRIC_STATUS_KEYS[status];
|
|
148
|
+
if (key === void 0) return;
|
|
149
|
+
counts[key] += 1;
|
|
150
|
+
};
|
|
151
|
+
const MetricsSchema = Metrics;
|
|
76
152
|
const MetricsResultSchema = S.Struct({
|
|
77
153
|
name: S.String,
|
|
78
|
-
metrics:
|
|
154
|
+
metrics: Metrics,
|
|
79
155
|
childResults: S.Array(S.suspend(() => MetricsResultSchema))
|
|
80
156
|
}).annotate({ identifier: "MetricsResult" });
|
|
81
157
|
//#endregion
|
|
@@ -91,8 +167,8 @@ const MutantResultSchema = S.Struct({
|
|
|
91
167
|
static: S.optional(S.Boolean),
|
|
92
168
|
coveredBy: S.optional(S.Array(S.String)),
|
|
93
169
|
killedBy: S.optional(S.Array(S.String)),
|
|
94
|
-
testsCompleted: S.optional(
|
|
95
|
-
duration: S.optional(
|
|
170
|
+
testsCompleted: S.optional(NonNegativeInt),
|
|
171
|
+
duration: S.optional(NonNegativeFinite)
|
|
96
172
|
});
|
|
97
173
|
const FileResultSchema = S.Struct({
|
|
98
174
|
language: S.String,
|
|
@@ -111,9 +187,23 @@ const TestFileSchema = S.Struct({
|
|
|
111
187
|
});
|
|
112
188
|
const TestFileDefinitionDictionarySchema = S.Record(S.String, TestFileSchema);
|
|
113
189
|
const ThresholdsSchema = S.Struct({
|
|
114
|
-
high:
|
|
115
|
-
low:
|
|
116
|
-
})
|
|
190
|
+
high: Percentage,
|
|
191
|
+
low: Percentage
|
|
192
|
+
}).pipe(S.check(S.makeFilter((t) => t.low <= t.high, {
|
|
193
|
+
expected: "thresholds where low <= high",
|
|
194
|
+
arbitrary: { candidate: { make: (fc) => fc.tuple(fc.float({
|
|
195
|
+
min: 0,
|
|
196
|
+
max: 100,
|
|
197
|
+
noNaN: true
|
|
198
|
+
}), fc.float({
|
|
199
|
+
min: 0,
|
|
200
|
+
max: 100,
|
|
201
|
+
noNaN: true
|
|
202
|
+
})).map(([a, b]) => ({
|
|
203
|
+
high: Math.max(a, b),
|
|
204
|
+
low: Math.min(a, b)
|
|
205
|
+
})) } }
|
|
206
|
+
})));
|
|
117
207
|
const BrandingInformationSchema = S.Struct({
|
|
118
208
|
homepageUrl: S.String,
|
|
119
209
|
imageUrl: S.optional(S.String)
|
|
@@ -245,24 +335,24 @@ const ReporterEventKind = S.Literals([
|
|
|
245
335
|
"mutationTestReportReady"
|
|
246
336
|
]);
|
|
247
337
|
const RunTimingSchema = S.Struct({
|
|
248
|
-
net:
|
|
249
|
-
overhead:
|
|
338
|
+
net: NonNegativeFinite,
|
|
339
|
+
overhead: NonNegativeFinite
|
|
250
340
|
});
|
|
251
341
|
const ReporterPlanKind = S.Literals(["EarlyResult", "Run"]);
|
|
252
342
|
const ReporterPlanDescriptorSchema = S.Struct({
|
|
253
343
|
mutantId: S.String,
|
|
254
344
|
plan: ReporterPlanKind,
|
|
255
|
-
netTime:
|
|
345
|
+
netTime: NonNegativeFinite,
|
|
256
346
|
reloadEnvironment: S.Boolean
|
|
257
347
|
});
|
|
258
348
|
var DryRunCompleted = class extends S.TaggedClass()("dryRunCompleted", {
|
|
259
349
|
timing: RunTimingSchema,
|
|
260
350
|
capabilities: TestRunnerCapabilitiesSchema,
|
|
261
|
-
testCount:
|
|
351
|
+
testCount: NonNegativeInt,
|
|
262
352
|
tests: S.Array(TestResultSchema)
|
|
263
353
|
}) {};
|
|
264
354
|
var MutationTestingPlanReady = class extends S.TaggedClass()("mutationTestingPlanReady", {
|
|
265
|
-
total:
|
|
355
|
+
total: NonNegativeInt,
|
|
266
356
|
plans: S.Array(ReporterPlanDescriptorSchema)
|
|
267
357
|
}) {};
|
|
268
358
|
var MutantTested = class extends S.TaggedClass()("mutantTested", {
|
|
@@ -272,8 +362,8 @@ var MutantTested = class extends S.TaggedClass()("mutantTested", {
|
|
|
272
362
|
location: LocationSchema$1,
|
|
273
363
|
mutator: S.String,
|
|
274
364
|
replacement: S.NullOr(S.String),
|
|
275
|
-
completed:
|
|
276
|
-
total:
|
|
365
|
+
completed: NonNegativeInt,
|
|
366
|
+
total: NonNegativeInt
|
|
277
367
|
}) {};
|
|
278
368
|
var MutationTestReportReady = class extends S.TaggedClass()("mutationTestReportReady", {
|
|
279
369
|
report: MutationTestResultSchema,
|
|
@@ -302,7 +392,7 @@ const TestRunnerDryRunRequest = S.Struct({ options: DryRunOptionsSchema });
|
|
|
302
392
|
const TestRunnerMutantRunRequest = S.Struct({ options: MutantRunOptionsSchema$1 });
|
|
303
393
|
const CheckerRequest = S.Struct({
|
|
304
394
|
checkerName: S.String,
|
|
305
|
-
mutants: S.Array(
|
|
395
|
+
mutants: S.Array(CheckerMutantWire)
|
|
306
396
|
});
|
|
307
397
|
const CheckerCheckResult = S.Record(S.String, CheckResultSchema);
|
|
308
398
|
const CheckerGroupResult = S.Array(S.Array(S.String));
|
|
@@ -445,11 +535,6 @@ const PackageManager = S.Literals([
|
|
|
445
535
|
"yarn",
|
|
446
536
|
"pnpm"
|
|
447
537
|
]);
|
|
448
|
-
/** 0–100 percentage used by the mutation-score thresholds. */
|
|
449
|
-
const Percentage = S.Finite.pipe(S.check(S.isBetween({
|
|
450
|
-
minimum: 0,
|
|
451
|
-
maximum: 100
|
|
452
|
-
})));
|
|
453
538
|
const CommandRunnerOptionsSchema = openStruct({ command: defaulted(S.String, "npm test") });
|
|
454
539
|
const ClearTextReporterOptions = openStruct({
|
|
455
540
|
allowColor: defaulted(S.Boolean, true),
|
|
@@ -467,7 +552,26 @@ const MutationScoreThresholdsSchema = S.Struct({
|
|
|
467
552
|
high: defaulted(Percentage, 80),
|
|
468
553
|
low: defaulted(Percentage, 60),
|
|
469
554
|
break: defaulted(S.NullOr(Percentage), null)
|
|
470
|
-
})
|
|
555
|
+
}).pipe(S.check(S.makeFilter((t) => t.low <= t.high, {
|
|
556
|
+
expected: "thresholds where low <= high",
|
|
557
|
+
arbitrary: { candidate: { make: (fc) => fc.tuple(fc.float({
|
|
558
|
+
min: 0,
|
|
559
|
+
max: 100,
|
|
560
|
+
noNaN: true
|
|
561
|
+
}), fc.float({
|
|
562
|
+
min: 0,
|
|
563
|
+
max: 100,
|
|
564
|
+
noNaN: true
|
|
565
|
+
}), fc.option(fc.float({
|
|
566
|
+
min: 0,
|
|
567
|
+
max: 100,
|
|
568
|
+
noNaN: true
|
|
569
|
+
}), { nil: null })).map(([a, b, brk]) => ({
|
|
570
|
+
high: Math.max(a, b),
|
|
571
|
+
low: Math.min(a, b),
|
|
572
|
+
break: brk
|
|
573
|
+
})) } }
|
|
574
|
+
})));
|
|
471
575
|
const MutatorDescriptor = S.Struct({ excludedMutations: defaulted(S.Array(S.String), []) });
|
|
472
576
|
const WarningOptions = openStruct({
|
|
473
577
|
unknownOptions: defaulted(S.Boolean, true),
|
|
@@ -692,4 +796,4 @@ const parseTraceparent = (value) => {
|
|
|
692
796
|
};
|
|
693
797
|
const TraceContextReference = Context.Reference("@systemfsoftware/stryker-js-plugin-interface/TraceContextReference", { defaultValue: () => Option.none() });
|
|
694
798
|
//#endregion
|
|
695
|
-
export { BoundaryErrorSchema, BoundaryPayloadRejected, BoundaryUnrecognizedSignal, BrandingInformationSchema, CheckResultSchema, CheckStatus, Checker, CheckerCheckResult, CheckerCustomConfigSchema, CheckerEntryConfigSchema, CheckerFailed, CheckerGroupResult, CheckerRequest, CheckerRpcs, CommandRunnerOptionsSchema, CoverageAnalysisMode, CoverageAnalysisSchema, DependenciesSchema, DryRunCompleted, DryRunOptionsSchema, DryRunResultSchema, DryRunStatus, EXIT_CODE, Evaluator, EvaluatorFailed, ExitClass, FileResultDictionarySchema, FileResultSchema, FrameworkInformationSchema, LocationSchema, LogLevel, MetricsResultSchema, MetricsSchema, MutantActivationSchema, MutantCoverageSchema, MutantResultSchema, MutantRunOptionsSchema, MutantRunResultSchema, MutantRunStatus, MutantStatusSchema, MutantTested, MutationScoreThresholdsSchema, MutationTestReportReady, MutationTestResultSchema, MutationTestingPlanReady, OpenEndLocationSchema, PackageManager, PluginFileUrl, PositionSchema, PropagatedTrace, RENDERED_OPTION_DEFAULTS, ReportType, ReporterAck, ReporterDrained, ReporterEventBatch, ReporterEventKind, ReporterEventSchema, ReporterEventUnion, ReporterFailed, ReporterInitOptions, ReporterPlanDescriptorSchema, ReporterPlanKind, ReporterRpcs, RunTimingSchema, StrykerOptionsSchema, TRACEPARENT_HEADER, TRACESTATE_HEADER, TestDefinitionSchema, TestFileDefinitionDictionarySchema, TestFileSchema, TestResultSchema, TestRunner, TestRunnerCapabilitiesSchema, TestRunnerConfigSchema, TestRunnerCustomConfigSchema, TestRunnerDryRunRequest, TestRunnerFailed, TestRunnerMutantRunRequest, TestRunnerRpcs, TestStatus, ThresholdsSchema, TraceContextMiddleware, TraceContextReference, WorkerEntryUrl, WorkerPluginKind, WorkerPluginSpawnSchema, formatTraceparent, isCustomTestRunner, parseTraceparent, propertyPath, strykerCoreSchema, strykerReportBugUrl, testFilesProvided, toMutantRunResult };
|
|
799
|
+
export { BoundaryErrorSchema, BoundaryPayloadRejected, BoundaryUnrecognizedSignal, BrandingInformationSchema, CheckResultSchema, CheckStatus, Checker, CheckerCheckResult, CheckerCustomConfigSchema, CheckerEntryConfigSchema, CheckerFailed, CheckerGroupResult, CheckerMutantWire, CheckerRequest, CheckerRpcs, CommandRunnerOptionsSchema, CoverageAnalysisMode, CoverageAnalysisSchema, DependenciesSchema, DetectedStatus, DryRunCompleted, DryRunOptionsSchema, DryRunResultSchema, DryRunStatus, EXIT_CODE, Evaluator, EvaluatorFailed, ExitClass, FileResultDictionarySchema, FileResultSchema, FrameworkInformationSchema, InvalidStatus, LocationSchema, LogLevel, Metrics, MetricsResultSchema, MetricsSchema, MutantActivationSchema, MutantCoverageSchema, MutantResultSchema, MutantRunOptionsSchema, MutantRunResultSchema, MutantRunStatus, MutantStatusSchema, MutantTested, MutationScoreThresholdsSchema, MutationTestReportReady, MutationTestResultSchema, MutationTestingPlanReady, NonNegativeFinite, NonNegativeInt, OpenEndLocationSchema, PackageManager, Percentage, PluginFileUrl, PositionSchema, PropagatedTrace, RENDERED_OPTION_DEFAULTS, ReportType, ReporterAck, ReporterDrained, ReporterEventBatch, ReporterEventKind, ReporterEventSchema, ReporterEventUnion, ReporterFailed, ReporterInitOptions, ReporterPlanDescriptorSchema, ReporterPlanKind, ReporterRpcs, RunTimingSchema, StrykerOptionsSchema, TRACEPARENT_HEADER, TRACESTATE_HEADER, TestDefinitionSchema, TestFileDefinitionDictionarySchema, TestFileSchema, TestResultSchema, TestRunner, TestRunnerCapabilitiesSchema, TestRunnerConfigSchema, TestRunnerCustomConfigSchema, TestRunnerDryRunRequest, TestRunnerFailed, TestRunnerMutantRunRequest, TestRunnerRpcs, TestStatus, ThresholdsSchema, TraceContextMiddleware, TraceContextReference, UndetectedStatus, UntestedStatus, WorkerEntryUrl, WorkerPluginKind, WorkerPluginSpawnSchema, formatTraceparent, isCustomTestRunner, parseTraceparent, propertyPath, strykerCoreSchema, strykerReportBugUrl, testFilesProvided, toMutantRunResult };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js-plugin-interface",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"tsdown": "^0.23.0",
|
|
37
37
|
"typescript": "^7",
|
|
38
38
|
"vitest": "^4",
|
|
39
|
-
"@systemfsoftware/
|
|
40
|
-
"@systemfsoftware/
|
|
39
|
+
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
40
|
+
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public",
|