@systemfsoftware/stryker-js 0.2.0 → 2.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 CHANGED
@@ -1,5 +1,157 @@
1
1
  # @systemfsoftware/stryker-js
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - The packages are renamed. `plugin-api` is now `@systemfsoftware/stryker-js`, the
8
+ language every plugin is written against. `mutation-run` is split: the run
9
+ itself is `@systemfsoftware/stryker-js-engine`
10
+ (host-neutral, no Node on its manifest) and the Node process entries are
11
+ `@systemfsoftware/stryker-js-cli`, which owns the worker files and the runtime
12
+ gate. `mutation-report` is now `@systemfsoftware/stryker-js-html-reporter`.
13
+ `@systemfsoftware/stryker-js-platform-node` is never published — do not install
14
+ it. Install the new names and change your imports.
15
+
16
+ Options types moved. `StrykerOptions`, `PartialStrykerOptions` and `LogLevel` are
17
+ imported from the `Schema` export; `Mutant`, `MutantStatus`, `Position` and
18
+ `Location` from the `Mutant` export. Point a config's `extends` at the language
19
+ package's `Schema` export.
20
+
21
+ `MutantStatus` accepts one spelling per outcome: `Killed`, `Survived`,
22
+ `NoCoverage`, `Timeout`, `CompileError`, `RuntimeError`, `Ignored` and `Pending`.
23
+ The lowercase and abbreviated forms — `killed`, `timedOut`, `noCoverage` and the
24
+ rest — are gone. A comparison against a removed spelling never matched the value
25
+ the reporter actually produced, so check any status comparison you wrote.
26
+
27
+ Statuses, plugin kinds, exit classes and AST formats are string literal unions
28
+ rather than enums, so read them as their string values. Member access such as
29
+ `ExitClass.VerdictFail` no longer resolves.
30
+
31
+ A plugin no longer receives a logger, and the logger port is gone. Plugins log
32
+ through Effect, and the host decides where that output goes.
33
+
34
+ The bundled base preset is gone. A config inherits from the language package's
35
+ `Schema` export and states the thresholds, reporters and plugins it wants; you no
36
+ longer silently inherit a package manager, a plugin list or a break threshold.
37
+
38
+ - An evaluator now answers with the verdict it reached instead of failing to
39
+ report one.
40
+
41
+ `Evaluator.evaluate` returns `ExitClass | null` on the success channel: the
42
+ class the run should end in, or `null` for nothing to report. `ExitClass` is
43
+ exported from `@systemfsoftware/stryker-js/evaluate`. The error
44
+ channel is for the evaluator itself breaking — a report it cannot read, a
45
+ decision it cannot reach.
46
+
47
+ Previously the only way to report a failed gate was to fail, which a caller
48
+ could not tell apart from the evaluator crashing, so neither the exit code nor
49
+ the message could distinguish them. If you wrote an evaluator that failed to
50
+ signal a verdict, return the class instead.
51
+
52
+ A run's verdict is now the most severe class anyone reported — the score against
53
+ your `break` threshold, plus every evaluator's answer.
54
+
55
+ - Plugins are written against Effect instead of Promise.
56
+
57
+ `Checker`, `TestRunner`, `Reporter`, `Ignorer` and `Evaluator` are capability services whose operations return an `Effect`. Provide your plugin as a `Layer` through `declarePlugin`; the class, factory and value declarations are gone, along with the `typed-inject` dependency. Implement the operations that were optional — return `Effect.void` where there is nothing to do, and one group per mutant from `group` if you have no grouping opinion.
58
+
59
+ Each capability fails with a tagged error. Outcomes are not failures: a killed mutant, a survivor and a compile error in the code under test are successful results.
60
+
61
+ Read the sandbox path from `SandboxDirectory`. `commonTokens`, `tokens` and the plugin context types are removed. `determineHitLimitReached` returns an `Option`.
62
+
63
+ ### Minor Changes
64
+
65
+ - `RENDERED_OPTION_DEFAULTS` is exported from the `core` entry point. It carries
66
+ the four option defaults that appear in human-readable help text, so a tool
67
+ printing "the default is X" reads the same value the option schema applies
68
+ instead of restating it.
69
+
70
+ - The shared helpers package is gone. Nothing installs it any more, and the
71
+ handful of helpers worth sharing now live in the plugin contract next to the
72
+ types they serve:
73
+
74
+ - `strykerReportBugUrl`, `normalizeFileName`, `propertyPath`, `errorToString`
75
+ and `isErrnoException` from `@systemfsoftware/stryker-js/core`
76
+ - `noopLogger` from `@systemfsoftware/stryker-js/logging`
77
+ - `testFilesProvided` from `@systemfsoftware/stryker-js/test-runner`
78
+
79
+ If you imported any of those, change the specifier. Everything else it exported
80
+ had no consumer and is removed: use `Predicate.isNotNullish` from Effect in place
81
+ of `notEmpty`, and `RegExp.escape` in place of `escapeRegExp`.
82
+
83
+ - Checker and test-runner workers now talk over Effect's own worker RPC, and every
84
+ call they exchange is a declared operation with a declared result.
85
+
86
+ Before, the parent and its workers spoke a protocol written by hand: messages were
87
+ newline-delimited JSON, arguments were typed as "any JSON value", and each method
88
+ was reached by name through a proxy. Nothing checked that a payload was one the far
89
+ end could serve, so a value it could not read was refused after it arrived, and a
90
+ call whose message never landed was waited on anyway.
91
+
92
+ The six operations that cross that boundary — a checker's `check` and `group`, a
93
+ runner's `capabilities`, `dryRun` and `mutantRun` — now each name what they take
94
+ and what they return, and the options a worker starts from are sent once when it
95
+ starts rather than as a first method call. A payload that does not fit is refused
96
+ where it is built, and a worker that cannot answer fails the call that was waiting.
97
+
98
+ The two worker entry points are no longer importable subpaths of this package.
99
+ They were only ever spawned as processes, and the paths resolved to TypeScript
100
+ sources that could not be executed.
101
+
102
+ ### Patch Changes
103
+
104
+ - A mutation run that is killed mid-way keeps every completed mutant: the JSONL progress stream is flushed after each result, and incremental mode writes remembered verdicts as they finish so the next run continues instead of starting over.
105
+
106
+ Remembered killed mutants still name the tests that killed them, so a resumed run's report matches a complete run.
107
+
108
+ The progress stream path is progressStreamFile (default reports/mutation-stream.jsonl) and can be set in config or with --progressStreamFile.
109
+
110
+ - New version is published through npm trusted publishing, so it carries a provenance attestation you can verify.
111
+
112
+ - Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
113
+
114
+ - An oversized message between the runner and a worker now fails the run with a
115
+ reason instead of exhausting memory. Each side of the connection reads frames
116
+ up to 16 MiB, which leaves headroom over the largest legitimate payload — a dry
117
+ run carrying per-test coverage — and a frame past the limit fails the calls
118
+ waiting on it rather than growing until the process dies.
119
+
120
+ - Each of these packages now has a README, so its registry page says what the package is, how
121
+ to install it, and what to import or register — previously the page was blank. The lint
122
+ plugins show the configuration line that enables what they recommend.
123
+
124
+ `@systemfsoftware/stryker-js-html-reporter` also carries its licence text
125
+
126
+ - These packages no longer install dependencies they never imported, so installing them pulls less into your tree.
127
+
128
+ `tslib` is gone from all six. The mutation runner additionally stops installing `lodash.groupby`, `semver` and `source-map`, and the command line interface stops installing `@effect/platform-node-shared`. Nothing exported changes.
129
+
130
+ - Published packages no longer carry build artifacts left over from earlier builds. One package was shipping about a megabyte of bundled test-runner internals this way.
131
+
132
+ - The closing verdict line carries its findings again. It had shrunk to the score alone, so a consumer reading the stream could no longer see the score limits the run was held to, where the report was written, or which mutants survived — the survivors were reported while the run was in flight and then absent from the summary that closes it.
133
+
134
+ The verdict now states the thresholds, the report path, and every surviving mutant with its file, position, mutator and replacement.
135
+
136
+ ## 1.0.0
137
+
138
+ ### Major Changes
139
+
140
+ - The console log threshold is now scoped to the run that set it. Two runs in one
141
+ process no longer share it, so a run that lowers its own level can no longer
142
+ quieten another run happening alongside it.
143
+
144
+ `setEngineLogLevel` is removed. The level travels with the run.
145
+
146
+ - `runMutationTest` now requires the run-identity services to be provided by the caller; the effect names them in its requirements channel.
147
+
148
+ - The public Run subpath's shouldKeepTempDir now accepts any failure channel instead of only S.SchemaError; the runMutationTest signature and event surface are unchanged
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies:
153
+ - @systemfsoftware/effect-cell-types@6.0.0
154
+
3
155
  ## 0.2.0
