@systemfsoftware/stryker-js 4.0.0 → 6.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 (45) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +3 -15
  3. package/README.md +172 -13
  4. package/dist/Plugins-DF95m9KO.d.mts +1400 -0
  5. package/dist/builtin-reporters-BqePgAN0.mjs +671 -0
  6. package/dist/builtin-reporters.d.mts +312 -0
  7. package/dist/builtin-reporters.mjs +3 -0
  8. package/dist/compiler-Bq9Nelu8.mjs +48406 -0
  9. package/dist/compiler-C8aLIb5U.mjs +48406 -0
  10. package/dist/config.d.mts +12 -0
  11. package/dist/config.mjs +7 -0
  12. package/dist/dist-B3nT7z4G.mjs +5155 -0
  13. package/dist/dist-CWbipfGB.mjs +711 -0
  14. package/dist/execAsync-CfPZgJSD.mjs +10 -0
  15. package/dist/execAsync-DdCu5QLN.mjs +10 -0
  16. package/dist/getMachineId-bsd-C6bLIaiv.mjs +27 -0
  17. package/dist/getMachineId-bsd-CXSiHDga.mjs +27 -0
  18. package/dist/getMachineId-darwin-D3cIKeqx.mjs +24 -0
  19. package/dist/getMachineId-darwin-DPZ0kdKD.mjs +24 -0
  20. package/dist/getMachineId-linux-CQwLSlZk.mjs +20 -0
  21. package/dist/getMachineId-linux-Ci8OVJU0.mjs +20 -0
  22. package/dist/getMachineId-unsupported-PX0hnW6X.mjs +15 -0
  23. package/dist/getMachineId-unsupported-_ExL3Avl.mjs +15 -0
  24. package/dist/getMachineId-win-BCsS9pC_.mjs +26 -0
  25. package/dist/getMachineId-win-D9Tb0p7w.mjs +26 -0
  26. package/dist/index-BInJWa0x.d.mts +1148 -0
  27. package/dist/index.d.mts +2570 -938
  28. package/dist/index.mjs +4 -1034
  29. package/dist/main.mjs +102939 -0
  30. package/dist/merge-config-BrrNQWje.mjs +16 -0
  31. package/dist/mutation-test.cell-Cw1ZzDnb.d.mts +561 -0
  32. package/dist/output-mode-CfGHDpi5.d.mts +17 -0
  33. package/dist/parser.wasm32-wasi.wasm +0 -0
  34. package/dist/plugin-loader.d.mts +1673 -0
  35. package/dist/plugin-loader.mjs +3 -0
  36. package/dist/plugin-worker-entry-D00fedxV.mjs +1585 -0
  37. package/dist/promises.d.mts +5 -0
  38. package/dist/promises.mjs +14 -0
  39. package/dist/rolldown-runtime-Dr7-SnC6.mjs +45 -0
  40. package/dist/rolldown-runtime-XITHOX9H.mjs +15 -0
  41. package/dist/src-fju4cI5I.mjs +12466 -0
  42. package/dist/src-js-DRK8boNV.mjs +1009 -0
  43. package/dist/stryker-config-DIGmQrm1.d.mts +14 -0
  44. package/dist/wasm-Dr7kZatW.mjs +13017 -0
  45. package/package.json +101 -39
