@systemfsoftware/stryker-js 11.0.0 → 12.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.
@@ -0,0 +1,18 @@
1
+ import { n as mod_d_exports$2 } from "./index-f-U3oZaJ.mjs";
2
+ import * as S from "effect/Schema";
3
+ //#region src/config/stryker-config.schema.d.ts
4
+ type StrykerConfig = mod_d_exports$2.PartialStrykerOptions;
5
+ type Primitive = boolean | number | string | null | undefined;
6
+ type ImmutablePrimitive = Primitive | ((...args: never[]) => void);
7
+ type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ReadonlyArray<Immutable<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<Immutable<K>, Immutable<V>> : T extends Set<infer M> ? ReadonlySet<Immutable<M>> : T extends RegExp ? Readonly<RegExp> : { readonly [K in keyof T]: Immutable<T[K]>; };
8
+ declare const ConfigEnvSchema: S.Struct<{
9
+ readonly command: S.Literals<readonly ["run", "merge-reports"]>;
10
+ readonly isDryRun: S.Boolean;
11
+ readonly mode: S.Literals<readonly ["human", "machine"]>;
12
+ readonly isCi: S.Boolean;
13
+ }>;
14
+ type ConfigEnv = typeof ConfigEnvSchema.Type;
15
+ type StrykerConfigFn = (env: ConfigEnv) => StrykerConfig | Promise<StrykerConfig>;
16
+ type StrykerConfigExport = StrykerConfig | Promise<StrykerConfig> | StrykerConfigFn;
17
+ //#endregion
18
+ export { StrykerConfig as a, Primitive as i, Immutable as n, StrykerConfigExport as o, ImmutablePrimitive as r, StrykerConfigFn as s, ConfigEnv as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js",
3
- "version": "11.0.0",
3
+ "version": "12.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
@@ -32,29 +32,23 @@
32
32
  "@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
33
33
  "@opentelemetry/sdk-metrics": "^2.11.0",
34
34
  "@opentelemetry/sdk-trace-base": "^2.2.0",
35
- "@systemfsoftware/effect-cell-types": "^10.1.1",
36
- "@systemfsoftware/stryker-vm-harness": "^3.0.0"
35
+ "@systemfsoftware/effect-cell-types": "^10.2.0",
36
+ "@systemfsoftware/stryker-vm-harness": "^3.0.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "effect": "4.0.0-rc.117"
40
40
  },
41
- "peerDependenciesMeta": {
42
- "effect": {
43
- "optional": true
44
- }
45
- },
46
41
  "devDependencies": {
47
42
  "@effect/tsgo": "^0.45.0",
48
- "@effect/vitest": "4.0.0-rc.117",
49
43
  "@microsoft/api-extractor": "^7",
50
44
  "@oxc-parser/binding-wasm32-wasi": "^0.150.0",
51
45
  "@std/jsonc": "npm:@jsr/std__jsonc@^1",
52
46
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
53
- "@systemfsoftware/differential-spec": "^0.3.0",
54
- "@systemfsoftware/effect-gherkin-spec": "^4.3.1",
55
- "@systemfsoftware/effect-schema-law": "^2.3.1",
56
- "@systemfsoftware/effect-schema-vite": "^2.2.3",
57
- "@systemfsoftware/oxlint-config-recommended": "^2.0.2",
47
+ "@systemfsoftware/differential-spec": "^0.5.0",
48
+ "@systemfsoftware/effect-gherkin-spec": "^5.0.0",
49
+ "@systemfsoftware/effect-schema-law": "^3.0.0",
50
+ "@systemfsoftware/effect-schema-vite": "^2.2.5",
51
+ "@systemfsoftware/oxlint-config-recommended": "^3.1.0",
58
52
  "@systemfsoftware/stryker-ignorer-effect-schema-declarations": "latest",
59
53
  "@systemfsoftware/stryker-ignorer-in-source-vitest-block": "latest",
60
54
  "@systemfsoftware/stryker-js": "latest",
@@ -62,6 +56,7 @@
62
56
  "@systemfsoftware/stryker-js-vitest-runner": "latest",
63
57
  "@systemfsoftware/stryker-test-contribution": "latest",
64
58
  "@systemfsoftware/tsconfig": "^2.0.1",
59
+ "@systemfsoftware/vitest": "^0.1.0",
65
60
  "@types/node": "^24",
66
61
  "@vitest/coverage-v8": "^5",
67
62
  "concurrently": "^10",
@@ -77,14 +72,14 @@
77
72
  "typescript": "^7",
78
73
  "vitest": "^5",
79
74
  "@systemfsoftware/stryker-framework-interface": "^0.0.0",
80
- "@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
75
+ "@systemfsoftware/stryker-js-instrumenter": "^9.0.1",
81
76
  "@systemfsoftware/stryker-config": "^0.1.0",
82
- "@systemfsoftware/stryker-js-html-reporter": "^5.0.0",
83
- "@systemfsoftware/stryker-js-instrumenter": "^9.0.0",
77
+ "@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
78
+ "@systemfsoftware/stryker-js-html-reporter": "^5.0.1",
84
79
  "@systemfsoftware/stryker-js-plugin-interface": "^8.0.0",
85
- "@systemfsoftware/stryker-js-plugin-runtime": "^6.0.0",
86
- "@systemfsoftware/vitest-config": "^0.1.0",
87
- "@systemfsoftware/tsdown-config": "^0.1.0"
80
+ "@systemfsoftware/stryker-js-plugin-runtime": "^6.0.1",
81
+ "@systemfsoftware/tsdown-config": "^0.1.0",
82
+ "@systemfsoftware/vitest-config": "^0.1.0"
88
83
  },