4
156
 
5
157
  ### Minor Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The mutation-testing language — the plugin kinds, capability ports, and schemas
4
4
  a mutation run is built from, with no platform. The Node host that runs a
5
- mutation test lives in `@systemfsoftware/stryker-js-platform-node`.
5
+ mutation test lives in `@systemfsoftware/stryker-js-engine`.
6
6
 
7
7
  ## Install
8
8
 
@@ -29,4 +29,4 @@ Each concept module is an enumerated specifier:
29
29
 
30
30
  ## License
31
31
 
32
- Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/stryker-js#readme).
32
+ Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js#readme).
@@ -1,4 +1,4 @@
1
- import { t as ExitClass } from "./ExitClass.schema-BmCUn2Sm.mjs";
1
+ import { r as ExitClass } from "./ExitClass.schema-BmOIK5zT.mjs";
2
2
  import * as Context from "effect/Context";
3
3
  import * as S from "effect/Schema";
4
4
  import * as schema from "mutation-testing-report-schema/api";
@@ -1,3 +1,3 @@
1
- import { n as EvaluatorService, r as EvaluatorFailed, t as Evaluator } from "./Evaluator-DLVXUcVj.mjs";
2
- import { t as ExitClass } from "./ExitClass.schema-BmCUn2Sm.mjs";
1
+ import { n as EvaluatorService, r as EvaluatorFailed, t as Evaluator } from "./Evaluator-RZBS4oeh.mjs";
2
+ import { r as ExitClass } from "./ExitClass.schema-BmOIK5zT.mjs";
3
3
  export { Evaluator, EvaluatorFailed, EvaluatorService, type ExitClass };