package/CHANGELOG.md CHANGED
@@ -1,5 +1,134 @@
1
1
  # @systemfsoftware/stryker-js
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - `testRunner`, `checkers`, and `ignorers` now carry the plugin and its options together.
8
+
9
+ - `testRunner` is `'command'`, `'vm'`, or `{ plugin, options?, nodeArgs? }`.
10
+ - `checkers` is `{ plugin, options?, nodeArgs? }[]`. Each checker is its own plugin.
11
+ - `ignorers` is plugin file URLs. Every ignorer those modules export runs. There is no separate name list.
12
+ - Put Vitest settings on `testRunner.options` (`configFile`, `dir`, `related`). There is no `vitest` block.
13
+ - Put TypeScript checker settings on that checker's `options` (`prioritizePerformanceOverAccuracy`). There is no `typescriptChecker` block.
14
+
15
+ Before:
16
+
17
+ ```ts
18
+ export default defineConfig({
19
+ testRunner: 'vitest',
20
+ checkers: ['typescript'],
21
+ plugins: [
22
+ import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
23
+ import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
24
+ import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
25
+ ],
26
+ vitest: { configFile: 'vitest.config.ts' },
27
+ typescriptChecker: { prioritizePerformanceOverAccuracy: true },
28
+ ignorers: ['effect-schema-declarations'],
29
+ })
30
+ ```
31
+
32
+ After:
33
+
34
+ ```ts
35
+ export default defineConfig({
36
+ testRunner: {
37
+ plugin: import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
38
+ options: { configFile: 'vitest.config.ts' },
39
+ },
40
+ checkers: [
41
+ {
42
+ plugin: import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
43
+ options: { prioritizePerformanceOverAccuracy: true },
44
+ },
45
+ ],
46
+ ignorers: [
47
+ import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
48
+ ],
49
+ })
50
+ ```
51
+
52
+ ### Patch Changes
53
+
54
+ - Unix worker sockets are now owner-read-write once the worker has bound them. Named pipes are unchanged.
55
+
56
+ - Updated dependencies:
57
+ - @systemfsoftware/stryker-js-plugin-interface@6.0.0
58
+
59
+ ## 5.0.0
60
+
61
+ ### Major Changes
62
+
63
+ - Plugin entries in `plugins` and `appendPlugins` are now the entrypoints
64
+ themselves, as `file:` URLs, instead of package names Stryker resolved for you.
65
+
66
+ Stryker resolved every specifier against its own module before, so a plugin the
67
+ project had installed was only found when Node happened to walk to the right
68
+ `node_modules` from Stryker's location — which is not the project's location for
69
+ a global install, an `npx` run, or a strict isolated store. The project now
70
+ resolves each plugin itself, in the config module where the project's own
71
+ dependencies are visible:
72
+
73
+ ```ts
74
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
75
+
76
+ export default defineConfig({
77
+ plugins: [import.meta.resolve('@acme/stryker-runner')],
78
+ })
79
+ ```
80
+
81
+ The `--plugins` and `--appendPlugins` flags take the same resolved URLs. A value
82
+ that is not a `file:` URL is refused with the entry named.
83
+
84
+ Stryker no longer reports an unresolved specifier as a warning it can continue
85
+ past, because it no longer resolves one: a plugin that cannot be loaded stops
86
+ the run and names the entry, and a plugin that loads but contributes nothing is
87
+ still reported as before.
88
+
89
+ - The engine and the CLI are one package. `@systemfsoftware/stryker-js` now ships
90
+ the `stryker` binary, the run engine, and the configuration surface, replacing
91
+ `@systemfsoftware/stryker-js-cli` and `@systemfsoftware/stryker-js-engine`, which
92
+ are discontinued.
93
+
94
+ Two subpaths are new:
95
+
96
+ - `./config` — `defineConfig`, `mergeConfig`, `ConfigEnv`, `StrykerConfig`. Use it
97
+ instead of hand-typing `stryker.config.ts` against the option type.
98
+ - `./promises` — `run`, the same run interpreted for promise callers, so an
99
+ embedding script does not need an Effect runtime.
100
+
101
+ Migrate by importing from `@systemfsoftware/stryker-js`. Everything the two
102
+ discontinued packages exported — the option type, `readConfig`, the plugin
103
+ loader, `WorkerLauncher`, and the exit classification — keeps its name and its
104
+ behavior at the new address.
105
+
106
+ `@systemfsoftware/stryker-js-language` is gone; it is replaced rather than
107
+ continued. The run-event vocabulary it was carrying — `RunEvents`, `RunIdentity`,
108
+ `RunPhase`, and the `Run*` event schemas — now ships from
109
+ `@systemfsoftware/stryker-js`. Two consequences follow for anyone who imported
110
+ it:
111
+
112
+ - The mutant model, the report schemas, and the checker, evaluator and
113
+ test-runner contracts come from `@systemfsoftware/stryker-js-instrumenter`
114
+ and `@systemfsoftware/stryker-js-plugin-interface`. Update those imports.
115
+ - The service identifiers `@systemfsoftware/stryker-js-language/RunEvents` and
116
+ `@systemfsoftware/stryker-js-language/RunIdentity` are now
117
+ `@systemfsoftware/stryker-js/RunEvents` and
118
+ `@systemfsoftware/stryker-js/RunEvents/RunIdentity`. A program that provides or
119
+ looks up either service by its identifier string must use the new one.
120
+
121
+ Two more changes reach programmatic callers:
122
+
123
+ - `testRunner: 'vm'` runs the test suite in memory. Stryker strips TypeScript from
124
+ the test files during preparation and evaluates them in a fresh V8 context per
125
+ mutant, so a run needs no child process and no manual bundling.
126
+ - `readConfig` and `resolveExtends` take the invocation a configuration is being
127
+ read for, so a `stryker.config.ts` may export a factory receiving
128
+ `{ command, isDryRun, mode, isCi }` and compute its settings per invocation.
129
+ Both keep working for a plain exported object; the extra argument is the
130
+ `command` and output `mode` the loader cannot see for itself.
131
+
3
132
  ## 4.0.0
