Socket
Socket
Sign inDemoInstall

mutation-testing-metrics

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mutation-testing-metrics - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

# [1.3.0](https://github.com/stryker-mutator/mutation-testing-elements/compare/v1.2.3...v1.3.0) (2020-02-27)
### Features
* **ignored status:** add MutantStatus Ignored ([#239](https://github.com/stryker-mutator/mutation-testing-elements/issues/239)) ([68b2302](https://github.com/stryker-mutator/mutation-testing-elements/commit/68b23022d2c4d21d642edc17ef4905c77adffd35)), closes [#85](https://github.com/stryker-mutator/mutation-testing-elements/issues/85)
* **line-numbers:** add line numbers in code samples ([#313](https://github.com/stryker-mutator/mutation-testing-elements/issues/313)) ([20b3eab](https://github.com/stryker-mutator/mutation-testing-elements/commit/20b3eabfb89e9791d7425531736a17964f35d93e))
* **n/a mutation score:** support no mutation score ([66a1549](https://github.com/stryker-mutator/mutation-testing-elements/commit/66a1549d7a464ccb42bdd988fa66a20e44430e43))
## [1.2.2](https://github.com/stryker-mutator/mutation-testing-elements/compare/v1.2.1...v1.2.2) (2019-12-04)

@@ -8,0 +21,0 @@

10

dist/src/api/Metrics.d.ts

@@ -32,2 +32,6 @@ /**

/**
* The total number of mutants that were not even tested because the config of the user asked for them to be ignored.
*/
ignored: number;
/**
* The total number of mutants that were detected, meaning either killed or caused a time out.

@@ -59,7 +63,7 @@ * `killed + timed out`

* The total number of mutants tested in an area that had code coverage result
* `totalDetected + survived`
* `totalDetected + survived + ignored`
*/
totalCovered: number;
/**
* The total percentage of mutants that were killed.
* The total percentage of mutants that were killed, or NaN if not available.
* `totalDetected / totalValid * 100`,

@@ -69,3 +73,3 @@ */

/**
* The total percentage of mutants that were killed based on the code coverage results of the initial test run.
* The total percentage of mutants that were killed based on the code coverage results of the initial test run, or NaN if not available.
* `totalDetected / totalCovered * 100`

@@ -72,0 +76,0 @@ */

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const helpers_1 = require("./helpers");
const lodash_groupby_1 = __importDefault(require("lodash.groupby"));
const DEFAULT_SCORE = 100;
const helpers_2 = require("./helpers");
const DEFAULT_SCORE = NaN;
const ROOT_NAME = 'All files';

@@ -38,3 +35,3 @@ /**

function toChildModels(files) {
const filesByDirectory = lodash_groupby_1.default(Object.entries(files), namedFile => namedFile[0].split('/')[0]);
const filesByDirectory = helpers_2.groupBy(Object.entries(files), namedFile => namedFile[0].split('/')[0]);
return Object.keys(filesByDirectory)

@@ -63,2 +60,3 @@ .map(directoryName => {

const compileErrors = count("CompileError" /* CompileError */);
const ignored = count("Ignored" /* Ignored */);
const totalDetected = timeout + killed;

@@ -76,2 +74,3 @@ const totalUndetected = survived + noCoverage;

compileErrors,
ignored,
totalDetected,

@@ -82,3 +81,3 @@ totalUndetected, totalCovered,

mutationScore: totalValid > 0 ? totalDetected / totalValid * 100 : DEFAULT_SCORE,
totalMutants: totalValid + totalInvalid,
totalMutants: totalValid + totalInvalid + ignored,
mutationScoreBasedOnCoveredCode: totalValid > 0 ? totalDetected / totalCovered * 100 || 0 : DEFAULT_SCORE

@@ -85,0 +84,0 @@ };

import { MetricsResult } from './api/MetricsResult';
import { FileResultDictionary } from 'mutation-testing-report-schema';
export declare function flatMap<T, R>(source: T[], fn: (input: T) => R[]): R[];
export declare function groupBy<T>(arr: T[], criteria: (element: T) => string): Record<string, T[]>;
export declare function pathJoin(...parts: string[]): string;

@@ -5,0 +6,0 @@ export declare function normalizeFileNames(input: FileResultDictionary): FileResultDictionary;

@@ -10,2 +10,13 @@ "use strict";

exports.flatMap = flatMap;
function groupBy(arr, criteria) {
return arr.reduce((acc, item) => {
const key = criteria(item);
if (!acc.hasOwnProperty(key)) {
acc[key] = [];
}
acc[key].push(item);
return acc;
}, {});
}
exports.groupBy = groupBy;
function pathJoin(...parts) {

@@ -12,0 +23,0 @@ return parts.reduce((prev, current) => prev.length ? current ? `${prev}/${current}` : prev : current, '');

{
"name": "mutation-testing-metrics",
"version": "1.2.2",
"version": "1.3.0",
"description": "Utility functions to calculate mutation testing metrics.",

@@ -8,3 +8,4 @@ "main": "dist/src/index.js",

"scripts": {
"test": "mocha -r source-map-support/register dist/test/**/*.js"
"test": "mocha -r source-map-support/register dist/test/**/*.js",
"stryker": "stryker run"
},

@@ -21,9 +22,5 @@ "repository": {

"dependencies": {
"lodash.groupby": "^4.6.0",
"mutation-testing-report-schema": "^1.2.0"
"mutation-testing-report-schema": "^1.3.0"
},
"devDependencies": {
"@types/lodash.groupby": "^4.6.6"
},
"gitHead": "bd51cab3afe3195bfeffe8af4a4bc8c50bda9c44"
"gitHead": "fe44d6e0a273c267a5e5b49d39c53341e8476447"
}

@@ -1,3 +0,5 @@

[![Build Status](https://travis-ci.org/stryker-mutator/mutation-testing-elements.svg?branch=master)](https://travis-ci.org/stryker-mutator/mutation-testing-elements)
[![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

@@ -40,2 +42,3 @@

* `compileErrors`
* `ignored`
* `totalDetected`

@@ -42,0 +45,0 @@ * `totalUndetected`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc