Skip to content

Add mutation testing module for test quality assessment#5

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-mutation-testing-support
Draft

Add mutation testing module for test quality assessment#5
Copilot wants to merge 5 commits intomainfrom
copilot/add-mutation-testing-support

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 27, 2025

Implements a mutation testing system that inserts bugs into code, runs tests against mutated versions, and reports which mutations survive—indicating gaps in test coverage.

Implementation

  • MutationTestingService: Core service providing 5 mutation operators (ARITHMETIC, COMPARISON, LOGICAL, UNARY, RETURN) with 21 mutation types. Generates mutants, executes tests, calculates mutation scores.

  • IPC Integration: 5 handlers expose mutation testing to renderer process (mutation:getOperators, mutation:generateMutants, mutation:runTests, mutation:getReport, mutation:reset)

  • Test Coverage: 23 tests covering mutant generation, test execution, score calculation, and edge cases

Usage

const { MutationTestingService } = require('./src/main/mutation-testing.js')
const service = new MutationTestingService()
service.setProjectPath('/path/to/project')

const mutants = await service.generateMutants('src/math.js', ['ARITHMETIC'])
const report = await service.runMutationTesting('npm test')

console.log(`Score: ${report.summary.mutationScore}%`)
console.log(`Killed: ${report.summary.killedMutants}/${report.summary.totalMutants}`)

From Electron renderer:

const { report } = await window.api.invoke('mutation:runTests', {
  filePath: 'src/math.js',
  testCommand: 'npm test'
})

Documentation

  • docs/MUTATION_TESTING.md: Complete API reference, mutation operators, interpretation guide
  • examples/mutation-testing-example.js: Working demonstration with sample code
Original prompt

Add mutation testing support; Puffin should have a module that inserts bugs, runs tests, and count killings


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 27, 2025 16:15
Co-authored-by: roehst <21047691+roehst@users.noreply.github.com>
Co-authored-by: roehst <21047691+roehst@users.noreply.github.com>
Co-authored-by: roehst <21047691+roehst@users.noreply.github.com>
…capsulation

Co-authored-by: roehst <21047691+roehst@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mutation testing support to Puffin Add mutation testing module for test quality assessment Dec 27, 2025
Copilot AI requested a review from roehst December 27, 2025 16:23
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.

2 participants