4
133
 
5
134
  ### 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,185 @@
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 modern mutation testing framework for JavaScript and TypeScript.
4
+ A ground-up, breaking-change fork of `@stryker-mutator/core` built with Effect 4:
5
+ provides the `stryker` executable, in-memory V8 and isolated Vitest runners,
6
+ and the typed `./config` authoring surface.
6
7
 
7
8
  ## Install
8
9
 
9
- ```sh
10
- pnpm add @systemfsoftware/stryker-js
10
+ ```bash
11
+ pnpm add -D @systemfsoftware/stryker-js
11
12
  ```
12
13
 
13
- ## Entry point
14
+ ## Quick Start: Vitest Runner
14
15
 
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:
16
+ For TypeScript codebases using Vitest:
17
+
18
+ ```bash
19
+ pnpm add -D @systemfsoftware/stryker-js \
20
+ @systemfsoftware/stryker-js-vitest-runner \
21
+ @systemfsoftware/stryker-js-typescript-checker
22
+ ```
23
+
24
+ Create `stryker.config.ts` in your project root:
25
+
26
+ ```ts
27
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
28
+
29
+ export default defineConfig({
30
+ testRunner: 'vitest',
31
+ checkers: ['typescript'],
32
+ plugins: [
33
+ import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
34
+ import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
35
+ ],
36
+ mutate: [
37
+ 'src/**/*.ts',
38
+ '!src/**/*.test.ts',
39
+ '!src/**/*.d.ts',
40
+ ],
41
+ thresholds: {
42
+ high: 90,
43
+ low: 70,
44
+ break: 80,
45
+ },
46
+ })
47
+ ```
48
+
49
+ Run mutation testing:
50
+
51
+ ```bash
52
+ pnpm exec stryker run
53
+ ```
54
+
55
+ ## Zero-Plugin Built-in Runners
56
+
57
+ ### 1. Shell Command Runner (`testRunner: 'command'`)
58
+
59
+ Execute any test suite without extra plugins:
60
+
61
+ ```ts
62
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
63
+
64
+ export default defineConfig({
65
+ testRunner: 'command',
66
+ commandRunner: {
67
+ command: 'npm test',
68
+ },
69
+ mutate: ['src/**/*.ts', '!src/**/*.test.ts'],
70
+ })
71
+ ```
72
+
73
+ ### 2. In-Memory V8 VM Runner (`testRunner: 'vm'`)
74
+
75
+ Run pure unit tests directly inside Node's native V8 VM with zero process spawning overhead:
76
+
77
+ ```ts
78
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
79
+
80
+ export default defineConfig({
81
+ testRunner: 'vm',
82
+ testFiles: ['test/**/*.test.ts'],
83
+ mutate: ['src/**/*.ts', '!src/**/*.test.ts'],
84
+ })
85
+ ```
86
+
87
+ ## Configuration API (`@systemfsoftware/stryker-js/config`)
88
+
89
+ The `./config` subpath exports lightweight, inert TypeScript configuration helpers:
90
+
91
+ ```ts
92
+ import { defineConfig, mergeConfig } from '@systemfsoftware/stryker-js/config'
93
+ ```
94
+
95
+ ### `defineConfig(options | configFactory)`
96
+
97
+ Identity function providing strict autocompletion and type checking without runtime dependencies. Can take a configuration object or a factory receiving `ConfigEnv`:
19
98
 
20
99
  ```ts
