@systemfsoftware/stryker-js-html-reporter 3.0.2 → 4.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,27 @@
1
1
  # @systemfsoftware/stryker-js-html-reporter
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - The plugin system now runs each configured TestRunner/Checker/Reporter plugin in its own spawned process over an @effect/rpc wire: plugins load from the project's config-declared specifiers (no glob discovery), boundary failures are typed errors, and plugin spans link into the host trace. Breaking: the in-process plugin Layer contract is removed.
8
+
9
+ ### Patch Changes
10
+
11
+ - Maintenance release. Every published entry point, export, option, and behaviour is exactly as it was.
12
+
13
+ - effect peer range widens to ^4.0.0-rc.112 and the platform-node-shared dependency range widens to the repo catalog; repository metadata now points at stryker-js-effect
14
+
15
+ ## 3.0.3
16
+
17
+ ### Patch Changes
18
+
19
+ - Imports rewired to the collapsed `@systemfsoftware/stryker-js` root entry; each package now co-releases against the root-entry major.
20
+
21
+ - Updated dependencies:
22
+ - @systemfsoftware/effect-cell-types@8.0.0
23
+ - @systemfsoftware/stryker-js@4.0.0
24
+
3
25
  ## 3.0.2
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -7,17 +7,18 @@ HTML reporter plugin for the @systemfsoftware mutation engine.
7
7
 
8
8
  ## Usage
9
9
 
10
- You normally never import this package directly — the CLI wires it in. The
11
- reporter exists so a programmatic consumer can assemble its own host:
10
+ You normally never import this package directly — the CLI binds it as a built-in
11
+ in-process reporter. The reporter exists so a programmatic consumer can assemble
12
+ its own host:
12
13
 
13
14
  ```ts
14
- import { makeHtmlReporter, strykerPlugins } from '@systemfsoftware/stryker-js-html-reporter'
15
+ import { makeHtmlReporter } from '@systemfsoftware/stryker-js-html-reporter'
15
16
  ```
16
17
 
17
18
  ## Related
18
19
 
19
20
  - [`@systemfsoftware/stryker-js-engine`][engine] — the engine that emits the events this reporter presents
20
- - [`@systemfsoftware/stryker-js-cli`][cli] — the terminal-facing half, which binds this package's `strykerPlugins`
21
+ - [`@systemfsoftware/stryker-js-cli`][cli] — the terminal-facing half, which binds this package's `makeHtmlReporter` as a built-in reporter
21
22
 
22
23
  ## License
23
24
 
@@ -26,7 +27,7 @@ Licensed under [Apache 2.0][license-url].
26
27
  [npm-badge]: https://img.shields.io/npm/v/@systemfsoftware/stryker-js-html-reporter?style=flat-square
27
28
  [npm-url]: https://www.npmjs.com/package/@systemfsoftware/stryker-js-html-reporter
28
29
  [license-badge]: https://img.shields.io/badge/license-Apache_2.0-blue?style=flat-square
29
- [license-url]: https://github.com/systemfsoftware/systemfsoftware/blob/main/LICENSE
30
- [repo]: https://github.com/systemfsoftware/systemfsoftware
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
30
+ [license-url]: https://github.com/systemfsoftware/stryker-js-effect/blob/main/LICENSE
31
+ [repo]: https://github.com/systemfsoftware/stryker-js-effect
32
+ [engine]: https://github.com/systemfsoftware/stryker-js-effect/tree/main/packages/stryker-js-engine
33
+ [cli]: https://github.com/systemfsoftware/stryker-js-effect/tree/main/apps/stryker-js-cli
package/dist/index.d.mts CHANGED
@@ -1,10 +1,5 @@
1
- import "effect/Schema";
2
- import { ReporterFactory } from "@systemfsoftware/stryker-js/ReporterEvent";
3
- //#region src/Reporter.d.ts
4
- declare const makeHtmlReporter: ReporterFactory;
5
- //#endregion
6
- //#region src/index.d.ts
7
- declare const htmlReporterFactory: ReporterFactory;
8
- declare const strykerPlugins: import("@systemfsoftware/stryker-js/Plugin").PluginReporterContribution[];
9
- //#endregion
10
- export { htmlReporterFactory, makeHtmlReporter, strykerPlugins };
1
+ import { ReporterFactory } from '@systemfsoftware/stryker-js-language';
2
+
3
+ export declare const makeHtmlReporter: ReporterFactory;
4
+
5
+ export { }
package/dist/index.mjs CHANGED
@@ -1,12 +1,14 @@
1
- import { declarePlugin } from "@systemfsoftware/stryker-js/Plugin";
2
1
  import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
