ci(mutation): wire Stryker mutation testing into nightly CI#106
Merged
Conversation
Stryker deps were declared but no workflow ran them. Add a working root config, a nightly/on-demand workflow, and docs (#80). - stryker.conf.json: mutation-tests packages/pipeline (TS); runs from the package so pnpm-linked node_modules resolve in the sandbox; vitest runner + typescript checker; excludes barrels/CLIs/entry points - vitest.stryker.config.ts: excludes the e2e test (reads a repo-root fixture outside the sandbox) from mutation runs - .github/workflows/mutation.yml: nightly + workflow_dispatch (never on PRs); posts the score to the run summary, uploads the HTML report - README: how to run locally + the opt-in threshold (qualityGate.mutationScore in pipeline.config.json, enabled:false, threshold 80) - Verified locally: a complete scoped run finishes and produces a mutation score Refs #80 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
@stryker-mutator/*was indevDependenciesbut no workflow ran Stryker — mutation score was referenced (Phase 8) but never measured. This wires it up end-to-end (#80).What was actually wrong
The existing root
stryker.config.jsonis a template for generated apps (targets a rootsrc/that doesn't exist here) and uses a filename Stryker doesn't auto-discover (stryker.conf.*). So the framework never mutation-tested its own code. This PR adds a working setup forpackages/pipeline(the substantial TS library with 133 fast unit tests).Changes
stryker.conf.json(repo root) — mutation-testspackages/pipeline/src. The interesting bit: it runs frompackages/pipelineso the pnpm-linkednode_modulesresolve inside Stryker's sandbox (a monorepo gotcha), and declarespluginsexplicitly so the vitest runner + typescript checker load regardless of cwd. Excludes barrels, CLIs, entry points, and*.d.ts.packages/pipeline/vitest.stryker.config.ts— excludes the end-to-end test, which reads a repo-root fixture outside the sandbox and would fail Stryker's initial test run. Unit tests provide the mutant-killing signal..github/workflows/mutation.yml— runs Stryker nightly (cron) and on demand (workflow_dispatch, with an optional--mutatescope), never on PRs. Informational/non-blocking: posts the mutation score to the run summary and uploads the HTML report as an artifact.Acceptance criteria
stryker.conf.jsonat the repo root with sensible defaults.github/workflows/mutation.yml(nightly + on-demand, off the PR path)pipeline.config.json, opt-in —qualityGate.mutationScore={ enabled: false, threshold: 80, blocking: false }(already present; now documented as opt-in in the README, the actionable part of the AC)Verified locally
Stryker runs cleanly against
packages/pipeline— initial test run passes, mutants instrument, the sandbox runs unit tests and kills mutants, and a complete run produces a mutation score + JSON/HTML reports (confirmed on a scoped subset; a full run is nightly-CI-scale, hence the schedule).prettier --check .,check-doc-counts, and valid-JSON checks pass; generated.stryker-tmp/andreports/mutation/are gitignored.Refs #80