@@ -1,8 +1,9 @@
1
- import { t as ExitClass } from "./ExitClass.schema-BmCUn2Sm.mjs";
1
+ import { n as ClassifyExitDecision, r as ExitClass, t as ClassifyExitCommand } from "./ExitClass.schema-BmOIK5zT.mjs";
2
2
  //#region src/ExitClass.d.ts
3
3
  declare const EXIT_CODE: Record<ExitClass, number>;
4
4
  declare function verdictExitClass(score: number | null, breakingThreshold: number | null): ExitClass | null;
5
5
  declare function highestExitClass(pending: Iterable<ExitClass>): ExitClass | null;
6
6
  declare function resolveExitCode(pending: Iterable<ExitClass>, signal: number | null): number;
7
+ declare const classifyExit: (command: ClassifyExitCommand) => ClassifyExitDecision;
7
8
  //#endregion
8
- export { EXIT_CODE, ExitClass, highestExitClass, resolveExitCode, verdictExitClass };
9
+ export { EXIT_CODE, ExitClass, classifyExit, highestExitClass, resolveExitCode, verdictExitClass };
@@ -1,4 +1,5 @@
1
1
  import * as S from "effect/Schema";
2
+ import * as Match from "effect/Match";
2
3
  //#region src/ExitClass.schema.ts
3
4
  const ExitClass = S.Literals([
4
5
  "VerdictFail",
@@ -6,6 +7,16 @@ const ExitClass = S.Literals([
6
7
  "RuntimeError",
7
8
  "InternalError"
8
9
  ]);
10
+ S.TaggedClass()("ClassifyExitCommand", {
11
+ pending: S.Array(ExitClass),
12
+ signal: S.NullOr(S.Number),
13
+ score: S.NullOr(S.Number),
14
+ breakingThreshold: S.NullOr(S.Number)
15
+ });
16
+ var ClassifyExitDecision = class extends S.TaggedClass()("ClassifyExitDecision", {
17
+ highestClass: S.NullOr(ExitClass),
18
+ verdictClass: S.NullOr(ExitClass)
19
+ }) {};
9
20
  //#endregion
10
21
  //#region src/ExitClass.ts
11
22
  const EXIT_CODE = {
@@ -30,5 +41,30 @@ function resolveExitCode(pending, signal) {
30
41
  if (highest === null) return 0;
31
42
  return EXIT_CODE[highest];
32
43
  }
44
+ const deriveVerdict = (score, breakingThreshold) => {
45
+ if (score === null || breakingThreshold === null) return null;
46
+ if (score < breakingThreshold) return "VerdictFail";
47
+ return null;
48
+ };
49
+ const rank = (value) => Match.value(value).pipe(Match.when("InternalError", () => 4), Match.when("RuntimeError", () => 3), Match.when("ConfigError", () => 2), Match.when("VerdictFail", () => 1), Match.exhaustive);
50
+ const withVerdict = (pending, verdict) => {
51
+ if (verdict === null) return pending;
52
+ if (pending.includes(verdict)) return pending;
53
+ return [...pending, verdict];
54
+ };
55
+ const highestOf = (values) => values.reduce((acc, cur) => {
56
+ if (acc === null) return cur;
57
+ if (rank(cur) > rank(acc)) return cur;
58
+ return acc;
59
+ }, null);
60
+ const classifyExit = (command) => {
61
+ const verdictClass = deriveVerdict(command.score, command.breakingThreshold);
62
+ const pendingWithVerdict = withVerdict(command.pending, verdictClass);
63
+ const highestClass = highestOf(pendingWithVerdict);
64
+ return ClassifyExitDecision.make({
65
+ highestClass,
66
+ verdictClass
67
+ });
68
+ };
33
69
  //#endregion
34
- export { EXIT_CODE, ExitClass, highestExitClass, resolveExitCode, verdictExitClass };
70
+ export { EXIT_CODE, ExitClass, classifyExit, highestExitClass, resolveExitCode, verdictExitClass };
@@ -0,0 +1,18 @@
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 };
@@ -20,9 +20,9 @@ declare const Module_base: Context.ServiceClass<Module, "@systemfsoftware/stryke
20
20
  * feature code may use: `createRequire` and `isBuiltin`. Resolving a
21
21
  * specifier against a project directory, importing a plugin, and asking
22
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
24
- * `@systemfsoftware/stryker-js-platform-node`; tests substitute a layer
25
- * returning fixed paths.
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
26
  *
27
27
  * @since 2.0.0
28
28
  */
package/dist/Module.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as ModuleRequire, t as Module } from "./Module-DUBk7gl2.mjs";
1
+ import { n as ModuleRequire, t as Module } from "./Module-DHKEMAFI.mjs";
2
2
  export { Module, ModuleRequire };
package/dist/Module.mjs CHANGED
@@ -5,9 +5,9 @@ import * as Context from "effect/Context";
5
5
  * feature code may use: `createRequire` and `isBuiltin`. Resolving a
6
6
  * specifier against a project directory, importing a plugin, and asking
7
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
9
- * `@systemfsoftware/stryker-js-platform-node`; tests substitute a layer
10
- * returning fixed paths.
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
11
  *
12
12
  * @since 2.0.0
13
13
  */
@@ -1,8 +1,8 @@
1
1
  import { n as Checker } from "./Checker-DYgIIEai.mjs";
2
2
  import { J as TestRunner } from "./Mutant-BPRJTF8f.mjs";
3
- import { t as Evaluator } from "./Evaluator-DLVXUcVj.mjs";
3
+ import { t as Evaluator } from "./Evaluator-RZBS4oeh.mjs";
4
4
  import { t as Ignorer } from "./Ignorer-BUY68FZQ.mjs";
5
- import { t as Module } from "./Module-DUBk7gl2.mjs";
5
+ import { t as Module } from "./Module-DHKEMAFI.mjs";
6
6
  import { c as Reporter } from "./Reporter-eZ3M7lO6.mjs";
7
7
  import * as Context from "effect/Context";
8
8
  import * as S from "effect/Schema";
package/dist/Plugin.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as PluginEnvironment, c as RunConfiguration, d as declarePlugin, f as PluginContribution, i as MergedPluginServices, l as SandboxDirectory, m as Shadowing, n as ComposedPlugins, o as PluginInterfaces, p as PluginKind, r as ContributionOf, t as AnyPluginContribution, u as composePlugins } from "./Plugin-HR2dbiT7.mjs";
1
+ import { a as PluginEnvironment, c as RunConfiguration, d as declarePlugin, f as PluginContribution, i as MergedPluginServices, l as SandboxDirectory, m as Shadowing, n as ComposedPlugins, o as PluginInterfaces, p as PluginKind, r as ContributionOf, t as AnyPluginContribution, u as composePlugins } from "./Plugin-DcDAIBQi.mjs";
2
2
  export { AnyPluginContribution, ComposedPlugins, ContributionOf, MergedPluginServices, PluginContribution, PluginEnvironment, PluginInterfaces, PluginKind, RunConfiguration, SandboxDirectory, Shadowing, composePlugins, declarePlugin };
