Skip to content

test: harden test suite with mutation testing - #10

Open
jonmumm wants to merge 10 commits into
mainfrom
swarm/harden-tests
Open

test: harden test suite with mutation testing#10
jonmumm wants to merge 10 commits into
mainfrom
swarm/harden-tests

Conversation

@jonmumm

@jonmumm jonmumm commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Set up Stryker mutation testing infrastructure with vitest runner
  • Upgrade vitest from 1.x to 2.x across all packages
  • Add Husky pre-commit hooks with lint-staged + prettier
  • Add lcov coverage reporters for CRAP score calculation
  • Kill 33 surviving mutants across native and react packages via targeted tests

Mutation testing results (so far — swarm still running)

  • app-bridge-native createStore: +5 tests, 7 mutants killed
  • app-bridge-native createNativeBridge: +12 tests, 23 mutants killed
  • app-bridge-react createBridgeContext: +6 tests, 3 mutants killed

Tooling added

  • Stryker mutation testing (pnpm test:mutate:incremental)
  • Prettier + lint-staged pre-commit hooks
  • Vitest workspace config for cross-package testing
  • CRAP score calculator (all functions below threshold of 30)

Test plan

  • All existing tests pass (pnpm test)
  • Build succeeds (pnpm build)
  • Mutation testing runs successfully
  • CRAP analysis shows no high-risk functions
  • Swarm mutation agent continues to improve scores (in progress)

🤖 Generated with Claude Code using the Swarm skill

AI Feature Agent and others added 10 commits March 12, 2026 15:39
- Set up Stryker mutation testing with vitest runner
- Upgrade vitest from 1.x to 2.x across all packages
- Fix vi.fn() type signatures for vitest 2.x compatibility
- Add lcov coverage reporters for CRAP score calculation
- Configure Husky pre-commit hooks with lint-staged + prettier
- Add vitest workspace config and turbo task definitions
- Add prettier config for consistent formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Target mutants in dispatch/event listener path:
- L46: instanceof Promise check for sync listeners
- L62/L73: stateChanged flag initialization and guard
- L63: config.producer truthiness check
- L67: nextState !== currentState reference equality
- L102: event listener cleanup on unsubscribe

Also fix Stryker config to resolve typescript checker plugin loading
issues by disabling the checker and using explicit plugin list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Target message validation guards, BRIDGE_READY STATE_INIT message type,
postMessage guard paths, and WebView-without-postMessage tolerance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Target isSupported return value, nativeEvent message format, STATE_UPDATE
broadcast content/type, getReadyState null guard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant