@systemfsoftware/stryker-js-typescript-checker 8.2.1 → 10.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 +70 -0
- package/README.md +69 -4
- package/dist/index.d.mts +7 -7
- package/dist/main.mjs +10945 -7023
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/runtime.d.mts +32 -13
- package/dist/runtime.mjs +44 -1583
- package/dist/type-query.d.mts +12 -0
- package/dist/type-query.handle-DrgF8cok.mjs +3551 -0
- package/dist/type-query.mjs +2 -0
- package/package.json +38 -28
- package/schema/typescript-checker-options.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-typescript-checker
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
The package manifest's `inlinedDependencies` now names the effect 4.1.2 the checker bundles. It had said 4.1.4, a version the workspace pins away from.
|
|
6
|
+
|
|
7
|
+
Check the TypeScript checker against frozen real source files in its own test suite, in place of the checker-parity lane.
|
|
8
|
+
|
|
9
|
+
`effect` is a peer dependency (`^4.1.2`) of every package whose library entry points import it, so a consumer's schemas, layers and errors and these packages' share one effect instance.
|
|
10
|
+
|
|
11
|
+
- cli-contract, plugin-interface, instrumenter, typescript-checker and plugin-runtime declared `effect` as a dependency. A consumer on another 4.1.x got a second copy, and the contract's `ShardPlan` no longer type-checked against the consumer's effect. They now peer on it; install `effect` yourself.
|
|
12
|
+
- stryker-js and the html-reporter already peered on `effect`; the floor rises from 4.1.0 to 4.1.2, the version these packages are built and tested with.
|
|
13
|
+
|
|
14
|
+
The processes Stryker starts are unchanged: the CLI (`main.mjs`), the TypeScript checker's worker and the vitest runner's worker bundle their own effect 4.1.2. The flake package `stryker-package` now declares `effect` itself.
|
|
15
|
+
|
|
16
|
+
The install section names `pnpm add` and the npm packages instead of the flake. The workspace takes the released packages it dogfoods from npm; no published manifest changes.
|
|
17
|
+
|
|
18
|
+
## 9.0.1
|
|
19
|
+
|
|
20
|
+
Updated dependency @systemfsoftware/stryker-js to 21.0.0
|
|
21
|
+
|
|
22
|
+
## 9.0.0
|
|
23
|
+
|
|
24
|
+
Build on effect 4.1.0. effect 4.1.0 removed the `effect/Crypto` module, which the published stryker-js and stryker-js-vitest-runner imported, so a mutation run on effect 4.1.0 failed with ERR_MODULE_NOT_FOUND. Both packages now take random identifiers from `effect/crypto/SecureRandom` (`NodeCrypto.layerSecureRandom`), and the effect peer range is now `^4.1.0`: `effect/crypto/*` does not exist in 4.0.x. Schema classes are branded as @effect/tsgo 0.63.0 requires, the MCP server registers its toolkit through the stdio transport's `registrations` option with a middleware that provides the engine services to each request, and file identity in the case-sensitivity probe is a bigint, as effect 4.1.0 reports it.
|
|
25
|
+
|
|
26
|
+
No change to the published packages. The repository's own mutation run of these three packages now grades workflow files only, not schema files.
|
|
27
|
+
|
|
28
|
+
Breaking: `CheckerRuntime.layer(options)` from the `./runtime` entry is removed. Build the same Layer with `TypeScriptCheckerRuntime.layer(options)`, exported from `./runtime` next to `CheckerRuntime`; it provides `CheckerRuntime` and `TypeScriptCompiler` with the same requirements as before. `TypeScriptCheckerRuntime.make(compiler)` builds the checker service on its own. `./runtime` now also exports the `TSCompiler` type that `make` and `nodes` take.
|
|
29
|
+
|
|
30
|
+
`TypeQuery.TypeQueryRefused.version` is the version of the request that was refused. A request for a version a checker does not serve is refused with that version and reason `unsupported-version`, so a caller reads the version it asked for from the refusal instead of its message. The TypeScript checker answers the same way when it cannot open the requested project.
|
|
31
|
+
|
|
32
|
+
A check call that names the same mutant id more than once now fails with the tagged error `DuplicateMutantIds` (code `duplicate-mutant-ids`), whose message asks the caller to send each mutant id once per check call. Callers that sent repeated ids must deduplicate them before calling the checker.
|
|
33
|
+
|
|
34
|
+
Adds the `typescriptChecker.importerCheck` option. With `'location-rule'` (the default), a mutant that compiles in its own file skips re-checking the files that import it when the edit sits inside the body of a function whose declared signature does not depend on that body, in a TypeScript module with no `declare global`, `import()`, `require()` or import type in the edit, and no other project compiles the file except through `references` (the README lists every condition). Such mutants from different files share one snapshot update. `'always'` re-checks importers for every mutant that compiles in its own file and checks one mutant per update, as before. An invalid value, or any other key in the `typescriptChecker` block, fails the checker with `InvalidCheckerOptions` (code `invalid-checker-options`), whose message names the accepted values.
|
|
35
|
+
|
|
36
|
+
A type query whose TypeScript server stops answering is no longer left to hang. After a 30 second grace the query is abandoned, its file is refused as `query-timed-out`, and the server is discarded, so a file queried after it is answered on a fresh server and one wedged server cannot hold up the queries behind it. Opening a project that never finishes loading is bounded by the same grace: the request is refused as `project-open-failed` instead of holding up every query for every project.
|
|
37
|
+
|
|
38
|
+
Adds a provisional `./type-query` entry exposing `layer`, a `Layer` for the `TypeQuery` service of `@systemfsoftware/stryker-js-plugin-interface`, with one TypeScript server per `tsconfigFile`. Each candidate gets `Assignable`, `NotAssignable`, or `Unknown` with a reason. `NotAssignable` comes only where a declared type is enforced against the site: under an object spread or a non-null assertion, or on the right of `??`, `||` or `&&` when the left operand's type keeps that side out of the result, the answer is `Unknown` with reason `context-not-enforced`. A version-2 `function-body` site is `NotAssignable` when `undefined` cannot be the declared return type. The worker serves the same answers through the `typeQuery` RPC and declares versions 1 and 2 through `capabilities`.
|
|
39
|
+
|
|
40
|
+
## 8.3.2
|
|
41
|
+
|
|
42
|
+
A tsconfig `extends` that resolves through a package `exports` fallback array now uses the first listed file that exists, as TypeScript does. A `null` entry, including one inside a nested array, ends the whole list: files listed before it are still tried, files after it are not. Previously only the first listed file was considered, so when that file was absent the extended compiler options were dropped. A tsconfig `extends` that names a package now resolves the way TypeScript 7 does. When the package manifest declares `exports`, only the files `exports` lists are candidates. A config file named after the subpath, or the package's root config, is no longer used when `exports` leaves the subpath unmapped, points at a missing file, or has no active condition. The search then moves on to the same package in an outer `node_modules`. A condition whose file is missing now falls through to the next active condition, as in an `exports` array. Previously only the first active condition was tried. A `null` in `exports` ends the search entirely, outer `node_modules` included. An `exports` value of `null`, `false` or `""` still counts as absent. The program digest therefore follows the base config the compiler actually loads. A tsconfig `extends` that names a package without `exports` now picks the same base config as TypeScript 7. `<subpath>.json` comes before the config inside a `<subpath>` directory, a file named exactly `<subpath>` with no extension is never used, and inside a package directory the file its manifest names in a `tsconfig` field comes before that directory's own config. Previously the checker preferred the directory's config and ignored the `tsconfig` field, so the program digest could follow a base config the compiler doesn't load. The checker's equivalent-mutant detection no longer writes `.js` files next to your TypeScript sources. When your tsconfig reaches other sources through `paths` aliases or package imports, earlier versions left a compiled `.js` beside each of those files after a run. On the next run those files could change which tests ran.
|
|
43
|
+
|
|
44
|
+
If an earlier version left stray `.js` files beside your `.ts` sources, delete them. With OpenTelemetry enabled, each `typescript-checker.compiler.check` span now reports how much compiler work the check took: `typescript.snapshot_updates.count`, `typescript.resplices.count`, `typescript.tce_builds.count`, `typescript.tce.ms` and `typescript.importer_shortcut.count`, versioned by `typescript.counts.schema_version` (currently `1`). A `CompileError` reason now names the line and column where the error sits in that mutant's own code. When several mutants were checked together, an earlier mutant's reason could point at a position computed from a later mutant's code, so the reported line was wrong. The README now states the TypeScript floor the checker enforces: TypeScript `>=7.0.0`, not 5.x. Older compilers were already refused at startup.
|
|
45
|
+
|
|
46
|
+
Correction to the 8.1.0 notes: files that import a mutated file are not checked "only when the mutant changes what that file exports". They are re-checked whenever the mutated file has no compile errors of its own, whatever the mutant changed.
|
|
47
|
+
|
|
48
|
+
## 8.3.1
|
|
49
|
+
|
|
50
|
+
Only the package manifest changes: the development dependencies on stryker-js, its runner, its checker and the two ignorers now name the released tarballs instead of the npm `latest` tag. Runtime code, dependencies and peer dependencies are unchanged. The TypeScript checker now treats a `null` in a package's `exports` map the way TypeScript does when it resolves a tsconfig `extends`: a `null` reached inside a condition object or a nested array, or under an active condition such as `types`, excludes the subpath instead of falling through to the next entry. Before, the checker could pick a later entry that TypeScript never loads, so the program digest described a config the program did not use. The TypeScript checker now resolves a tsconfig `extends` that names a package subpath through that package's `exports` map, as TypeScript does. Before, the lookup only tried the literal path under `node_modules`; a package that maps the subpath elsewhere made the checker report no program digest, so no CompileError verdict in that project could be reused.
|
|
51
|
+
|
|
52
|
+
`stryker plan` now asks the checker for the program digest when the previous incremental report holds a CompileError verdict, and reuses those verdicts on the same terms as the run. Before, the plan always passed no digest and scheduled every CompileError mutant. With `inPlace: true` the plan still schedules them, because an in-place run digests the instrumented files. A checker that cannot produce a digest now logs a warning naming the checker, the project and the reason instead of failing silently. `Engine` exports `planRequest`.
|
|
53
|
+
|
|
54
|
+
## 8.3.0
|
|
55
|
+
|
|
56
|
+
A checker plugin must now report the program it loaded. `CheckerService` gains a
|
|
57
|
+
`digest` holding the digest of that program, the checker RPC exposes it as
|
|
58
|
+
`digest`, and a TypeScript checker answers with the digest of the TypeScript
|
|
59
|
+
program it built: the hashed content of every source file the program loaded
|
|
60
|
+
(project files, declaration files and the ones TypeScript ships), the tsconfig
|
|
61
|
+
files it was built from, the TypeScript version, the checker's own version, and
|
|
62
|
+
its configured options. The digest is stable for an unchanged program and moves
|
|
63
|
+
when any of those change.
|
|
64
|
+
|
|
65
|
+
Breaking for checker plugin authors: a checker worker that does not answer the
|
|
66
|
+
`digest` RPC no longer works with the engine. Add a `digest` handler that
|
|
67
|
+
returns the digest of everything your check reads. Effect moves to `4.0.0-rc.117`, together with the `@effect/*` packages these libraries use. Projects that install `effect` next to them need the same release.
|
|
68
|
+
|
|
69
|
+
- The TypeScript checker and test-runner workers now bundle their own runtime, so the only modules they load from your project are the TypeScript compiler and your test framework.
|
|
70
|
+
- The test-runner plugin supports the framework's fifth major release.
|
|
71
|
+
- The ignorer interface re-exports the `oxc-parser` 0.150 AST, in which `FormalParameterRest.decorators` is `Array<Decorator>`. Enable the `@effect/language-service` tsgo plugin in every source package's `tsconfig.app.json` and `tsconfig.test.json`, and bump `@effect/tsgo` to `^0.50.0`. This turns on Effect-aware diagnostics during `effect-tsgo` type checking; it changes no runtime behaviour or public API.
|
|
72
|
+
|
|
3
73
|
## 8.2.1
|
|
4
74
|
|
|
5
75
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](../../LICENSE)
|
|
4
4
|
[](https://www.npmjs.com/package/@systemfsoftware/stryker-js-typescript-checker)
|
|
5
5
|
|
|
6
|
-
TypeScript checker plugin for Stryker mutation testing
|
|
6
|
+
TypeScript checker plugin for Stryker mutation testing, built on the native TypeScript 7 compiler.
|
|
7
7
|
|
|
8
8
|
## Why Use a Type Checker Plugin?
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ The TypeScript checker intercepts mutants _before_ they reach the test runner. I
|
|
|
14
14
|
## Prerequisites
|
|
15
15
|
|
|
16
16
|
- Node.js `>=22.18.0`
|
|
17
|
-
- TypeScript `>=
|
|
17
|
+
- TypeScript `>=7.0.0`
|
|
18
18
|
- `@systemfsoftware/stryker-js` `>=5.0.0`
|
|
19
19
|
|
|
20
20
|
## Install
|
|
@@ -36,15 +36,80 @@ export default defineConfig({
|
|
|
36
36
|
})
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Options
|
|
40
|
+
|
|
41
|
+
Options go in a `typescriptChecker` block of the Stryker config. A key the block does not define, or a value it does not accept, fails the check with `invalid-checker-options`.
|
|
42
|
+
|
|
43
|
+
### `importerCheck`
|
|
44
|
+
|
|
45
|
+
`'location-rule'` (default) or `'always'`.
|
|
46
|
+
|
|
47
|
+
When a mutant compiles in its own file, the checker normally re-checks every file that imports that file, and every file of the program when the mutated file is a script or declares `declare global`. Under `'location-rule'` it skips that re-check when the edit cannot change any type another file sees:
|
|
48
|
+
|
|
49
|
+
- the edit sits inside the body of one function, method, constructor, accessor or arrow function;
|
|
50
|
+
- that function has an explicit return type annotation, or is a `set` accessor (a constructor never qualifies: an unannotated class property takes its type from the constructor's assignments, so a constructor body edit can change what importers see);
|
|
51
|
+
- the file is a TypeScript module with no `declare global`;
|
|
52
|
+
- the edit holds no `import()`, `require()` or `import("…")` type;
|
|
53
|
+
- no other project compiles the file: a project that includes or imports it without reaching its owner through `references` checks it under its own compiler options, so its errors in that file are read too.
|
|
54
|
+
|
|
55
|
+
All five must hold before and after the edit, and the function's header (everything before its body) must be unchanged. Mutants that meet the rule and sit in different files are checked together in one snapshot update. Under `isolatedDeclarations`, every exported function has an annotation, so the rule applies to most of its body edits.
|
|
56
|
+
|
|
57
|
+
`'always'` re-checks importers for every mutant that compiles in its own file and checks one mutant per snapshot update. Use it if you suspect a verdict is wrong. Changing the option changes the program digest, so incremental runs never mix verdicts from the two modes.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
checkers: ['typescript'],
|
|
62
|
+
plugins: ['@systemfsoftware/stryker-js-typescript-checker'],
|
|
63
|
+
typescriptChecker: { importerCheck: 'always' },
|
|
64
|
+
})
|
|
65
|
+
```
|
|
66
|
+
|
|
39
67
|
## In-process runtime (`./runtime`)
|
|
40
68
|
|
|
41
69
|
The default entry is the worker plugin Stryker loads from `plugins`, and that is all a normal setup needs. Tooling that drives the compiler itself — for example an oracle that instruments a project and hands the mutants to the real checker — can import the in-process runtime from the `./runtime` subpath instead:
|
|
42
70
|
|
|
43
71
|
```ts
|
|
44
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
CheckerRuntime,
|
|
74
|
+
nodes,
|
|
75
|
+
TypeScriptCheckerRuntime,
|
|
76
|
+
TypeScriptCompiler,
|
|
77
|
+
} from '@systemfsoftware/stryker-js-typescript-checker/runtime'
|
|
45
78
|
```
|
|
46
79
|
|
|
47
|
-
It publishes the
|
|
80
|
+
It publishes the `CheckerRuntime` service tag and its `CheckerRuntimeShape` type, the TypeScript-backed implementation as the `TypeScriptCheckerRuntime` namespace (`TypeScriptCheckerRuntime.layer(options)` builds the runtime Layer, and `TypeScriptCheckerRuntime.make(compiler)` builds the checker service it holds), the `TypeScriptCompiler` service tag, the `nodes` program-graph accessor, and the `TSCompiler` type both `make` and `nodes` take. Everything else stays behind the worker entry.
|
|
81
|
+
|
|
82
|
+
`CheckerRuntimeShape` carries three members:
|
|
83
|
+
|
|
84
|
+
- `checker` — the lazy checker service the worker resolves for `check`, `group` and `digest`.
|
|
85
|
+
- `capabilities` — the static `CheckerCapabilities` the checker declares, `{ typeQuery: [1, 2] }`.
|
|
86
|
+
- `typeQuery` — an `Effect<TypeQueryShape>` built on first use: the `./type-query` entry's `layer` is built into the runtime layer's scope when the effect first runs and closed with that scope, so `check`, `group` and `digest` never open a query server.
|
|
87
|
+
|
|
88
|
+
The checker worker serves both over the `Plugin.CheckerRpcs` group: `capabilities` answers the declaration for `"typescript"` without resolving the checker, and `typeQuery` delegates to the lazy `TypeQuery` service.
|
|
89
|
+
|
|
90
|
+
## Type query (`./type-query`)
|
|
91
|
+
|
|
92
|
+
Provisional: this entry changes shape when its consumer confirms it, and that change ships as an ordinary break.
|
|
93
|
+
|
|
94
|
+
`./type-query` exports `layer`, a `Layer` that implements the `TypeQuery` port from the `TypeQuery` namespace of `@systemfsoftware/stryker-js-plugin-interface`. It answers type queries on its own tsgo server, opened on first use per `tsconfigFile` and closed when the layer's scope closes.
|
|
95
|
+
|
|
96
|
+
A candidate is `NotAssignable` only where a declared type enforces the site's context. A site under an object spread or a non-null assertion, or on the right of `??`, `||` or `&&` when the left operand's type keeps that side out of the result, answers `Unknown` with reason `context-not-enforced`, because the checker never checks such a site against the context.
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { TypeQuery } from '@systemfsoftware/stryker-js-plugin-interface'
|
|
100
|
+
import * as TypeQueryTsgo from '@systemfsoftware/stryker-js-typescript-checker/type-query'
|
|
101
|
+
import * as Effect from 'effect/Effect'
|
|
102
|
+
|
|
103
|
+
const answered = Effect.scoped(
|
|
104
|
+
Effect.provide(
|
|
105
|
+
Effect.gen(function*() {
|
|
106
|
+
const query = yield* TypeQuery.TypeQuery
|
|
107
|
+
return yield* query.query(request)
|
|
108
|
+
}),
|
|
109
|
+
TypeQueryTsgo.layer,
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
```
|
|
48
113
|
|
|
49
114
|
## License
|
|
50
115
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/mod.d.ts
|
|
2
|
+
export declare const strykerPlugins: readonly {
|
|
3
|
+
readonly kind: 'Checker';
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly workerEntry: string;
|
|
6
|
+
}[];
|
|
7
|
+
//#endregion
|