@@ -2,10 +2,9 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import * as Context from "effect/Context";
3
3
  import * as S from "effect/Schema";
4
4
  import * as Effect from "effect/Effect";
5
- import { Cell, Wire, Workflow } from "@systemfsoftware/effect-cell-types";
6
5
  import * as Exit from "effect/Exit";
7
- import { pipe } from "effect/Function";
8
6
  import * as Result from "effect/Result";
7
+ import { Wire } from "@systemfsoftware/effect-cell-types";
9
8
  //#region src/Run.schema.ts
10
9
  const RunPhase = S.Literals([
11
10
  "prepare",
@@ -137,8 +136,6 @@ var RunOutput = class extends S.TaggedClass()("RunOutput", {
137
136
  S.TaggedError()("RunDecodeError", { message: S.String });
138
137
  S.TaggedError()("RunReadError", { message: S.String });
139
138
  S.TaggedError()("RunWriteError", { message: S.String });
140
- //#endregion
141
- //#region src/Run.workflow.ts
142
139
  var PlanMutationRunCommand = class extends S.TaggedClass()("PlanMutationRunCommand", {
143
140
  configMutatePatterns: Wire.mint(S.Array(Wire.mint(S.String))),
144
141
  configMutatorNames: Wire.mint(S.Array(Wire.mint(S.String))),
@@ -149,27 +146,6 @@ var MutationRunPlan = class extends S.TaggedClass()("MutationRunPlan", {
149
146
  mutatePatterns: Wire.mint(S.Array(Wire.mint(S.String))),
150
147
  mutatorNames: Wire.mint(S.Array(Wire.mint(S.String)))
151
148
  }) {};
152
- S.TaggedError()("PlanMutationRunError", {
153
- message: S.String,
154
- detail: S.String
155
- });
156
- const selectMutatePatterns = (target, fallback) => {
157
- if (target.length > 0) return [...target];
158
- return [...fallback];
159
- };
160
- const selectMutatorNames = (available, fallback) => {
161
- if (available.length > 0) return [...available];
162
- return [...fallback];
163
- };
164
- const decidePlan = (command) => {
165
- const mutatePatterns = selectMutatePatterns(command.targetMutatePatterns, command.configMutatePatterns);
166
- const mutatorNames = selectMutatorNames(command.availableMutators, command.configMutatorNames);
167
- return Result.succeed(MutationRunPlan.make({
168
- mutatePatterns,
169
- mutatorNames
170
- }));
171
- };
172
- const planMutationRun = Workflow.make(PlanMutationRunCommand, (command) => decidePlan(command));
173
149
  //#endregion
174
150
  //#region src/Run.ts
175
151
  var Run_exports = /* @__PURE__ */ __exportAll({
@@ -189,37 +165,35 @@ var Run_exports = /* @__PURE__ */ __exportAll({
189
165
  RunPhase: () => RunPhase,
190
166
  RunStarted: () => RunStarted,
191
167
  VerdictReached: () => VerdictReached,
168
+ planMutationRun: () => planMutationRun,
192
169
  runMutationTest: () => runMutationTest,
193
170
  shouldKeepTempDir: () => shouldKeepTempDir
194
171
  });
195
- /**
196
- * Where a run's events go.
197
- *
198
- * The error channel carries `Cause.Done`, the graceful completion signal: a finished run
199
- * ends the queue, and `Stream.fromQueue` excludes `Done` from its own error channel, so the
200
- * consumer sees end-of-stream. Interrupting the queue instead would end it with an
201
- * interrupt cause, and joining the drain would then re-raise that into the caller and lose
202
- * the exit code the run had already decided.
203
- */
172
+ const firstNonEmpty = (preferred, fallback) => {
173
+ if (preferred.length > 0) return [...preferred];
174
+ return [...fallback];
175
+ };
176
+ const planMutationRun = (command) => MutationRunPlan.make({
177
+ mutatePatterns: firstNonEmpty(command.targetMutatePatterns, command.configMutatePatterns),
178
+ mutatorNames: firstNonEmpty(command.availableMutators, command.configMutatorNames)
179
+ });
204
180
  var RunEvents = class extends Context.Service()("~@systemfsoftware/stryker-js/RunEvents") {};
205
181
  var RunIdentity = class extends Context.Service()("~@systemfsoftware/stryker-js/RunIdentity") {};
206
- const mutationRunDescription = (io, services) => pipe(Cell.read((command) => Effect.provideContext(io.read(command), services)), Cell.decode((raw) => S.decodeUnknownResult(PlanMutationRunCommand)(raw)), Cell.decide(planMutationRun), Cell.encode((outcome) => Result.match(outcome, {
207
- onFailure: (error) => new RunOutput({
208
- verdictJson: JSON.stringify({ error: error.message }),
209
- exitCode: 1
210
- }),
211
- onSuccess: (plan) => new RunOutput({
182
+ const runMutationTest = (io, command) => Effect.gen(function* () {
183
+ const raw = yield* io.read(command);
184
+ const planCommand = yield* Result.match(S.decodeUnknownResult(PlanMutationRunCommand)(raw), {
185
+ onFailure: (error) => Effect.fail(error),
186
+ onSuccess: (decoded) => Effect.succeed(decoded)
187
+ });
188
+ const plan = planMutationRun(planCommand);
189
+ return yield* io.write(new RunOutput({
212
190
  verdictJson: JSON.stringify({
213
191
  mutate: plan.mutatePatterns,
214
- mutators: plan.mutatorNames
192
+ mutatorNames: plan.mutatorNames
215
193
  }),
216
194
  exitCode: 0
217
- })
218
- })), Cell.write((output) => Effect.provideContext(io.write(output), services)));
219
- const runMutationTest = (io, command) => Effect.gen(function* () {
220
- const services = yield* Effect.context();
221
- return yield* Cell.apply(mutationRunDescription(io, services), command);
195
+ }));
222
196
  });
223
197
  const shouldKeepTempDir = (exit, cleanTempDir) => Exit.isFailure(exit) && cleanTempDir !== "always";
224
198
  //#endregion
225
- export { RunPhase as _, shouldKeepTempDir as a, ManifestRendered as c, MutantTested as d, OutputMode as f, RunFailed as g, RunEvent as h, runMutationTest as i, ModeSignal as l, PlanKnown as m, RunIdentity as n, Heartbeat as o, PhaseEntered as p, Run_exports as r, HelpRendered as s, RunEvents as t, MutantStatus as u, RunStarted as v, VerdictReached as y };
199
+ export { RunFailed as _, runMutationTest as a, VerdictReached as b, HelpRendered as c, MutantStatus as d, MutantTested as f, RunEvent as g, PlanKnown as h, planMutationRun as i, ManifestRendered as l, PhaseEntered as m, RunIdentity as n, shouldKeepTempDir as o, OutputMode as p, Run_exports as r, Heartbeat as s, RunEvents as t, ModeSignal as u, RunPhase as v, RunStarted as y };
@@ -1,9 +1,8 @@
1
1
  import * as Context from "effect/Context";
2
2
  import * as S from "effect/Schema";
3
3
  import * as Effect from "effect/Effect";
4
- import { Wire, Workflow } from "@systemfsoftware/effect-cell-types";
5
4
  import * as Exit from "effect/Exit";
6
- import "effect/Result";
5
+ import { Wire } from "@systemfsoftware/effect-cell-types";
7
6
  import * as Cause from "effect/Cause";
8
7
  import * as Queue from "effect/Queue";
9
8
  //#region src/Run.schema.d.ts
@@ -146,26 +145,23 @@ declare const RunOutput_base: S.Class<RunOutput, S.TaggedStruct<"RunOutput", {
146
145
  readonly exitCode: S.Finite;
147
146
  }>, {}>;
148
147
  declare class RunOutput extends RunOutput_base {}
149
- //#endregion
150
- //#region src/Run.workflow.d.ts
151
- declare const PlanMutationRunError_base: S.Class<PlanMutationRunError, S.TaggedStruct<"PlanMutationRunError", {
152
- readonly message: S.String;
153
- readonly detail: S.String;
154
- }>, import("effect/Cause").YieldableError>;
155
- declare class PlanMutationRunError extends PlanMutationRunError_base {}
148
+ declare const PlanMutationRunCommand_base: S.Class<PlanMutationRunCommand, S.TaggedStruct<"PlanMutationRunCommand", {
149
+ readonly configMutatePatterns: S.$Array<S.String & Wire.Mark> & Wire.Mark;
150
+ readonly configMutatorNames: S.$Array<S.String & Wire.Mark> & Wire.Mark;
151
+ readonly targetMutatePatterns: S.$Array<S.String & Wire.Mark> & Wire.Mark;
152
+ readonly availableMutators: S.$Array<S.String & Wire.Mark> & Wire.Mark;
153
+ }>, {}>;
154
+ declare class PlanMutationRunCommand extends PlanMutationRunCommand_base {}
155
+ declare const MutationRunPlan_base: S.Class<MutationRunPlan, S.TaggedStruct<"MutationRunPlan", {
156
+ readonly mutatePatterns: S.$Array<S.String & Wire.Mark> & Wire.Mark;
157
+ readonly mutatorNames: S.$Array<S.String & Wire.Mark> & Wire.Mark;
158
+ }>, {}>;
159
+ declare class MutationRunPlan extends MutationRunPlan_base {}
156
160
  declare namespace Run_d_exports {
157
- export { Heartbeat, HelpRendered, Location, ManifestRendered, ModeSignal, MutantStatus, MutantTested, MutationRunIo, OutputMode, PhaseEntered, PlanKnown, Position, RunEvent, RunEvent as RunEventType, RunEvents, RunFailed, RunIdentity, RunIdentityShape, RunPhase, RunStarted, RunTerminalEvent, VerdictReached, runMutationTest, shouldKeepTempDir };
161
+ export { Heartbeat, HelpRendered, Location, ManifestRendered, ModeSignal, MutantStatus, MutantTested, MutationRunIo, OutputMode, PhaseEntered, PlanKnown, Position, RunEvent, RunEvent as RunEventType, RunEvents, RunFailed, RunIdentity, RunIdentityShape, RunPhase, RunStarted, RunTerminalEvent, VerdictReached, planMutationRun, runMutationTest, shouldKeepTempDir };
158
162
  }
163
+ declare const planMutationRun: (command: PlanMutationRunCommand) => MutationRunPlan;
159
164
  declare const RunEvents_base: Context.ServiceClass<RunEvents, "~@systemfsoftware/stryker-js/RunEvents", Queue.Queue<Heartbeat | HelpRendered | ManifestRendered | MutantTested | PhaseEntered | PlanKnown | RunFailed | RunStarted | VerdictReached, Cause.Done<void>>>;
160
- /**
161
- * Where a run's events go.
162
- *
163
- * The error channel carries `Cause.Done`, the graceful completion signal: a finished run
164
- * ends the queue, and `Stream.fromQueue` excludes `Done` from its own error channel, so the
165
- * consumer sees end-of-stream. Interrupting the queue instead would end it with an
166
- * interrupt cause, and joining the drain would then re-raise that into the caller and lose
167
- * the exit code the run had already decided.
168
- */
169
165
  declare class RunEvents extends RunEvents_base {}
170
166
  interface RunIdentityShape {
171
167
  readonly runId: string;
@@ -178,6 +174,6 @@ interface MutationRunIo {
178
174
  readonly write: (output: RunOutput) => Effect.Effect<void, S.SchemaError, RunIdentity>;
179
175
  }
180
176
  declare const runMutationTest: (io: MutationRunIo, command: RunCommand) => Effect.Effect<void, S.SchemaError, RunIdentity>;
181
- declare const shouldKeepTempDir: (exit: Exit.Exit<void, PlanMutationRunError | S.SchemaError>, cleanTempDir: 'always' | boolean) => boolean;
177
+ declare const shouldKeepTempDir: (exit: Exit.Exit<void, unknown>, cleanTempDir: 'always' | boolean) => boolean;
182
178
  //#endregion
183
- export { RunTerminalEvent as C, RunStarted as S, PlanKnown as _, Run_d_exports as a, RunFailed as b, Heartbeat as c, ManifestRendered as d, ModeSignal as f, PhaseEntered as g, OutputMode as h, RunIdentityShape as i, HelpRendered as l, MutantTested as m, RunEvents as n, runMutationTest as o, MutantStatus as p, RunIdentity as r, shouldKeepTempDir as s, MutationRunIo as t, Location as u, Position as v, VerdictReached as w, RunPhase as x, RunEvent as y };
179
+ export { RunStarted as C, RunPhase as S, VerdictReached as T, PhaseEntered as _, Run_d_exports as a, RunEvent as b, shouldKeepTempDir as c, Location as d, ManifestRendered as f, OutputMode as g, MutantTested as h, RunIdentityShape as i, Heartbeat as l, MutantStatus as m, RunEvents as n, planMutationRun as o, ModeSignal as p, RunIdentity as r, runMutationTest as s, MutationRunIo as t, HelpRendered as u, PlanKnown as v, RunTerminalEvent as w, RunFailed as x, Position as y };
package/dist/Run.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { C as RunTerminalEvent, S as RunStarted, _ as PlanKnown, b as RunFailed, c as Heartbeat, d as ManifestRendered, f as ModeSignal, g as PhaseEntered, h as OutputMode, i as RunIdentityShape, l as HelpRendered, m as MutantTested, n as RunEvents, o as runMutationTest, p as MutantStatus, r as RunIdentity, s as shouldKeepTempDir, t as MutationRunIo, u as Location, v as Position, w as VerdictReached, x as RunPhase, y as RunEvent } from "./Run-BudLsVwF.mjs";
2
- export { Heartbeat, HelpRendered, type Location, ManifestRendered, ModeSignal, MutantStatus, MutantTested, MutationRunIo, OutputMode, PhaseEntered, PlanKnown, type Position, RunEvent, type RunEvent as RunEventType, RunEvents, RunFailed, RunIdentity, RunIdentityShape, RunPhase, RunStarted, type RunTerminalEvent, VerdictReached, runMutationTest, shouldKeepTempDir };
1
+ import { C as RunStarted, S as RunPhase, T as VerdictReached, _ as PhaseEntered, b as RunEvent, c as shouldKeepTempDir, d as Location, f as ManifestRendered, g as OutputMode, h as MutantTested, i as RunIdentityShape, l as Heartbeat, m as MutantStatus, n as RunEvents, o as planMutationRun, p as ModeSignal, r as RunIdentity, s as runMutationTest, t as MutationRunIo, u as HelpRendered, v as PlanKnown, w as RunTerminalEvent, x as RunFailed, y as Position } from "./Run-BnmGGgWj.mjs";
2
+ export { Heartbeat, HelpRendered, type Location, ManifestRendered, ModeSignal, MutantStatus, MutantTested, MutationRunIo, OutputMode, PhaseEntered, PlanKnown, type Position, RunEvent, type RunEvent as RunEventType, RunEvents, RunFailed, RunIdentity, RunIdentityShape, RunPhase, RunStarted, type RunTerminalEvent, VerdictReached, planMutationRun, runMutationTest, shouldKeepTempDir };
package/dist/Run.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as RunPhase, a as shouldKeepTempDir, c as ManifestRendered, d as MutantTested, f as OutputMode, g as RunFailed, h as RunEvent, i as runMutationTest, l as ModeSignal, m as PlanKnown, n as RunIdentity, o as Heartbeat, p as PhaseEntered, s as HelpRendered, t as RunEvents, u as MutantStatus, v as RunStarted, y as VerdictReached } from "./Run-lXratlN7.mjs";
2
- export { Heartbeat, HelpRendered, ManifestRendered, ModeSignal, MutantStatus, MutantTested, OutputMode, PhaseEntered, PlanKnown, RunEvent, RunEvents, RunFailed, RunIdentity, RunPhase, RunStarted, VerdictReached, runMutationTest, shouldKeepTempDir };
1
+ import { _ as RunFailed, a as runMutationTest, b as VerdictReached, c as HelpRendered, d as MutantStatus, f as MutantTested, g as RunEvent, h as PlanKnown, i as planMutationRun, l as ManifestRendered, m as PhaseEntered, n as RunIdentity, o as shouldKeepTempDir, p as OutputMode, s as Heartbeat, t as RunEvents, u as ModeSignal, v as RunPhase, y as RunStarted } from "./Run-BcDo-hIC.mjs";
2
+ export { Heartbeat, HelpRendered, ManifestRendered, ModeSignal, MutantStatus, MutantTested, OutputMode, PhaseEntered, PlanKnown, RunEvent, RunEvents, RunFailed, RunIdentity, RunPhase, RunStarted, VerdictReached, planMutationRun, runMutationTest, shouldKeepTempDir };
@@ -103,12 +103,14 @@ const WarningOptions = openStruct({
103
103
  unserializableOptions: defaulted(Wire.mint(S.Boolean), true),
104
104
  slow: defaulted(Wire.mint(S.Boolean), true)
105
105
  });
106
+ const ConcurrencyCount = Wire.mint(Wire.mint(S.Finite).pipe(S.check(S.isGreaterThanOrEqualTo(1))));
107
+ const ConcurrencyPercent = Wire.mint(Wire.mint(S.String).pipe(S.check(S.isPattern(/^(100|[1-9]?[0-9])%$/))));
106
108
  const StrykerOptionsSchema = S.StructWithRest(S.Struct({
107
109
  allowConsoleColors: defaulted(Wire.mint(S.Boolean), true),
108
110
  buildCommand: S.optional(Wire.mint(S.String)),
109
111
  checkers: defaulted(Wire.mint(S.Array(Wire.mint(S.String))), []),
110
112
  checkerNodeArgs: defaulted(Wire.mint(S.Array(Wire.mint(S.String))), []),
111
- concurrency: S.optional(Wire.mint(S.Union([Wire.mint(Wire.mint(S.Finite).pipe(S.check(S.isGreaterThanOrEqualTo(1)))), Wire.mint(Wire.mint(S.String).pipe(S.check(S.isPattern(/^(100|[1-9]?[0-9])%$/))))]))),
113
+ concurrency: S.optional(Wire.mint(S.Union([ConcurrencyCount, ConcurrencyPercent]))),
112
114
  commandRunner: defaulted(CommandRunnerOptionsSchema, { command: "npm test" }),
113
115
  coverageAnalysis: defaulted(CoverageAnalysisMode, RENDERED_OPTION_DEFAULTS$1.coverageAnalysis),
114
116
  clearTextReporter: defaulted(ClearTextReporterOptions, {
package/dist/Schema.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as strykerReportBugUrl, c as PackageManager, i as strykerCoreSchema, l as ReportType, o as CoverageAnalysisMode, r as propertyPath, s as LogLevel, t as RENDERED_OPTION_DEFAULTS, u as StrykerOptionsSchema } from "./Schema-BAKDG_jC.mjs";
1
+ import { a as strykerReportBugUrl, c as PackageManager, i as strykerCoreSchema, l as ReportType, o as CoverageAnalysisMode, r as propertyPath, s as LogLevel, t as RENDERED_OPTION_DEFAULTS, u as StrykerOptionsSchema } from "./Schema-CdNkubPi.mjs";
2
2
  export { CoverageAnalysisMode, LogLevel, PackageManager, RENDERED_OPTION_DEFAULTS, ReportType, StrykerOptionsSchema, propertyPath, strykerCoreSchema, strykerReportBugUrl };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { i as Checker_d_exports } from "./Checker-DYgIIEai.mjs";
2
2
  import { Z as TestRunner_d_exports, v as Mutant_d_exports } from "./Mutant-BPRJTF8f.mjs";
3
3
  import { r as Ignorer_d_exports } from "./Ignorer-BUY68FZQ.mjs";
4
- import { s as Plugin_d_exports } from "./Plugin-HR2dbiT7.mjs";
4
+ import { s as Plugin_d_exports } from "./Plugin-DcDAIBQi.mjs";
5
5
  import { u as Reporter_d_exports } from "./Reporter-eZ3M7lO6.mjs";
6
- import { a as Run_d_exports } from "./Run-BudLsVwF.mjs";
6
+ import { a as Run_d_exports } from "./Run-BnmGGgWj.mjs";
7
7
  import { a as Schema_d_exports } from "./Schema-CXKiLnTu.mjs";
8
8
  export { Checker_d_exports as Checker, Ignorer_d_exports as Ignorer, Mutant_d_exports as Mutant, Plugin_d_exports as Plugin, Reporter_d_exports as Reporter, Run_d_exports as Run, Schema_d_exports as Schema, TestRunner_d_exports as TestRunner };
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { t as Ignorer_exports } from "./Ignorer.mjs";
3
3
  import { t as Mutant_exports } from "./Mutant.mjs";
4
4
  import { t as Plugin_exports } from "./Plugin-Ceh1G8Dz.mjs";
5
5
  import { n as Reporter_exports } from "./Reporter-COVWW1my.mjs";
6
- import { r as Run_exports } from "./Run-lXratlN7.mjs";
7
- import { n as Schema_exports } from "./Schema-BAKDG_jC.mjs";
6
+ import { r as Run_exports } from "./Run-BcDo-hIC.mjs";
7
+ import { n as Schema_exports } from "./Schema-CdNkubPi.mjs";
8
8
  import { n as TestRunner_exports } from "./TestRunner-DC9U8Unb.mjs";
9
9
  export { Checker_exports as Checker, Ignorer_exports as Ignorer, Mutant_exports as Mutant, Plugin_exports as Plugin, Reporter_exports as Reporter, Run_exports as Run, Schema_exports as Schema, TestRunner_exports as TestRunner };
@@ -1,4 +1,4 @@
1
- import { c as RunConfiguration } from "./Plugin-HR2dbiT7.mjs";
1
+ import { c as RunConfiguration } from "./Plugin-DcDAIBQi.mjs";
2
2
  //#region src/provided-options.d.ts
3
3
  /**
4
4
  * The run's options exactly as the `RunConfiguration` service hands them over.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js",
3
- "version": "0.2.0",
3
+ "version": "2.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
7
- "directory": "packages/testing/mutation/stryker-js/stryker-js"
7
+ "directory": "packages/stryker-js/stryker-js"
8
8
  },
9
- "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/stryker-js#readme",
9
+ "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js#readme",
10
10
  "bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
11
11
  "description": "The mutation-testing language — concept modules, no platform.",
12
12
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "effect": "^4.0.0-rc.112",
22
22
  "mutation-testing-report-schema": "3.7.3",
23
- "@systemfsoftware/effect-cell-types": "^5.0.2"
23
+ "@systemfsoftware/effect-cell-types": "^6.0.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
@@ -31,11 +31,11 @@
31
31
  "tsdown": "^0.22.14",
32
32
  "typescript": "^7",
33
33
  "vitest": "^4",
34
- "@systemfsoftware/effect-schema-law": "^2.0.1",
35
- "@systemfsoftware/effect-schema-vite": "^2.0.2",
36
- "@systemfsoftware/vitest-config": "^0.1.0",
34
+ "@systemfsoftware/all": "^1.1.3",
35
+ "@systemfsoftware/effect-schema-vite": "^2.0.3",
37
36
  "@systemfsoftware/tsconfig": "^1.3.3",
38
- "@systemfsoftware/all": "^1.1.0"
37
+ "@systemfsoftware/vitest-config": "^0.1.0",
38
+ "@systemfsoftware/effect-schema-law": "^2.0.2"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public",
@@ -1,6 +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
- //#endregion
6
- export { ExitClass as t };