@systemfsoftware/stryker-js-html-reporter 1.0.0 → 3.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,120 @@
1
1
  # @systemfsoftware/stryker-js-html-reporter
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Reporter plugins are now pull-stream consumers: a reporter exports a factory
8
+ that returns an async consumer of the four run events, instead of registering
9
+ an Effect layer that provides the `Reporter` capability service.
10
+
11
+ - Removed: `ReporterService`, `broadcastReporter`, `NamedReporter`, the
12
+ `Reporter` service class, and the legacy event payload types.
13
+ - The event protocol ships as a Standard Schema object; validate and infer it
14
+ with `import { ReporterEventSchema, type ReporterFactory, type ReporterInit }
15
+ from '@systemfsoftware/stryker-js/ReporterEvent'`.
16
+ - Event payloads are narrowed: the dry-run event no longer carries the coverage
17
+ map; the plan event carries reduced mutant descriptors instead of full run
18
+ options; `mutantTested` drops `killedBy`, `coveredBy`, `static`,
19
+ `testsCompleted` and `statusReason`, and renames `mutatorName` to `mutator`.
20
+ - `ReporterFailed.event` now names the event kind being processed instead of a
21
+ lifecycle method name; `'wrapUp'` no longer occurs.
22
+ - An unknown reporter name now fails the run at startup instead of being
23
+ silently ignored. A reporter that fails on the terminal report now fails the
24
+ run; a reporter that fails earlier is logged and detached with the exit code
25
+ unchanged.
26
+ - `@systemfsoftware/stryker-js-engine/builtin-reporters` no longer exports
27
+ `strykerPlugins`; call `makeBuiltinReporterFactories({ fileSystem, path })`.
28
+ - The built-in json and clear-text reporters write their notices directly to
29
+ stdout and stderr instead of the Effect logger, and the html reporter no
30
+ longer depends on `@effect/platform-node`.
31
+
32
+ ### Patch Changes
33
+
34
+ - Re-released against @systemfsoftware/stryker-js without the removed --llms manifest. The Run stream no longer carries a manifest terminal event, and the RunEvent / RunTerminalEvent unions no longer include the manifest arm, so any exhaustive consumer of those types must drop that case.
35
+
36
+ - Updated dependencies:
37
+ - @systemfsoftware/stryker-js@3.0.0
38
+
39
+ ## 2.0.0
40
+
41
+ ### Major Changes
42
+
43
+ - The packages are renamed. `plugin-api` is now `@systemfsoftware/stryker-js`, the
44
+ language every plugin is written against. `mutation-run` is split: the run
45
+ itself is `@systemfsoftware/stryker-js-engine`
46
+ (host-neutral, no Node on its manifest) and the Node process entries are
47
+ `@systemfsoftware/stryker-js-cli`, which owns the worker files and the runtime
48
+ gate. `mutation-report` is now `@systemfsoftware/stryker-js-html-reporter`.
49
+ `@systemfsoftware/stryker-js-platform-node` is never published — do not install
50
+ it. Install the new names and change your imports.
51
+
52
+ Options types moved. `StrykerOptions`, `PartialStrykerOptions` and `LogLevel` are
53
+ imported from the `Schema` export; `Mutant`, `MutantStatus`, `Position` and
54
+ `Location` from the `Mutant` export. Point a config's `extends` at the language
55
+ package's `Schema` export.
56
+
57
+ `MutantStatus` accepts one spelling per outcome: `Killed`, `Survived`,
58
+ `NoCoverage`, `Timeout`, `CompileError`, `RuntimeError`, `Ignored` and `Pending`.
59
+ The lowercase and abbreviated forms — `killed`, `timedOut`, `noCoverage` and the
60
+ rest — are gone. A comparison against a removed spelling never matched the value
61
+ the reporter actually produced, so check any status comparison you wrote.
62
+
63
+ Statuses, plugin kinds, exit classes and AST formats are string literal unions
64
+ rather than enums, so read them as their string values. Member access such as
65
+ `ExitClass.VerdictFail` no longer resolves.
66
+
67
+ A plugin no longer receives a logger, and the logger port is gone. Plugins log
68
+ through Effect, and the host decides where that output goes.
69
+
70
+ The bundled base preset is gone. A config inherits from the language package's
71
+ `Schema` export and states the thresholds, reporters and plugins it wants; you no
72
+ longer silently inherit a package manager, a plugin list or a break threshold.
73
+
74
+ - effect is now a required peer dependency. Install it alongside these packages. They previously bundled their own copy, which meant two Effect instances in one process and services that could not find each other across the boundary.
75
+
76
+ - Five entry points that were never API are gone. Each existed because another
77
+ package in this project found the code convenient, not because it was a surface
78
+ anyone should depend on.
79
+
80
+ What is left is documented: an entry point is a name you may import and we may
81
+ not move without a major, and everything else is internal whatever file it sits
82
+ in.
83
+
84
+ - Reporters are constructed by a factory and provided as a layer.
85
+
86
+ The exported reporter classes are gone. Replace each `new` with the matching
87
+ factory — `makeClearTextReporter`, `makeHtmlReporter`, `makeJsonReporter`,
88
+ `makeProgressBarReporter`, `makeProgressStreamReporter`.
89
+
90
+ Each factory takes the reporter's own options rather than an injected container,
91
+ and each operation returns an `Effect`. If you registered a reporter as a plugin,
92
+ declare it with `declarePlugin` and hand over a layer that provides `Reporter`.
93
+
94
+ `drawClearTextScoreTable` is now exported for anyone rendering the score table
95
+ outside a reporter.
96
+
97
+ ### Patch Changes
98
+
99
+ - New version is published through npm trusted publishing, so it carries a provenance attestation you can verify.
100
+
101
+ - Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
102
+
103
+ - A mutation run writes the JSON report the `json` reporter is configured to produce.
104
+
105
+ Vitest no longer reprints its full summary for every mutant.
106
+
107
+ - Each of these packages now has a README, so its registry page says what the package is, how
108
+ to install it, and what to import or register — previously the page was blank. The lint
109
+ plugins show the configuration line that enables what they recommend.
110
+
111
+ `@systemfsoftware/stryker-js-html-reporter` also carries its licence text
112
+
113
+ - 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.
114
+
115
+ - Updated dependencies:
116
+ - @systemfsoftware/stryker-js@2.0.0
117
+
3
118
  ## 1.0.0
