@systemfsoftware/stryker-js-vitest-runner 5.0.0 → 7.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 +64 -0
- package/README.md +59 -16
- package/dist/index.d.mts +0 -8
- package/dist/index.mjs +1 -47
- package/dist/main.mjs +4534 -714
- package/dist/src-js-DRK8boNV.mjs +1009 -0
- package/dist/stryker-setup.mjs +2 -9
- package/package.json +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-vitest-runner
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- The runner now requires vitest 4.1 or later, and the peer dependency says so:
|
|
8
|
+
`vitest >=4.1.0`.
|
|
9
|
+
|
|
10
|
+
Upgrade vitest to 4.1 or later before upgrading this package. Projects that must
|
|
11
|
+
stay below 4.1 should stay on the previous release.
|
|
12
|
+
|
|
13
|
+
The published bundle now also inlines `oxc-parser` and `@eslint-community/regexpp`
|
|
14
|
+
so they ship inside the runner's install. Consumers that previously resolved those
|
|
15
|
+
packages as transitive dependencies from another tool should now take them from
|
|
16
|
+
the runner's published bundle.
|
|
17
|
+
|
|
18
|
+
## 6.0.0
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- `testRunner`, `checkers`, and `ignorers` now carry the plugin and its options together.
|
|
23
|
+
|
|
24
|
+
- `testRunner` is `'command'`, `'vm'`, or `{ plugin, options?, nodeArgs? }`.
|
|
25
|
+
- `checkers` is `{ plugin, options?, nodeArgs? }[]`. Each checker is its own plugin.
|
|
26
|
+
- `ignorers` is plugin file URLs. Every ignorer those modules export runs. There is no separate name list.
|
|
27
|
+
- Put Vitest settings on `testRunner.options` (`configFile`, `dir`, `related`). There is no `vitest` block.
|
|
28
|
+
- Put TypeScript checker settings on that checker's `options` (`prioritizePerformanceOverAccuracy`). There is no `typescriptChecker` block.
|
|
29
|
+
|
|
30
|
+
Before:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
testRunner: 'vitest',
|
|
35
|
+
checkers: ['typescript'],
|
|
36
|
+
plugins: [
|
|
37
|
+
import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
|
|
38
|
+
import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
|
|
39
|
+
import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
|
|
40
|
+
],
|
|
41
|
+
vitest: { configFile: 'vitest.config.ts' },
|
|
42
|
+
typescriptChecker: { prioritizePerformanceOverAccuracy: true },
|
|
43
|
+
ignorers: ['effect-schema-declarations'],
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
After:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
export default defineConfig({
|
|
51
|
+
testRunner: {
|
|
52
|
+
plugin: import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
|
|
53
|
+
options: { configFile: 'vitest.config.ts' },
|
|
54
|
+
},
|
|
55
|
+
checkers: [
|
|
56
|
+
{
|
|
57
|
+
plugin: import.meta.resolve('@systemfsoftware/stryker-js-typescript-checker'),
|
|
58
|
+
options: { prioritizePerformanceOverAccuracy: true },
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
ignorers: [
|
|
62
|
+
import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
|
|
63
|
+
],
|
|
64
|
+
})
|
|
65
|
+
```
|
|
66
|
+
|
|
3
67
|
## 5.0.0
|
|
4
68
|
|
|
5
69
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -1,34 +1,77 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-vitest-runner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](../../LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@systemfsoftware/stryker-js-vitest-runner)
|
|
5
|
+
|
|
6
|
+
Vitest test-runner plugin for Stryker mutation testing. Provides fast in-process sandboxing, per-test coverage tracking, and native TypeScript support.
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
- Node.js `>=22.18.0`
|
|
11
|
+
- Vitest `>=2.0.0`
|
|
12
|
+
- `@systemfsoftware/stryker-js` `>=5.0.0`
|
|
4
13
|
|
|
5
14
|
## Install
|
|
6
15
|
|
|
7
|
-
```
|
|
8
|
-
pnpm add @systemfsoftware/stryker-js-vitest-runner
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add -D @systemfsoftware/stryker-js-vitest-runner vitest
|
|
9
18
|
```
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
## Setup in `stryker.config.ts`
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
Plugins in Stryker 5.0 are resolved as `file:` URLs via `import.meta.resolve()`:
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
```ts
|
|
25
|
+
import { defineConfig } from '@systemfsoftware/stryker-js/config'
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
testRunner: 'vitest',
|
|
29
|
+
plugins: [
|
|
30
|
+
import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
|
|
31
|
+
],
|
|
32
|
+
mutate: [
|
|
33
|
+
'src/**/*.ts',
|
|
34
|
+
'!src/**/*.test.ts',
|
|
35
|
+
'!src/**/*.d.ts',
|
|
36
|
+
],
|
|
37
|
+
})
|
|
38
|
+
```
|
|
17
39
|
|
|
18
|
-
##
|
|
40
|
+
## How It Works
|
|
19
41
|
|
|
20
|
-
|
|
42
|
+
1. **Dry-run phase**: The Vitest runner executes your existing test suite, collecting per-test execution profiles and code coverage data.
|
|
43
|
+
2. **Mutant sandbox**: During the mutation test phase, worker processes run only the subset of tests that cover each mutant, terminating early on test failure to maximize speed.
|
|
44
|
+
3. **Vitest Config**: By default, Stryker automatically discovers your `vitest.config.ts` or `vite.config.ts`. If your configuration is located elsewhere, specify it in your config:
|
|
21
45
|
|
|
22
|
-
```
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
```ts
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
testRunner: 'vitest',
|
|
49
|
+
plugins: [import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner')],
|
|
50
|
+
vitest: {
|
|
51
|
+
configFile: 'vitest.unit.config.ts',
|
|
52
|
+
},
|
|
53
|
+
})
|
|
26
54
|
```
|
|
27
55
|
|
|
28
|
-
##
|
|
56
|
+
## In-Source Tests (`import.meta.vitest`)
|
|
29
57
|
|
|
30
|
-
|
|
58
|
+
If your project uses in-source testing with `if (import.meta.vitest)` blocks, add the companion ignorer plugin so unreachable test mutants are excluded from your score:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm add -D @systemfsoftware/stryker-ignorer-in-source-vitest-block
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
export default defineConfig({
|
|
66
|
+
testRunner: {
|
|
67
|
+
plugin: import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
|
|
68
|
+
},
|
|
69
|
+
ignorers: [
|
|
70
|
+
import.meta.resolve('@systemfsoftware/stryker-ignorer-in-source-vitest-block'),
|
|
71
|
+
],
|
|
72
|
+
})
|
|
73
|
+
```
|
|
31
74
|
|
|
32
75
|
## License
|
|
33
76
|
|
|
34
|
-
Apache-2.0
|
|
77
|
+
[Apache-2.0](../../LICENSE)
|
package/dist/index.d.mts
CHANGED
|
@@ -4,12 +4,4 @@ export declare const strykerPlugins: readonly {
|
|
|
4
4
|
readonly workerEntry: string;
|
|
5
5
|
}[];
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* The `vitest` option section as a JSON Schema document, for Stryker's option
|
|
9
|
-
* validation — derived from the declaration, never read from a file. It is built
|
|
10
|
-
* here, at the entry that contributes it, because a document is a *use* of a
|
|
11
|
-
* schema and the schema module exports only declarations.
|
|
12
|
-
*/
|
|
13
|
-
export declare const strykerValidationSchema: Record<string, unknown>;
|
|
14
|
-
|
|
15
7
|
export { }
|
package/dist/index.mjs
CHANGED
|
@@ -1,54 +1,8 @@
|
|
|
1
|
-
import * as S from "effect/Schema";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import * as Predicate from "effect/Predicate";
|
|
4
|
-
//#region src/Runner.schema.ts
|
|
5
|
-
const VitestRunnerOptionsSchema = S.Struct({
|
|
6
|
-
dir: S.optional(S.String),
|
|
7
|
-
related: S.optional(S.Boolean).pipe(S.withDecodingDefault(Effect.succeed(true))),
|
|
8
|
-
configFile: S.optional(S.String)
|
|
9
|
-
});
|
|
10
|
-
S.optional(VitestRunnerOptionsSchema).pipe(S.withDecodingDefault(Effect.succeed({ related: true })));
|
|
11
|
-
S.Struct({ hitCount: S.optional(S.Finite) });
|
|
12
|
-
S.Struct({ mutantCoverage: S.optional(S.Struct({
|
|
13
|
-
static: S.Record(S.String, S.Finite),
|
|
14
|
-
perTest: S.Record(S.String, S.Record(S.String, S.Finite))
|
|
15
|
-
})) });
|
|
16
|
-
S.Struct({
|
|
17
|
-
static: S.Record(S.String, S.Finite),
|
|
18
|
-
perTest: S.Record(S.String, S.Record(S.String, S.Finite))
|
|
19
|
-
});
|
|
20
|
-
S.TaggedError()("CoverageDecodeFailed", { cause: S.Unknown });
|
|
21
|
-
const ExportEntry = S.Union([S.String, S.Record(S.String, S.Unknown)]);
|
|
22
|
-
S.StructWithRest(S.Struct({
|
|
23
|
-
name: S.optional(S.String),
|
|
24
|
-
exports: S.optional(S.Record(S.String, ExportEntry))
|
|
25
|
-
}), [S.Record(S.String, S.Unknown)]);
|
|
26
|
-
S.declare((input) => Predicate.isObject(input), { description: "The project-local vitest/node module" });
|
|
27
|
-
S.Struct({ version: S.String });
|
|
28
|
-
S.TaggedClass()("VitestDryRunCommand", {
|
|
29
|
-
rawTests: S.Array(S.Unknown),
|
|
30
|
-
projectRoot: S.String,
|
|
31
|
-
hasExternalError: S.Boolean,
|
|
32
|
-
externalErrorText: S.String
|
|
33
|
-
});
|
|
34
|
-
S.TaggedClass()("Complete", { testsJson: S.String });
|
|
35
|
-
S.TaggedClass()("Error", {
|
|
36
|
-
testsJson: S.String,
|
|
37
|
-
errorMessage: S.String
|
|
38
|
-
});
|
|
39
|
-
//#endregion
|
|
40
1
|
//#region src/index.ts
|
|
41
2
|
const strykerPlugins = [{
|
|
42
3
|
kind: "TestRunner",
|
|
43
4
|
name: "vitest",
|
|
44
5
|
workerEntry: new URL("./main.mjs", import.meta.url).href
|
|
45
6
|
}];
|
|
46
|
-
/**
|
|
47
|
-
* The `vitest` option section as a JSON Schema document, for Stryker's option
|
|
48
|
-
* validation — derived from the declaration, never read from a file. It is built
|
|
49
|
-
* here, at the entry that contributes it, because a document is a *use* of a
|
|
50
|
-
* schema and the schema module exports only declarations.
|
|
51
|
-
*/
|
|
52
|
-
const strykerValidationSchema = S.toJsonSchemaDocument(S.Struct({ vitest: S.optional(VitestRunnerOptionsSchema) })).schema;
|
|
53
7
|
//#endregion
|
|
54
|
-
export { strykerPlugins
|
|
8
|
+
export { strykerPlugins };
|