@systemfsoftware/stryker-js-html-reporter 0.1.2 → 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,17 @@
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
+
3
15
  ## 0.1.2
4
16
 
5
17
  ### 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,28 +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 { Cell, Wire, Workflow } from "@systemfsoftware/effect-cell-types";
8
7
  import { writeOutputFile } from "@systemfsoftware/stryker-js/output-file";
9
8
  import * as Cause from "effect/Cause";
10
- import { pipe } from "effect/Function";
11
- import * as Result from "effect/Result";
9
+ import { Wire } from "@systemfsoftware/effect-cell-types";
12
10
  import * as S from "effect/Schema";
13
11
  //#region src/Reporter.schema.ts
14
- /**
15
- * Html reporter declarations — the wire types for the html report pipeline.
16
- */
17
12
  const MutationTestResultSchema = Wire.mint(S.Unknown);
18
13
  var HtmlReportCommand = class extends S.TaggedClass()("HtmlReportCommand", {
19
14
  report: MutationTestResultSchema,
20
15
  scriptContent: S.String
21
16
  }) {};
17
+ var HtmlDocument = class extends S.TaggedClass()("HtmlDocument", { html: S.String }) {};
22
18
  S.TaggedError()("HtmlReportError", { message: S.String });
23
19
  //#endregion
24
- //#region src/Reporter.workflow.ts
25
- /**
26
- * Html reporter workflow — pure document construction.
27
- */
28
- var HtmlDocument = class extends S.TaggedClass()("HtmlDocument", { html: S.String }) {};
20
+ //#region src/Reporter.ts
29
21
  function escapeHtmlTags(json) {
30
22
  return json.replace(/</g, "<\"+\"");
31
23
  }
@@ -56,57 +48,34 @@ function buildReportHtml(report, scriptContent) {
56
48
  </body>
57
49
  </html>`;
58
50
  }
59
- const makeHtmlDocument = Workflow.make(HtmlReportCommand, (command) => {
60
- const html = buildReportHtml(command.report, command.scriptContent);
61
- return Result.succeed(HtmlDocument.make({ html }));
62
- });
63
- //#endregion
64
- //#region src/Reporter.ts
65
- /**
66
- * Html reporter — Cell pipeline that renders the mutation report to a file.
67
- */
51
+ const buildHtmlDocument = (command) => HtmlDocument.make({ html: buildReportHtml(command.report, command.scriptContent) });
68
52
  const makeHtmlReporter = (params) => {
69
53
  const options = params.options;
70
- const fs = params.fs;
71
- const path = params.path;
72
- let heldReport;
73
- const htmlReportDescription = pipe(Cell.read(() => Effect.gen(function* () {
74
- const scriptPath = yield* path.fromFileUrl(new URL(import.meta.resolve("mutation-testing-elements/dist/mutation-test-elements.js")));
75
- const scriptContent = yield* fs.readFileString(scriptPath);
76
- return {
77
- report: heldReport,
78
- scriptContent
79
- };
80
- })), Cell.decode((raw) => Result.succeed(HtmlReportCommand.make({
81
- report: raw.report,
82
- scriptContent: raw.scriptContent
83
- }))), Cell.decide(makeHtmlDocument), Cell.encode((outcome) => Result.match(outcome, {
84
- onFailure: () => "",
85
- onSuccess: (doc) => doc.html
86
- })), Cell.write((html) => Effect.gen(function* () {
87
- if (options === void 0) return;
88
- const fileName = options.htmlReporter.fileName;
89
- yield* Effect.logDebug(`Using file "${fileName}"`);
90
- yield* writeOutputFile(fs, path, fileName, html);
91
- const fileUrl = yield* path.toFileUrl(path.resolve(fileName));
92
- yield* Effect.logInfo(`Your report can be found at: ${fileUrl.href}`);
93
- })));
94
54
  return {
95
55
  onDryRunCompleted: (_event) => Effect.void,
96
56
  onMutationTestingPlanReady: (_event) => Effect.void,
97
57
  onMutantTested: (_result) => Effect.void,
98
- onMutationTestReportReady: (report, _metrics) => Effect.sync(() => {
99
- heldReport = report;
100
- }),
101
- 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;
102
67
  if (options === void 0) return;
103
- if (heldReport === void 0) return;
104
- yield* Cell.apply(htmlReportDescription, void 0);
105
- }).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({
106
74
  reporterName: "html",
107
- event: "wrapUp",
75
+ event: "onMutationTestReportReady",
108
76
  cause: Cause.pretty(cause)
109
- }))))
77
+ })))),
78
+ wrapUp: Effect.void
110
79
  };
111
80
  };
112
81
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-html-reporter",
3
- "version": "0.1.2",
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/stryker-js": "^0.2.0",
21
- "@systemfsoftware/effect-cell-types": "^5.0.2"
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/all": "^1.1.0",
34
- "@systemfsoftware/effect-gherkin-spec": "^4.0.0",
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": {