4
119
 
5
120
  ### Major Changes
package/README.md CHANGED
@@ -28,5 +28,5 @@ Licensed under [Apache 2.0][license-url].
28
28
  [license-badge]: https://img.shields.io/badge/license-Apache_2.0-blue?style=flat-square
29
29
  [license-url]: https://github.com/systemfsoftware/systemfsoftware/blob/main/LICENSE
30
30
  [repo]: https://github.com/systemfsoftware/systemfsoftware
31
- [engine]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/engine
32
- [cli]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/cli
31
+ [engine]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js-engine
32
+ [cli]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js-cli
package/dist/index.d.mts CHANGED
@@ -1,17 +1,11 @@
1
- import { ReporterService } from "@systemfsoftware/stryker-js/Reporter";
2
- import * as FileSystem from "effect/FileSystem";
3
- import * as Path from "effect/Path";
4
- import { Wire } from "@systemfsoftware/effect-cell-types";
5
1
  import "effect/Schema";
6
- import { ProvidedStrykerOptions } from "@systemfsoftware/stryker-js/provided-options";
2
+ import { Wire } from "@systemfsoftware/effect-cell-types";
3
+ import { ReporterFactory } from "@systemfsoftware/stryker-js/ReporterEvent";
7
4
  //#region src/Reporter.d.ts
8
- declare const makeHtmlReporter: (params: {
9
- readonly options?: ProvidedStrykerOptions;
10
- readonly fs: FileSystem.FileSystem;
11
- readonly path: Path.Path;
12
- }) => ReporterService;
5
+ declare const makeHtmlReporter: ReporterFactory;
13
6
  //#endregion
14
7
  //#region src/index.d.ts
15
- declare const strykerPlugins: import("@systemfsoftware/stryker-js/Plugin").PluginContribution<"Reporter">[];
8
+ declare const htmlReporterFactory: ReporterFactory;
9
+ declare const strykerPlugins: import("@systemfsoftware/stryker-js/Plugin").PluginReporterContribution[];
16
10
  //#endregion
