@systemfsoftware/stryker-js 5.0.0 → 6.1.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 +68 -0
- package/README.md +144 -39
- package/dist/Plugins-DF95m9KO.d.mts +1400 -0
- package/dist/{builtin-reporters-wAuKFSsd.mjs → builtin-reporters-BqePgAN0.mjs} +3 -4
- package/dist/builtin-reporters.d.mts +299 -1
- package/dist/builtin-reporters.mjs +3 -2
- package/dist/compiler-C8aLIb5U.mjs +48406 -0
- package/dist/config.d.mts +2 -1
- package/dist/dist-CWbipfGB.mjs +711 -0
- package/dist/index-BInJWa0x.d.mts +1148 -0
- package/dist/index.d.mts +2538 -312
- package/dist/index.mjs +4 -3
- package/dist/main.mjs +499 -1893
- package/dist/{mutation-test.cell-RmF-sBUm.d.mts → mutation-test.cell-Cw1ZzDnb.d.mts} +70 -18
- package/dist/plugin-loader.d.mts +1577 -10
- package/dist/plugin-loader.mjs +3 -2
- package/dist/{plugin-worker-entry-DNu0SHO8.mjs → plugin-worker-entry-D00fedxV.mjs} +356 -184
- package/dist/promises.d.mts +2 -2
- package/dist/promises.mjs +1 -1
- package/dist/rolldown-runtime-XITHOX9H.mjs +15 -0
- package/dist/src-BoVgxGWD.mjs +12466 -0
- package/dist/src-js-DRK8boNV.mjs +1009 -0
- package/dist/{stryker-config-BlfHxS7n.d.mts → stryker-config-DIGmQrm1.d.mts} +2 -2
- package/package.json +35 -13
- package/dist/Plugins-sA_9VKus.d.mts +0 -96
- package/dist/src-Bzh7ykDp.mjs +0 -4724
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js
|
|
2
2
|
|
|
3
|
+
## 6.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Types that appear on the published CLI and instrumenter APIs are now exported.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Installing the CLI no longer nests the HTML reporter, plugin-interface, plugin-runtime, instrumenter, or ignorer-interface packages. The CLI still includes the HTML reporter. Those packages remain installable on their own.
|
|
12
|
+
|
|
13
|
+
- Installing the CLI no longer depends on minimatch. mutate and ignorePatterns still accept the same glob syntax.
|
|
14
|
+
|
|
15
|
+
## 6.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- `testRunner`, `checkers`, and `ignorers` now carry the plugin and its options together.
|
|
20
|
+
|
|
21
|
+
- `testRunner` is `'command'`, `'vm'`, or `{ plugin, options?, nodeArgs? }`.
|
|
22
|
+
- `checkers` is `{ plugin, options?, nodeArgs? }[]`. Each checker is its own plugin.
|
|
23
|
+
- `ignorers` is plugin file URLs. Every ignorer those modules export runs. There is no separate name list.
|
|
24
|
+
- Put Vitest settings on `testRunner.options` (`configFile`, `dir`, `related`). There is no `vitest` block.
|
|
25
|
+
- Put TypeScript checker settings on that checker's `options` (`prioritizePerformanceOverAccuracy`). There is no `typescriptChecker` block.
|
|
26
|
+
|
|
27
|
+
Before:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
testRunner: 'vitest',
|
|
32
|
+
checkers: ['typescript'],
|
|
33
|
+
plugins: [
|
|
34
|
+
import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
|
|
35
|
+
import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
|
|
36
|
+
import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
|
|
37
|
+
],
|
|
38
|
+
vitest: { configFile: 'vitest.config.ts' },
|
|
39
|
+
typescriptChecker: { prioritizePerformanceOverAccuracy: true },
|
|
40
|
+
ignorers: ['effect-schema-declarations'],
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
After:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
testRunner: {
|
|
49
|
+
plugin: import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
|
|
50
|
+
options: { configFile: 'vitest.config.ts' },
|
|
51
|
+
},
|
|
52
|
+
checkers: [
|
|
53
|
+
{
|
|
54
|
+
plugin: import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
|
|
55
|
+
options: { prioritizePerformanceOverAccuracy: true },
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
ignorers: [
|
|
59
|
+
import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
|
|
60
|
+
],
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Unix worker sockets are now owner-read-write once the worker has bound them. Named pipes are unchanged.
|
|
67
|
+
|
|
68
|
+
- Updated dependencies:
|
|
69
|
+
- @systemfsoftware/stryker-js-plugin-interface@6.0.0
|
|
70
|
+
|
|
3
71
|
## 5.0.0
|
|
4
72
|
|
|
5
73
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# `@systemfsoftware/stryker-js`
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
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
|
-
##
|
|
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(
|
|
29
|
+
export default defineConfig({
|
|
19
30
|
testRunner: 'vitest',
|
|
20
|
-
|
|
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
|
-
`
|
|
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
|
-
|
|
110
|
+
Deeply merges configuration presets. Keys in records merge recursively; scalar values and arrays in `overrides` completely replace base values:
|
|
32
111
|
|
|
33
|
-
```
|
|
34
|
-
|
|
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
|
-
|
|
38
|
-
and reads its exit code.
|
|
122
|
+
## CLI Usage and Flags
|
|
39
123
|
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
##
|
|
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({
|
|
152
|
+
NodeRuntime.runMain(strykerCell({
|
|
153
|
+
mutate: ['src/**/*.ts'],
|
|
154
|
+
testRunner: 'command',
|
|
155
|
+
}))
|
|
50
156
|
```
|
|
51
157
|
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
165
|
+
const verdict = await run({
|
|
166
|
+
testRunner: 'command',
|
|
167
|
+
commandRunner: { command: 'pnpm test' },
|
|
168
|
+
})
|
|
62
169
|
|
|
63
|
-
|
|
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
|
-
##
|
|
173
|
+
## Published Subpaths
|
|
72
174
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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)
|