@systemfsoftware/stryker-js-html-reporter 2.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 +36 -0
- package/dist/index.d.mts +6 -12
- package/dist/index.mjs +42 -43
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
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
|
+
|
|
3
39
|
## 2.0.0
|
|
4
40
|
|
|
5
41
|
### Major Changes
|
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 {
|
|
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:
|
|
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
|
|
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 {
|
|
2
|
-
import
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
84
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js-html-reporter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
|
|
@@ -14,23 +14,22 @@
|
|
|
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
19
|
"@systemfsoftware/effect-cell-types": "^6.0.1",
|
|
21
|
-
"@systemfsoftware/stryker-js": "^
|
|
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": "
|
|
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": "^
|
|
32
|
+
"@systemfsoftware/all": "^2.0.0",
|
|
34
33
|
"@systemfsoftware/effect-gherkin-spec": "^4.0.1",
|
|
35
34
|
"@systemfsoftware/tsconfig": "^1.3.3",
|
|
36
35
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
"provenance": true
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
|
-
"effect": "
|
|
46
|
+
"effect": "4.0.0-rc.112"
|
|
48
47
|
},
|
|
49
48
|
"exports": {
|
|
50
49
|
".": "./dist/index.mjs",
|