@systemfsoftware/stryker-js-html-reporter 0.1.1 → 1.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,26 @@
1
1
  # @systemfsoftware/stryker-js-html-reporter
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Report generation moved to a plain kernel; the reporter service shape is unchanged
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies:
12
+ - @systemfsoftware/effect-cell-types@6.0.0
13
+ - @systemfsoftware/stryker-js@1.0.0
14
+
15
+ ## 0.1.2
16
+
17
+ ### Patch Changes
18
+
19
+ - Refreshed builds on the platform-services dependency graph; the packages no longer reach for host builtins directly. No CLI flags or option names change.
20
+
21
+ - Updated dependencies:
22
+ - @systemfsoftware/stryker-js@0.2.0
23
+
3
24
  ## 0.1.1
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -16,7 +16,7 @@ import { makeHtmlReporter, strykerPlugins } from '@systemfsoftware/stryker-js-ht
16
16
 
17
17
  ## Related
18
18
 
19
- - [`@systemfsoftware/stryker-js-platform-node`][engine] — the engine that emits the events this reporter presents
19
+ - [`@systemfsoftware/stryker-js-engine`][engine] — the engine that emits the events this reporter presents
20
20
  - [`@systemfsoftware/stryker-js-cli`][cli] — the terminal-facing half, which binds this package's `strykerPlugins`
21
21
 
22
22
  ## License
@@ -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/platform-node
31
+ [engine]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/engine
32
32
  [cli]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/cli
package/dist/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { ReporterService } from "@systemfsoftware/stryker-js/Reporter";
2
2
  import * as FileSystem from "effect/FileSystem";
3
3
  import * as Path from "effect/Path";
4
+ import { Wire } from "@systemfsoftware/effect-cell-types";
5
+ import "effect/Schema";
4
6
  import { ProvidedStrykerOptions } from "@systemfsoftware/stryker-js/provided-options";
5
7
  //#region src/Reporter.d.ts
