mutation-testing-metrics
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -1,2 +0,2 @@ | ||
import { FileResult, MutationTestResult } from 'mutation-testing-report-schema'; | ||
import { FileResult, MutationTestResult } from 'mutation-testing-report-schema/api'; | ||
import { FileUnderTestModel, Metrics, MetricsResult, MutationTestMetricsResult } from './model'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -5,3 +5,3 @@ "use strict"; | ||
const helpers_1 = require("./helpers"); | ||
const mutation_testing_report_schema_1 = require("mutation-testing-report-schema"); | ||
const api_1 = require("mutation-testing-report-schema/api"); | ||
const helpers_2 = require("./helpers"); | ||
@@ -121,9 +121,9 @@ const model_1 = require("./model"); | ||
const count = (status) => mutants.filter((_) => _.status === status).length; | ||
const killed = count(mutation_testing_report_schema_1.MutantStatus.Killed); | ||
const timeout = count(mutation_testing_report_schema_1.MutantStatus.Timeout); | ||
const survived = count(mutation_testing_report_schema_1.MutantStatus.Survived); | ||
const noCoverage = count(mutation_testing_report_schema_1.MutantStatus.NoCoverage); | ||
const runtimeErrors = count(mutation_testing_report_schema_1.MutantStatus.RuntimeError); | ||
const compileErrors = count(mutation_testing_report_schema_1.MutantStatus.CompileError); | ||
const ignored = count(mutation_testing_report_schema_1.MutantStatus.Ignored); | ||
const killed = count(api_1.MutantStatus.Killed); | ||
const timeout = count(api_1.MutantStatus.Timeout); | ||
const survived = count(api_1.MutantStatus.Survived); | ||
const noCoverage = count(api_1.MutantStatus.NoCoverage); | ||
const runtimeErrors = count(api_1.MutantStatus.RuntimeError); | ||
const compileErrors = count(api_1.MutantStatus.CompileError); | ||
const ignored = count(api_1.MutantStatus.Ignored); | ||
const totalDetected = timeout + killed; | ||
@@ -130,0 +130,0 @@ const totalUndetected = survived + noCoverage; |
@@ -1,2 +0,2 @@ | ||
import { FileResult, MutantResult } from 'mutation-testing-report-schema'; | ||
import { FileResult, MutantResult } from 'mutation-testing-report-schema/api'; | ||
import { MutantModel } from './mutant-model'; | ||
@@ -3,0 +3,0 @@ import { SourceFile } from './source-file'; |
@@ -1,2 +0,2 @@ | ||
import { Location, MutantResult, MutantStatus } from 'mutation-testing-report-schema'; | ||
import { Location, MutantResult, MutantStatus } from 'mutation-testing-report-schema/api'; | ||
import { FileUnderTestModel } from './file-under-test-model'; | ||
@@ -3,0 +3,0 @@ import { TestModel } from './test-model'; |
@@ -1,2 +0,2 @@ | ||
import { OpenEndLocation } from 'mutation-testing-report-schema'; | ||
import { OpenEndLocation } from 'mutation-testing-report-schema/api'; | ||
export declare function assertSourceDefined(source: string | undefined): asserts source; | ||
@@ -3,0 +3,0 @@ export declare abstract class SourceFile { |
@@ -1,2 +0,2 @@ | ||
import { TestFile as TestFile } from 'mutation-testing-report-schema'; | ||
import { TestFile as TestFile } from 'mutation-testing-report-schema/api'; | ||
import { SourceFile } from './source-file'; | ||
@@ -3,0 +3,0 @@ import { TestModel } from './test-model'; |
@@ -1,2 +0,2 @@ | ||
import { OpenEndLocation, TestDefinition } from 'mutation-testing-report-schema'; | ||
import { OpenEndLocation, TestDefinition } from 'mutation-testing-report-schema/api'; | ||
import { MutantModel } from './mutant-model'; | ||
@@ -3,0 +3,0 @@ import { TestFileModel } from './test-file-model'; |
{ | ||
"name": "mutation-testing-metrics", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "Utility functions to calculate mutation testing metrics.", | ||
@@ -21,5 +21,5 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"mutation-testing-report-schema": "^1.7.1" | ||
"mutation-testing-report-schema": "^1.7.3" | ||
}, | ||
"gitHead": "a9337daaa56a234f569aedb53998c13c2fd1618f" | ||
"gitHead": "97638fc957a9bc53fbb2f0203aa2faa9b5b2c496" | ||
} |
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fstryker-mutator%2Fmutation-testing-elements%2Fmaster%3Fmodule%3Dmetrics)](https://badge-api.stryker-mutator.io/github.com/stryker-mutator/mutation-testing-elements/master?module=metrics) | ||
[![Build Status](https://github.com/stryker-mutator/mutation-testing-elements/workflows/CI/badge.svg)](https://github.com/stryker-mutator/mutation-testing-elements/actions?query=workflow%3ACI+branch%3Amaster) | ||
# Mutation testing metrics | ||
@@ -19,8 +18,11 @@ | ||
const mutationTestReport: MutationTestResult = { /*... Get a holds of mutation test results somehow */ }; | ||
const mutationTestReport: MutationTestResult = { | ||
/*... Get a holds of mutation test results somehow */ | ||
}; | ||
const result: MetricsResult = calculateMetrics(mutationTestReport); | ||
console.log('Mutation score', result.metrics.mutationScore) | ||
console.log('Mutation score', result.metrics.mutationScore); | ||
``` | ||
## API Reference | ||
@@ -32,23 +34,22 @@ | ||
### `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` | ||
A `MetricsResult` has a `metrics` property containing the following metrics: | ||
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. | ||
- `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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54
54171