Mutation testing metrics
Utility function to calculate mutation testing metrics..
See mutant states and metrics in the Stryker handbook for more details about mutation testing metrics.
Usage example
See the below example (uses TypeScript):
import { MetricsResult, calculateMetrics } from 'mutation-testing-metrics';
import { MutationTestResult } from 'mutation-testing-report-schema';
const mutationTestReport: MutationTestResult = {
};
const result: MetricsResult = calculateMetrics(mutationTestReport);
console.log('Mutation score', result.metrics.mutationScore);
API Reference
calculateMetrics
[(MutationTestResult) => MetricsResult
]
Calculates the metrics for a MutationTestResult. This result must be valid according to the [https://github.com/stryker-mutator/mutation-testing-elements/tree/master/packages/report-schema#readme].
MetricsResult
A MetricsResult
has a metrics
property containing the following metrics:
killed
timeout
survived
noCoverage
runtimeErrors
compileErrors
ignored
totalDetected
totalUndetected
totalValid
totalInvalid
mutationScore
totalMutants
mutationScoreBasedOnCoveredCode
It optionally has a file
property which points to a FileResult
(mutation-testing-report-schema) or one or more childResults
if it represents a directory.