Skip to content

feat(testing): add Stryker mutation testing for frontend and backend - #835

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
EmperorNexus:feat/mutation-testing-stryker-715
Jul 30, 2026
Merged

feat(testing): add Stryker mutation testing for frontend and backend#835
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
EmperorNexus:feat/mutation-testing-stryker-715

Conversation

@EmperorNexus

Copy link
Copy Markdown

Overview

This PR adds Stryker mutation testing infrastructure to validate the effectiveness of our test suite across both frontend (React Native) and backend (Node.js/Express) modules. Mutation testing injects small changes (mutants) into source code and verifies that tests detect them, surfacing weak or missing test coverage.

Related Issue

Closes #715

Changes

🧬 Mutation Testing Infrastructure

  • [ENHANCE] stryker.conf.json — frontend Stryker config with broader mutate exclusions (tests, mocks, fixtures, declarations), dashboard reporter, concurrency 4, 60s timeout, and explicit plugin declarations
  • [ADD] stryker.backend.conf.json — backend Stryker config targeting backend/**/*.ts with Jest backend config and backend/tsconfig.json
  • [ADD] scripts/check-mutation-score.js — mutation score validator that reads Stryker reports, enforces break threshold (50%), flags weak tests (<60%), and generates dashboard JSON
  • [ADD] reports/mutation-dashboard/index.html — live web dashboard for visualizing mutation scores, thresholds, and weak test detection

📦 Package Scripts

  • [ADD] mutation:frontend — run Stryker on frontend source
  • [ADD] mutation:backend — run Stryker on backend source
  • [ADD] mutation:all — run both frontend and backend mutation tests
  • [ADD] mutation:score — check mutation scores from latest reports

🔄 CI Integration

  • [ADD] mutation-frontend job — runs Stryker on src/, uploads HTML report as artifact, enforces score threshold
  • [ADD] mutation-backend job — runs Stryker on backend/, uploads HTML report as artifact, enforces score threshold
  • [ADD] mutation-summary job — downloads both reports, generates dashboard JSON, prints combined summary

📚 Documentation

  • [UPDATE] docs/mutation-testing.md — comprehensive guide covering configuration, running tests, reports, CI, weak test detection, best practices, and troubleshooting

Verification Results

npm run lint        ✅ Pass (only pre-existing warnings)
npx tsc --noEmit   ✅ TypeScript compiles clean
npm test           ✅ 708/712 tests pass (4 pre-existing failures unrelated)
Acceptance Criteria Status
Stryker configuration for React Native ✅ stryker.conf.json enhanced
Stryker configuration for backend ✅ stryker.backend.conf.json added
Mutation score tracking ✅ Score thresholds (high: 80%, low: 60%, break: 50%)
Mutation testing in CI ✅ 3 CI jobs in ci.yml
Weak test detection and reporting ✅ scripts/check-mutation-score.js with <60% flagging
Mutation testing dashboard ✅ reports/mutation-dashboard/index.html
Mutation testing documentation ✅ docs/mutation-testing.md updated

Introduce mutation testing infrastructure with Stryker Mutator to
validate test effectiveness across both frontend (React Native) and
backend (Node.js/Express) modules.

- Enhanced stryker.conf.json with broader mutate exclusions, dashboard
  reporter, concurrency, timeout, and explicit plugin declarations
- Added stryker.backend.conf.json for backend mutation testing with
  jest.backend.config.js and backend/tsconfig.json
- Added npm scripts: mutation:frontend, mutation:backend, mutation:all,
  mutation:score
- Added mutation-testing CI jobs (mutation-frontend, mutation-backend,
  mutation-summary) to ci.yml with score threshold enforcement
- Added scripts/check-mutation-score.js for score validation, weak test
  detection, and dashboard JSON generation
- Added reports/mutation-dashboard/index.html — a live web dashboard
  for mutation scores and weak test visualization
- Updated docs/mutation-testing.md with full configuration, usage,
  reporting, and troubleshooting documentation

Closes Smartdevs17#715
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@EmperorNexus Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Smartdevs17
Smartdevs17 merged commit ea40321 into Smartdevs17:main Jul 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add mutation testing with Stryker for frontend and backend

2 participants