@systemfsoftware/stryker-js 16.0.0 → 17.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.
@@ -1,4 +1,4 @@
1
- import { i as mod_d_exports$5 } from "./index-DEphx668.mjs";
1
+ import { i as mod_d_exports$5 } from "./index-y-Pg3XgT.mjs";
2
2
  import * as S from "effect/Schema";
3
3
  //#region src/config/stryker-config.schema.d.ts
4
4
  type StrykerConfig = mod_d_exports$5.PartialStrykerOptions;
@@ -1032,6 +1032,9 @@ const MutantRunResultSchema = S.Union([
1032
1032
  errorMessage: S.String
1033
1033
  })
1034
1034
  ]);
1035
+ var MutantRunStarted = class extends S.TaggedClass()("MutantRunStarted", {}) {};
1036
+ var MutantRunSettled = class extends S.TaggedClass()("MutantRunSettled", { result: MutantRunResultSchema }) {};
1037
+ const MutantRunEventSchema = S.Union([MutantRunStarted, MutantRunSettled]);
1035
1038
  const CoverageAnalysisSchema = S.Literals([
1036
1039
  "off",
1037
1040
  "all",
@@ -1247,8 +1250,9 @@ const dryRun = Rpc.make("dryRun", {
1247
1250
  }).middleware(TraceContextMiddleware);
1248
1251
  const mutantRun = Rpc.make("mutantRun", {
1249
1252
  payload: TestRunnerMutantRunRequest,
1250
- success: MutantRunResultSchema,
1251
- error: TestRunnerFailed
1253
+ success: MutantRunEventSchema,
1254
+ error: TestRunnerFailed,
1255
+ stream: true
1252
1256
  }).middleware(TraceContextMiddleware);
1253
1257
  const check = Rpc.make("check", {
1254
1258
  payload: CheckerRequest,
@@ -1399,7 +1403,10 @@ var TestRunner_exports = /* @__PURE__ */ __exportAll({
1399
1403
  HitLimitReason: () => HitLimitReason,
1400
1404
  HitLimitReasonPrefix: () => HitLimitReasonPrefix,
1401
1405
  HitLimitReasonText: () => HitLimitReasonText,
1406
+ MutantRunEventSchema: () => MutantRunEventSchema,
1402
1407
  MutantRunResultSchema: () => MutantRunResultSchema,
1408
+ MutantRunSettled: () => MutantRunSettled,
1409
+ MutantRunStarted: () => MutantRunStarted,
1403
1410
  MutantRunStatus: () => MutantRunStatus,
1404
1411
  TestId: () => TestId,
1405
1412
  TestResultSchema: () => TestResultSchema,
@@ -1,5 +1,5 @@
1
- import { i as mod_d_exports$5 } from "./index-DEphx668.mjs";
2
- import { l as MutationTestDone } from "./RunEnvironment.service-F8LgeCqh.mjs";
1
+ import { i as mod_d_exports$5 } from "./index-y-Pg3XgT.mjs";
2
+ import { l as MutationTestDone } from "./RunEnvironment.service-Cluh-Bxt.mjs";
3
3
  //#region src/drivers/promise.d.ts
4
4
  export declare const run: ((targetMutatePatterns?: readonly string[]) => (options: mod_d_exports$5.PartialStrykerOptions) => Promise<MutationTestDone>) & ((options: mod_d_exports$5.PartialStrykerOptions, targetMutatePatterns?: readonly string[]) => Promise<MutationTestDone>);
5
5
  //#endregion
package/dist/promises.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as nodePlatformLayer, t as strykerCell } from "./run-stages-k4L7ymmp.mjs";
1
+ import { C as nodePlatformLayer, t as strykerCell } from "./run-stages-B5YfftjV.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { dual } from "effect/Function";
4
4
  //#region src/drivers/promise.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll$4 } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { a as MutatorCatalog_exports, c as Plugin_exports, d as TestRunner_exports, f as Trace_exports$1, i as Mutant_exports, l as Report_exports, n as mergeConfigs, o as MutatorProvider_exports, r as Checker_exports, s as Options_exports, t as mergeConfig, u as Reporter_exports } from "./merge-config-BYhhPA7r.mjs";
2
+ import { a as MutatorCatalog_exports, c as Plugin_exports, d as TestRunner_exports, f as Trace_exports$1, i as Mutant_exports, l as Report_exports, n as mergeConfigs, o as MutatorProvider_exports, r as Checker_exports, s as Options_exports, t as mergeConfig, u as Reporter_exports } from "./merge-config-ruui2TPS.mjs";
3
3
  import { n as StageError, t as PrepareError } from "./Run.schema-DuaneDGd.mjs";
4
4
  import { Blueprint, Cell, Handle, Sandwich, Workflow } from "@systemfsoftware/effect-cell-types";
5
5
  import * as S from "effect/Schema";
@@ -2154,6 +2154,13 @@ const createDefaultOptions = S.decodeEffect(Options_exports.StrykerOptionsSchema
2154
2154
  const defaultOptions = Effect$1.map(createDefaultOptions, (options) => deepFreeze(options));
2155
2155
  //#endregion
2156
2156
  //#region src/ConfigError.schema.ts
2157
+ const CAUSE_DEPTH = 4;
2158
+ const ownMessageOf = (value) => Option$1.filter(Option$1.map(Option$1.liftPredicate(value, Predicate$1.hasProperty("message")), (carrier) => String(carrier.message)), S.is(S.NonEmptyString));
2159
+ const causeMessagesOf = (value, depth) => depth === 0 ? [] : [...Option$1.toArray(ownMessageOf(value)), ...Option$1.match(Option$1.liftPredicate(value, Predicate$1.hasProperty("cause")), {
2160
+ onNone: () => [],
2161
+ onSome: (carrier) => causeMessagesOf(carrier.cause, depth - 1)
2162
+ })];
2163
+ const causeTextOf$1 = (cause) => Option$1.liftPredicate(causeMessagesOf(cause, CAUSE_DEPTH).join(": "), S.is(S.NonEmptyString));
2157
2164
  var ConfigFileNotFoundError = class extends S.TaggedError()("ConfigFileNotFoundError", { file: S.String }) {
2158
2165
  exitClass = "ConfigError";
2159
2166
  get message() {
@@ -2175,7 +2182,10 @@ var ConfigFileUnreadableError = class extends S.TaggedError()("ConfigFileUnreada
2175
2182
  }) {
2176
2183
  exitClass = "ConfigError";
2177
2184
  get message() {
2178
- return `Config file is unreadable: ${this.file}`;
2185
+ return Option$1.match(causeTextOf$1(this.cause), {
2186
+ onNone: () => `Config file is unreadable: ${this.file}`,
2187
+ onSome: (cause) => `Config file is unreadable: ${this.file}: ${cause}`
2188
+ });
2179
2189
  }
2180
2190
  };
2181
2191
  var ConfigFileInvalidError = class extends S.TaggedError()("ConfigFileInvalidError", {
@@ -11336,7 +11346,7 @@ const strykerOutputFilesOf = (options) => [
11336
11346
  ];
11337
11347
  //#endregion
11338
11348
  //#region package.json
11339
- var version = "16.0.0";
11349
+ var version = "17.0.0";
11340
11350
  //#endregion
11341
11351
  //#region src/stryker-package.schema.ts
11342
11352
  var StrykerPackage = class extends S.Class("StrykerPackage")({
@@ -11825,7 +11835,7 @@ const writeIncrementalReport = Effect$1.fn(SpanTaxonomy_exports.Spans.mutationRe
11825
11835
  const runInputsDigest = yield* runInputsDigestOf(deps.fs, deps.path, input.basePath, input.options);
11826
11836
  const json = yield* S.encodeEffect(S.fromJsonString(S.Unknown, { space: 2 }))({
11827
11837
  incrementalVersion: "3",
11828
- verdictSemanticsVersion: 3,
11838
+ verdictSemanticsVersion: 4,
11829
11839
  mutantSetPolicy: input.options.mutator.mutantSetPolicy,
11830
11840
  runInputsDigest,
11831
11841
  ...report,
@@ -11875,7 +11885,7 @@ const slimIncrementalReport = Effect$1.fn(SpanTaxonomy_exports.Spans.mutationRep
11875
11885
  const runInputsDigest = yield* runInputsDigestOf(deps.fs, deps.path, input.basePath, input.options);
11876
11886
  return {
11877
11887
  incrementalVersion: "3",
11878
- verdictSemanticsVersion: 3,
11888
+ verdictSemanticsVersion: 4,
11879
11889
  mutantSetPolicy: input.options.mutator.mutantSetPolicy,
11880
11890
  runInputsDigest,
11881
11891
  schemaVersion: Report_exports.WrittenSchemaVersion.literal,
@@ -14863,7 +14873,7 @@ const readProject = Effect$1.fn(SpanTaxonomy_exports.Spans.projectReadFromDisk.n
14863
14873
  _tag: "AdmitIncrementalReportCommand",
14864
14874
  report: reportRead.report,
14865
14875
  expectedIncrementalVersion: "3",
14866
- verdictSemanticsVersion: 3,
14876
+ verdictSemanticsVersion: 4,
14867
14877
  mutantSetPolicy: options.mutator.mutantSetPolicy,
14868
14878
  runInputsDigest,
14869
14879
  options,
@@ -15916,6 +15926,43 @@ const make$1 = (runner) => PooledTestRunner.make({
15916
15926
  dryRun: runner.dryRun,
15917
15927
  mutantRun: runner.mutantRun
15918
15928
  });
15929
+ const wallClockTimeoutResult = {
15930
+ status: "timeout",
15931
+ reason: TestRunner_exports.WallClockTimeoutReason.literal
15932
+ };
15933
+ const endedWithoutResult = () => TestRunner_exports.TestRunnerFailed.make({
15934
+ runnerName: "test runner",
15935
+ phase: "mutantRun",
15936
+ cause: "the mutant run ended without reporting a result"
15937
+ });
15938
+ const deadlineArmedMutantRun = dual(2, (events, timeoutMs) => Effect$1.scoped(Effect$1.gen(function* () {
15939
+ const started = yield* Deferred.make();
15940
+ const settled = yield* Deferred.make();
15941
+ const pump = events.pipe(Stream.runForEach((event) => Match$1.value(event).pipe(Match$1.tag("MutantRunStarted", () => Deferred.succeed(started, void 0)), Match$1.tag("MutantRunSettled", ({ result }) => Deferred.succeed(settled, result)), Match$1.exhaustive, Effect$1.asVoid)), Effect$1.onExit((exit) => Exit.match(exit, {
15942
+ onFailure: (cause) => Deferred.failCause(settled, cause),
15943
+ onSuccess: () => Deferred.fail(settled, endedWithoutResult())
15944
+ }).pipe(Effect$1.asVoid)));
15945
+ yield* Effect$1.forkScoped(pump);
15946
+ const deadline = Effect$1.raceFirst(Deferred.await(started).pipe(Effect$1.as(true)), Deferred.await(settled).pipe(Effect$1.as(false))).pipe(Effect$1.timeoutOption(WORKER_BOOT_TIMEOUT), Effect$1.flatMap(Option$1.match({
15947
+ onNone: () => Effect$1.succeed(wallClockTimeoutResult),
15948
+ onSome: (began) => began ? Effect$1.sleep(Duration.millis(timeoutMs)).pipe(Effect$1.as(wallClockTimeoutResult)) : Deferred.await(settled)
15949
+ })));
15950
+ return yield* Effect$1.raceFirst(deadline, Deferred.await(settled));
15951
+ })));
15952
+ /**
15953
+ * The dry run keeps the configured absolute budget. A mutant run is bounded from
15954
+ * its own start by {@link deadlineArmedMutantRun}, so it is not wrapped here.
15955
+ */
15956
+ const withDryRunTimeout = (inner) => make$1({
15957
+ ...inner,
15958
+ dryRun: (options) => inner.dryRun(options).pipe(Effect$1.timeoutOrElse({
15959
+ duration: Duration.millis(options.timeout),
15960
+ orElse: () => Effect$1.succeed({
15961
+ status: "timeout",
15962
+ reason: TestRunner_exports.WallClockTimeoutReason.literal
15963
+ })
15964
+ }))
15965
+ });
15919
15966
  const withTimeout = (inner) => make$1({
15920
15967
  ...inner,
15921
15968
  dryRun: (options) => inner.dryRun(options).pipe(Effect$1.timeoutOrElse({
@@ -16138,7 +16185,7 @@ const scopedOf = Effect$1.fnUntraced(function* (params) {
16138
16185
  capabilities: client.capabilities().pipe(Effect$1.mapError(toRunnerFailure(runnerName, "capabilities"))),
16139
16186
  init: Effect$1.void,
16140
16187
  dryRun: (options) => client.dryRun({ options }).pipe(Effect$1.mapError(toRunnerFailure(runnerName, "dryRun"))),
16141
- mutantRun: (options) => client.mutantRun({ options }).pipe(Effect$1.mapError(toRunnerFailure(runnerName, "mutantRun")))
16188
+ mutantRun: (options) => deadlineArmedMutantRun(client.mutantRun({ options }).pipe(Stream.mapError(toRunnerFailure(runnerName, "mutantRun"))), options.timeout)
16142
16189
  });
16143
16190
  });
16144
16191
  const TestRunners = Blueprint.make()(TypeId$5).steps({
@@ -16150,7 +16197,7 @@ const commandRunnerEffect = (context) => ChildProcessSpawner.ChildProcessSpawner
16150
16197
  const inProcessRunner = (context) => Match$1.value(context.options.testRunner).pipe(Match$1.when(isCommandRunner, () => Option$1.some(commandRunnerEffect(context))), Match$1.orElse(() => Option$1.none()));
16151
16198
  const decorateChildRunner = Effect$1.fnUntraced(function* (context, childProcessRunner) {
16152
16199
  const base = yield* childProcessRunner;
16153
- const timed = withTimeout(base);
16200
+ const timed = withDryRunTimeout(base);
16154
16201
  const limited = yield* withMaxReuse(context.options, context.retire)(timed);
16155
16202
  const reloading = yield* withEnvironmentReload(context.retire)(limited);
16156
16203
  return withRetry(reloading);
@@ -18152,7 +18199,7 @@ const readIncrementalReuseCommand = Effect$1.fn(SpanTaxonomy_exports.Spans.incre
18152
18199
  previousRecords: [...previousRecords],
18153
18200
  closureDigestsByMutantId: closures.digests,
18154
18201
  closureAnalysisFailed: closures.failed,
18155
- verdictSemanticsVersion: 3,
18202
+ verdictSemanticsVersion: 4,
18156
18203
  mutantSetPolicy: input.options.mutator.mutantSetPolicy,
18157
18204
  runInputsDigest,
18158
18205
  force: input.force,
@@ -20349,7 +20396,7 @@ const prepareCell = Sandwich.named(SpanTaxonomy_exports.Spans.prepare.name)(read
20349
20396
  });
20350
20397
  //#endregion
20351
20398
  //#region src/run/run-stages.cell.ts
20352
- const configReadReasonOf = (cause) => Match$1.value(cause).pipe(Match$1.tag("ConfigError", (refused) => refused.message), Match$1.orElse(() => "Failed to read config"));
20399
+ const configReadReasonOf = (cause) => cause.message;
20353
20400
  const mutationTestCell = Cell.andThen(Cell.andThen(Cell.andThen(Cell.andThen(Cell.mapError(loadConfigCell, (cause) => StageError.make({
20354
20401
  stage: "prepare",
20355
20402
  reason: configReadReasonOf(cause),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js",
3
- "version": "16.0.0",
3
+ "version": "17.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
@@ -33,18 +33,18 @@
33
33
  "@opentelemetry/sdk-metrics": "^2.11.0",
34
34
  "@opentelemetry/sdk-trace-base": "^2.2.0",
35
35
  "@systemfsoftware/effect-cell-types": "^12.0.0",
36
- "@systemfsoftware/stryker-js-vm-runner": "npm:@systemfsoftware/stryker-js-vitest-runner@^8.1.0"
36
+ "@systemfsoftware/stryker-js-vm-runner": "npm:@systemfsoftware/stryker-js-vitest-runner@^8.1.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "effect": "^4.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@effect/tsgo": "^0.47.2",
42
+ "@effect/tsgo": "^0.48.0",
43
43
  "@microsoft/api-extractor": "^7",
44
44
  "@oxc-parser/binding-wasm32-wasi": "^0.150.0",
45
45
  "@std/jsonc": "npm:@jsr/std__jsonc@^1",
46
46
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
47
- "@systemfsoftware/differential-spec": "^1.0.0",
47
+ "@systemfsoftware/differential-spec": "^1.0.1",
48
48
  "@systemfsoftware/effect-gherkin-spec": "^7.0.0",
49
49
  "@systemfsoftware/effect-schema-law": "^5.0.0",
50
50
  "@systemfsoftware/oxlint-config-recommended": "^4.0.0",
@@ -54,7 +54,7 @@
54
54
  "@systemfsoftware/stryker-js-typescript-checker": "latest",
55
55
  "@systemfsoftware/stryker-js-vitest-runner": "latest",
56
56
  "@systemfsoftware/tsconfig": "^2.0.1",
57
- "@systemfsoftware/vitest": "^1.0.0",
57
+ "@systemfsoftware/vitest": "^2.0.0",
58
58
  "@types/node": "^24",
59
59
  "@vitest/browser-playwright": "^5",
60
60
  "@vitest/coverage-v8": "^5",
@@ -72,14 +72,14 @@
72
72
  "vitest": "^5",
73
73
  "@systemfsoftware/stryker-config": "^0.1.0",
74
74
  "@systemfsoftware/stryker-framework-interface": "^0.0.0",
75
- "@systemfsoftware/stryker-js-cli-contract": "^0.3.0",
76
75
  "@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
77
- "@systemfsoftware/stryker-js-html-reporter": "^6.0.1",
78
- "@systemfsoftware/stryker-js-instrumenter": "^12.1.0",
79
- "@systemfsoftware/stryker-js-plugin-runtime": "^7.0.1",
80
- "@systemfsoftware/stryker-js-plugin-interface": "^13.0.0",
81
- "@systemfsoftware/tsdown-config": "^0.1.0",
82
- "@systemfsoftware/vitest-config": "^0.1.0"
76
+ "@systemfsoftware/stryker-js-html-reporter": "^6.0.2",
77
+ "@systemfsoftware/stryker-js-plugin-runtime": "^7.0.2",
78
+ "@systemfsoftware/stryker-js-plugin-interface": "^14.0.0",
79
+ "@systemfsoftware/stryker-js-instrumenter": "^12.1.1",
80
+ "@systemfsoftware/stryker-js-cli-contract": "^0.3.1",
81
+ "@systemfsoftware/vitest-config": "^0.1.0",
82
+ "@systemfsoftware/tsdown-config": "^0.1.0"
83
83
  },
84
84
  "publishConfig": {
85
85
  "access": "public",