@systemfsoftware/stryker-js-typescript-checker 3.0.0 → 3.0.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.mjs +47 -22
  3. package/package.json +10 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @systemfsoftware/stryker-js-typescript-checker
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Re-published against the oxc-based instrumenter: workspace dependency ranges move to the new instrumenter major; no package's own behavior changes in this release.
8
+
9
+ ## 3.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - When two or more mutants in one TypeScript project file produce a compiler error that cannot be blamed on exactly one of them, `check` now rechecks each mutant alone. A mutant that typechecks by itself is reported `passed`. A mutant that fails typecheck by itself is reported `compileError`.
14
+
15
+ - Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
16
+
3
17
  ## 3.0.0
4
18
 
5
19
  ### Major Changes
package/dist/index.mjs CHANGED
@@ -59,8 +59,8 @@ var CompilerFailed = class extends S.TaggedError()("CompilerFailed", {
59
59
  * Checker — pure check decision.
60
60
  *
61
61
  * `Workflow.make` lives here and only here. The workflow receives a fully
62
- * decoded input (mutants + diagnostics + file graph) and produces the
63
- * pass/compileError map without touching I/O.
62
+ * decoded input (mutants + diagnostics + file graph) and produces results plus
63
+ * `needsRetest` without touching I/O.
64
64
  */
65
65
  var DiagnosticWithoutFileError = class extends S.TaggedError()("DiagnosticWithoutFileError", { text: Wire.mint(S.String) }) {};
66
66
  var DiagnosticInUnrelatedFileError = class extends S.TaggedError()("DiagnosticInUnrelatedFileError", {
@@ -131,22 +131,37 @@ const buildResult = (input) => {
131
131
  const mutants = input.mutants;
132
132
  const diagnostics = input.diagnostics;
133
133
  const nodes = input.nodes;
134
- const result = {};
135
- for (const m of mutants) result[m.id] = { status: "passed" };
136
- if (mutants.length === 0) return Result$1.succeed(result);
134
+ if (mutants.length === 0) return Result$1.succeed({
135
+ results: {},
136
+ needsRetest: []
137
+ });
137
138
  const first = mutants[0];
138
- if (first === void 0 || nodes[normalizeFileName$3(first.fileName)] === void 0) return Result$1.succeed(result);
139
+ if (first === void 0 || nodes[normalizeFileName$3(first.fileName)] === void 0) {
140
+ const results = {};
141
+ for (const m of mutants) results[m.id] = { status: "passed" };
142
+ return Result$1.succeed({
143
+ results,
144
+ needsRetest: []
145
+ });
146
+ }
139
147
  const classified = classifyDiagnosticsPure(diagnostics, mutants, nodes);
140
148
  if (Result$1.isFailure(classified)) return Result$1.fail(classified.failure);
141
- const { definitive } = classified.success;
142
- for (const id of Object.keys(definitive)) {
143
- const diags = definitive[id];
144
- if (diags !== void 0) result[id] = {
149
+ const { definitive, needsRetest } = classified.success;
150
+ const retestIds = {};
151
+ for (const m of needsRetest) retestIds[m.id] = true;
152
+ const results = {};
153
+ for (const m of mutants) {
154
+ const diags = definitive[m.id];
155
+ if (diags !== void 0) results[m.id] = {
145
156
  status: "compileError",
146
157
  reason: diags.map((d) => d.text).join("\n")
147
158
  };
159
+ else if (retestIds[m.id] !== true) results[m.id] = { status: "passed" };
148
160
  }
149
- return Result$1.succeed(result);
161
+ return Result$1.succeed({
162
+ results,
163
+ needsRetest
164
+ });
150
165
  };
151
166
  const checkMutants = Workflow.make(CheckMutantsInput, (input) => buildResult(input));
152
167
  //#endregion
@@ -1135,15 +1150,7 @@ const makeCheckDescription = (compiler) => pipe(Cell.read((command) => Effect.ge
1135
1150
  mutantIds: [],
1136
1151
  cause: errorToString(failure)
1137
1152
  })),
1138
- onSuccess: (record) => {
1139
- let map = HashMap.empty();
1140
- for (const [id, value] of Object.entries(record)) if (value.status === "passed") map = HashMap.set(map, id, { status: "passed" });
1141
- else map = HashMap.set(map, id, {
1142
- status: "compileError",
1143
- reason: value.reason
1144
- });
1145
- return Effect.succeed(map);
1146
- }
1153
+ onSuccess: (decision) => Effect.succeed(decision)
1147
1154
  })));
1148
1155
  function makeCheckerService({ options, compiler }) {
1149
1156
  const formatDiagnostic = (error) => Effect.gen(function* () {
@@ -1186,9 +1193,27 @@ function makeCheckerService({ options, compiler }) {
1186
1193
  }
1187
1194
  }),
1188
1195
  check: (mutants) => Effect.gen(function* () {
1189
- const command = new CheckMutantsCommand({ mutants: [...mutants] });
1190
1196
  const description = makeCheckDescription(compiler);
1191
- return yield* Cell.apply(description, command);
1197
+ const applyOnce = (group) => Cell.apply(description, new CheckMutantsCommand({ mutants: [...group] }));
1198
+ const first = yield* applyOnce(mutants);
1199
+ let map = HashMap.empty();
1200
+ const mergeResults = (results) => {
1201
+ for (const [id, value] of Object.entries(results)) if (value.status === "passed") map = HashMap.set(map, id, { status: "passed" });
1202
+ else map = HashMap.set(map, id, {
1203
+ status: "compileError",
1204
+ reason: value.reason
1205
+ });
1206
+ };
1207
+ mergeResults(first.results);
1208
+ if (first.needsRetest.length > 0) yield* applyOnce([]);
1209
+ const originals = {};
1210
+ for (const m of mutants) originals[m.id] = m;
1211
+ for (const pending of first.needsRetest) {
1212
+ const original = originals[pending.id];
1213
+ if (original === void 0) continue;
1214
+ mergeResults((yield* applyOnce([original])).results);
1215
+ }
1216
+ return map;
1192
1217
  }),
1193
1218
  group: (mutants) => Effect.gen(function* () {
1194
1219
  const nodes = yield* compiler.nodes.pipe(Effect.mapError((cause) => new CheckerFailed({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-typescript-checker",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
@@ -22,25 +22,25 @@
22
22
  "dependencies": {
23
23
  "effect": "^4.0.0-rc.112",
24
24
  "typescript": "^7",
25
- "@systemfsoftware/stryker-js": "^0.1.0",
26
- "@systemfsoftware/effect-cell-types": "^5.0.0"
25
+ "@systemfsoftware/effect-cell-types": "^5.0.2",
26
+ "@systemfsoftware/stryker-js": "^0.1.1"
27
27
  },
28
28
  "devDependencies": {
29
+ "@effect/platform-node-shared": "^4.0.0-rc.112",
29
30
  "@std/jsonc": "npm:@jsr/std__jsonc@^1.0.2",
30
31
  "@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
31
32
  "@types/node": "^24",
32
33
  "oxlint": "^1.77.0",
33
34
  "rimraf": "^6.1.3",
34
35
  "tsdown": "^0.22.14",
35
- "vitest": "^4.1.10",
36
- "@systemfsoftware/effect-gherkin-spec": "^2.0.1",
37
- "@systemfsoftware/effect-schema-law": "^1.0.0",
38
- "@systemfsoftware/effect-schema-refutation-vite": "^0.2.0",
36
+ "vitest": "^4",
37
+ "@systemfsoftware/all": "^1.0.2",
38
+ "@systemfsoftware/effect-gherkin-spec": "^4.0.0",
39
+ "@systemfsoftware/effect-schema-vite": "^2.0.2",
40
+ "@systemfsoftware/effect-schema-law": "^2.0.1",
39
41
  "@systemfsoftware/tsconfig": "^1.3.3",
40
- "@systemfsoftware/oxlint-config": "^0.1.0",
41
42
  "@systemfsoftware/vitest-config": "^0.1.0",
42
- "@systemfsoftware/all": "^1.0.0",
43
- "@systemfsoftware/effect-schema-vite": "^2.0.0"
43
+ "@systemfsoftware/oxlint-config": "^0.1.0"
44
44
  },
45
45
  "inlinedDependencies": {
46
46
  "@jsr/std__jsonc": "1.0.2"