@systemfsoftware/stryker-plugins 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ryan Lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @systemfsoftware/stryker-plugins
2
+
3
+ [Stryker](https://stryker-mutator.io) mutation-testing plugins for [Effect](https://effect.website).
4
+
5
+ ## `effect-schema-ignorer`
6
+
7
+ A Stryker **Ignore** plugin (`effect-schema-declarations`) that skips the _equivalent_ mutants on Effect `Schema` declarations — mutations that change source without changing behaviour, so no test can ever kill them. It recognizes and ignores:
8
+
9
+ - brand descriptions in `Symbol.for('…')`,
10
+ - `Schema.TaggedClass` / `Schema.TaggedError` `_tag` identifiers,
11
+ - the field schemas of those declarations.
12
+
13
+ Schema declarations are **data, not behaviour** (Constitution Article III §4) — mutating them produces unkillable equivalent mutants that drag a mutation score below 100% for no real coverage gap. This plugin removes that noise so the score reflects logic.
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ pnpm add -D @systemfsoftware/stryker-plugins
19
+ ```
20
+
21
+ In `stryker.config.json`:
22
+
23
+ ```jsonc
24
+ {
25
+ "plugins": [
26
+ "@stryker-mutator/vitest-runner",
27
+ "@stryker-mutator/typescript-checker",
28
+ "@systemfsoftware/stryker-plugins"
29
+ ],
30
+ "ignorers": ["effect-schema-declarations"]
31
+ }
32
+ ```
33
+
34
+ > [!NOTE]
35
+ > `@stryker-mutator/api` is a peer dependency — your Stryker install provides it. `effect` is a direct dependency (the plugin decodes AST nodes with `Schema`).
@@ -0,0 +1,68 @@
1
+ import { PluginKind, declareValuePlugin } from "@stryker-mutator/api/plugin";
2
+ import { Schema } from "effect";
3
+ //#region src/effect-schema-ignorer/ast-node.schema.ts
4
+ const Identifier = Schema.Struct({
5
+ type: Schema.Literal("Identifier"),
6
+ name: Schema.String
7
+ });
8
+ const StringLiteral = Schema.Struct({
9
+ type: Schema.Literal("StringLiteral"),
10
+ value: Schema.String
11
+ });
12
+ const ObjectExpression = Schema.Struct({ type: Schema.Literal("ObjectExpression") });
13
+ const UnknownNode = Schema.Struct({ type: Schema.String });
14
+ const MemberExpression = Schema.suspend(() => Schema.Struct({
15
+ type: Schema.Literal("MemberExpression"),
16
+ object: Schema.suspend(() => AstNode),
17
+ property: Schema.suspend(() => AstNode)
18
+ }));
19
+ const CallExpression = Schema.suspend(() => Schema.Struct({
20
+ type: Schema.Literal("CallExpression"),
21
+ callee: Schema.suspend(() => AstNode),
22
+ arguments: Schema.Array(Schema.suspend(() => AstNode))
23
+ }));
24
+ const AstNode = Schema.suspend(() => Schema.Union(Identifier, StringLiteral, ObjectExpression, MemberExpression, CallExpression, UnknownNode));
25
+ //#endregion
26
+ //#region src/effect-schema-ignorer/schema-declaration-ignore.ts
27
+ const SYMBOL_DESCRIPTION_IGNORED = "Symbol.for() brand description is identity-only data, not behaviour";
28
+ const TAGGED_TAG_IGNORED = "TaggedClass/TaggedError _tag is a declaration discriminant, not behaviour";
29
+ const TAGGED_FIELDS_IGNORED = "TaggedClass/TaggedError field schema is a declaration, not behaviour";
30
+ const TAGGED_FACTORIES = ["TaggedClass", "TaggedError"];
31
+ const isIdentifier = Schema.is(Identifier);
32
+ const isStringLiteral = Schema.is(StringLiteral);
33
+ const isObjectExpression = Schema.is(ObjectExpression);
34
+ const isMemberExpression = Schema.is(MemberExpression);
35
+ const isCallExpression = Schema.is(CallExpression);
36
+ const isNamedMember = (node, object, property) => isMemberExpression(node) && isIdentifier(node.object) && node.object.name === object && isIdentifier(node.property) && node.property.name === property;
37
+ const isSymbolForCallee = (callee) => isNamedMember(callee, "Symbol", "for");
38
+ const isTaggedFactoryReference = (reference) => isIdentifier(reference.property) && TAGGED_FACTORIES.includes(reference.property.name);
39
+ const isTaggedFactoryCallee = (callee) => isCallExpression(callee) && isMemberExpression(callee.callee) && isTaggedFactoryReference(callee.callee);
40
+ const isArgumentOf = (node, parent, index, calleeMatches) => isCallExpression(parent) && calleeMatches(parent.callee) && parent.arguments[index] === node;
41
+ const RULES = [
42
+ {
43
+ is: isStringLiteral,
44
+ argumentIndex: 0,
45
+ calleeMatches: isSymbolForCallee,
46
+ reason: SYMBOL_DESCRIPTION_IGNORED
47
+ },
48
+ {
49
+ is: isStringLiteral,
50
+ argumentIndex: 0,
51
+ calleeMatches: isTaggedFactoryCallee,
52
+ reason: TAGGED_TAG_IGNORED
53
+ },
54
+ {
55
+ is: isObjectExpression,
56
+ argumentIndex: 1,
57
+ calleeMatches: isTaggedFactoryCallee,
58
+ reason: TAGGED_FIELDS_IGNORED
59
+ }
60
+ ];
61
+ const decideSchemaDeclarationIgnore = (node, parent) => RULES.find((rule) => rule.is(node) && isArgumentOf(node, parent, rule.argumentIndex, rule.calleeMatches))?.reason;
62
+ //#endregion
63
+ //#region src/effect-schema-ignorer/index.ts
64
+ const strykerPlugins = [declareValuePlugin(PluginKind.Ignore, "effect-schema-declarations", { shouldIgnore(path) {
65
+ return decideSchemaDeclarationIgnore(path.node, path.parentPath?.node);
66
+ } })];
67
+ //#endregion
68
+ export { strykerPlugins as t };
@@ -0,0 +1,6 @@
1
+ import { PluginKind } from "@stryker-mutator/api/plugin";
2
+
3
+ //#region src/effect-schema-ignorer/index.d.ts
4
+ declare const strykerPlugins: import("@stryker-mutator/api/plugin").ValuePlugin<PluginKind.Ignore>[];
5
+ //#endregion
6
+ export { strykerPlugins };
@@ -0,0 +1,2 @@
1
+ import { t as strykerPlugins } from "./effect-schema-ignorer-CvcMxzYN.mjs";
2
+ export { strykerPlugins };
@@ -0,0 +1,4 @@
1
+ //#region src/mod.d.ts
2
+ declare const strykerPlugins: import("@stryker-mutator/api/plugin").ValuePlugin<import("@stryker-mutator/api/plugin").PluginKind.Ignore>[];
3
+ //#endregion
4
+ export { strykerPlugins };
package/dist/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ import { t as strykerPlugins$1 } from "./effect-schema-ignorer-CvcMxzYN.mjs";
2
+ //#region src/mod.ts
3
+ const strykerPlugins = [...strykerPlugins$1];
4
+ //#endregion
5
+ export { strykerPlugins };
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@systemfsoftware/stryker-plugins",
3
+ "license": "MIT",
4
+ "version": "0.1.0",
5
+ "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
9
+ "directory": "packages/stryker-plugins"
10
+ },
11
+ "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/stryker-plugins#readme",
12
+ "bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
13
+ "description": "Stryker mutation-testing plugins for Effect-TS — ignore equivalent mutants on Effect Schema declarations (brands, TaggedClass/TaggedError tags) so the score reflects behaviour, not data.",
14
+ "keywords": [
15
+ "stryker",
16
+ "stryker-mutator",
17
+ "mutation-testing",
18
+ "effect",
19
+ "effect-ts",
20
+ "schema",
21
+ "ignorer",
22
+ "equivalent-mutants",
23
+ "test-quality",
24
+ "typescript"
25
+ ],
26
+ "type": "module",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "exports": {
31
+ ".": "./dist/index.mjs",
32
+ "./effect-schema-ignorer": "./dist/effect-schema-ignorer.mjs",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "dependencies": {
36
+ "effect": "^3.21.2"
37
+ },
38
+ "devDependencies": {
39
+ "@babel/types": "^7.29.0",
40
+ "@effect/vitest": "0.29.0",
41
+ "@stryker-mutator/api": "^9.6.1",
42
+ "@stryker-mutator/core": "^9.6.1",
43
+ "@stryker-mutator/typescript-checker": "^9.6.1",
44
+ "@stryker-mutator/vitest-runner": "^9.6.1",
45
+ "@types/node": "^24",
46
+ "@vitest/coverage-v8": "^4",
47
+ "rimraf": "^6.1.3",
48
+ "tsdown": "^0.22.3",
49
+ "tstyche": "^7.1.0",
50
+ "typescript": "^6.0.3",
51
+ "vitest": "^4",
52
+ "@systemfsoftware/effect-schema-law": "^0.1.0",
53
+ "@systemfsoftware/tsconfig": "^1.0.0",
54
+ "@systemfsoftware/vitest-config": "^0.1.0",
55
+ "@systemfsoftware/oxlint-config": "^0.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "@stryker-mutator/api": "^9.6.1",
59
+ "typescript": ">=5.0.0"
60
+ },
61
+ "scripts": {
62
+ "build": "tsdown",
63
+ "clean": "rimraf dist",
64
+ "typecheck": "tsgo --noEmit --incremental",
65
+ "test": "vitest run",
66
+ "test:run": "vitest run --coverage",
67
+ "test:types": "tstyche",
68
+ "mutation": "stryker run --incremental",
69
+ "mutation:full": "stryker run",
70
+ "lint": "oxlint . ${AGENT:+--format=unix --quiet}"
71
+ }
72
+ }