@systemfsoftware/stryker-js 4.0.0 → 5.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +3 -15
  3. package/README.md +67 -13
  4. package/dist/Plugins-sA_9VKus.d.mts +96 -0
  5. package/dist/builtin-reporters-wAuKFSsd.mjs +672 -0
  6. package/dist/builtin-reporters.d.mts +14 -0
  7. package/dist/builtin-reporters.mjs +2 -0
  8. package/dist/compiler-Bq9Nelu8.mjs +48406 -0
  9. package/dist/config.d.mts +11 -0
  10. package/dist/config.mjs +7 -0
  11. package/dist/dist-B3nT7z4G.mjs +5155 -0
  12. package/dist/execAsync-CfPZgJSD.mjs +10 -0
  13. package/dist/execAsync-DdCu5QLN.mjs +10 -0
  14. package/dist/getMachineId-bsd-C6bLIaiv.mjs +27 -0
  15. package/dist/getMachineId-bsd-CXSiHDga.mjs +27 -0
  16. package/dist/getMachineId-darwin-D3cIKeqx.mjs +24 -0
  17. package/dist/getMachineId-darwin-DPZ0kdKD.mjs +24 -0
  18. package/dist/getMachineId-linux-CQwLSlZk.mjs +20 -0
  19. package/dist/getMachineId-linux-Ci8OVJU0.mjs +20 -0
  20. package/dist/getMachineId-unsupported-PX0hnW6X.mjs +15 -0
  21. package/dist/getMachineId-unsupported-_ExL3Avl.mjs +15 -0
  22. package/dist/getMachineId-win-BCsS9pC_.mjs +26 -0
  23. package/dist/getMachineId-win-D9Tb0p7w.mjs +26 -0
  24. package/dist/index.d.mts +659 -1253
  25. package/dist/index.mjs +3 -1034
  26. package/dist/main.mjs +104333 -0
  27. package/dist/merge-config-BrrNQWje.mjs +16 -0
  28. package/dist/mutation-test.cell-RmF-sBUm.d.mts +509 -0
  29. package/dist/output-mode-CfGHDpi5.d.mts +17 -0
  30. package/dist/parser.wasm32-wasi.wasm +0 -0
  31. package/dist/plugin-loader.d.mts +106 -0
  32. package/dist/plugin-loader.mjs +2 -0
  33. package/dist/plugin-worker-entry-DNu0SHO8.mjs +1413 -0
  34. package/dist/promises.d.mts +5 -0
  35. package/dist/promises.mjs +14 -0
  36. package/dist/rolldown-runtime-Dr7-SnC6.mjs +45 -0
  37. package/dist/src-Bzh7ykDp.mjs +4724 -0
  38. package/dist/stryker-config-BlfHxS7n.d.mts +14 -0
  39. package/dist/wasm-Dr7kZatW.mjs +13017 -0
  40. package/package.json +80 -40