21
- import { Mutant, ReporterEventSchema, StrykerOptionsSchema } from '@systemfsoftware/stryker-js'
100
+ export default defineConfig(({ isCi, command }) => ({
101
+ testRunner: 'vitest',
102
+ plugins: [import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner')],
103
+ mutate: ['src/**/*.ts', '!src/**/*.test.ts'],
104
+ concurrency: isCi ? 2 : 4,
105
+ }))
22
106
  ```
23
107
 
108
+ ### `mergeConfig(base, overrides)`
109
+
110
+ Deeply merges configuration presets. Keys in records merge recursively; scalar values and arrays in `overrides` completely replace base values:
111
+
112
+ ```ts
113
+ import { mergeConfig } from '@systemfsoftware/stryker-js/config'
114
+ import baseConfig from './stryker.base.config.ts'
115
+
116
+ export default mergeConfig(baseConfig, {
117
+ concurrency: 8,
118
+ mutate: ['packages/core/src/**/*.ts'],
119
+ })
120
+ ```
121
+
122
+ ## CLI Usage and Flags
123
+
124
+ ```bash
125
+ # Run mutation testing
126
+ pnpm exec stryker run [options]
127
+
128
+ # Mutate specific files only
129
+ pnpm exec stryker run --mutate "src/auth/*.ts"
130
+
131
+ # Re-test only surviving mutants from prior run
132
+ pnpm exec stryker run --survivors
133
+
134
+ # Enable incremental caching
135
+ pnpm exec stryker run --incremental
136
+
137
+ # Run with specific concurrency
138
+ pnpm exec stryker run --concurrency 4
139
+
140
+ # Merge partial mutation reports from parallel CI shards
141
+ pnpm exec stryker merge-reports --output reports/mutation/mutation.json "reports/shards/*.json"
142
+ ```
143
+
144
+ ## Programmatic API
145
+
146
+ ### Effect 4 Native Interface
147
+
148
+ ```ts
149
+ import { NodeRuntime } from '@effect/platform-node'
150
+ import { strykerCell } from '@systemfsoftware/stryker-js'
151
+
152
+ NodeRuntime.runMain(strykerCell({
153
+ mutate: ['src/**/*.ts'],
154
+ testRunner: 'command',
155
+ }))
156
+ ```
157
+
158
+ ### Vanilla Promise Interface (`./promises`)
159
+
160
+ For non-Effect environments:
161
+
162
+ ```ts
163
+ import { run } from '@systemfsoftware/stryker-js/promises'
164
+
165
+ const verdict = await run({
166
+ testRunner: 'command',
167
+ commandRunner: { command: 'pnpm test' },
168
+ })
169
+
170
+ console.log(`Mutation score: ${verdict.score}%`)
171
+ ```
172
+
173
+ ## Published Subpaths
174
+
175
+ | Subpath | Description |
176
+ | --------------------- | ---------------------------------------------------------------------------- |
177
+ | `.` | Main entry point: `strykerCell`, runtime layers, and error schemas |
178
+ | `./config` | `defineConfig`, `mergeConfig`, and `StrykerConfig` typing |
179
+ | `./promises` | `run()` wrapper returning standard JavaScript promises |
180
+ | `./builtin-reporters` | Built-in reporter implementations (`clear-text`, `progress`, `json`, `html`) |
181
+ | `./plugin-loader` | Worker entry resolution and plugin discovery |
182
+
24
183
  ## License
25
184
 
26
- Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-js/stryker-js#readme).
185
+ [Apache-2.0](../../LICENSE)