3
2
  import * as NodePath from "@effect/platform-node-shared/NodePath";
4
- import { MutationTestReportReady } from "@systemfsoftware/stryker-js/Reporter";
3
+ import { MutationTestReportReady, ReporterFailed, errorToString } from "@systemfsoftware/stryker-js-language";
5
4
  import * as Effect from "effect/Effect";
6
5
  import * as FileSystem from "effect/FileSystem";
7
6
  import * as Layer from "effect/Layer";
7
+ import * as Match from "effect/Match";
8
8
  import * as Path from "effect/Path";
9
+ import * as Ref from "effect/Ref";
9
10
  import * as S from "effect/Schema";
11
+ import * as Stream from "effect/Stream";
10
12
  //#region src/Reporter.schema.ts
11
13
  const MutationTestResultSchema = S.Unknown;
12
14
  var HtmlReportCommand = class extends S.TaggedClass()("HtmlReportCommand", {
@@ -50,44 +52,29 @@ function buildReportHtml(report, scriptContent) {
50
52
  const buildHtmlDocument = (command) => HtmlDocument.make({ html: buildReportHtml(command.report, command.scriptContent) });
51
53
  const BUNDLE_SPECIFIER = "mutation-testing-elements/dist/mutation-test-elements.js";
52
54
  const nodeFsPathLayer = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
53
- const readBundleContent = Effect.gen(function* () {
54
- if (typeof __STRYKER_HTML_REPORTER_CLIENT_BUNDLE__ === "string") return __STRYKER_HTML_REPORTER_CLIENT_BUNDLE__;
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);
55
+ const inlinedBundle = () => Match.value(typeof __STRYKER_HTML_REPORTER_CLIENT_BUNDLE__).pipe(Match.when("undefined", () => void 0), Match.orElse(() => __STRYKER_HTML_REPORTER_CLIENT_BUNDLE__));
56
+ const readBundleContent = Effect.suspend(() => Match.value(inlinedBundle()).pipe(Match.when(Match.string, (bundle) => Effect.succeed(bundle)), Match.orElse(() => Effect.flatMap(FileSystem.FileSystem, (fs) => Effect.flatMap(Path.Path, (path) => Effect.flatMap(path.fromFileUrl(new URL(import.meta.resolve(BUNDLE_SPECIFIER))), (bundlePath) => fs.readFileString(bundlePath)))))));
57
+ const writeHtmlFile = (fileName, html) => Effect.flatMap(FileSystem.FileSystem, (fs) => Effect.flatMap(Path.Path, (path) => Effect.andThen(fs.makeDirectory(path.dirname(fileName), { recursive: true }), fs.writeFileString(fileName, html))));
58
+ const loadBundle = (cached) => Effect.filterOrElse(Ref.get(cached), (hit) => hit !== void 0, () => Effect.tap(readBundleContent, (fresh) => Ref.set(cached, fresh)));
59
+ const writeReportHtml = (fileName, event, cached) => Effect.flatMap(loadBundle(cached), (bundle) => writeHtmlFile(fileName, buildHtmlDocument(HtmlReportCommand.make({
60
+ report: event.report,
61
+ scriptContent: bundle
62
+ })).html));
63
+ const failAsHtmlReporter = (cause) => ReporterFailed.make({
64
+ reporterName: "html",
65
+ event: "mutationTestReportReady",
66
+ cause: errorToString(cause)
58
67
  });
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;
70
- };
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);
68
+ const writeReportHtmlIfReady = (fileName, event, cached) => {
69
+ if (S.is(MutationTestReportReady)(event)) return writeReportHtml(fileName, event, cached).pipe(Effect.mapError(failAsHtmlReporter));
70
+ return Effect.void;
82
71
  };
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
- };
88
- //#endregion
89
- //#region src/index.ts
90
- const htmlReporterFactory = makeHtmlReporter;
91
- const strykerPlugins = [declarePlugin("Reporter", "html", htmlReporterFactory)];
72
+ const streamErrorOf = (cause) => ReporterFailed.make({
73
+ reporterName: "html",
74
+ event: "mutationTestReportReady",
75
+ cause: errorToString(cause)
76
+ });
77
+ const drainEvents = (fileName, events) => Effect.flatMap(Ref.make(void 0), (cached) => Stream.runForEach(Stream.fromAsyncIterable(events, streamErrorOf), (event) => writeReportHtmlIfReady(fileName, event, cached)));
78
+ const makeHtmlReporter = (options, _init) => (events) => Effect.provide(drainEvents(options.htmlReporter.fileName, events), nodeFsPathLayer);
92
79
  //#endregion
93
- export { htmlReporterFactory, makeHtmlReporter, strykerPlugins };
80
+ export { makeHtmlReporter };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-html-reporter",
3
- "version": "3.0.2",
3
+ "version": "4.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
- "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
7
- "directory": "packages/stryker-js/stryker-js-html-reporter"
6
+ "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
7
+ "directory": "packages/stryker-js-html-reporter"
8
8
  },
