Package Exports
- mutation-testing-metrics
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mutation-testing-metrics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 = { /*... Get a holds of mutation test results somehow */ };
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/mutation-testing-report-schema#readme].
MetricsResult
A MetricsResult
has a metrics
property containing the following metrics:
killed
timeout
survived
noCoverage
runtimeErrors
compileErrors
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.