chore: Stryker mutation testing (opt-in, local only, never CI)#115
Merged
Conversation
Adds Stryker 9.6 with the command runner as an opt-in, local-only gate. CI is untouched by design; forks run npm test exactly as before. - npm run test:mutation (incremental - the pre-PR ritual), test:mutation:full (--force), STRYKER_MUTATE to scope to changed files. - The per-mutant command is a dedicated test:mutant script = the normal mocha suite plus --exit: a mutant that breaks teardown would otherwise leave open handles and turn every kill into a slow timeout. - concurrency is capped at 4: each command-runner mutant spawns a full ts-node/esm + mocha process, so default Stryker worker counts oversubscribe the CPU and turn every kill into a timeout. - ignorePatterns excludes sample (128M, incl. the Angular showcase), website (473M), docs, coverage, complexity, .tmp and dist so the per-mutant sandbox copies stay small. - Docs: new guidelines section 11 (mutation testing), README pointer, CHANGELOG Unreleased entry. Repo tooling only - nothing ships in the package, no release. Verified locally: scoped smoke run over param-metadata.util.ts + trpc-enhancer-runtime.factory.ts: 20 mutants, 14 killed, 4 timeout (hanging-mutant detections in specs that raise mocha timeouts), 2 survived, 0 errors, in 1m35s. npm run ci green (the Angular showcase ng build requires Node >=22.22.3 and was verified with the local v22.23.1; everything else ran on the standard toolchain). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📊
|
| Metric | PR | Base | Diff | |
|---|---|---|---|---|
| Statements | ████████████████████ |
664/664 (100%) |
664/664 (100%) |
⚪ 0% |
| Branches | ████████████████████ |
283/283 (100%) |
283/283 (100%) |
⚪ 0% |
| Functions | ████████████████████ |
122/122 (100%) |
122/122 (100%) |
⚪ 0% |
| Lines | ████████████████████ |
639/639 (100%) |
639/639 (100%) |
⚪ 0% |
Updated for b51bf23 | Compared against base branch
⏱️ Performance Report
🐢 Slowest test suites
🐌 Slowest individual tests
Updated for |
🧠 Cognitive Complexity Report
🧩 Most complex functions
Updated for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An opt-in, local-only layer on top of the normal gate. CI is untouched by design; forks run
npm testexactly as before, and no workflow file changes.Mutation testing (Stryker 9.6, command runner):
npm run test:mutation(incremental — the pre-PR ritual),test:mutation:full(--force),STRYKER_MUTATEto scope to the files a change touched (comma-separated globs). Two hard-won details from the drizzle repo are encoded in the config:test:mutantscript = the normal mocha suite plus--exit— a mutant that breaks teardown would otherwise leave open handles and turn every kill into a slow timeout;ignorePatternskeeps the per-mutant sandbox copies small by excludingsample(128M, including the Angular fullstack showcase),website(473M),docs,coverage,complexity,.tmp, anddist.Verification (local): scoped smoke run over
packages/trpc/decorators/param-metadata.util.ts+packages/trpc/context/trpc-enhancer-runtime.factory.ts: 20 mutants — 14 killed, 4 timeout, 2 survived, 0 errors in 1m35s. The 4 timeouts are genuine detections: all four corrupt param metadata and hang E2E specs that raise mocha timeouts to 15–30s, blowing Stryker's per-mutant allowance. The 2 survivors point at an untestedpropertyKey == nullguard inaddTrpcParamMetadata— a candidate test addition for a future PR, exactly the signal this tool is for.npm run ciran green locally (note: the Angular showcaseng buildgates on Node ≥22.22.3 — pre-existing onmain's lockfile, unrelated to this change; that one step was verified green with the locally installed v22.23.1).Docs: new "11. Mutation testing (Stryker — local only, never in CI)" section in GUIDELINES_NEST_TRPC.md (pre-PR ritual: run
test:mutation, look at surviving mutants, mention the outcome in the PR body), README Workspace Commands pointer, CHANGELOG Unreleased entry. Repo tooling only — nothing ships in the package, no release.