package/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
1
1
  # @systemfsoftware/stryker-js
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Plugin entries in `plugins` and `appendPlugins` are now the entrypoints
8
+ themselves, as `file:` URLs, instead of package names Stryker resolved for you.
9
+
10
+ Stryker resolved every specifier against its own module before, so a plugin the
11
+ project had installed was only found when Node happened to walk to the right
12
+ `node_modules` from Stryker's location — which is not the project's location for
13
+ a global install, an `npx` run, or a strict isolated store. The project now
14
+ resolves each plugin itself, in the config module where the project's own
15
+ dependencies are visible:
16
+
17
+ ```ts
18
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
19
+
20
+ export default defineConfig({
21
+ plugins: [import.meta.resolve('@acme/stryker-runner')],
22
+ })
23
+ ```
24
+
25
+ The `--plugins` and `--appendPlugins` flags take the same resolved URLs. A value
26
+ that is not a `file:` URL is refused with the entry named.
27
+
28
+ Stryker no longer reports an unresolved specifier as a warning it can continue
29
+ past, because it no longer resolves one: a plugin that cannot be loaded stops
30
+ the run and names the entry, and a plugin that loads but contributes nothing is
31
+ still reported as before.
32
+
33
+ - The engine and the CLI are one package. `@systemfsoftware/stryker-js` now ships
34
+ the `stryker` binary, the run engine, and the configuration surface, replacing
35
+ `@systemfsoftware/stryker-js-cli` and `@systemfsoftware/stryker-js-engine`, which
36
+ are discontinued.
37
+
38
+ Two subpaths are new:
39
+
40
+ - `./config` — `defineConfig`, `mergeConfig`, `ConfigEnv`, `StrykerConfig`. Use it
41
+ instead of hand-typing `stryker.config.ts` against the option type.
42
+ - `./promises` — `run`, the same run interpreted for promise callers, so an
43
+ embedding script does not need an Effect runtime.
44
+
45
+ Migrate by importing from `@systemfsoftware/stryker-js`. Everything the two
46
+ discontinued packages exported — the option type, `readConfig`, the plugin
47
+ loader, `WorkerLauncher`, and the exit classification — keeps its name and its
48
+ behavior at the new address.
49
+
50
+ `@systemfsoftware/stryker-js-language` is gone; it is replaced rather than
51
+ continued. The run-event vocabulary it was carrying — `RunEvents`, `RunIdentity`,
52
+ `RunPhase`, and the `Run*` event schemas — now ships from
53
+ `@systemfsoftware/stryker-js`. Two consequences follow for anyone who imported
54
+ it:
55
+
56
+ - The mutant model, the report schemas, and the checker, evaluator and
57
+ test-runner contracts come from `@systemfsoftware/stryker-js-instrumenter`
58
+ and `@systemfsoftware/stryker-js-plugin-interface`. Update those imports.
59
+ - The service identifiers `@systemfsoftware/stryker-js-language/RunEvents` and
60
+ `@systemfsoftware/stryker-js-language/RunIdentity` are now
61
+ `@systemfsoftware/stryker-js/RunEvents` and
62
+ `@systemfsoftware/stryker-js/RunEvents/RunIdentity`. A program that provides or
63
+ looks up either service by its identifier string must use the new one.
64
+
65
+ Two more changes reach programmatic callers:
66
+
67
+ - `testRunner: 'vm'` runs the test suite in memory. Stryker strips TypeScript from
68
+ the test files during preparation and evaluates them in a fresh V8 context per
69
+ mutant, so a run needs no child process and no manual bundling.
70
+ - `readConfig` and `resolveExtends` take the invocation a configuration is being
71
+ read for, so a `stryker.config.ts` may export a factory receiving
72
+ `{ command, isDryRun, mode, isCi }` and compute its settings per invocation.
73
+ Both keep working for a plain exported object; the extra argument is the
74
+ `command` and output `mode` the loader cannot see for itself.
75
+
3
76
  ## 4.0.0
4
77
 
5
78
  ### Major Changes
package/LICENSE CHANGED
@@ -1,6 +1,4 @@
1
- Copyright (c) 2026 Ryan Lee (systemfsoftware)
2
-
3
- Apache License
1
+ Apache License
4
2
  Version 2.0, January 2004
5
3
  http://www.apache.org/licenses/
6
4
 
@@ -180,7 +178,7 @@ Apache License
180
178
  APPENDIX: How to apply the Apache License to your work.
181
179
 
182
180
  To apply the Apache License to your work, attach the following
183
- boilerplate notice, with the fields enclosed by brackets "[]"
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
184
182
  replaced with your own identifying information. (Don't include
185
183
  the brackets!) The text should be enclosed in the appropriate
186
184
  comment syntax for the file format. We also recommend that a
@@ -188,7 +186,7 @@ Apache License
188
186
  same "printed page" as the copyright notice for easier