17
- export { makeHtmlReporter, strykerPlugins };
11
+ export { htmlReporterFactory, makeHtmlReporter, strykerPlugins };
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import { RunConfiguration, declarePlugin } from "@systemfsoftware/stryker-js/Plugin";
2
- import { Reporter, ReporterFailed } from "@systemfsoftware/stryker-js/Reporter";
1
+ import { declarePlugin } from "@systemfsoftware/stryker-js/Plugin";
2
+ import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
3
+ import * as NodePath from "@effect/platform-node-shared/NodePath";
4
+ import { MutationTestReportReady } from "@systemfsoftware/stryker-js/Reporter";
3
5
  import * as Effect from "effect/Effect";
4
6
  import * as FileSystem from "effect/FileSystem";
5
7
  import * as Layer from "effect/Layer";
6
8
  import * as Path from "effect/Path";
7
- import { writeOutputFile } from "@systemfsoftware/stryker-js/output-file";
8
- import * as Cause from "effect/Cause";
9
- import { Wire } from "@systemfsoftware/effect-cell-types";
10
9
  import * as S from "effect/Schema";
10
+ import { Wire } from "@systemfsoftware/effect-cell-types";
11
11
  //#region src/Reporter.schema.ts
12
12
  const MutationTestResultSchema = Wire.mint(S.Unknown);
