@systemfsoftware/stryker-js 3.0.1 → 4.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 +36 -0
- package/README.md +10 -16
- package/dist/index.d.mts +1603 -8
- package/dist/index.mjs +1034 -9
- package/package.json +12 -9
- package/dist/Checker-A8o5B3Ub.d.mts +0 -40
- package/dist/Checker-Bq8NXD8d.mjs +0 -25
- package/dist/Checker.d.mts +0 -2
- package/dist/Checker.mjs +0 -2
- package/dist/Evaluator-CnAN8-pZ.d.mts +0 -19
- package/dist/Evaluator.d.mts +0 -3
- package/dist/Evaluator.mjs +0 -9
- package/dist/ExitClass.d.mts +0 -9
- package/dist/ExitClass.mjs +0 -59
- package/dist/ExitClass.schema-BmOIK5zT.d.mts +0 -18
- package/dist/Ignorer-BUY68FZQ.d.mts +0 -21
- package/dist/Ignorer.d.mts +0 -2
- package/dist/Ignorer.mjs +0 -7
- package/dist/Metrics.d.mts +0 -7
- package/dist/Metrics.mjs +0 -79
- package/dist/Metrics.schema-BaVd6rXs.d.mts +0 -50
- package/dist/Metrics.schema-DZdoc46X.mjs +0 -27
- package/dist/Module-DHKEMAFI.d.mts +0 -31
- package/dist/Module.d.mts +0 -2
- package/dist/Module.mjs +0 -16
- package/dist/Mutant-Ci25PsWA.d.mts +0 -351
- package/dist/Mutant.d.mts +0 -3
- package/dist/Mutant.mjs +0 -90
- package/dist/Mutant.schema-H3r0ho_R.mjs +0 -34
- package/dist/Plugin-BtItMchw.d.mts +0 -153
- package/dist/Plugin-DXFdJP1l.mjs +0 -105
- package/dist/Plugin.d.mts +0 -2
- package/dist/Plugin.mjs +0 -2
- package/dist/Report.d.mts +0 -2
- package/dist/Report.mjs +0 -98
- package/dist/Report.schema-_buHXdnZ.d.mts +0 -251
- package/dist/Reporter-BWTwlSJf.mjs +0 -25
- package/dist/Reporter-C7ysGxqX.d.mts +0 -16
- package/dist/Reporter.d.mts +0 -4
- package/dist/Reporter.mjs +0 -3
- package/dist/ReporterEvent.d.mts +0 -2
- package/dist/ReporterEvent.mjs +0 -57
- package/dist/ReporterEvent.schema-BhtyYCZo.d.mts +0 -189
- package/dist/Run-BUpNSmcM.d.mts +0 -172
- package/dist/Run.d.mts +0 -2
- package/dist/Run.mjs +0 -56
- package/dist/Run.schema-DZve3k2m.mjs +0 -138
- package/dist/Schema-4oCWQ0P0.d.mts +0 -158
- package/dist/Schema-CMKdWMUN.mjs +0 -244
- package/dist/Schema.d.mts +0 -2
- package/dist/Schema.mjs +0 -2
- package/dist/TestRunner.d.mts +0 -2
- package/dist/TestRunner.mjs +0 -57
- package/dist/TestRunner.schema-Dy0Wdro2.mjs +0 -119
- package/dist/output-file.d.mts +0 -8
- package/dist/output-file.mjs +0 -8
- package/dist/provided-options.d.mts +0 -16
- package/dist/provided-options.mjs +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"effect": "4.0.0-rc.112",
|
|
22
|
-
"@systemfsoftware/effect-cell-types": "^
|
|
22
|
+
"@systemfsoftware/effect-cell-types": "^8.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@effect/vitest": "4.0.0-rc.112",
|
|
26
|
-
"@
|
|
26
|
+
"@microsoft/api-extractor": "^7.58.7",
|
|
27
|
+
"@systemfsoftware/arethetypeswrong-cli": "^4.1.0",
|
|
27
28
|
"@types/node": "^24",
|
|
28
29
|
"oxlint": "^1.77.0",
|
|
29
30
|
"oxlint-tsgolint": "7.0.2001",
|
|
@@ -31,11 +32,11 @@
|
|
|
31
32
|
"tsdown": "^0.22.14",
|
|
32
33
|
"typescript": "^7",
|
|
33
34
|
"vitest": "^4",
|
|
34
|
-
"@systemfsoftware/all": "^2.0.
|
|
35
|
-
"@systemfsoftware/effect-schema-law": "^2.1.
|
|
36
|
-
"@systemfsoftware/tsconfig": "^1.3.
|
|
35
|
+
"@systemfsoftware/all": "^2.0.2",
|
|
36
|
+
"@systemfsoftware/effect-schema-law": "^2.1.1",
|
|
37
|
+
"@systemfsoftware/tsconfig": "^1.3.4",
|
|
37
38
|
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
38
|
-
"@systemfsoftware/effect-schema-vite": "^2.1.
|
|
39
|
+
"@systemfsoftware/effect-schema-vite": "^2.1.1"
|
|
39
40
|
},
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public",
|
|
@@ -63,10 +64,12 @@
|
|
|
63
64
|
},
|
|
64
65
|
"scripts": {
|
|
65
66
|
"clean": "rimraf dist",
|
|
66
|
-
"build": "tsdown",
|
|
67
|
+
"build": "tsdown && pnpm api:check",
|
|
67
68
|
"typecheck": "tsc --noEmit --incremental",
|
|
68
69
|
"test": "vitest run",
|
|
69
70
|
"attw": "attw --pack .",
|
|
70
|
-
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}"
|
|
71
|
+
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
|
|
72
|
+
"api:check": "tsdown && api-extractor run",
|
|
73
|
+
"api:update": "api-extractor run --local"
|
|
71
74
|
}
|
|
72
75
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { gt as Mutant } from "./Mutant-Ci25PsWA.mjs";
|
|
2
|
-
import * as Context from "effect/Context";
|
|
3
|
-
import * as S from "effect/Schema";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as HashMap from "effect/HashMap";
|
|
6
|
-
//#region src/Checker.schema.d.ts
|
|
7
|
-
declare const CheckStatus: S.Literals<readonly ["passed", "compileError"]>;
|
|
8
|
-
type CheckStatus = typeof CheckStatus.Type;
|
|
9
|
-
declare const CheckResultSchema: S.Union<readonly [S.Struct<{
|
|
10
|
-
readonly status: S.Literal<"passed">;
|
|
11
|
-
}>, S.Struct<{
|
|
12
|
-
readonly status: S.Literal<"compileError">;
|
|
13
|
-
readonly reason: S.String;
|
|
14
|
-
}>]>;
|
|
15
|
-
declare const CheckerFailed_base: S.Class<CheckerFailed, S.TaggedStruct<"CheckerFailed", {
|
|
16
|
-
readonly cause: S.String;
|
|
17
|
-
readonly checkerName: S.String;
|
|
18
|
-
readonly mutantIds: S.$Array<S.String>;
|
|
19
|
-
}>, import("effect/Cause").YieldableError>;
|
|
20
|
-
declare class CheckerFailed extends CheckerFailed_base {}
|
|
21
|
-
declare namespace Checker_d_exports {
|
|
22
|
-
export { CheckResult, CheckResultSchema, CheckStatus, Checker, CheckerFailed, CheckerService, FailedCheckResult, PassedCheckResult };
|
|
23
|
-
}
|
|
24
|
-
interface FailedCheckResult {
|
|
25
|
-
readonly reason: string;
|
|
26
|
-
readonly status: 'compileError';
|
|
27
|
-
}
|
|
28
|
-
interface PassedCheckResult {
|
|
29
|
-
readonly status: 'passed';
|
|
30
|
-
}
|
|
31
|
-
type CheckResult = FailedCheckResult | PassedCheckResult;
|
|
32
|
-
interface CheckerService {
|
|
33
|
-
readonly init: Effect.Effect<void, CheckerFailed>;
|
|
34
|
-
readonly check: (mutants: readonly Mutant[]) => Effect.Effect<HashMap.HashMap<string, CheckResult>, CheckerFailed>;
|
|
35
|
-
readonly group: (mutants: readonly Mutant[]) => Effect.Effect<readonly (readonly string[])[], CheckerFailed>;
|
|
36
|
-
}
|
|
37
|
-
declare const Checker_base: Context.ServiceClass<Checker, "~@systemfsoftware/stryker-js/Checker", CheckerService>;
|
|
38
|
-
declare class Checker extends Checker_base {}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { FailedCheckResult as a, CheckStatus as c, Checker_d_exports as i, CheckerFailed as l, Checker as n, PassedCheckResult as o, CheckerService as r, CheckResultSchema as s, CheckResult as t };
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
//#region src/Checker.schema.ts
|
|
5
|
-
const CheckStatus = S.Literals(["passed", "compileError"]);
|
|
6
|
-
const CheckResultSchema = S.Union([S.Struct({ status: S.Literal("passed") }), S.Struct({
|
|
7
|
-
status: S.Literal("compileError"),
|
|
8
|
-
reason: S.String
|
|
9
|
-
})]);
|
|
10
|
-
var CheckerFailed = class extends S.TaggedError()("CheckerFailed", {
|
|
11
|
-
cause: S.String,
|
|
12
|
-
checkerName: S.String,
|
|
13
|
-
mutantIds: S.Array(S.String)
|
|
14
|
-
}) {};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/Checker.ts
|
|
17
|
-
var Checker_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
-
CheckResultSchema: () => CheckResultSchema,
|
|
19
|
-
CheckStatus: () => CheckStatus,
|
|
20
|
-
Checker: () => Checker,
|
|
21
|
-
CheckerFailed: () => CheckerFailed
|
|
22
|
-
});
|
|
23
|
-
var Checker = class extends Context.Service()("~@systemfsoftware/stryker-js/Checker") {};
|
|
24
|
-
//#endregion
|
|
25
|
-
export { CheckerFailed as a, CheckStatus as i, Checker_exports as n, CheckResultSchema as r, Checker as t };
|
package/dist/Checker.d.mts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as FailedCheckResult, c as CheckStatus, l as CheckerFailed, n as Checker, o as PassedCheckResult, r as CheckerService, s as CheckResultSchema, t as CheckResult } from "./Checker-A8o5B3Ub.mjs";
|
|
2
|
-
export { CheckResult, CheckResultSchema, CheckStatus, Checker, CheckerFailed, CheckerService, FailedCheckResult, PassedCheckResult };
|
package/dist/Checker.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { _ as MutationTestResult } from "./Report.schema-_buHXdnZ.mjs";
|
|
2
|
-
import { r as ExitClass } from "./ExitClass.schema-BmOIK5zT.mjs";
|
|
3
|
-
import * as Context from "effect/Context";
|
|
4
|
-
import * as S from "effect/Schema";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
|
-
//#region src/Evaluator.schema.d.ts
|
|
7
|
-
declare const EvaluatorFailed_base: S.Class<EvaluatorFailed, S.TaggedStruct<"EvaluatorFailed", {
|
|
8
|
-
readonly cause: S.Unknown;
|
|
9
|
-
}>, import("effect/Cause").YieldableError>;
|
|
10
|
-
declare class EvaluatorFailed extends EvaluatorFailed_base {}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/Evaluator.d.ts
|
|
13
|
-
interface EvaluatorService {
|
|
14
|
-
readonly evaluate: (report: MutationTestResult) => Effect.Effect<ExitClass | null, EvaluatorFailed>;
|
|
15
|
-
}
|
|
16
|
-
declare const Evaluator_base: Context.ServiceClass<Evaluator, "~@systemfsoftware/stryker-js/Evaluator", EvaluatorService>;
|
|
17
|
-
declare class Evaluator extends Evaluator_base {}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { EvaluatorService as n, EvaluatorFailed as r, Evaluator as t };
|
package/dist/Evaluator.d.mts
DELETED
package/dist/Evaluator.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import * as S from "effect/Schema";
|
|
3
|
-
//#region src/Evaluator.schema.ts
|
|
4
|
-
var EvaluatorFailed = class extends S.TaggedError()("EvaluatorFailed", { cause: S.Unknown }) {};
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/Evaluator.ts
|
|
7
|
-
var Evaluator = class extends Context.Service()("~@systemfsoftware/stryker-js/Evaluator") {};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { Evaluator, EvaluatorFailed };
|
package/dist/ExitClass.d.mts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { n as ClassifyExitDecision, r as ExitClass, t as ClassifyExitCommand } from "./ExitClass.schema-BmOIK5zT.mjs";
|
|
2
|
-
//#region src/ExitClass.d.ts
|
|
3
|
-
declare const EXIT_CODE: Record<ExitClass, number>;
|
|
4
|
-
declare function highestExitClass(pending: Iterable<ExitClass>): ExitClass | null;
|
|
5
|
-
declare function resolveExitCode(pending: Iterable<ExitClass>, signal: number | null): number;
|
|
6
|
-
declare function verdictExitClass(score: number | null, breakingThreshold: number | null): ExitClass | null;
|
|
7
|
-
declare const classifyExit: (command: ClassifyExitCommand) => ClassifyExitDecision;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { EXIT_CODE, ExitClass, classifyExit, highestExitClass, resolveExitCode, verdictExitClass };
|
package/dist/ExitClass.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as S from "effect/Schema";
|
|
2
|
-
import * as Match from "effect/Match";
|
|
3
|
-
import * as Option from "effect/Option";
|
|
4
|
-
//#region src/ExitClass.schema.ts
|
|
5
|
-
const ExitClass = S.Literals([
|
|
6
|
-
"VerdictFail",
|
|
7
|
-
"ConfigError",
|
|
8
|
-
"RuntimeError",
|
|
9
|
-
"InternalError"
|
|
10
|
-
]);
|
|
11
|
-
S.TaggedClass()("ClassifyExitCommand", {
|
|
12
|
-
pending: S.Array(ExitClass),
|
|
13
|
-
signal: S.NullOr(S.Number),
|
|
14
|
-
score: S.NullOr(S.Number),
|
|
15
|
-
breakingThreshold: S.NullOr(S.Number)
|
|
16
|
-
});
|
|
17
|
-
var ClassifyExitDecision = class extends S.TaggedClass()("ClassifyExitDecision", {
|
|
18
|
-
highestClass: S.NullOr(ExitClass),
|
|
19
|
-
verdictClass: S.NullOr(ExitClass)
|
|
20
|
-
}) {};
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/ExitClass.ts
|
|
23
|
-
const EXIT_CODE = {
|
|
24
|
-
VerdictFail: 1,
|
|
25
|
-
ConfigError: 2,
|
|
26
|
-
RuntimeError: 3,
|
|
27
|
-
InternalError: 4
|
|
28
|
-
};
|
|
29
|
-
function highestExitClass(pending) {
|
|
30
|
-
return Array.from(pending).reduce((incumbent, challenger) => Option.match(Option.fromNullishOr(incumbent), {
|
|
31
|
-
onNone: () => challenger,
|
|
32
|
-
onSome: (value) => Match.value(EXIT_CODE[value] < EXIT_CODE[challenger]).pipe(Match.when(true, () => challenger), Match.when(false, () => value), Match.exhaustive)
|
|
33
|
-
}), null);
|
|
34
|
-
}
|
|
35
|
-
function resolveExitCode(pending, signal) {
|
|
36
|
-
return Option.match(Option.fromNullishOr(signal), {
|
|
37
|
-
onNone: () => Option.match(Option.fromNullishOr(highestExitClass(pending)), {
|
|
38
|
-
onNone: () => 0,
|
|
39
|
-
onSome: (exitClass) => EXIT_CODE[exitClass]
|
|
40
|
-
}),
|
|
41
|
-
onSome: (value) => 128 + value
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function verdictExitClass(score, breakingThreshold) {
|
|
45
|
-
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)));
|
|
46
|
-
}
|
|
47
|
-
const classifyExit = (command) => {
|
|
48
|
-
const verdictClass = verdictExitClass(command.score, command.breakingThreshold);
|
|
49
|
-
const highestClass = highestExitClass(Option.match(Option.fromNullishOr(verdictClass), {
|
|
50
|
-
onNone: () => command.pending,
|
|
51
|
-
onSome: (verdict) => Array.from(/* @__PURE__ */ new Set([...command.pending, verdict]))
|
|
52
|
-
}));
|
|
53
|
-
return ClassifyExitDecision.make({
|
|
54
|
-
highestClass,
|
|
55
|
-
verdictClass
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
//#endregion
|
|
59
|
-
export { EXIT_CODE, ExitClass, classifyExit, highestExitClass, resolveExitCode, verdictExitClass };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as S from "effect/Schema";
|
|
2
|
-
//#region src/ExitClass.schema.d.ts
|
|
3
|
-
declare const ExitClass: S.Literals<readonly ["VerdictFail", "ConfigError", "RuntimeError", "InternalError"]>;
|
|
4
|
-
type ExitClass = typeof ExitClass.Type;
|
|
5
|
-
declare const ClassifyExitCommand_base: S.Class<ClassifyExitCommand, S.TaggedStruct<"ClassifyExitCommand", {
|
|
6
|
-
readonly pending: S.$Array<S.Literals<readonly ["VerdictFail", "ConfigError", "RuntimeError", "InternalError"]>>;
|
|
7
|
-
readonly signal: S.NullOr<S.Number>;
|
|
8
|
-
readonly score: S.NullOr<S.Number>;
|
|
9
|
-
readonly breakingThreshold: S.NullOr<S.Number>;
|
|
10
|
-
}>, {}>;
|
|
11
|
-
declare class ClassifyExitCommand extends ClassifyExitCommand_base {}
|
|
12
|
-
declare const ClassifyExitDecision_base: S.Class<ClassifyExitDecision, S.TaggedStruct<"ClassifyExitDecision", {
|
|
13
|
-
readonly highestClass: S.NullOr<S.Literals<readonly ["VerdictFail", "ConfigError", "RuntimeError", "InternalError"]>>;
|
|
14
|
-
readonly verdictClass: S.NullOr<S.Literals<readonly ["VerdictFail", "ConfigError", "RuntimeError", "InternalError"]>>;
|
|
15
|
-
}>, {}>;
|
|
16
|
-
declare class ClassifyExitDecision extends ClassifyExitDecision_base {}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { ClassifyExitDecision as n, ExitClass as r, ClassifyExitCommand as t };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import * as Option from "effect/Option";
|
|
3
|
-
declare namespace Ignorer_d_exports {
|
|
4
|
-
export { Ignorer, IgnorerService, NodePath };
|
|
5
|
-
}
|
|
6
|
-
interface NodePath {
|
|
7
|
-
readonly node: unknown;
|
|
8
|
-
readonly parentPath?: NodePath | null;
|
|
9
|
-
isObjectExpression(): boolean;
|
|
10
|
-
isCallExpression(): boolean;
|
|
11
|
-
isClassProperty(): boolean;
|
|
12
|
-
isClassPrivateProperty(): boolean;
|
|
13
|
-
isClassAccessorProperty(): boolean;
|
|
14
|
-
}
|
|
15
|
-
interface IgnorerService {
|
|
16
|
-
readonly shouldIgnore: (path: NodePath) => Option.Option<string>;
|
|
17
|
-
}
|
|
18
|
-
declare const Ignorer_base: Context.ServiceClass<Ignorer, "~@systemfsoftware/stryker-js/Ignorer", IgnorerService>;
|
|
19
|
-
declare class Ignorer extends Ignorer_base {}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { NodePath as i, IgnorerService as n, Ignorer_d_exports as r, Ignorer as t };
|
package/dist/Ignorer.d.mts
DELETED
package/dist/Ignorer.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import * as Context from "effect/Context";
|
|
3
|
-
//#region src/Ignorer.ts
|
|
4
|
-
var Ignorer_exports = /* @__PURE__ */ __exportAll({ Ignorer: () => Ignorer });
|
|
5
|
-
var Ignorer = class extends Context.Service()("~@systemfsoftware/stryker-js/Ignorer") {};
|
|
6
|
-
//#endregion
|
|
7
|
-
export { Ignorer, Ignorer_exports as t };
|
package/dist/Metrics.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { a as FileResult, p as MutantResult } from "./Report.schema-_buHXdnZ.mjs";
|
|
2
|
-
import { i as MetricsSchema, n as MetricsResult, r as MetricsResultSchema, t as Metrics } from "./Metrics.schema-BaVd6rXs.mjs";
|
|
3
|
-
//#region src/Metrics.d.ts
|
|
4
|
-
declare const countMutants: (mutants: readonly MutantResult[]) => Metrics;
|
|
5
|
-
declare const calculateMetrics: (files: Readonly<Record<string, FileResult>>) => MetricsResult;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { type Metrics, type MetricsResult, MetricsResultSchema, MetricsSchema, calculateMetrics, countMutants };
|
package/dist/Metrics.mjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { n as MetricsSchema, t as MetricsResultSchema } from "./Metrics.schema-DZdoc46X.mjs";
|
|
2
|
-
import * as Match from "effect/Match";
|
|
3
|
-
import * as Option from "effect/Option";
|
|
4
|
-
import * as Arr from "effect/Array";
|
|
5
|
-
//#region src/Metrics.ts
|
|
6
|
-
const countStatus = (mutants, status) => mutants.filter((mutant) => mutant.status === status).length;
|
|
7
|
-
const percentage = (numerator, denominator) => numerator / denominator * 100;
|
|
8
|
-
/** A percentage whose denominator is zero is not 0%; `emptyDenominator` says what it is instead. */
|
|
9
|
-
const percentOr = (emptyDenominator, numerator, denominator) => Match.value(denominator).pipe(Match.when(0, () => emptyDenominator), Match.orElse(() => percentage(numerator, denominator)));
|
|
10
|
-
const coveredFraction = (totalDetected, totalCovered, totalValid) => Match.value(totalValid).pipe(Match.when(0, () => NaN), Match.orElse(() => percentOr(0, totalDetected, totalCovered)));
|
|
11
|
-
const countMutants = (mutants) => {
|
|
12
|
-
const pending = countStatus(mutants, "Pending");
|
|
13
|
-
const killed = countStatus(mutants, "Killed");
|
|
14
|
-
const timeout = countStatus(mutants, "Timeout");
|
|
15
|
-
const survived = countStatus(mutants, "Survived");
|
|
16
|
-
const noCoverage = countStatus(mutants, "NoCoverage");
|
|
17
|
-
const runtimeErrors = countStatus(mutants, "RuntimeError");
|
|
18
|
-
const compileErrors = countStatus(mutants, "CompileError");
|
|
19
|
-
const ignored = countStatus(mutants, "Ignored");
|
|
20
|
-
const totalDetected = timeout + killed;
|
|
21
|
-
const totalUndetected = survived + noCoverage;
|
|
22
|
-
const totalCovered = totalDetected + survived;
|
|
23
|
-
const totalValid = totalUndetected + totalDetected;
|
|
24
|
-
const totalInvalid = runtimeErrors + compileErrors;
|
|
25
|
-
return {
|
|
26
|
-
pending,
|
|
27
|
-
killed,
|
|
28
|
-
timeout,
|
|
29
|
-
survived,
|
|
30
|
-
noCoverage,
|
|
31
|
-
runtimeErrors,
|
|
32
|
-
compileErrors,
|
|
33
|
-
ignored,
|
|
34
|
-
totalDetected,
|
|
35
|
-
totalUndetected,
|
|
36
|
-
totalCovered,
|
|
37
|
-
totalValid,
|
|
38
|
-
totalInvalid,
|
|
39
|
-
totalMutants: totalValid + totalInvalid + ignored + pending,
|
|
40
|
-
mutationScore: percentOr(NaN, totalDetected, totalValid),
|
|
41
|
-
mutationScoreBasedOnCoveredCode: coveredFraction(totalDetected, totalCovered, totalValid)
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const segmentOf = (fileName) => {
|
|
45
|
-
const separator = fileName.indexOf("/");
|
|
46
|
-
if (separator === -1) return fileName;
|
|
47
|
-
return fileName.slice(0, separator);
|
|
48
|
-
};
|
|
49
|
-
const groupBySegment = (files) => Object.entries(files).reduce((groups, [fileName, file]) => {
|
|
50
|
-
const segment = segmentOf(fileName);
|
|
51
|
-
const group = groups[segment] ?? {};
|
|
52
|
-
group[fileName] = file;
|
|
53
|
-
groups[segment] = group;
|
|
54
|
-
return groups;
|
|
55
|
-
}, {});
|
|
56
|
-
const metricsOf = (files) => countMutants(Object.values(files).flatMap((file) => file.mutants));
|
|
57
|
-
const fileResultOf = (fileName, file) => ({
|
|
58
|
-
name: fileName,
|
|
59
|
-
metrics: countMutants(file.mutants),
|
|
60
|
-
childResults: []
|
|
61
|
-
});
|
|
62
|
-
const nestedGroupResult = (segment, entries) => {
|
|
63
|
-
const nested = Object.fromEntries(entries.map(([fileName, file]) => [fileName.slice(segment.length + 1), file]));
|
|
64
|
-
return {
|
|
65
|
-
name: segment,
|
|
66
|
-
metrics: metricsOf(nested),
|
|
67
|
-
childResults: childResultsOf(nested)
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
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())));
|
|
71
|
-
const childResultOf = (segment, entries) => Option.getOrElse(soleSegmentFileResult(segment, entries), () => nestedGroupResult(segment, entries));
|
|
72
|
-
const childResultsOf = (files) => Object.entries(groupBySegment(files)).map(([segment, grouped]) => childResultOf(segment, Object.entries(grouped))).sort((left, right) => left.name.localeCompare(right.name));
|
|
73
|
-
const calculateMetrics = (files) => ({
|
|
74
|
-
name: "All files",
|
|
75
|
-
metrics: metricsOf(files),
|
|
76
|
-
childResults: childResultsOf(files)
|
|
77
|
-
});
|
|
78
|
-
//#endregion
|
|
79
|
-
export { MetricsResultSchema, MetricsSchema, calculateMetrics, countMutants };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as S from "effect/Schema";
|
|
2
|
-
//#region src/Metrics.schema.d.ts
|
|
3
|
-
declare const MetricsSchema: S.Struct<{
|
|
4
|
-
readonly pending: S.Finite;
|
|
5
|
-
readonly killed: S.Finite;
|
|
6
|
-
readonly timeout: S.Finite;
|
|
7
|
-
readonly survived: S.Finite;
|
|
8
|
-
readonly noCoverage: S.Finite;
|
|
9
|
-
readonly runtimeErrors: S.Finite;
|
|
10
|
-
readonly compileErrors: S.Finite;
|
|
11
|
-
readonly ignored: S.Finite;
|
|
12
|
-
readonly totalDetected: S.Finite;
|
|
13
|
-
readonly totalUndetected: S.Finite;
|
|
14
|
-
readonly totalInvalid: S.Finite;
|
|
15
|
-
readonly totalValid: S.Finite;
|
|
16
|
-
readonly totalMutants: S.Finite;
|
|
17
|
-
readonly totalCovered: S.Finite;
|
|
18
|
-
readonly mutationScore: S.Finite;
|
|
19
|
-
readonly mutationScoreBasedOnCoveredCode: S.Finite;
|
|
20
|
-
}>;
|
|
21
|
-
type Metrics = typeof MetricsSchema.Type;
|
|
22
|
-
interface MetricsResult {
|
|
23
|
-
readonly name: string;
|
|
24
|
-
readonly metrics: Metrics;
|
|
25
|
-
readonly childResults: readonly MetricsResult[];
|
|
26
|
-
}
|
|
27
|
-
declare const MetricsResultSchema: S.Struct<{
|
|
28
|
-
readonly name: S.String;
|
|
29
|
-
readonly metrics: S.Struct<{
|
|
30
|
-
readonly pending: S.Finite;
|
|
31
|
-
readonly killed: S.Finite;
|
|
32
|
-
readonly timeout: S.Finite;
|
|
33
|
-
readonly survived: S.Finite;
|
|
34
|
-
readonly noCoverage: S.Finite;
|
|
35
|
-
readonly runtimeErrors: S.Finite;
|
|
36
|
-
readonly compileErrors: S.Finite;
|
|
37
|
-
readonly ignored: S.Finite;
|
|
38
|
-
readonly totalDetected: S.Finite;
|
|
39
|
-
readonly totalUndetected: S.Finite;
|
|
40
|
-
readonly totalInvalid: S.Finite;
|
|
41
|
-
readonly totalValid: S.Finite;
|
|
42
|
-
readonly totalMutants: S.Finite;
|
|
43
|
-
readonly totalCovered: S.Finite;
|
|
44
|
-
readonly mutationScore: S.Finite;
|
|
45
|
-
readonly mutationScoreBasedOnCoveredCode: S.Finite;
|
|
46
|
-
}>;
|
|
47
|
-
readonly childResults: S.$Array<S.suspend<S.Codec<MetricsResult, MetricsResult, never, never>>>;
|
|
48
|
-
}>;
|
|
49
|
-
//#endregion
|
|
50
|
-
export { MetricsSchema as i, MetricsResult as n, MetricsResultSchema as r, Metrics as t };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as S from "effect/Schema";
|
|
2
|
-
//#region src/Metrics.schema.ts
|
|
3
|
-
const MetricsSchema = S.Struct({
|
|
4
|
-
pending: S.Finite,
|
|
5
|
-
killed: S.Finite,
|
|
6
|
-
timeout: S.Finite,
|
|
7
|
-
survived: S.Finite,
|
|
8
|
-
noCoverage: S.Finite,
|
|
9
|
-
runtimeErrors: S.Finite,
|
|
10
|
-
compileErrors: S.Finite,
|
|
11
|
-
ignored: S.Finite,
|
|
12
|
-
totalDetected: S.Finite,
|
|
13
|
-
totalUndetected: S.Finite,
|
|
14
|
-
totalInvalid: S.Finite,
|
|
15
|
-
totalValid: S.Finite,
|
|
16
|
-
totalMutants: S.Finite,
|
|
17
|
-
totalCovered: S.Finite,
|
|
18
|
-
mutationScore: S.Finite,
|
|
19
|
-
mutationScoreBasedOnCoveredCode: S.Finite
|
|
20
|
-
});
|
|
21
|
-
const MetricsResultSchema = S.Struct({
|
|
22
|
-
name: S.String,
|
|
23
|
-
metrics: MetricsSchema,
|
|
24
|
-
childResults: S.Array(S.suspend(() => MetricsResultSchema))
|
|
25
|
-
}).annotate({ identifier: "MetricsResult" });
|
|
26
|
-
//#endregion
|
|
27
|
-
export { MetricsSchema as n, MetricsResultSchema as t };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
//#region src/Module.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* The subset of `node:module`'s `createRequire` result this port certifies: a
|
|
5
|
-
* require function bound to one path, plus its resolution. Calling it loads
|
|
6
|
-
* the specifier exactly as a module evaluated next to that path would.
|
|
7
|
-
*/
|
|
8
|
-
interface ModuleRequire {
|
|
9
|
-
(request: string): unknown;
|
|
10
|
-
resolve(request: string, options?: {
|
|
11
|
-
readonly paths?: readonly string[];
|
|
12
|
-
}): string;
|
|
13
|
-
}
|
|
14
|
-
declare const Module_base: Context.ServiceClass<Module, "@systemfsoftware/stryker-js/Module", {
|
|
15
|
-
readonly createRequire: (filename: string | URL) => ModuleRequire;
|
|
16
|
-
readonly isBuiltin: (moduleName: string) => boolean;
|
|
17
|
-
}>;
|
|
18
|
-
/**
|
|
19
|
-
* Port over the host module loader, shaped as the subset of `node:module`
|
|
20
|
-
* feature code may use: `createRequire` and `isBuiltin`. Resolving a
|
|
21
|
-
* specifier against a project directory, importing a plugin, and asking
|
|
22
|
-
* whether a name is a builtin all go through this one tag; no feature module
|
|
23
|
-
* touches the host module API. The Node implementation ships in the
|
|
24
|
-
* composition-root package (`@systemfsoftware/stryker-js-cli`); tests that do
|
|
25
|
-
* not need real plugin resolution substitute a layer returning fixed paths.
|
|
26
|
-
*
|
|
27
|
-
* @since 2.0.0
|
|
28
|
-
*/
|
|
29
|
-
declare class Module extends Module_base {}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { ModuleRequire as n, Module as t };
|
package/dist/Module.d.mts
DELETED
package/dist/Module.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
//#region src/Module.ts
|
|
3
|
-
/**
|
|
4
|
-
* Port over the host module loader, shaped as the subset of `node:module`
|
|
5
|
-
* feature code may use: `createRequire` and `isBuiltin`. Resolving a
|
|
6
|
-
* specifier against a project directory, importing a plugin, and asking
|
|
7
|
-
* whether a name is a builtin all go through this one tag; no feature module
|
|
8
|
-
* touches the host module API. The Node implementation ships in the
|
|
9
|
-
* composition-root package (`@systemfsoftware/stryker-js-cli`); tests that do
|
|
10
|
-
* not need real plugin resolution substitute a layer returning fixed paths.
|
|
11
|
-
*
|
|
12
|
-
* @since 2.0.0
|
|
13
|
-
*/
|
|
14
|
-
var Module = class extends Context.Service()("@systemfsoftware/stryker-js/Module") {};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { Module };
|