189
187
  identification within third-party archives.
190
188
 
191
- Copyright 2026 Ryan Lee (systemfsoftware)
189
+ Copyright {yyyy} {name of copyright owner}
192
190
 
193
191
  Licensed under the Apache License, Version 2.0 (the "License");
194
192
  you may not use this file except in compliance with the License.
@@ -201,13 +199,3 @@ Apache License
201
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
200
  See the License for the specific language governing permissions and
203
201
  limitations under the License.
204
-
205
-
206
- ----------------------------------------------------------------------
207
- Third-party notices
208
-
209
- Portions of this software are derived from @stryker-mutator/vitest-runner
210
- v9.6.1 (upstream commit e1abfbe), part of StrykerJS
211
- (https://github.com/stryker-mutator/stryker-js), which is licensed under the
212
- Apache License, Version 2.0 — the same license this package is distributed
213
- under. The derived files have been modified.
package/README.md CHANGED
@@ -1,26 +1,80 @@
1
- # @systemfsoftware/stryker-js
1
+ # `@systemfsoftware/stryker-js`
2
2
 
3
- The mutation-testing language — the plugin kinds, capability ports, and schemas
4
- a mutation run is built from, with no platform. The Node host that runs a
5
- mutation test lives in `@systemfsoftware/stryker-js-engine`.
3
+ The Stryker mutation testing tool: the `stryker` executable, the run engine it
4
+ drives, and the configuration surface a project writes its options against.
6
5
 
7
6
  ## Install
8
7
 
9
- ```sh
10
- pnpm add @systemfsoftware/stryker-js
8
+ ```bash
9
+ pnpm add -D @systemfsoftware/stryker-js
11
10
  ```
12
11
 
13
- ## Entry point
12
+ ## Configure
14
13
 
15
- One specifier carries the whole vocabulary. The package entry
16
- enumerates every published symbol exactly once — concepts (Checker,
17
- Evaluator, ExitClass, Ignorer, Metrics, Module, Mutant, Plugin, Report,
18
- ReporterEvent, Run, Schema, TestRunner) are all imported from the root:
14
+ ```ts
15
+ // stryker.config.ts
16
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
17
+
18
+ export default defineConfig(({ isCi }) => ({
19
+ testRunner: 'vitest',
20
+ plugins: ['@systemfsoftware/stryker-js-vitest-runner'],
21
+ mutate: ['src/**/*.ts', '!src/**/*.test.ts'],
22
+ }))
23
+ ```
24
+
25
+ `defineConfig` is an identity function: it preserves literal types and accepts
26
+ an object, a promise, or a function receiving `ConfigEnv` (`command`,
27
+ `isDryRun`, `mode`, `isCi`). `mergeConfig` composes a preset with overrides —
28
+ records merge key by key, and a scalar or array (the default plugin globs among
29
+ them) replaces the default outright.
30
+
31
+ ## Run
32
+
33
+ ```bash
34
+ pnpm exec stryker run
35
+ ```
36
+
37
+ The **`command`** runner ships in the box: it shells out to a configured command
38
+ and reads its exit code.
39
+
40
+ Projects whose suites depend on a real module graph, DOM emulation, or per-test
41
+ coverage use the satellite `@systemfsoftware/stryker-js-vitest-runner` instead.
42
+
43
+ ## Program from Effect
19
44
 
20
45
  ```ts
21
- import { Mutant, ReporterEventSchema, StrykerOptionsSchema } from '@systemfsoftware/stryker-js'
46
+ import { NodeRuntime } from '@effect/platform-node'
47
+ import { strykerCell } from '@systemfsoftware/stryker-js'
48
+
49
+ NodeRuntime.runMain(strykerCell({ mutate: ['src/**/*.ts'] }))
50
+ ```
51
+
52
+ `strykerCell` is a lazy `Effect`, not a started promise. Callers that speak
53
+ promises import the wrapper instead:
54
+
55
+ ```ts
56
+ import { run } from '@systemfsoftware/stryker-js/promises'
57
+
58
+ const report = await run({ testRunner: 'command' })
22
59
  ```
23
60
 
61
+ ## Subpaths
62
+
63
+ | Subpath | What it is |
64
+ | --------------------- | ----------------------------------------------------------------- |
65
+ | `.` | Programmatic surface: Effect cells, layers and the run vocabulary |
66
+ | `./config` | `defineConfig`, `mergeConfig`, `ConfigEnv`, `StrykerConfig` |
67
+ | `./promises` | `run` — the same run, interpreted for promise callers |
68
+ | `./builtin-reporters` | The built-in reporter factories |
69
+ | `./plugin-loader` | Plugin discovery and worker-entry resolution |
70
+
71
+ ## Related
72
+
73
+ - [`@systemfsoftware/stryker-js-instrumenter`](../stryker-js-instrumenter) — AST mutation and the mutant vocabulary
74
+ - [`@systemfsoftware/stryker-js-plugin-interface`](../stryker-js-plugin-interface) — the plugin boundary: RPC groups, payload schemas, typed failures
75
+ - [`@systemfsoftware/stryker-js-vitest-runner`](../stryker-js-vitest-runner) — the Vitest-backed test runner
76
+ - [`@systemfsoftware/stryker-js-html-reporter`](../stryker-js-html-reporter) — the HTML report
77
+
24
78
  ## License
25
79
 
26
- Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js#readme).
80
+ Apache-2.0
@@ -0,0 +1,96 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Path from "effect/Path";
3
+ import { ExitClass, WorkerPluginKind } from "@systemfsoftware/stryker-js-plugin-interface";
4
+ import "effect/Option";
5
+ import * as S from "effect/Schema";
6
+ import { Schema } from "effect";
7
+ import * as HashMap from "effect/HashMap";
8
+ import { Ignorer } from "@systemfsoftware/stryker-ignorer-interface";
9
+ //#region src/Run.schema.d.ts
10
+ declare const TypeId: '~stryker/mutation-run/StageError';
11
+ declare const StageError_base: S.Class<StageError, S.TaggedStruct<"StageError", {
12
+ readonly stage: S.Literals<readonly ["prepare", "instrument", "dryRun", "dryRunNoTests", "mutationTest"]>;
13
+ readonly reason: S.String;
14
+ readonly cause: S.optional<S.Defect>;
15
+ readonly command: S.optional<S.String>;
16
+ }>, import("effect/Cause").YieldableError>;
17
+ declare class StageError extends StageError_base {
18
+ readonly [TypeId]: "~stryker/mutation-run/StageError";
19
+ get exitClass(): ExitClass;
20
+ get message(): string;
21
+ }
22
+ //#endregion
23
+ //#region src/Plugins.schema.d.ts
24
+ declare const PluginNotFoundError_base: Schema.Class<PluginNotFoundError, Schema.TaggedStruct<"PluginNotFoundError", {
25
+ readonly descriptor: Schema.String;
26
+ }>, import("effect/Cause").YieldableError>;
27
+ declare class PluginNotFoundError extends PluginNotFoundError_base {
28
+ readonly exitClass: 'ConfigError';
29
+ }
30
+ declare const PluginLoadFailedError_base: Schema.Class<PluginLoadFailedError, Schema.TaggedStruct<"PluginLoadFailedError", {
31
+ readonly descriptor: Schema.String;
32
+ readonly cause: Schema.Unknown;
33
+ }>, import("effect/Cause").YieldableError>;
34
+ declare class PluginLoadFailedError extends PluginLoadFailedError_base {
35
+ readonly exitClass: 'InternalError';
36
+ }
37
+ //#endregion
38
+ //#region src/Plugins.d.ts
39
+ type PluginKind = WorkerPluginKind | 'Evaluator';
40
+ interface WorkerPluginDescriptor<K extends WorkerPluginKind = WorkerPluginKind> {
41
+ readonly kind: K;
42
+ readonly name: string;
43
+ readonly workerEntry: string;
44
+ }
45
+ interface EvaluatorPluginDescriptor {
46
+ readonly kind: 'Evaluator';
47
+ readonly name: string;
48
+ }
49
+ type AnyWorkerPluginDescriptor = { [K in WorkerPluginKind]: WorkerPluginDescriptor<K>; }[WorkerPluginKind];
50
+ type AnyPluginDescriptor = AnyWorkerPluginDescriptor | EvaluatorPluginDescriptor;
51
+ type PluginDescriptorOf<K extends PluginKind> = Extract<AnyPluginDescriptor, {
52
+ readonly kind: K;
53
+ }>;
54
+ type PluginDescriptor<K extends PluginKind = PluginKind> = PluginDescriptorOf<K>;
55
+ interface WorkerPluginSource<K extends WorkerPluginKind = WorkerPluginKind> {
56
+ readonly kind: K;
57
+ readonly name: string;
58
+ readonly modulePath: string;
59
+ readonly workerEntry: string;
60
+ }
61
+ interface EvaluatorPluginSource {
62
+ readonly kind: 'Evaluator';
63
+ readonly name: string;
64
+ readonly modulePath: string;
65
+ }
66
+ type AnyWorkerPluginSource = { [K in WorkerPluginKind]: WorkerPluginSource<K>; }[WorkerPluginKind];
67
+ type PluginSource = AnyWorkerPluginSource | EvaluatorPluginSource;
68
+ interface PluginLoaderEntryLike {
69
+ readonly moduleName: string;
70
+ readonly plugins: readonly PluginDescriptor[] | undefined;
71
+ readonly schemaContribution: Record<string, unknown> | undefined;
72
+ }
73
+ interface PluginLoadPlan {
74
+ readonly schemaContributions: readonly Record<string, unknown>[];
75
+ readonly pluginsByKind: HashMap.HashMap<PluginKind, readonly PluginDescriptor[]>;
76
+ readonly pluginModulePaths: readonly string[];
77
+ readonly pluginSources: readonly PluginSource[];
78
+ readonly shadowings: readonly {
79
+ readonly kind: PluginKind;
80
+ readonly name: string;
81
+ readonly shadowedIndex: number;
82
+ readonly winnerIndex: number;
83
+ }[];
84
+ }
85
+ interface LoadedPlugins {
86
+ readonly schemaContributions: readonly Record<string, unknown>[];
87
+ readonly pluginsByKind: HashMap.HashMap<PluginKind, readonly PluginDescriptor[]>;
88
+ readonly pluginModulePaths: readonly string[];
89
+ readonly pluginSources: readonly PluginSource[];
90
+ readonly ignorers: readonly Ignorer[];
91
+ }
92
+ declare function loadPlugins(pluginDescriptors: readonly string[]): Effect.Effect<LoadedPlugins, PluginLoadFailedError, Path.Path>;
93
+ declare function create<K extends PluginKind>(pluginsByKind: HashMap.HashMap<PluginKind, readonly AnyPluginDescriptor[]>, kind: K, name: string): Effect.Effect<PluginDescriptorOf<K>, PluginNotFoundError>;
94
+ declare function createAll<K extends PluginKind>(pluginsByKind: HashMap.HashMap<PluginKind, readonly AnyPluginDescriptor[]>, kind: K): Effect.Effect<readonly PluginDescriptorOf<K>[]>;
95
+ //#endregion
96
+ export { PluginLoadPlan as a, create as c, PluginLoadFailedError as d, PluginNotFoundError as f, PluginKind as i, createAll as l, PluginDescriptor as n, PluginLoaderEntryLike as o, StageError as p, PluginDescriptorOf as r, PluginSource as s, LoadedPlugins as t, loadPlugins as u };