13
13
  var HtmlReportCommand = class extends S.TaggedClass()("HtmlReportCommand", {
@@ -49,46 +49,45 @@ function buildReportHtml(report, scriptContent) {
49
49
  </html>`;
50
50
  }
51
51
  const buildHtmlDocument = (command) => HtmlDocument.make({ html: buildReportHtml(command.report, command.scriptContent) });
52
- const makeHtmlReporter = (params) => {
53
- const options = params.options;
54
- return {
55
- onDryRunCompleted: (_event) => Effect.void,
56
- onMutationTestingPlanReady: (_event) => Effect.void,
57
- onMutantTested: (_result) => Effect.void,
58
- onMutationTestReportReady: (report, metrics) => Effect.gen(function* () {
59
- const path = yield* Path.Path;
60
- const fs = yield* FileSystem.FileSystem;
61
- const scriptPath = yield* path.fromFileUrl(new URL(import.meta.resolve("mutation-testing-elements/dist/mutation-test-elements.js")));
62
- const scriptContent = yield* fs.readFileString(scriptPath);
63
- const html = buildHtmlDocument(HtmlReportCommand.make({
64
- report,
65
- scriptContent
66
- })).html;
67
- if (options === void 0) return;
68
- const fileName = options.htmlReporter.fileName;
69
- yield* Effect.logDebug(`Using file "${fileName}"`);
70
- yield* writeOutputFile(fs, path, fileName, html);
71
- const fileUrl = yield* path.toFileUrl(path.resolve(fileName));
72
- yield* Effect.logInfo(`Your report can be found at: ${fileUrl.href}`);
73
- }).pipe(Effect.provideService(FileSystem.FileSystem, params.fs), Effect.provideService(Path.Path, params.path), Effect.catchCause((cause) => Effect.fail(new ReporterFailed({
74
- reporterName: "html",
75
- event: "onMutationTestReportReady",
76
- cause: Cause.pretty(cause)
77
- })))),
78
- wrapUp: Effect.void
52
+ const BUNDLE_SPECIFIER = "mutation-testing-elements/dist/mutation-test-elements.js";
53
+ const nodeFsPathLayer = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
54
+ const readBundleContent = Effect.gen(function* () {
55
+ const fs = yield* FileSystem.FileSystem;
56
+ const bundlePath = yield* (yield* Path.Path).fromFileUrl(new URL(import.meta.resolve(BUNDLE_SPECIFIER)));
57
+ return yield* fs.readFileString(bundlePath);
58
+ });
59
+ const writeHtmlFile = (fileName, html) => Effect.gen(function* () {
60
+ const fs = yield* FileSystem.FileSystem;
61
+ const path = yield* Path.Path;
62
+ yield* fs.makeDirectory(path.dirname(fileName), { recursive: true });
63
+ yield* fs.writeFileString(fileName, html);
64
+ });
65
+ const bundleLoader = () => {
66
+ let cached;
67
+ return async () => {
68
+ cached ??= await Effect.runPromise(Effect.provide(readBundleContent, nodeFsPathLayer));
69
+ return cached;
79
70
  };
80
71
  };
72
+ const writeReportHtml = async (fileName, event, loadBundle) => {
73
+ const html = buildHtmlDocument(HtmlReportCommand.make({
74
+ report: event.report,
75
+ scriptContent: await loadBundle()
76
+ })).html;
77
+ await Effect.runPromise(Effect.provide(writeHtmlFile(fileName, html), nodeFsPathLayer));
78
+ };
79
+ const writeReportHtmlIfReady = async (fileName, event, loadBundle) => {
80
+ if (!S.is(MutationTestReportReady)(event)) return;
81
+ await writeReportHtml(fileName, event, loadBundle);
82
+ };
83
+ const makeHtmlReporter = (options, _init) => async (events) => {
84
+ const fileName = options.htmlReporter.fileName;
85
+ const loadBundle = bundleLoader();
86
+ for await (const event of events) await writeReportHtmlIfReady(fileName, event, loadBundle);
87
+ };
81
88
  //#endregion
82
89
  //#region src/index.ts
83
- const strykerPlugins = [declarePlugin("Reporter", "html", Layer.effect(Reporter, Effect.gen(function* () {
84
- const options = yield* RunConfiguration;
85
- const fs = yield* FileSystem.FileSystem;
86
- const path = yield* Path.Path;
87
- return makeHtmlReporter({
88
- options,
89
- fs,
90
- path
91
- });
92
- })))];
90
+ const htmlReporterFactory = makeHtmlReporter;
91
+ const strykerPlugins = [declarePlugin("Reporter", "html", htmlReporterFactory)];
93
92
  //#endregion
94
- export { makeHtmlReporter, strykerPlugins };
93
+ export { htmlReporterFactory, makeHtmlReporter, strykerPlugins };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-html-reporter",
3
- "version": "1.0.0",
3
+ "version": "3.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/html-reporter"
7
+ "directory": "packages/stryker-js/stryker-js-html-reporter"
8
8
  },
9
- "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/html-reporter#readme",
9
+ "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js-html-reporter#readme",
10
10
  "bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
11
11
  "description": "HTML reporter plugin for the @systemfsoftware mutation engine.",
12
12
  "type": "module",
@@ -14,25 +14,24 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
+ "@effect/platform-node-shared": "4.0.0-rc.112",
17
18
  "mutation-testing-elements": "3.7.3",
18
- "mutation-testing-metrics": "3.7.3",
19
- "mutation-testing-report-schema": "3.7.3",
20
- "@systemfsoftware/effect-cell-types": "^6.0.0",
21
- "@systemfsoftware/stryker-js": "^1.0.0"
19
+ "@systemfsoftware/effect-cell-types": "^6.0.1",
20
+ "@systemfsoftware/stryker-js": "^3.0.0"
22
21
  },
23
22
  "devDependencies": {
24
23
  "@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
25
24
  "@types/node": "^24",
26
- "effect": "^4.0.0-rc.112",
25
+ "effect": "4.0.0-rc.112",
27
26
  "oxlint": "^1.77.0",
28
27
  "oxlint-tsgolint": "7.0.2001",
29
28
  "rimraf": "^6.1.3",
30
29
  "tsdown": "^0.22.14",
31
30
  "typescript": "^7",
32
31
  "vitest": "^4",
33
- "@systemfsoftware/all": "^1.1.2",
32
+ "@systemfsoftware/all": "^2.0.0",
33
+ "@systemfsoftware/effect-gherkin-spec": "^4.0.1",
34
34
  "@systemfsoftware/tsconfig": "^1.3.3",
35
- "@systemfsoftware/effect-gherkin-spec": "^4.0.0",
36
35
  "@systemfsoftware/vitest-config": "^0.1.0"
37
36
  },
38
37
  "engines": {
@@ -44,7 +43,7 @@
44
43
  "provenance": true
45
44
  },
46
45
  "peerDependencies": {
47
- "effect": "^4.0.0-rc.112"
46
+ "effect": "4.0.0-rc.112"
48
47
  },
49
48
  "exports": {
50
49
  ".": "./dist/index.mjs",