@systemfsoftware/stryker-js-html-reporter 3.0.3 → 4.0.1
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 +19 -0
- package/README.md +8 -9
- package/dist/index.d.mts +1 -6
- package/dist/index.mjs +28 -39
- package/package.json +27 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-html-reporter
|
|
2
2
|
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @systemfsoftware/stryker-js-plugin-interface@6.0.0
|
|
9
|
+
|
|
10
|
+
## 4.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- 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.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Maintenance release. Every published entry point, export, option, and behaviour is exactly as it was.
|
|
19
|
+
|
|
20
|
+
- 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
|
|
21
|
+
|
|
3
22
|
## 3.0.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -7,17 +7,17 @@ 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
|
|
11
|
-
reporter exists so a programmatic consumer can assemble
|
|
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
|
|
15
|
+
import { makeHtmlReporter } from '@systemfsoftware/stryker-js-html-reporter'
|
|
15
16
|
```
|
|
16
17
|
|
|
17
18
|
## Related
|
|
18
19
|
|
|
19
|
-
- [`@systemfsoftware/stryker-js
|
|
20
|
-
- [`@systemfsoftware/stryker-js-cli`][cli] — the terminal-facing half, which binds this package's `strykerPlugins`
|
|
20
|
+
- [`@systemfsoftware/stryker-js`][engine] — the run engine that emits the events this reporter presents, and the binary that binds `makeHtmlReporter` as a built-in reporter
|
|
21
21
|
|
|
22
22
|
## License
|
|
23
23
|
|
|
@@ -26,7 +26,6 @@ Licensed under [Apache 2.0][license-url].
|
|
|
26
26
|
[npm-badge]: https://img.shields.io/npm/v/@systemfsoftware/stryker-js-html-reporter?style=flat-square
|
|
27
27
|
[npm-url]: https://www.npmjs.com/package/@systemfsoftware/stryker-js-html-reporter
|
|
28
28
|
[license-badge]: https://img.shields.io/badge/license-Apache_2.0-blue?style=flat-square
|
|
29
|
-
[license-url]: https://github.com/systemfsoftware/
|
|
30
|
-
[repo]: https://github.com/systemfsoftware/
|
|
31
|
-
[engine]: https://github.com/systemfsoftware/
|
|
32
|
-
[cli]: https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js-cli
|
|
29
|
+
[license-url]: https://github.com/systemfsoftware/stryker-js-effect/blob/main/LICENSE
|
|
30
|
+
[repo]: https://github.com/systemfsoftware/stryker-js-effect
|
|
31
|
+
[engine]: https://github.com/systemfsoftware/stryker-js-effect/tree/main/packages/stryker-js
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReporterFactory } from '@systemfsoftware/stryker-js';
|
|
3
|
-
|
|
4
|
-
export declare const htmlReporterFactory: ReporterFactory;
|
|
1
|
+
import { ReporterFactory } from '@systemfsoftware/stryker-js-plugin-interface';
|
|
5
2
|
|
|
6
3
|
export declare const makeHtmlReporter: ReporterFactory;
|
|
7
4
|
|
|
8
|
-
export declare const strykerPlugins: PluginReporterContribution[];
|
|
9
|
-
|
|
10
5
|
export { }
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { MutationTestReportReady, declarePlugin } from "@systemfsoftware/stryker-js";
|
|
2
1
|
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
|
|
3
2
|
import * as NodePath from "@effect/platform-node-shared/NodePath";
|
|
3
|
+
import { errorToString } from "@systemfsoftware/stryker-js-instrumenter/mutants";
|
|
4
|
+
import { MutationTestReportReady, ReporterFailed } from "@systemfsoftware/stryker-js-plugin-interface";
|
|
4
5
|
import * as Effect from "effect/Effect";
|
|
5
6
|
import * as FileSystem from "effect/FileSystem";
|
|
6
7
|
import * as Layer from "effect/Layer";
|
|
8
|
+
import * as Match from "effect/Match";
|
|
7
9
|
import * as Path from "effect/Path";
|
|
10
|
+
import * as Ref from "effect/Ref";
|
|
8
11
|
import * as S from "effect/Schema";
|
|
12
|
+
import * as Stream from "effect/Stream";
|
|
9
13
|
//#region src/Reporter.schema.ts
|
|
10
14
|
const MutationTestResultSchema = S.Unknown;
|
|
11
15
|
var HtmlReportCommand = class extends S.TaggedClass()("HtmlReportCommand", {
|
|
@@ -49,44 +53,29 @@ function buildReportHtml(report, scriptContent) {
|
|
|
49
53
|
const buildHtmlDocument = (command) => HtmlDocument.make({ html: buildReportHtml(command.report, command.scriptContent) });
|
|
50
54
|
const BUNDLE_SPECIFIER = "mutation-testing-elements/dist/mutation-test-elements.js";
|
|
51
55
|
const nodeFsPathLayer = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const inlinedBundle = () => Match.value(typeof __STRYKER_HTML_REPORTER_CLIENT_BUNDLE__).pipe(Match.when("undefined", () => void 0), Match.orElse(() => __STRYKER_HTML_REPORTER_CLIENT_BUNDLE__));
|
|
57
|
+
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)))))));
|
|
58
|
+
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))));
|
|
59
|
+
const loadBundle = (cached) => Effect.filterOrElse(Ref.get(cached), (hit) => hit !== void 0, () => Effect.tap(readBundleContent, (fresh) => Ref.set(cached, fresh)));
|
|
60
|
+
const writeReportHtml = (fileName, event, cached) => Effect.flatMap(loadBundle(cached), (bundle) => writeHtmlFile(fileName, buildHtmlDocument(HtmlReportCommand.make({
|
|
61
|
+
report: event.report,
|
|
62
|
+
scriptContent: bundle
|
|
63
|
+
})).html));
|
|
64
|
+
const failAsHtmlReporter = (cause) => ReporterFailed.make({
|
|
65
|
+
reporterName: "html",
|
|
66
|
+
event: "mutationTestReportReady",
|
|
67
|
+
cause: errorToString(cause)
|
|
57
68
|
});
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
yield* fs.makeDirectory(path.dirname(fileName), { recursive: true });
|
|
62
|
-
yield* fs.writeFileString(fileName, html);
|
|
63
|
-
});
|
|
64
|
-
const bundleLoader = () => {
|
|
65
|
-
let cached;
|
|
66
|
-
return async () => {
|
|
67
|
-
cached ??= await Effect.runPromise(Effect.provide(readBundleContent, nodeFsPathLayer));
|
|
68
|
-
return cached;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
const writeReportHtml = async (fileName, event, loadBundle) => {
|
|
72
|
-
const html = buildHtmlDocument(HtmlReportCommand.make({
|
|
73
|
-
report: event.report,
|
|
74
|
-
scriptContent: await loadBundle()
|
|
75
|
-
})).html;
|
|
76
|
-
await Effect.runPromise(Effect.provide(writeHtmlFile(fileName, html), nodeFsPathLayer));
|
|
77
|
-
};
|
|
78
|
-
const writeReportHtmlIfReady = async (fileName, event, loadBundle) => {
|
|
79
|
-
if (!S.is(MutationTestReportReady)(event)) return;
|
|
80
|
-
await writeReportHtml(fileName, event, loadBundle);
|
|
69
|
+
const writeReportHtmlIfReady = (fileName, event, cached) => {
|
|
70
|
+
if (S.is(MutationTestReportReady)(event)) return writeReportHtml(fileName, event, cached).pipe(Effect.mapError(failAsHtmlReporter));
|
|
71
|
+
return Effect.void;
|
|
81
72
|
};
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const htmlReporterFactory = makeHtmlReporter;
|
|
90
|
-
const strykerPlugins = [declarePlugin("Reporter", "html", htmlReporterFactory)];
|
|
73
|
+
const streamErrorOf = (cause) => ReporterFailed.make({
|
|
74
|
+
reporterName: "html",
|
|
75
|
+
event: "mutationTestReportReady",
|
|
76
|
+
cause: errorToString(cause)
|
|
77
|
+
});
|
|
78
|
+
const drainEvents = (fileName, events) => Effect.flatMap(Ref.make(void 0), (cached) => Stream.runForEach(Stream.fromAsyncIterable(events, streamErrorOf), (event) => writeReportHtmlIfReady(fileName, event, cached)));
|
|
79
|
+
const makeHtmlReporter = (options, _init) => (events) => Effect.provide(drainEvents(options.htmlReporter.fileName, events), nodeFsPathLayer);
|
|
91
80
|
//#endregion
|
|
92
|
-
export {
|
|
81
|
+
export { makeHtmlReporter };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js-html-reporter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "git+https://github.com/systemfsoftware/
|
|
7
|
-
"directory": "packages/stryker-js
|
|
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/
|
|
10
|
-
"bugs": "https://github.com/systemfsoftware/
|
|
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,27 @@
|
|
|
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/
|
|
20
|
-
"@systemfsoftware/stryker-js": "^
|
|
20
|
+
"@systemfsoftware/stryker-js-plugin-interface": "^6.0.0",
|
|
21
|
+
"@systemfsoftware/stryker-js-instrumenter": "^7.0.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
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",
|
|
25
30
|
"@types/node": "^24",
|
|
26
31
|
"effect": "4.0.0-rc.112",
|
|
27
|
-
"oxlint": "^1
|
|
28
|
-
"oxlint-tsgolint": "7
|
|
32
|
+
"oxlint": "^1",
|
|
33
|
+
"oxlint-tsgolint": "^7",
|
|
29
34
|
"rimraf": "^6.1.3",
|
|
30
|
-
"tsdown": "^0.
|
|
35
|
+
"tsdown": "^0.23.0",
|
|
31
36
|
"typescript": "^7",
|
|
32
37
|
"vitest": "^4",
|
|
33
|
-
"@systemfsoftware/
|
|
34
|
-
"@systemfsoftware/effect-gherkin-spec": "^4.0.2",
|
|
35
|
-
"@systemfsoftware/tsconfig": "^1.3.4",
|
|
38
|
+
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
36
39
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
37
40
|
},
|
|
38
41
|
"engines": {
|
|
@@ -47,17 +50,21 @@
|
|
|
47
50
|
"effect": "4.0.0-rc.112"
|
|
48
51
|
},
|
|
49
52
|
"exports": {
|
|
50
|
-
".":
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./dist/index.d.mts",
|
|
55
|
+
"default": "./dist/index.mjs"
|
|
56
|
+
},
|
|
51
57
|
"./package.json": "./package.json"
|
|
52
58
|
},
|
|
53
59
|
"scripts": {
|
|
54
60
|
"clean": "rimraf dist",
|
|
55
|
-
"build": "tsdown
|
|
56
|
-
"typecheck": "tsc --noEmit",
|
|
61
|
+
"build": "tsdown",
|
|
62
|
+
"typecheck": "tsc --noEmit --incremental && tsc -p tsconfig.node.json --noEmit",
|
|
57
63
|
"attw": "attw --pack .",
|
|
58
64
|
"test": "vitest run",
|
|
59
65
|
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint --format=${f:-default}",
|
|
60
|
-
"api:check": "
|
|
61
|
-
"api:update": "api-extractor run --local"
|
|
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}"
|
|
62
69
|
}
|
|
63
70
|
}
|