89
84
  "publishConfig": {
90
85
  "access": "public",
@@ -1,226 +0,0 @@
1
- import { d as Mutant_exports, i as Report_exports } from "./dist-ClUhPgb6.mjs";
2
- import * as Match from "effect/Match";
3
- import * as S from "effect/Schema";
4
- import { SchemaGetter, SchemaTransformation } from "effect";
5
- //#region src/run-event.schema.ts
6
- const RunPhase = S.Literals([
7
- "prepare",
8
- "instrument",
9
- "dry-run",
10
- "mutation-test"
11
- ]);
12
- const OutputMode = S.Literals(["human", "machine"]);
13
- const ModeSignal = S.Literals([
14
- "flag",
15
- "env",
16
- "tty",
17
- "agent",
18
- "tool"
19
- ]);
20
- var RunStarted = class extends S.TaggedClass()("stream", {
21
- schemaVersion: S.String,
22
- runId: S.String,
23
- mode: OutputMode,
24
- signal: ModeSignal
25
- }) {};
26
- var PhaseEntered = class extends S.TaggedClass()("phase", {
27
- phase: RunPhase,
28
- elapsedMs: Report_exports.NonNegativeFinite
29
- }) {};
30
- var PlanKnown = class extends S.TaggedClass()("plan", { total: Report_exports.NonNegativeInt }) {};
31
- var RunMutantTested = class extends S.TaggedClass()("mutant", {
32
- id: S.String,
33
- status: Mutant_exports.MutantStatusSchema,
34
- file: S.String,
35
- location: Mutant_exports.LocationSchema,
36
- mutator: S.String,
37
- replacement: S.NullOr(S.String),
38
- completed: Report_exports.NonNegativeInt,
39
- total: Report_exports.NonNegativeInt
40
- }) {};
41
- var Heartbeat = class extends S.TaggedClass()("tick", {
42
- elapsedMs: Report_exports.NonNegativeFinite,
43
- completed: Report_exports.NonNegativeInt,
44
- total: S.NullOr(Report_exports.NonNegativeInt)
45
- }) {};
46
- const VerdictThresholdsValuesSchema = S.Struct({
47
- high: Report_exports.Percentage,
48
- low: Report_exports.Percentage,
49
- break: S.NullOr(Report_exports.Percentage)
50
- });
51
- const isVerdictThresholds = (value) => S.is(VerdictThresholdsValuesSchema)(value) && value.low <= value.high;
52
- /**
53
- * The pair is *built* ordered — a drawn pair is sorted — rather than drawn at
54
- * random and discarded until it happens to be ordered. The invariant lives on
55
- * the declaration because a filter over the pair cannot express `low <= high`
56
- * in the generation-constraint vocabulary, and only a declaration carries a
57
- * `toCodecArbitrary` derivation. The struct stays the wire side, so decoding
58
- * keeps its field paths.
59
- */
60
- const OrderedVerdictThresholds = S.declare(isVerdictThresholds, {
61
- message: "expected thresholds where low <= high",
62
- toCodecArbitrary: () => S.link()(VerdictThresholdsValuesSchema, {
63
- decode: SchemaGetter.transform(({ break: breaking, high, low }) => ({
64
- break: breaking,
65
- high: Math.max(high, low),
66
- low: Math.min(high, low)
67
- })),
68
- encode: SchemaGetter.transform((thresholds) => thresholds)
69
- })
70
- });
71
- const VerdictThresholds = VerdictThresholdsValuesSchema.pipe(S.decodeTo(OrderedVerdictThresholds, SchemaTransformation.passthrough()));
72
- const VerdictMutant = S.Struct({
73
- id: S.String,
74
- file: S.String,
75
- location: Mutant_exports.LocationSchema,
76
- mutator: S.String,
77
- replacement: S.NullOr(S.String),
78
- status: Mutant_exports.MutantStatusSchema
79
- });
80
- var VerdictReached = class extends S.TaggedClass()("verdict", {
81
- schemaVersion: S.String,
82
- runId: S.String,
83
- mode: OutputMode,
84
- signal: ModeSignal,
85
- score: S.NullOr(Report_exports.Percentage),
86
- thresholds: VerdictThresholds,
87
- reportFile: S.NullOr(S.String),
88
- counts: Report_exports.Metrics,
89
- mutants: S.Array(VerdictMutant)
90
- }) {};
91
- const FrameworkContributionRow = S.Struct({
92
- name: S.String,
93
- formatId: S.String,
94
- extensions: S.Array(S.String)
95
- });
96
- const FrameworkModuleRow = S.Struct({
97
- moduleName: S.String,
98
- contributions: S.Array(FrameworkContributionRow)
99
- });
100
- const FormatClaimShadowingRow = S.Struct({
101
- extension: S.String,
102
- winner: S.String,
103
- loser: S.String
104
- });
105
- var PluginsReported = class extends S.TaggedClass()("plugins", {
106
- modules: S.Array(FrameworkModuleRow),
107
- shadowings: S.Array(FormatClaimShadowingRow)
108
- }) {};
109
- const FormatRegistryRow = S.Struct({
110
- extension: S.String,
111
- formatId: S.String,
112
- ownerModule: S.String,
113
- language: S.String
114
- });
115
- var FormatRegistryResolved = class extends S.TaggedClass()("formats", { rows: S.Array(FormatRegistryRow) }) {};
116
- const SkippedFileRow = S.Struct({
117
- file: S.String,
118
- extension: S.String,
119
- reason: S.String
120
- });
121
- var SkippedReported = class extends S.TaggedClass()("skipped", { files: S.Array(SkippedFileRow) }) {};
122
- const PluginFailureReason = S.Literals([
123
- "PeerMissing",
124
- "PeerVersionUnsupported",
125
- "PeerUnrecognized",
126
- "InvalidContribution",
127
- "ImportFailed"
128
- ]);
129
- var RunFailed = class extends S.TaggedClass()("error", {
130
- schemaVersion: S.String,
131
- code: S.Finite,
132
- error: S.String,
133
- remediation: S.String,
134
- reason: S.NullOr(PluginFailureReason)
135
- }) {};
136
- var HelpRendered = class extends S.TaggedClass()("help", {
137
- schemaVersion: S.String,
138
- code: S.Literals([0]),
139
- help: S.String
140
- }) {};
141
- const RunEvent = Object.assign(S.Union([
142
- RunStarted,
143
- PhaseEntered,
144
- PlanKnown,
145
- RunMutantTested,
146
- Heartbeat,
147
- PluginsReported,
148
- FormatRegistryResolved,
149
- SkippedReported,
150
- VerdictReached,
151
- RunFailed,
152
- HelpRendered
153
- ]), { QUEUE_BOUND: 256 });
154
- S.TaggedClass()("RunCommand", {
155
- cliOptionsJson: S.String,
156
- targetMutatePatterns: S.Array(S.String)
157
- });
158
- S.TaggedClass()("RunOutput", {
159
- verdictJson: S.String,
160
- exitCode: S.Finite
161
- });
162
- var RunDecodeError = class extends S.TaggedError()("RunDecodeError", { message: S.String }) {};
163
- var RunReadError = class extends S.TaggedError()("RunReadError", { message: S.String }) {};
164
- S.TaggedError()("RunWriteError", { message: S.String });
165
- var PlanMutationRunCommand = class extends S.TaggedClass()("PlanMutationRunCommand", {
166
- configMutatePatterns: S.Array(S.String),
167
- configMutatorNames: S.Array(S.String),
168
- targetMutatePatterns: S.Array(S.String),
169
- availableMutators: S.Array(S.String)
170
- }) {};
171
- var MutationRunPlan = class extends S.TaggedClass()("MutationRunPlan", {
172
- mutatePatterns: S.Array(S.String),
173
- mutatorNames: S.Array(S.String)
174
- }) {};
175
- //#endregion
176
- //#region src/Run.schema.ts
177
- const TypeId = "~stryker/mutation-run/StageError";
178
- var StageError = class extends S.TaggedError(TypeId)("StageError", {
179
- stage: S.Literals([
180
- "prepare",
181
- "instrument",
182
- "dryRun",
183
- "dryRunNoTests",
184
- "mutationTest"
185
- ]),
186
- reason: S.String,
187
- cause: S.optional(S.Defect()),
188
- command: S.optional(S.String)
189
- }) {
190
- [TypeId] = TypeId;
191
- get exitClass() {
192
- return STAGE_PRESENTATION[this.stage].exitClass;
193
- }
194
- get message() {
195
- const failure = `${STAGE_PRESENTATION[this.stage].label} failed: ${this.reason}`;
196
- return Match.value(this.command).pipe(Match.when(Match.nonEmptyString, (present) => `${failure} (command: ${present})`), Match.orElse(() => failure));
197
- }
198
- };
199
- const STAGE_PRESENTATION = {
200
- prepare: {
201
- label: "Prepare",
202
- exitClass: "ConfigError"
203
- },
204
- instrument: {
205
- label: "Instrument",
206
- exitClass: "RuntimeError"
207
- },
208
- dryRun: {
209
- label: "Dry run",
210
- exitClass: "RuntimeError"
211
- },
212
- dryRunNoTests: {
213
- label: "Dry run",
214
- exitClass: "ConfigError"
215
- },
216
- mutationTest: {
217
- label: "Mutation testing",
218
- exitClass: "RuntimeError"
219
- }
220
- };
221
- var PrepareError = class extends S.TaggedError()("PrepareError", {
222
- stage: S.Literal("prepare"),
223
- reason: S.String
224
- }) {};
225
- //#endregion
226
- export { RunReadError as C, VerdictReached as D, SkippedReported as E, RunPhase as S, SkippedFileRow as T, PluginsReported as _, FormatRegistryRow as a, RunFailed as b, Heartbeat as c, MutationRunPlan as d, OutputMode as f, PluginFailureReason as g, PlanMutationRunCommand as h, FormatRegistryResolved as i, HelpRendered as l, PlanKnown as m, StageError as n, FrameworkContributionRow as o, PhaseEntered as p, FormatClaimShadowingRow as r, FrameworkModuleRow as s, PrepareError as t, ModeSignal as u, RunDecodeError as v, RunStarted as w, RunMutantTested as x, RunEvent as y };
@@ -1,82 +0,0 @@
1
- import { n as Options_exports } from "./dist-ClUhPgb6.mjs";
2
- import * as Match from "effect/Match";
3
- import * as Option from "effect/Option";
4
- import * as Predicate from "effect/Predicate";
5
- import * as S from "effect/Schema";
6
- import * as Effect from "effect/Effect";
7
- import { dual } from "effect/Function";
8
- import * as Record from "effect/Record";
9
- //#region src/config/stryker-config.schema.ts
10
- /**
11
- * Whether an entry takes part in a merge: a key literally named `__proto__` never does — the
12
- * merged record must not gain a document-decided prototype — and an explicitly `undefined`
13
- * value states that the author left the key unset, not that they want it set to nothing.
14
- */
15
- const usable = (value, key) => key !== "__proto__" && value !== void 0;
16
- const usableEntries = (source) => Record.filter(source, usable);
17
- const isConfigRecord = (value) => Predicate.isObject(value);
18
- const asConfigRecord = (value) => Option.filter(Option.fromUndefinedOr(value), isConfigRecord);
19
- const mergeNested = (base, override) => Option.match(asConfigRecord(override), {
20
- onNone: () => override,
21
- onSome: (overrideRecord) => mergeRecords(base, overrideRecord)
22
- });
23
- const hasUsableMember = (key) => (merged) => merged.hasOwnProperty(key) && merged[key] !== void 0;
24
- const ownValueOf = (merged, key) => Option.map(Option.liftPredicate(merged, hasUsableMember(key)), (present) => present[key]);
25
- const baseRecordOf = (ownValue) => Option.filter(Option.flatMap(ownValue, Option.fromUndefinedOr), isConfigRecord);
26
- const mergeKeyInto = (merged, override, key) => ({
27
- ...merged,
28
- [key]: Option.match(baseRecordOf(ownValueOf(merged, key)), {
29
- onNone: () => override,
30
- onSome: (baseRecord) => mergeNested(baseRecord, override)
31
- })
32
- });
33
- const mergeRecords = (base, overrides) => Record.reduce(usableEntries(overrides), usableEntries(base), mergeKeyInto);
34
- S.Struct({
35
- command: S.Literals(["run", "merge-reports"]),
36
- isDryRun: S.Boolean,
37
- mode: S.Literals(["human", "machine"]),
38
- isCi: S.Boolean
39
- });
40
- const isNonNullObject = (value) => typeof value === "object" && value !== null;
41
- const isRecordValue = (value) => isNonNullObject(value) && Array.isArray(value) === false;
42
- const isArrayValue = (value) => Array.isArray(value);
43
- const freezeArrayValue = (value) => Object.freeze(value.map((element) => deepFreeze(element)));
44
- const freezeMapEntry = ([entryKey, entryValue]) => [deepFreeze(entryKey), deepFreeze(entryValue)];
45
- const freezeMapValue = (value) => Object.freeze(new Map([...value.entries()].map(freezeMapEntry)));
46
- const freezeSetValue = (value) => Object.freeze(new Set([...value.values()].map((element) => deepFreeze(element))));
47
- const freezeRegExpValue = (value) => Object.freeze(value);
48
- const freezeRecordValue = (value) => Object.freeze(Record.map(value, (propertyValue) => deepFreeze(propertyValue)));
49
- function deepFreeze(target) {
50
- return Match.value(target).pipe(Match.when(isArrayValue, freezeArrayValue), Match.when((value) => value instanceof Map, freezeMapValue), Match.when((value) => value instanceof RegExp, freezeRegExpValue), Match.when((value) => value instanceof Set, freezeSetValue), Match.when(isRecordValue, freezeRecordValue), Match.orElse(() => target));
51
- }
52
- const configFileNames = (extensions) => extensions.map((extension) => `stryker.config${extension}`);
53
- const CONFIG_FILE_NAMES = Object.freeze(configFileNames([
54
- ".ts",
55
- ".mts",
56
- ".js",
57
- ".mjs"
58
- ]));
59
- const CONFIG_SYNTAX_HELP = `
60
- Example of how a config file should look:
61
- /**
62
- * @type {import('@systemfsoftware/stryker-js-plugin-interface').StrykerOptions}
63
- */
64
- export default {
65
- mutate: ['src/**/*.js'],
66
- testRunner: 'vitest',
67
- reporters: ['progress', 'clear-text', 'html'],
68
- concurrency: 4
69
- };
70
- See https://stryker-mutator.io/docs/stryker-js/config-file for more information.`.trim();
71
- var StrykerConfig = class StrykerConfig extends S.Class("StrykerConfig")({ entries: S.Record(S.String, S.Unknown) }) {
72
- static define(config) {
73
- return config;
74
- }
75
- static merge = dual(2, (defaults, overrides) => mergeRecords(defaults, overrides));
76
- static createDefaultOptions = S.decodeEffect(Options_exports.StrykerOptionsSchema)({}).pipe(Effect.orDie);
77
- static defaultOptions = Effect.map(StrykerConfig.createDefaultOptions, (options) => deepFreeze(options));
78
- static supportedFileNames = CONFIG_FILE_NAMES;
79
- static syntaxHelp = CONFIG_SYNTAX_HELP;
80
- };
81
- //#endregion
82
- export { StrykerConfig as t };
@@ -1,35 +0,0 @@
1
- import { n as mod_d_exports$2 } from "./index-CMCCQdTd.mjs";
2
- import * as S from "effect/Schema";
3
- import * as Effect from "effect/Effect";
4
- //#region src/config/stryker-config.schema.d.ts
5
- type Primitive = boolean | number | string | null | undefined;
6
- type ImmutablePrimitive = Primitive | ((...args: never[]) => void);
7
- type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ReadonlyArray<Immutable<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<Immutable<K>, Immutable<V>> : T extends Set<infer M> ? ReadonlySet<Immutable<M>> : T extends RegExp ? Readonly<RegExp> : { readonly [K in keyof T]: Immutable<T[K]>; };
8
- declare const ConfigEnvSchema: S.Struct<{
9
- readonly command: S.Literals<readonly ["run", "merge-reports"]>;
10
- readonly isDryRun: S.Boolean;
11
- readonly mode: S.Literals<readonly ["human", "machine"]>;
12
- readonly isCi: S.Boolean;
13
- }>;
14
- type ConfigEnv = typeof ConfigEnvSchema.Type;
15
- type StrykerConfigFn = (env: ConfigEnv) => mod_d_exports$2.PartialStrykerOptions | Promise<mod_d_exports$2.PartialStrykerOptions>;
16
- type StrykerConfigExport = mod_d_exports$2.PartialStrykerOptions | Promise<mod_d_exports$2.PartialStrykerOptions> | StrykerConfigFn;
17
- declare const StrykerConfig_base: S.Class<StrykerConfig, S.Struct<{
18
- readonly entries: S.$Record<S.String, S.Unknown>;
19
- }>, {}>;
20
- declare class StrykerConfig extends StrykerConfig_base {
21
- static define(config: mod_d_exports$2.PartialStrykerOptions): mod_d_exports$2.PartialStrykerOptions;
22
- static define(config: Promise<mod_d_exports$2.PartialStrykerOptions>): Promise<mod_d_exports$2.PartialStrykerOptions>;
23
- static define(config: StrykerConfigFn): StrykerConfigFn;
24
- static define(config: StrykerConfigExport): StrykerConfigExport;
25
- static readonly merge: {
26
- (overrides: mod_d_exports$2.PartialStrykerOptions): (defaults: mod_d_exports$2.PartialStrykerOptions) => mod_d_exports$2.PartialStrykerOptions;
27
- (defaults: mod_d_exports$2.PartialStrykerOptions, overrides: mod_d_exports$2.PartialStrykerOptions): mod_d_exports$2.PartialStrykerOptions;
28
- };
29
- static readonly createDefaultOptions: Effect.Effect<mod_d_exports$2.StrykerOptions>;
30
- static readonly defaultOptions: Effect.Effect<Immutable<mod_d_exports$2.StrykerOptions>, never, never>;
31
- static readonly supportedFileNames: readonly string[];
32
- static readonly syntaxHelp: string;
33
- }
34
- //#endregion
35
- export { StrykerConfig as a, Primitive as i, Immutable as n, StrykerConfigExport as o, ImmutablePrimitive as r, StrykerConfigFn as s, ConfigEnv as t };