Helper scripts for analyzing Stryker mutation testing reports.
Efficiently extracts and analyzes data from large mutation JSON reports.
node analyze-mutations.js <command> <file> [options]
summary <file>Get overall mutation metrics for a file.
node analyze-mutations.js summary server/services/googleSheetsApi.js
Output:
{
"total": 162,
"killed": 48,
"survived": 20,
"noCoverage": 88,
"timeout": 2,
"score": 29.63
}
survived <file>List all survived mutants with line numbers.
node analyze-mutations.js survived server/routes/projects.js
Output:
[
{
"id": "346",
"line": 75,
"column": 10,
"mutatorName": "EqualityOperator",
"replacement": "col <= dateRow.length"
},
...
]
by-type <file>Group survived mutants by mutator type.
node analyze-mutations.js by-type server/utils/dateUtils.js
Output:
{
"EqualityOperator": [
{ "id": "346", "line": 75, "replacement": "col <= dateRow.length" }
],
"ConditionalExpression": [
{ "id": "352", "line": 78, "replacement": "false" }
],
...
}
by-line <file> <line>Get all mutants at a specific line number.
node analyze-mutations.js by-line server/services/cacheService.js 45
Output:
[
{
"id": "123",
"status": "Killed",
"mutatorName": "ConditionalExpression",
"replacement": "true",
"line": 45,
"column": 10
}
]
high-priority <file>Categorize survived mutants by priority (high/medium/low).
node analyze-mutations.js high-priority server/services/googleSheetsApi.js
Output:
{
"high": [
{
"mutatorName": "EqualityOperator",
"count": 3,
"mutants": [...]
}
],
"medium": [...],
"low": [...]
}
High: ConditionalExpression, LogicalOperator, EqualityOperator
Medium: ArithmeticOperator, ReturnStatement, BlockStatement, MethodExpression, OptionalChaining
Low: StringLiteral, ObjectLiteral, etc.
MUTATION_REPORT: Custom path to mutation.json (default: reports/mutation/mutation.json)MUTATION_REPORT=custom/path/report.json node analyze-mutations.js summary myfile.js
import { getSummary, groupByType, loadReport, findFileData } from './analyze-mutations.js';
const report = loadReport('reports/mutation/mutation.json');
const { data } = findFileData(report, 'server/services/myService.js');
const summary = getSummary(data);
const grouped = groupByType(data);
Used by the /improve-test-quality skill to: