@systemfsoftware/stryker-js 1.0.0 → 3.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.
- package/CHANGELOG.md +164 -0
- package/README.md +1 -1
- package/dist/{Checker-DYgIIEai.d.mts → Checker-A8o5B3Ub.d.mts} +1 -1
- package/dist/Checker.d.mts +1 -1
- package/dist/{Evaluator-RZBS4oeh.d.mts → Evaluator-CnAN8-pZ.d.mts} +2 -2
- package/dist/Evaluator.d.mts +1 -1
- package/dist/ExitClass.d.mts +1 -1
- package/dist/ExitClass.mjs +20 -31
- package/dist/Metrics.d.mts +7 -0
- package/dist/Metrics.mjs +79 -0
- package/dist/Metrics.schema-BaVd6rXs.d.mts +50 -0
- package/dist/Metrics.schema-DZdoc46X.mjs +27 -0
- package/dist/{Mutant-BPRJTF8f.d.mts → Mutant-Ci25PsWA.d.mts} +6 -6
- package/dist/Mutant.d.mts +3 -2
- package/dist/Mutant.mjs +54 -78
- package/dist/{Mutant.schema-BTWhFTk4.mjs → Mutant.schema-H3r0ho_R.mjs} +3 -3
- package/dist/{Plugin-DcDAIBQi.d.mts → Plugin-CunIOPtw.d.mts} +31 -13
- package/dist/Plugin-DXFdJP1l.mjs +105 -0
- package/dist/Plugin.d.mts +2 -2
- package/dist/Plugin.mjs +2 -2
- package/dist/Report.d.mts +2 -0
- package/dist/Report.mjs +98 -0
- package/dist/Report.schema-_buHXdnZ.d.mts +251 -0
- package/dist/Reporter-BU7qo6MR.d.mts +16 -0
- package/dist/Reporter-BWTwlSJf.mjs +25 -0
- package/dist/Reporter.d.mts +4 -2
- package/dist/Reporter.mjs +3 -2
- package/dist/ReporterEvent.d.mts +2 -0
- package/dist/ReporterEvent.mjs +58 -0
- package/dist/ReporterEvent.schema-Db6r_euv.d.mts +190 -0
- package/dist/{Run-BnmGGgWj.d.mts → Run-CnhaYlAC.d.mts} +6 -12
- package/dist/Run.d.mts +2 -2
- package/dist/Run.mjs +56 -2
- package/dist/{Run-BcDo-hIC.mjs → Run.schema-C4m-b9Ki.mjs} +2 -62
- package/dist/TestRunner.d.mts +1 -1
- package/dist/TestRunner.mjs +57 -2
- package/dist/{TestRunner-DC9U8Unb.mjs → TestRunner.schema-Dy0Wdro2.mjs} +2 -64
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/provided-options.d.mts +1 -1
- package/package.json +13 -10
- package/dist/Plugin-Ceh1G8Dz.mjs +0 -117
- package/dist/Reporter-COVWW1my.mjs +0 -33
- package/dist/Reporter-eZ3M7lO6.d.mts +0 -83
package/dist/Mutant.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { n as Mutant, r as PositionSchema, t as LocationSchema } from "./Mutant.schema-
|
|
3
|
-
import
|
|
2
|
+
import { n as Mutant, r as PositionSchema, t as LocationSchema } from "./Mutant.schema-H3r0ho_R.mjs";
|
|
3
|
+
import { t as Report_schema_exports } from "./Report.mjs";
|
|
4
|
+
import * as Match from "effect/Match";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Predicate from "effect/Predicate";
|
|
4
7
|
//#region src/Mutant.ts
|
|
5
8
|
var Mutant_exports = /* @__PURE__ */ __exportAll({
|
|
6
9
|
ERROR_CODES: () => ERROR_CODES,
|
|
@@ -13,7 +16,7 @@ var Mutant_exports = /* @__PURE__ */ __exportAll({
|
|
|
13
16
|
isErrnoException: () => isErrnoException,
|
|
14
17
|
isMutant: () => isMutant,
|
|
15
18
|
normalizeFileName: () => normalizeFileName,
|
|
16
|
-
schema: () =>
|
|
19
|
+
schema: () => Report_schema_exports
|
|
17
20
|
});
|
|
18
21
|
const isMutant = (value) => value instanceof Mutant;
|
|
19
22
|
const INSTRUMENTER_CONSTANTS = Object.freeze({
|
|
@@ -28,87 +31,60 @@ const INSTRUMENTER_CONSTANTS = Object.freeze({
|
|
|
28
31
|
function normalizeFileName(fileName) {
|
|
29
32
|
return fileName.replace(/\\/g, "/");
|
|
30
33
|
}
|
|
34
|
+
const hasText = (value) => Predicate.isString(value) && value.length > 0;
|
|
35
|
+
const textIfNonEmpty = (value) => Option.getOrUndefined(Option.filter(Option.fromUndefinedOr(value), hasText));
|
|
36
|
+
const fieldOf = (value, key) => Match.value(key in value).pipe(Match.when(true, () => {
|
|
37
|
+
return Reflect.get(value, key);
|
|
38
|
+
}), Match.orElse(() => void 0));
|
|
39
|
+
const hasStringCode = (error) => Match.value(fieldOf(error, "code")).pipe(Match.when(Match.string, () => true), Match.orElse(() => false));
|
|
31
40
|
function isErrnoException(error) {
|
|
32
|
-
|
|
33
|
-
if (!("code" in error)) return false;
|
|
34
|
-
return typeof Reflect.get(error, "code") === "string";
|
|
41
|
+
return Match.value(error).pipe(Match.when(Match.instanceOf(Error), hasStringCode), Match.orElse(() => false));
|
|
35
42
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
const formatErrnoException = (error) => {
|
|
44
|
-
const stack = error.stack;
|
|
45
|
-
if (stack !== void 0 && stack.length > 0) return `${error.name}: ${error.code} (${error.syscall}) ${stack}`;
|
|
46
|
-
return `${error.name}: ${error.code} (${error.syscall})`;
|
|
47
|
-
};
|
|
48
|
-
const formatError = (error) => {
|
|
49
|
-
const message = `${error.name}: ${error.message}`;
|
|
50
|
-
if (error.stack !== void 0 && error.stack.length > 0) return `${message}\n${error.stack.toString()}`;
|
|
51
|
-
return message;
|
|
52
|
-
};
|
|
53
|
-
const stringifyNonError = (error) => {
|
|
54
|
-
if (typeof error === "string") return error;
|
|
55
|
-
if (typeof error === "number" || typeof error === "boolean" || typeof error === "bigint") return JSON.stringify(error);
|
|
43
|
+
const isEmptyNumber = (value) => Match.value(value).pipe(Match.when(0, () => true), Match.orElse(Number.isNaN));
|
|
44
|
+
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));
|
|
45
|
+
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})`));
|
|
46
|
+
const formatError = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.message}\n${stack}`), Match.orElse(() => `${error.name}: ${error.message}`));
|
|
47
|
+
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));
|
|
48
|
+
const jsonText = (error) => {
|
|
56
49
|
try {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (typeof error === "object" && error !== null && "toString" in error) {
|
|
61
|
-
const toStringValue = Reflect.get(error, "toString");
|
|
62
|
-
if (typeof toStringValue === "function") try {
|
|
63
|
-
const text = Reflect.apply(toStringValue, error, []);
|
|
64
|
-
if (typeof text === "string" && text.length > 0 && text !== "[object Object]") return text;
|
|
65
|
-
} catch {}
|
|
50
|
+
return textIfNonEmpty(JSON.stringify(error));
|
|
51
|
+
} catch {
|
|
52
|
+
return;
|
|
66
53
|
}
|
|
67
|
-
return "";
|
|
68
54
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
const isNonPlaceholderText = (text) => Match.value({
|
|
56
|
+
hasLength: text.length > 0,
|
|
57
|
+
isPlaceholder: text === "[object Object]"
|
|
58
|
+
}).pipe(Match.when({
|
|
59
|
+
hasLength: true,
|
|
60
|
+
isPlaceholder: false
|
|
61
|
+
}, () => true), Match.orElse(() => false));
|
|
62
|
+
const isUsableText = (value) => Match.value(value).pipe(Match.when(Match.string, isNonPlaceholderText), Match.orElse(() => false));
|
|
63
|
+
const usableText = (value) => Match.value(value).pipe(Match.when(isUsableText, (text) => text), Match.orElse(() => ""));
|
|
64
|
+
const objectToStringText = (value) => Match.value(fieldOf(value, "toString")).pipe(Match.when(Match.instanceOf(Function), (callable) => {
|
|
65
|
+
try {
|
|
66
|
+
return usableText(Reflect.apply(callable, value, []));
|
|
67
|
+
} catch {
|
|
68
|
+
return "";
|
|
74
69
|
}
|
|
75
|
-
|
|
70
|
+
}), Match.orElse(() => ""));
|
|
71
|
+
const isObjectType = (cause) => typeof cause === "object";
|
|
72
|
+
const toStringText = (error) => Match.value(error).pipe(Match.when(Match.null, () => ""), Match.when(isObjectType, (value) => objectToStringText(value)), Match.orElse(() => ""));
|
|
73
|
+
const stringifyRest = (error) => Match.value(jsonText(error)).pipe(Match.when(hasText, (json) => json), Match.orElse(() => toStringText(error)));
|
|
74
|
+
const stringifyNonError = (error) => Match.value(error).pipe(Match.when(Match.string, (text) => text), Match.when(isJsonPrimitive, (primitive) => JSON.stringify(primitive)), Match.orElse(() => stringifyRest(error)));
|
|
75
|
+
const errorText = (error) => Match.value(error).pipe(Match.when(isErrnoException, formatErrnoException), Match.orElse(() => formatError(error)));
|
|
76
|
+
function errorToString(error) {
|
|
77
|
+
return Match.value(error).pipe(Match.when(isEmptyError, () => ""), Match.when(Match.instanceOf(Error), errorText), Match.orElse(() => stringifyNonError(error)));
|
|
76
78
|
}
|
|
77
79
|
const ERROR_CODES = Object.freeze({ NoSuchFileOrDirectory: "ENOENT" });
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (typeof tag === "string" && tag.length > 0) return tag;
|
|
88
|
-
if (value instanceof Error && value.name.length > 0) return value.name;
|
|
89
|
-
};
|
|
90
|
-
const causeText = (cause, depth) => {
|
|
91
|
-
if (depth > 4 || cause === void 0 || cause === null) return;
|
|
92
|
-
if (typeof cause === "string") {
|
|
93
|
-
if (cause.length > 0) return cause;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (typeof cause !== "object") return;
|
|
97
|
-
let own;
|
|
98
|
-
const reason = stringField(cause, "reason");
|
|
99
|
-
if (reason !== void 0) own = reason;
|
|
100
|
-
else {
|
|
101
|
-
const message = stringField(cause, "message");
|
|
102
|
-
if (message !== void 0) own = message;
|
|
103
|
-
else if (cause instanceof Error && cause.message.length > 0) own = cause.message;
|
|
104
|
-
else own = tagOf(cause);
|
|
105
|
-
}
|
|
106
|
-
let nested;
|
|
107
|
-
if ("cause" in cause) nested = causeText(Reflect.get(cause, "cause"), depth + 1);
|
|
108
|
-
else nested = void 0;
|
|
109
|
-
if (own === void 0) return nested;
|
|
110
|
-
if (nested === void 0) return own;
|
|
111
|
-
return `${own}: ${nested}`;
|
|
112
|
-
};
|
|
80
|
+
const errorNameOf = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), (error) => textIfNonEmpty(error.name)), Match.orElse(() => void 0));
|
|
81
|
+
const tagOf = (value) => Match.value(textIfNonEmpty(fieldOf(value, "_tag"))).pipe(Match.when(hasText, (tag) => tag), Match.orElse(() => errorNameOf(value)));
|
|
82
|
+
const textWithNested = (own, nested) => Match.value(own).pipe(Match.when(hasText, (text) => appendNested(text, nested)), Match.orElse(() => nested));
|
|
83
|
+
const appendNested = (own, nested) => Match.value(nested).pipe(Match.when(hasText, (text) => `${own}: ${text}`), Match.orElse(() => own));
|
|
84
|
+
const errorMessage = (error) => Match.value(error.message.length > 0).pipe(Match.when(true, () => error.message), Match.orElse(() => tagOf(error)));
|
|
85
|
+
const errorMessageOrTag = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), errorMessage), Match.orElse(() => tagOf(value)));
|
|
86
|
+
const messageText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "message"))).pipe(Match.when(hasText, (message) => message), Match.orElse(() => errorMessageOrTag(value)));
|
|
87
|
+
const ownCauseText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "reason"))).pipe(Match.when(hasText, (reason) => reason), Match.orElse(() => messageText(value)));
|
|
88
|
+
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));
|
|
113
89
|
//#endregion
|
|
114
|
-
export { ERROR_CODES, INSTRUMENTER_CONSTANTS, LocationSchema, Mutant, PositionSchema, causeText, errorToString, isErrnoException, isMutant, normalizeFileName, schema, Mutant_exports as t };
|
|
90
|
+
export { ERROR_CODES, INSTRUMENTER_CONSTANTS, LocationSchema, Mutant, PositionSchema, causeText, errorToString, isErrnoException, isMutant, normalizeFileName, Report_schema_exports as schema, Mutant_exports as t };
|
|
@@ -9,9 +9,9 @@ const LocationSchema = S.Struct({
|
|
|
9
9
|
end: PositionSchema
|
|
10
10
|
});
|
|
11
11
|
var Mutant = class extends S.TaggedClass()("Mutant", {
|
|
12
|
-
id: S.
|
|
13
|
-
fileName: S.
|
|
14
|
-
mutatorName: S.
|
|
12
|
+
id: S.NonEmptyString,
|
|
13
|
+
fileName: S.NonEmptyString,
|
|
14
|
+
mutatorName: S.NonEmptyString,
|
|
15
15
|
replacement: S.String,
|
|
16
16
|
location: LocationSchema,
|
|
17
17
|
status: S.optional(S.Literals([
|
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
import { n as Checker } from "./Checker-
|
|
2
|
-
import {
|
|
3
|
-
import { t as Evaluator } from "./Evaluator-
|
|
1
|
+
import { n as Checker } from "./Checker-A8o5B3Ub.mjs";
|
|
2
|
+
import { q as TestRunner } from "./Mutant-Ci25PsWA.mjs";
|
|
3
|
+
import { t as Evaluator } from "./Evaluator-CnAN8-pZ.mjs";
|
|
4
4
|
import { t as Ignorer } from "./Ignorer-BUY68FZQ.mjs";
|
|
5
5
|
import { t as Module } from "./Module-DHKEMAFI.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { l as ReporterFactory } from "./ReporterEvent.schema-Db6r_euv.mjs";
|
|
7
7
|
import * as Context from "effect/Context";
|
|
8
8
|
import * as S from "effect/Schema";
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
10
9
|
import * as Option from "effect/Option";
|
|
10
|
+
import * as Layer from "effect/Layer";
|
|
11
11
|
import * as FileSystem from "effect/FileSystem";
|
|
12
12
|
import * as Path from "effect/Path";
|
|
13
13
|
//#region src/Plugin.schema.d.ts
|
|
14
14
|
declare const PluginKind: S.Literals<readonly ["Checker", "TestRunner", "Reporter", "Ignore", "Evaluator"]>;
|
|
15
15
|
type PluginKind = typeof PluginKind.Type;
|
|
16
|
-
declare const
|
|
17
|
-
|
|
16
|
+
declare const PluginLayerKind: S.Literals<readonly ["Checker", "TestRunner", "Ignore", "Evaluator"]>;
|
|
17
|
+
type PluginLayerKind = typeof PluginLayerKind.Type;
|
|
18
|
+
declare const PluginLayerContribution_base: S.Class<PluginLayerContribution<"Checker" | "Evaluator" | "Ignore" | "TestRunner">, S.TaggedStruct<"PluginContribution", {
|
|
19
|
+
readonly kind: S.Literals<readonly ["Checker", "TestRunner", "Ignore", "Evaluator"]>;
|
|
18
20
|
readonly name: S.String;
|
|
19
21
|
readonly layer: S.Unknown;
|
|
20
22
|
}>, {}>;
|
|
21
|
-
declare class
|
|
23
|
+
declare class PluginLayerContribution<K extends PluginLayerKind = PluginLayerKind> extends PluginLayerContribution_base {
|
|
22
24
|
readonly kind: K;
|
|
23
25
|
readonly name: string;
|
|
24
26
|
readonly layer: Layer.Layer<PluginInterfaces[K], never, PluginEnvironment>;
|
|
25
27
|
}
|
|
28
|
+
declare const PluginReporterContribution_base: S.Class<PluginReporterContribution, S.TaggedStruct<"PluginContribution", {
|
|
29
|
+
readonly kind: S.Literals<readonly ["Checker", "TestRunner", "Reporter", "Ignore", "Evaluator"]>;
|
|
30
|
+
readonly name: S.String;
|
|
31
|
+
readonly make: S.Unknown;
|
|
32
|
+
}>, {}>;
|
|
33
|
+
declare class PluginReporterContribution extends PluginReporterContribution_base {
|
|
34
|
+
readonly kind: 'Reporter';
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly make: ReporterFactory;
|
|
37
|
+
}
|
|
38
|
+
type PluginContribution<K extends PluginKind = PluginKind> = K extends 'Reporter' ? PluginReporterContribution : PluginLayerContribution<Extract<K, PluginLayerKind>>;
|
|
26
39
|
declare const Shadowing_base: S.Class<Shadowing, S.TaggedStruct<"Shadowing", {
|
|
27
40
|
readonly kind: S.String;
|
|
28
41
|
readonly name: S.String;
|
|
@@ -31,7 +44,7 @@ declare const Shadowing_base: S.Class<Shadowing, S.TaggedStruct<"Shadowing", {
|
|
|
31
44
|
}>, {}>;
|
|
32
45
|
declare class Shadowing extends Shadowing_base {}
|
|
33
46
|
declare namespace Plugin_d_exports {
|
|
34
|
-
export { AnyPluginContribution, ComposedPlugins, ContributionOf, MergedPluginServices, PluginContribution, PluginEnvironment, PluginInterfaces, PluginKind, RunConfiguration, SandboxDirectory, Shadowing, composePlugins, declarePlugin };
|
|
47
|
+
export { AnyPluginContribution, ComposedPlugins, ContributionOf, MergedPluginServices, PluginContribution, PluginEnvironment, PluginInterfaces, PluginKind, PluginLayerContribution, PluginLayerKind, PluginReporterContribution, RunConfiguration, SandboxDirectory, SelectedReporterFactory, Shadowing, composePlugins, declarePlugin };
|
|
35
48
|
}
|
|
36
49
|
declare const RunConfiguration_base: Context.ServiceClass<RunConfiguration, "~@systemfsoftware/stryker-js/RunConfiguration", {
|
|
37
50
|
readonly [x: string]: unknown;
|
|
@@ -115,7 +128,6 @@ declare class SandboxDirectory extends SandboxDirectory_base {}
|
|
|
115
128
|
interface PluginInterfaces {
|
|
116
129
|
Checker: Checker;
|
|
117
130
|
TestRunner: TestRunner;
|
|
118
|
-
Reporter: Reporter;
|
|
119
131
|
Ignore: Ignorer;
|
|
120
132
|
Evaluator: Evaluator;
|
|
121
133
|
}
|
|
@@ -124,12 +136,18 @@ type AnyPluginContribution = { [K in PluginKind]: PluginContribution<K>; }[Plugi
|
|
|
124
136
|
type ContributionOf<K extends PluginKind> = Extract<AnyPluginContribution, {
|
|
125
137
|
readonly kind: K;
|
|
126
138
|
}>;
|
|
127
|
-
declare function declarePlugin
|
|
128
|
-
|
|
139
|
+
declare function declarePlugin(kind: 'Reporter', name: string, make: ReporterFactory): PluginContribution<'Reporter'>;
|
|
140
|
+
declare function declarePlugin<K extends PluginLayerKind>(kind: K, name: string, layer: Layer.Layer<PluginInterfaces[K], never, PluginEnvironment>): PluginContribution<K>;
|
|
141
|
+
type MergedPluginServices = Checker & Ignorer & TestRunner;
|
|
142
|
+
interface SelectedReporterFactory {
|
|
143
|
+
readonly name: string;
|
|
144
|
+
readonly make: ReporterFactory;
|
|
145
|
+
}
|
|
129
146
|
interface ComposedPlugins {
|
|
130
147
|
readonly layer: Option.Option<Layer.Layer<MergedPluginServices, never, PluginEnvironment>>;
|
|
148
|
+
readonly reporterFactories: readonly SelectedReporterFactory[];
|
|
131
149
|
readonly shadowings: readonly Shadowing[];
|
|
132
150
|
}
|
|
133
151
|
declare function composePlugins(contributions: readonly AnyPluginContribution[]): ComposedPlugins;
|
|
134
152
|
//#endregion
|
|
135
|
-
export { PluginEnvironment as a, RunConfiguration as c,
|
|
153
|
+
export { PluginReporterContribution as _, PluginEnvironment as a, RunConfiguration as c, composePlugins as d, declarePlugin as f, PluginLayerKind as g, PluginLayerContribution as h, MergedPluginServices as i, SandboxDirectory as l, PluginKind as m, ComposedPlugins as n, PluginInterfaces as o, PluginContribution as p, ContributionOf as r, Plugin_d_exports as s, AnyPluginContribution as t, SelectedReporterFactory as u, Shadowing as v };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as S from "effect/Schema";
|
|
4
|
+
import * as Match from "effect/Match";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import * as MutableHashMap from "effect/MutableHashMap";
|
|
8
|
+
//#region src/Plugin.schema.ts
|
|
9
|
+
const PluginKind = S.Literals([
|
|
10
|
+
"Checker",
|
|
11
|
+
"TestRunner",
|
|
12
|
+
"Reporter",
|
|
13
|
+
"Ignore",
|
|
14
|
+
"Evaluator"
|
|
15
|
+
]);
|
|
16
|
+
const PluginLayerKind = S.Literals([
|
|
17
|
+
"Checker",
|
|
18
|
+
"TestRunner",
|
|
19
|
+
"Ignore",
|
|
20
|
+
"Evaluator"
|
|
21
|
+
]);
|
|
22
|
+
var PluginLayerContribution = class extends S.TaggedClass()("PluginContribution", {
|
|
23
|
+
kind: PluginLayerKind,
|
|
24
|
+
name: S.String,
|
|
25
|
+
layer: S.Unknown
|
|
26
|
+
}) {};
|
|
27
|
+
var PluginReporterContribution = class extends S.TaggedClass()("PluginContribution", {
|
|
28
|
+
kind: PluginKind,
|
|
29
|
+
name: S.String,
|
|
30
|
+
make: S.Unknown
|
|
31
|
+
}) {};
|
|
32
|
+
var Shadowing = class extends S.TaggedClass()("Shadowing", {
|
|
33
|
+
kind: S.String,
|
|
34
|
+
name: S.String,
|
|
35
|
+
shadowedIndex: S.Finite,
|
|
36
|
+
winnerIndex: S.Finite
|
|
37
|
+
}) {};
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/Plugin.ts
|
|
40
|
+
var Plugin_exports = /* @__PURE__ */ __exportAll({
|
|
41
|
+
PluginKind: () => PluginKind,
|
|
42
|
+
PluginLayerContribution: () => PluginLayerContribution,
|
|
43
|
+
PluginReporterContribution: () => PluginReporterContribution,
|
|
44
|
+
RunConfiguration: () => RunConfiguration,
|
|
45
|
+
SandboxDirectory: () => SandboxDirectory,
|
|
46
|
+
Shadowing: () => Shadowing,
|
|
47
|
+
composePlugins: () => composePlugins,
|
|
48
|
+
declarePlugin: () => declarePlugin
|
|
49
|
+
});
|
|
50
|
+
var RunConfiguration = class extends Context.Service()("~@systemfsoftware/stryker-js/RunConfiguration") {};
|
|
51
|
+
var SandboxDirectory = class extends Context.Service()("~@systemfsoftware/stryker-js/SandboxDirectory") {};
|
|
52
|
+
function declarePlugin(kind, name, payload) {
|
|
53
|
+
if (kind === "Reporter") return new PluginReporterContribution({
|
|
54
|
+
kind,
|
|
55
|
+
name,
|
|
56
|
+
make: payload
|
|
57
|
+
});
|
|
58
|
+
return new PluginLayerContribution({
|
|
59
|
+
kind,
|
|
60
|
+
name,
|
|
61
|
+
layer: payload
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function foldContributions(contributions) {
|
|
65
|
+
const resolved = MutableHashMap.empty();
|
|
66
|
+
const shadowings = [];
|
|
67
|
+
const lastSeen = MutableHashMap.empty();
|
|
68
|
+
for (const [index, contribution] of contributions.entries()) {
|
|
69
|
+
const key = `${contribution.kind}:${contribution.name}`;
|
|
70
|
+
const previous = MutableHashMap.get(lastSeen, key);
|
|
71
|
+
shadowings.push(...Option.match(previous, {
|
|
72
|
+
onNone: () => [],
|
|
73
|
+
onSome: (shadowedIndex) => [new Shadowing({
|
|
74
|
+
kind: String(contribution.kind),
|
|
75
|
+
name: contribution.name,
|
|
76
|
+
shadowedIndex,
|
|
77
|
+
winnerIndex: index
|
|
78
|
+
})]
|
|
79
|
+
}));
|
|
80
|
+
MutableHashMap.set(resolved, key, contribution);
|
|
81
|
+
MutableHashMap.set(lastSeen, key, index);
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
resolved,
|
|
85
|
+
shadowings
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const reporterFactoryOf = (contribution) => Match.value(contribution).pipe(Match.discriminator("kind")("Reporter", (reporter) => [{
|
|
89
|
+
name: reporter.name,
|
|
90
|
+
make: reporter.make
|
|
91
|
+
}]), Match.orElse(() => []));
|
|
92
|
+
const layerOf = (contribution) => Match.value(contribution).pipe(Match.discriminator("kind")("Reporter", () => []), Match.orElse((nonReporter) => [nonReporter.layer]));
|
|
93
|
+
const mergedLayer = (layers) => layers.reduce((accumulated, next) => Layer.merge(accumulated, next));
|
|
94
|
+
function composePlugins(contributions) {
|
|
95
|
+
const { resolved, shadowings } = foldContributions(contributions);
|
|
96
|
+
const allResolved = Array.from(MutableHashMap.values(resolved));
|
|
97
|
+
const layers = allResolved.flatMap(layerOf);
|
|
98
|
+
return {
|
|
99
|
+
layer: Option.map(Option.fromUndefinedOr(layers.at(0)), () => mergedLayer(layers)),
|
|
100
|
+
reporterFactories: allResolved.flatMap(reporterFactoryOf),
|
|
101
|
+
shadowings
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { declarePlugin as a, PluginReporterContribution as c, composePlugins as i, Shadowing as l, RunConfiguration as n, PluginKind as o, SandboxDirectory as r, PluginLayerContribution as s, Plugin_exports as t };
|
package/dist/Plugin.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PluginEnvironment, c as RunConfiguration, d as
|
|
2
|
-
export { AnyPluginContribution, ComposedPlugins, ContributionOf, MergedPluginServices, PluginContribution, PluginEnvironment, PluginInterfaces, PluginKind, RunConfiguration, SandboxDirectory, Shadowing, composePlugins, declarePlugin };
|
|
1
|
+
import { _ as PluginReporterContribution, a as PluginEnvironment, c as RunConfiguration, d as composePlugins, f as declarePlugin, g as PluginLayerKind, h as PluginLayerContribution, i as MergedPluginServices, l as SandboxDirectory, m as PluginKind, n as ComposedPlugins, o as PluginInterfaces, p as PluginContribution, r as ContributionOf, t as AnyPluginContribution, u as SelectedReporterFactory, v as Shadowing } from "./Plugin-CunIOPtw.mjs";
|
|
2
|
+
export { AnyPluginContribution, ComposedPlugins, ContributionOf, MergedPluginServices, type PluginContribution, PluginEnvironment, PluginInterfaces, PluginKind, PluginLayerContribution, type PluginLayerKind, PluginReporterContribution, RunConfiguration, SandboxDirectory, SelectedReporterFactory, Shadowing, composePlugins, declarePlugin };
|
package/dist/Plugin.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as declarePlugin, c as
|
|
2
|
-
export {
|
|
1
|
+
import { a as declarePlugin, c as PluginReporterContribution, i as composePlugins, l as Shadowing, n as RunConfiguration, o as PluginKind, r as SandboxDirectory, s as PluginLayerContribution } from "./Plugin-DXFdJP1l.mjs";
|
|
2
|
+
export { PluginKind, PluginLayerContribution, PluginReporterContribution, RunConfiguration, SandboxDirectory, Shadowing, composePlugins, declarePlugin };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as Thresholds, D as TestFileDefinitionDictionary, E as TestFile, O as TestFileDefinitionDictionarySchema, S as PositionSchema, T as TestDefinitionSchema, _ as MutationTestResult, a as FileResult, b as OpenEndLocationSchema, c as FileResultSchema, d as Location, f as LocationSchema, g as MutantStatusSchema, h as MutantStatus, i as DependenciesSchema, j as ThresholdsSchema, k as TestFileSchema, l as FrameworkInformation, m as MutantResultSchema, n as BrandingInformationSchema, o as FileResultDictionary, p as MutantResult, r as Dependencies, s as FileResultDictionarySchema, t as BrandingInformation, u as FrameworkInformationSchema, v as MutationTestResultSchema, w as TestDefinition, x as Position, y as OpenEndLocation } from "./Report.schema-_buHXdnZ.mjs";
|
|
2
|
+
export { BrandingInformation, BrandingInformationSchema, Dependencies, DependenciesSchema, FileResult, FileResultDictionary, FileResultDictionarySchema, FileResultSchema, FrameworkInformation, FrameworkInformationSchema, Location, LocationSchema, MutantResult, MutantResultSchema, MutantStatus, MutantStatusSchema, MutationTestResult, MutationTestResultSchema, OpenEndLocation, OpenEndLocationSchema, Position, PositionSchema, TestDefinition, TestDefinitionSchema, TestFile, TestFileDefinitionDictionary, TestFileDefinitionDictionarySchema, TestFileSchema, Thresholds, ThresholdsSchema };
|
package/dist/Report.mjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import * as S from "effect/Schema";
|
|
3
|
+
//#region src/Report.schema.ts
|
|
4
|
+
var Report_schema_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
BrandingInformationSchema: () => BrandingInformationSchema,
|
|
6
|
+
DependenciesSchema: () => DependenciesSchema,
|
|
7
|
+
FileResultDictionarySchema: () => FileResultDictionarySchema,
|
|
8
|
+
FileResultSchema: () => FileResultSchema,
|
|
9
|
+
FrameworkInformationSchema: () => FrameworkInformationSchema,
|
|
10
|
+
LocationSchema: () => LocationSchema,
|
|
11
|
+
MutantResultSchema: () => MutantResultSchema,
|
|
12
|
+
MutantStatusSchema: () => MutantStatusSchema,
|
|
13
|
+
MutationTestResultSchema: () => MutationTestResultSchema,
|
|
14
|
+
OpenEndLocationSchema: () => OpenEndLocationSchema,
|
|
15
|
+
PositionSchema: () => PositionSchema,
|
|
16
|
+
TestDefinitionSchema: () => TestDefinitionSchema,
|
|
17
|
+
TestFileDefinitionDictionarySchema: () => TestFileDefinitionDictionarySchema,
|
|
18
|
+
TestFileSchema: () => TestFileSchema,
|
|
19
|
+
ThresholdsSchema: () => ThresholdsSchema
|
|
20
|
+
});
|
|
21
|
+
const PositionSchema = S.Struct({
|
|
22
|
+
line: S.Finite,
|
|
23
|
+
column: S.Finite
|
|
24
|
+
});
|
|
25
|
+
const LocationSchema = S.Struct({
|
|
26
|
+
start: PositionSchema,
|
|
27
|
+
end: PositionSchema
|
|
28
|
+
});
|
|
29
|
+
const OpenEndLocationSchema = S.Struct({
|
|
30
|
+
start: PositionSchema,
|
|
31
|
+
end: S.optional(PositionSchema)
|
|
32
|
+
});
|
|
33
|
+
const MutantStatusSchema = S.Literals([
|
|
34
|
+
"Killed",
|
|
35
|
+
"Survived",
|
|
36
|
+
"NoCoverage",
|
|
37
|
+
"CompileError",
|
|
38
|
+
"RuntimeError",
|
|
39
|
+
"Timeout",
|
|
40
|
+
"Ignored",
|
|
41
|
+
"Pending"
|
|
42
|
+
]);
|
|
43
|
+
const MutantResultSchema = S.Struct({
|
|
44
|
+
id: S.String,
|
|
45
|
+
mutatorName: S.String,
|
|
46
|
+
status: MutantStatusSchema,
|
|
47
|
+
location: LocationSchema,
|
|
48
|
+
replacement: S.optional(S.String),
|
|
49
|
+
description: S.optional(S.String),
|
|
50
|
+
statusReason: S.optional(S.String),
|
|
51
|
+
static: S.optional(S.Boolean),
|
|
52
|
+
coveredBy: S.optional(S.Array(S.String)),
|
|
53
|
+
killedBy: S.optional(S.Array(S.String)),
|
|
54
|
+
testsCompleted: S.optional(S.Finite),
|
|
55
|
+
duration: S.optional(S.Finite)
|
|
56
|
+
});
|
|
57
|
+
const FileResultSchema = S.Struct({
|
|
58
|
+
language: S.String,
|
|
59
|
+
source: S.String,
|
|
60
|
+
mutants: S.Array(MutantResultSchema)
|
|
61
|
+
});
|
|
62
|
+
const FileResultDictionarySchema = S.Record(S.String, FileResultSchema);
|
|
63
|
+
const TestDefinitionSchema = S.Struct({
|
|
64
|
+
id: S.String,
|
|
65
|
+
name: S.String,
|
|
66
|
+
location: S.optional(OpenEndLocationSchema)
|
|
67
|
+
});
|
|
68
|
+
const TestFileSchema = S.Struct({
|
|
69
|
+
source: S.optional(S.String),
|
|
70
|
+
tests: S.Array(TestDefinitionSchema)
|
|
71
|
+
});
|
|
72
|
+
const TestFileDefinitionDictionarySchema = S.Record(S.String, TestFileSchema);
|
|
73
|
+
const ThresholdsSchema = S.Struct({
|
|
74
|
+
high: S.Finite,
|
|
75
|
+
low: S.Finite
|
|
76
|
+
});
|
|
77
|
+
const BrandingInformationSchema = S.Struct({
|
|
78
|
+
homepageUrl: S.String,
|
|
79
|
+
imageUrl: S.optional(S.String)
|
|
80
|
+
});
|
|
81
|
+
const DependenciesSchema = S.Record(S.String, S.String);
|
|
82
|
+
const FrameworkInformationSchema = S.Struct({
|
|
83
|
+
name: S.String,
|
|
84
|
+
version: S.optional(S.String),
|
|
85
|
+
branding: S.optional(BrandingInformationSchema),
|
|
86
|
+
dependencies: S.optional(DependenciesSchema)
|
|
87
|
+
});
|
|
88
|
+
const MutationTestResultSchema = S.Struct({
|
|
89
|
+
schemaVersion: S.String,
|
|
90
|
+
files: FileResultDictionarySchema,
|
|
91
|
+
thresholds: ThresholdsSchema,
|
|
92
|
+
config: S.optional(S.Record(S.String, S.Unknown)),
|
|
93
|
+
testFiles: S.optional(TestFileDefinitionDictionarySchema),
|
|
94
|
+
projectRoot: S.optional(S.String),
|
|
95
|
+
framework: S.optional(FrameworkInformationSchema)
|
|
96
|
+
});
|
|
97
|
+
//#endregion
|
|
98
|
+
export { BrandingInformationSchema, DependenciesSchema, FileResultDictionarySchema, FileResultSchema, FrameworkInformationSchema, LocationSchema, MutantResultSchema, MutantStatusSchema, MutationTestResultSchema, OpenEndLocationSchema, PositionSchema, TestDefinitionSchema, TestFileDefinitionDictionarySchema, TestFileSchema, ThresholdsSchema, Report_schema_exports as t };
|