test: add exploratory domain mutation testing

This commit is contained in:
murashit 2026-07-18 17:12:21 +09:00
parent 46ecf3addd
commit 760421613d
5 changed files with 1686 additions and 21 deletions

2
.gitignore vendored
View file

@ -1,4 +1,5 @@
node_modules/
.stryker-tmp/
.jj/
.codex/
main.js
@ -8,4 +9,5 @@ data.json
.DS_Store
dist/
coverage/
reports/
tmp/

View file

@ -9,6 +9,7 @@ npm ci
npm run fix
npm run check
npm run test:coverage
npm run test:mutation
```
Use the Node.js version in `.node-version`.
@ -17,6 +18,8 @@ Use `npm run fix` for mechanical cleanup, review its diff, and run `npm run chec
Use `npm run test:coverage` to identify source modules and branches that lack exercised behavior. It reports every authored TypeScript source file, including files not imported by tests, while excluding generated app-server bindings. Open `coverage/index.html` to inspect line-level gaps. Coverage is diagnostic and has no pass/fail threshold; prioritize user-visible behavior and state-transition invariants rather than raising the aggregate percentage.
Use `npm run test:mutation` for an exploratory mutation test of the domain-owned logic under `src/domain/` and `src/features/chat/domain/`. Review surviving mutants individually instead of treating the aggregate score as a quality gate: add tests for meaningful behavior gaps, simplify equivalent or redundant code, and leave mutants alone when neither change improves the durable contract. The run ignores expensive module-initialization mutants, is intentionally manual, and writes its ignored HTML report to `reports/mutation/mutation.html`.
## Commit Messages
Use [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) for new commits:

1691
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -37,12 +37,15 @@
"release:prepare": "node scripts/release/prepare.mjs",
"test": "vitest run --pool threads --maxWorkers 6",
"test:coverage": "vitest run --pool threads --maxWorkers 6 --coverage",
"test:mutation": "stryker run",
"typecheck": "tsc -p tsconfig.json --noEmit --incremental --tsBuildInfoFile node_modules/.cache/typescript/tsconfig.tsbuildinfo"
},
"devDependencies": {
"@biomejs/biome": "^2.5.3",
"@commitlint/cli": "^21.2.1",
"@commitlint/config-conventional": "^21.2.0",
"@stryker-mutator/core": "^9.6.1",
"@stryker-mutator/vitest-runner": "^9.6.1",
"@types/node": "^26.1.1",
"@vitest/coverage-v8": "^4.1.10",
"concurrently": "^10.0.3",

8
stryker.config.mjs Normal file
View file

@ -0,0 +1,8 @@
export default {
testRunner: "vitest",
coverageAnalysis: "perTest",
mutate: ["src/domain/**/*.ts", "src/features/chat/domain/**/*.ts"],
ignoreStatic: true,
incremental: true,
reporters: ["clear-text", "progress", "html"],
};