@systemfsoftware/stryker-js-html-reporter 0.1.2 → 2.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 +91 -0
- package/README.md +3 -3
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +22 -53
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-html-reporter
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- The packages are renamed. `plugin-api` is now `@systemfsoftware/stryker-js`, the
|
|
8
|
+
language every plugin is written against. `mutation-run` is split: the run
|
|
9
|
+
itself is `@systemfsoftware/stryker-js-engine`
|
|
10
|
+
(host-neutral, no Node on its manifest) and the Node process entries are
|
|
11
|
+
`@systemfsoftware/stryker-js-cli`, which owns the worker files and the runtime
|
|
12
|
+
gate. `mutation-report` is now `@systemfsoftware/stryker-js-html-reporter`.
|
|
13
|
+
`@systemfsoftware/stryker-js-platform-node` is never published — do not install
|
|
14
|
+
it. Install the new names and change your imports.
|
|
15
|
+
|
|
16
|
+
Options types moved. `StrykerOptions`, `PartialStrykerOptions` and `LogLevel` are
|
|
17
|
+
imported from the `Schema` export; `Mutant`, `MutantStatus`, `Position` and
|
|
18
|
+
`Location` from the `Mutant` export. Point a config's `extends` at the language
|
|
19
|
+
package's `Schema` export.
|
|
20
|
+
|
|
21
|
+
`MutantStatus` accepts one spelling per outcome: `Killed`, `Survived`,
|
|
22
|
+
`NoCoverage`, `Timeout`, `CompileError`, `RuntimeError`, `Ignored` and `Pending`.
|
|
23
|
+
The lowercase and abbreviated forms — `killed`, `timedOut`, `noCoverage` and the
|
|
24
|
+
rest — are gone. A comparison against a removed spelling never matched the value
|
|
25
|
+
the reporter actually produced, so check any status comparison you wrote.
|
|
26
|
+
|
|
27
|
+
Statuses, plugin kinds, exit classes and AST formats are string literal unions
|
|
28
|
+
rather than enums, so read them as their string values. Member access such as
|
|
29
|
+
`ExitClass.VerdictFail` no longer resolves.
|
|
30
|
+
|
|
31
|
+
A plugin no longer receives a logger, and the logger port is gone. Plugins log
|
|
32
|
+
through Effect, and the host decides where that output goes.
|
|
33
|
+
|
|
34
|
+
The bundled base preset is gone. A config inherits from the language package's
|
|
35
|
+
`Schema` export and states the thresholds, reporters and plugins it wants; you no
|
|
36
|
+
longer silently inherit a package manager, a plugin list or a break threshold.
|
|
37
|
+
|
|
38
|
+
- 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.
|
|
39
|
+
|
|
40
|
+
- Five entry points that were never API are gone. Each existed because another
|
|
41
|
+
package in this project found the code convenient, not because it was a surface
|
|
42
|
+
anyone should depend on.
|
|
43
|
+
|
|
44
|
+
What is left is documented: an entry point is a name you may import and we may
|
|
45
|
+
not move without a major, and everything else is internal whatever file it sits
|
|
46
|
+
in.
|
|
47
|
+
|
|
48
|
+
- Reporters are constructed by a factory and provided as a layer.
|
|
49
|
+
|
|
50
|
+
The exported reporter classes are gone. Replace each `new` with the matching
|
|
51
|
+
factory — `makeClearTextReporter`, `makeHtmlReporter`, `makeJsonReporter`,
|
|
52
|
+
`makeProgressBarReporter`, `makeProgressStreamReporter`.
|
|
53
|
+
|
|
54
|
+
Each factory takes the reporter's own options rather than an injected container,
|
|
55
|
+
and each operation returns an `Effect`. If you registered a reporter as a plugin,
|
|
56
|
+
declare it with `declarePlugin` and hand over a layer that provides `Reporter`.
|
|
57
|
+
|
|
58
|
+
`drawClearTextScoreTable` is now exported for anyone rendering the score table
|
|
59
|
+
outside a reporter.
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- New version is published through npm trusted publishing, so it carries a provenance attestation you can verify.
|
|
64
|
+
|
|
65
|
+
- Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
|
|
66
|
+
|
|
67
|
+
- A mutation run writes the JSON report the `json` reporter is configured to produce.
|
|
68
|
+
|
|
69
|
+
Vitest no longer reprints its full summary for every mutant.
|
|
70
|
+
|
|
71
|
+
- Each of these packages now has a README, so its registry page says what the package is, how
|
|
72
|
+
to install it, and what to import or register — previously the page was blank. The lint
|
|
73
|
+
plugins show the configuration line that enables what they recommend.
|
|
74
|
+
|
|
75
|
+
`@systemfsoftware/stryker-js-html-reporter` also carries its licence text
|
|
76
|
+
|
|
77
|
+
- 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.
|
|
78
|
+
|
|
79
|
+
- Updated dependencies:
|
|
80
|
+
- @systemfsoftware/stryker-js@2.0.0
|
|
81
|
+
|
|
82
|
+
## 1.0.0
|
|
83
|
+
|
|
84
|
+
### Major Changes
|
|
85
|
+
|
|
86
|
+
- Report generation moved to a plain kernel; the reporter service shape is unchanged
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies:
|
|
91
|
+
- @systemfsoftware/effect-cell-types@6.0.0
|
|
92
|
+
- @systemfsoftware/stryker-js@1.0.0
|
|
93
|
+
|
|
3
94
|
## 0.1.2
|
|
4
95
|
|
|
5
96
|
### 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-
|
|
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/
|
|
32
|
-
[cli]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/
|
|
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,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 {
|
|
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.
|
|
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
|
|
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,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
104
|
-
yield*
|
|
105
|
-
|
|
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: "
|
|
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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js-html-reporter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
|
|
7
|
-
"directory": "packages/
|
|
7
|
+
"directory": "packages/stryker-js/stryker-js-html-reporter"
|
|
8
8
|
},
|
|
9
|
-
"homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/
|
|
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",
|
|
@@ -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/
|
|
21
|
-
"@systemfsoftware/
|
|
20
|
+
"@systemfsoftware/effect-cell-types": "^6.0.1",
|
|
21
|
+
"@systemfsoftware/stryker-js": "^2.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"tsdown": "^0.22.14",
|
|
31
31
|
"typescript": "^7",
|
|
32
32
|
"vitest": "^4",
|
|
33
|
-
"@systemfsoftware/all": "^1.1.
|
|
34
|
-
"@systemfsoftware/effect-gherkin-spec": "^4.0.
|
|
33
|
+
"@systemfsoftware/all": "^1.1.3",
|
|
34
|
+
"@systemfsoftware/effect-gherkin-spec": "^4.0.1",
|
|
35
35
|
"@systemfsoftware/tsconfig": "^1.3.3",
|
|
36
36
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
37
37
|
},
|