6
8
  declare const makeHtmlReporter: (params: {
package/dist/index.mjs CHANGED
@@ -4,30 +4,20 @@ import * as Effect from "effect/Effect";
4
4
  import * as FileSystem from "effect/FileSystem";
5
5
  import * as Layer from "effect/Layer";
6
6
  import * as Path from "effect/Path";
7
- import { pathToFileURL } from "url";
8
- import { createRequire } from "module";
9
- import { Cell, Wire, Workflow } from "@systemfsoftware/effect-cell-types";
10
7
  import { writeOutputFile } from "@systemfsoftware/stryker-js/output-file";
11
8
  import * as Cause from "effect/Cause";
12
- import { pipe } from "effect/Function";
13
- import * as Result from "effect/Result";
9
+ import { Wire } from "@systemfsoftware/effect-cell-types";
14
10
  import * as S from "effect/Schema";
15
11
  //#region src/Reporter.schema.ts
16
- /**
17
- * Html reporter declarations — the wire types for the html report pipeline.
18
- */
19
12
  const MutationTestResultSchema = Wire.mint(S.Unknown);
20
13
  var HtmlReportCommand = class extends S.TaggedClass()("HtmlReportCommand", {
21
14
  report: MutationTestResultSchema,
22
15
  scriptContent: S.String
23
16
  }) {};
17
+ var HtmlDocument = class extends S.TaggedClass()("HtmlDocument", { html: S.String }) {};
24
18
  S.TaggedError()("HtmlReportError", { message: S.String });
25
19
  //#endregion
26
- //#region src/Reporter.workflow.ts
27
- /**
28
- * Html reporter workflow — pure document construction.
29
- */
30
- var HtmlDocument = class extends S.TaggedClass()("HtmlDocument", { html: S.String }) {};
20
+ //#region src/Reporter.ts
31
21
  function escapeHtmlTags(json) {
32
22
  return json.replace(/</g, "<\"+\"");
33
23
  }
@@ -58,56 +48,34 @@ function buildReportHtml(report, scriptContent) {
58
48
  </body>
59
49
  </html>`;
60
50
  }
61
- const makeHtmlDocument = Workflow.make(HtmlReportCommand, (command) => {
62
- const html = buildReportHtml(command.report, command.scriptContent);
63
- return Result.succeed(HtmlDocument.make({ html }));
64
- });
65
- //#endregion
66
- //#region src/Reporter.ts
67
- /**
68
- * Html reporter — Cell pipeline that renders the mutation report to a file.
69
- */
51
+ const buildHtmlDocument = (command) => HtmlDocument.make({ html: buildReportHtml(command.report, command.scriptContent) });
70
52
  const makeHtmlReporter = (params) => {
71
53
  const options = params.options;
72
- const fs = params.fs;
73
- const path = params.path;
74
- let heldReport;
75
- const htmlReportDescription = pipe(Cell.read(() => Effect.gen(function* () {
76
- const scriptPath = createRequire(import.meta.url).resolve("mutation-testing-elements/dist/mutation-test-elements.js");
77
- const scriptContent = yield* fs.readFileString(scriptPath);
78
- return {
79
- report: heldReport,
80
- scriptContent
81
- };
82
- })), Cell.decode((raw) => Result.succeed(HtmlReportCommand.make({
83
- report: raw.report,
84
- scriptContent: raw.scriptContent
85
- }))), Cell.decide(makeHtmlDocument), Cell.encode((outcome) => Result.match(outcome, {
86
- onFailure: () => "",
87
- onSuccess: (doc) => doc.html
88
- })), Cell.write((html) => Effect.gen(function* () {
89
- if (options === void 0) return;
90
- const fileName = options.htmlReporter.fileName;
91
- yield* Effect.logDebug(`Using file "${fileName}"`);
92
- yield* writeOutputFile(fs, path, fileName, html);
93
- yield* Effect.logInfo(`Your report can be found at: ${pathToFileURL(path.resolve(fileName)).href}`);
94
- })));
95
54
  return {
96
55
  onDryRunCompleted: (_event) => Effect.void,
97
56
  onMutationTestingPlanReady: (_event) => Effect.void,
98
57
  onMutantTested: (_result) => Effect.void,
99
- onMutationTestReportReady: (report, _metrics) => Effect.sync(() => {
100
- heldReport = report;
101
- }),
102
- wrapUp: Effect.gen(function* () {
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;
103
67
  if (options === void 0) return;
104
- if (heldReport === void 0) return;
105
- yield* Cell.apply(htmlReportDescription, void 0);
106
- }).pipe(Effect.catchCause((cause) => Effect.fail(new ReporterFailed({
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({
107
74
  reporterName: "html",
108
- event: "wrapUp",
75
+ event: "onMutationTestReportReady",
109
76
  cause: Cause.pretty(cause)
110
- }))))
77
+ })))),
78
+ wrapUp: Effect.void
111
79
  };
112
80
  };
113
81
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-html-reporter",
3
- "version": "0.1.1",
3
+ "version": "1.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
@@ -17,8 +17,8 @@
17
17
  "mutation-testing-elements": "3.7.3",
18
18
  "mutation-testing-metrics": "3.7.3",
19
19
  "mutation-testing-report-schema": "3.7.3",
20
- "@systemfsoftware/effect-cell-types": "^5.0.2",
21
- "@systemfsoftware/stryker-js": "^0.1.1"
20
+ "@systemfsoftware/effect-cell-types": "^6.0.0",
21
+ "@systemfsoftware/stryker-js": "^1.0.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
@@ -30,9 +30,9 @@
30
30
  "tsdown": "^0.22.14",
31
31
  "typescript": "^7",
32
32
  "vitest": "^4",
33
- "@systemfsoftware/effect-gherkin-spec": "^4.0.0",
34
- "@systemfsoftware/all": "^1.0.2",
33
+ "@systemfsoftware/all": "^1.1.2",
35
34
  "@systemfsoftware/tsconfig": "^1.3.3",
35
+ "@systemfsoftware/effect-gherkin-spec": "^4.0.0",
36
36
  "@systemfsoftware/vitest-config": "^0.1.0"
37
37
  },
38
38
  "engines": {