9
- "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js-html-reporter#readme",
10
- "bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
9
+ "homepage": "https://github.com/systemfsoftware/stryker-js-effect",
10
+ "bugs": "https://github.com/systemfsoftware/stryker-js-effect/issues",
11
11
  "description": "HTML reporter plugin for the @systemfsoftware mutation engine.",
12
12
  "type": "module",
13
13
  "files": [
@@ -15,24 +15,28 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "@effect/platform-node-shared": "4.0.0-rc.112",
18
+ "@systemfsoftware/effect-cell-types": "^8",
18
19
  "mutation-testing-elements": "3.7.3",
19
- "@systemfsoftware/effect-cell-types": "^7.0.1",
20
- "@systemfsoftware/stryker-js": "^3.0.2"
20
+ "@systemfsoftware/stryker-js-language": "^5.0.0",
21
+ "@systemfsoftware/stryker-js-plugin-interface": "^5.0.0"
21
22
  },
22
23
  "devDependencies": {
23
- "@systemfsoftware/arethetypeswrong-cli": "^4.1.0",
24
+ "@effect/tsgo": "^0.45.0",
25
+ "@microsoft/api-extractor": "^7",
26
+ "@systemfsoftware/all": "^2",
27
+ "@systemfsoftware/arethetypeswrong-cli": "^4",
28
+ "@systemfsoftware/effect-gherkin-spec": "^4",
29
+ "@systemfsoftware/tsconfig": "^1",
24
30
  "@types/node": "^24",
25
31
  "effect": "4.0.0-rc.112",
26
- "oxlint": "^1.77.0",
27
- "oxlint-tsgolint": "7.0.2001",
32
+ "oxlint": "^1",
33
+ "oxlint-tsgolint": "^7",
28
34
  "rimraf": "^6.1.3",
29
- "tsdown": "^0.22.14",
35
+ "tsdown": "^0.23.0",
30
36
  "typescript": "^7",
31
37
  "vitest": "^4",
32
- "@systemfsoftware/all": "^2.0.1",
33
- "@systemfsoftware/tsconfig": "^1.3.4",
34
- "@systemfsoftware/effect-gherkin-spec": "^4.0.2",
35
- "@systemfsoftware/vitest-config": "^0.1.0"
38
+ "@systemfsoftware/vitest-config": "^0.1.0",
39
+ "@systemfsoftware/tsdown-config": "^0.1.0"
36
40
  },
37
41
  "engines": {
38
42
  "node": ">=20.0.0"
@@ -46,15 +50,21 @@
46
50
  "effect": "4.0.0-rc.112"
47
51
  },
48
52
  "exports": {
49
- ".": "./dist/index.mjs",
53
+ ".": {
54
+ "types": "./dist/index.d.mts",
55
+ "default": "./dist/index.mjs"
56
+ },
50
57
  "./package.json": "./package.json"
51
58
  },
52
59
  "scripts": {
53
60
  "clean": "rimraf dist",
54
61
  "build": "tsdown",
55
- "typecheck": "tsc --noEmit",
62
+ "typecheck": "tsc --noEmit --incremental && tsc -p tsconfig.node.json --noEmit",
56
63
  "attw": "attw --pack .",
57
64
  "test": "vitest run",
58
- "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint --format=${f:-default}"
65
+ "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint --format=${f:-default}",
66
+ "api:check": "api-extractor run",
67
+ "api:update": "api-extractor run --local",
68
+ "lint:tsgo": "effect-tsgo diagnostics --project tsconfig.json --format ${TSGO_FORMAT:-text}"
59
69
  }
60
70
  }