@systemfsoftware/stryker-js 5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
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
+
3
59
  ## 5.0.0
4
60
 
5
61
  ### Major Changes
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # `@systemfsoftware/stryker-js`
2
2
 
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.
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.
5
7
 
6
8
  ## Install
7
9
 
@@ -9,72 +11,175 @@ drives, and the configuration surface a project writes its options against.
9
11
  pnpm add -D @systemfsoftware/stryker-js
10
12
  ```
11
13
 
12
- ## Configure
14
+ ## Quick Start: Vitest Runner
15
+
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:
13
25
 
14
26
  ```ts
15
- // stryker.config.ts
16
27
  import { defineConfig } from '@systemfsoftware/stryker-js/config'
17
28
 
18
- export default defineConfig(({ isCi }) => ({
29
+ export default defineConfig({
19
30
  testRunner: 'vitest',
20
- plugins: ['@systemfsoftware/stryker-js-vitest-runner'],
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'],
21
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`:
98
+
99
+ ```ts
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,
22
105
  }))
23
106
  ```
24
107
 
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.
108
+ ### `mergeConfig(base, overrides)`
30
109
 
31
- ## Run
110
+ Deeply merges configuration presets. Keys in records merge recursively; scalar values and arrays in `overrides` completely replace base values:
32
111
 
33
- ```bash
34
- pnpm exec stryker run
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
+ })
35
120
  ```
36
121
 
37
- The **`command`** runner ships in the box: it shells out to a configured command
38
- and reads its exit code.
122
+ ## CLI Usage and Flags
39
123
 
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.
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
+ ```
42
143
 
43
- ## Program from Effect
144
+ ## Programmatic API
145
+
146
+ ### Effect 4 Native Interface
44
147
 
45
148
  ```ts
46
149
  import { NodeRuntime } from '@effect/platform-node'
47
150
  import { strykerCell } from '@systemfsoftware/stryker-js'
48
151
 
49
- NodeRuntime.runMain(strykerCell({ mutate: ['src/**/*.ts'] }))
152
+ NodeRuntime.runMain(strykerCell({
153
+ mutate: ['src/**/*.ts'],
154
+ testRunner: 'command',
155
+ }))
50
156
  ```
51
157
 
52
- `strykerCell` is a lazy `Effect`, not a started promise. Callers that speak
53
- promises import the wrapper instead:
158
+ ### Vanilla Promise Interface (`./promises`)
159
+
160
+ For non-Effect environments:
54
161
 
55
162
  ```ts
56
163
  import { run } from '@systemfsoftware/stryker-js/promises'
57
164
 
58
- const report = await run({ testRunner: 'command' })
59
- ```
60
-
61
- ## Subpaths
165
+ const verdict = await run({
166
+ testRunner: 'command',
167
+ commandRunner: { command: 'pnpm test' },
168
+ })
62
169
 
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 |
170
+ console.log(`Mutation score: ${verdict.score}%`)
171
+ ```
70
172
 
71
- ## Related
173
+ ## Published Subpaths
72
174
 
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
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 |
77
182
 
78
183
  ## License
79
184
 
80
- Apache-2.0
185
+ [Apache-2.0](../../LICENSE)