esnext-coverage-analytics
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -8,2 +8,4 @@ 'use strict'; | ||
var _codec = require('./codec'); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
@@ -19,3 +21,3 @@ | ||
* | ||
* @param {Array} locations – Existing coverage data locations. | ||
* @param {Array<Array>} locations – Encoded coverage data locations. | ||
* @param {Array} rules – List of rules. | ||
@@ -29,4 +31,4 @@ * @returns {Object} New coverage data. | ||
rules.forEach(function (_ref, i) { | ||
var rule = _ref.rule; | ||
var tag = _ref.tag; | ||
var rule = _ref.rule, | ||
tag = _ref.tag; | ||
@@ -38,3 +40,3 @@ var value = rule === 'include'; | ||
return locations.filter(function (location) { | ||
return (0, _codec.decodeAll)(locations).filter(function (location) { | ||
var tags = location.tags; | ||
@@ -41,0 +43,0 @@ |
@@ -6,2 +6,3 @@ 'use strict'; | ||
}); | ||
exports.tags = exports.lines = exports.metrics = exports.filter = exports.codec = undefined; | ||
@@ -44,2 +45,10 @@ var _filter = require('./filter'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _codec = require('./codec'); | ||
var codec = _interopRequireWildcard(_codec); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.codec = codec; |
@@ -8,2 +8,5 @@ 'use strict'; | ||
exports.default = lines; | ||
var _codec = require('./codec'); | ||
function isLine(_ref) { | ||
@@ -23,3 +26,3 @@ var tags = _ref.tags; | ||
* Compute line coverage given a list of instrumented locations. | ||
* @param {Array} locations – Existing coverage data locations. | ||
* @param {Array<Array>} locations – Encoded coverage data locations. | ||
* @returns {Array} Array of line data. | ||
@@ -30,5 +33,5 @@ */ | ||
locations.filter(isLine).forEach(function (entry) { | ||
(0, _codec.decodeAll)(locations).filter(isLine).forEach(function (entry) { | ||
var line = entry.loc.start.line; | ||
if (lineExecCount.hasOwnProperty(line)) { | ||
if (Object.hasOwnProperty.call(lineExecCount, line)) { | ||
lineExecCount[line] = Math.max(lineExecCount[line], entry.count); | ||
@@ -42,4 +45,4 @@ } else { | ||
var count = lineExecCount[line]; | ||
return { line: line, count: count }; | ||
return { line, count }; | ||
}); | ||
} |
@@ -9,3 +9,3 @@ "use strict"; | ||
* Compute coverage metrics from the given locations. | ||
* @param {Array} locations – Existing coverage data locations. | ||
* @param {Array<Array>} locations – Encoded coverage data locations. | ||
* @return {Object} Metrics. | ||
@@ -17,6 +17,5 @@ */ | ||
var count = _ref.count; | ||
return count > 0 ? sum + 1 : sum; | ||
}, 0); | ||
return { covered: covered, total: total }; | ||
return { covered, total }; | ||
} |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -7,5 +7,8 @@ Object.defineProperty(exports, "__esModule", { | ||
exports.default = coverageByTag; | ||
var _codec = require('./codec'); | ||
/** | ||
* Generate a tag index from coverage data. | ||
* @param {Array} locations – Existing coverage data locations. | ||
* @param {Array<Array>} locations – Encoded coverage data locations. | ||
* @param {Array} [tagsToSelect] – List of tags to get data for. | ||
@@ -21,5 +24,5 @@ * @returns {Object} Locations grouped by tag. | ||
} | ||
locations.forEach(function (location) { | ||
(0, _codec.decodeAll)(locations).forEach(function (location) { | ||
location.tags.forEach(function (tag) { | ||
if (tagIndex.hasOwnProperty(tag)) { | ||
if (Object.hasOwnProperty.call(tagIndex, tag)) { | ||
tagIndex[tag].push(location); | ||
@@ -26,0 +29,0 @@ } else if (!tagsToSelect) { |
{ | ||
"name": "esnext-coverage-analytics", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Analytics package for esnext-coverage", | ||
"repository": "esnext-coverage/esnext-coverage-analytics", | ||
"main": "dist/index.js", | ||
@@ -29,9 +28,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel-cli": "^6.14.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-cli": "^6.18.0", | ||
"babel-preset-env": "^1.1.1", | ||
"chai": "^3.5.0", | ||
"eslint": "^3.4.0", | ||
"eslint-config-meetic": "^2.0.0", | ||
"mocha": "^3.0.2" | ||
"eslint": "^3.12.1", | ||
"eslint-config-meetic": "^4.0.0", | ||
"mocha": "^3.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
9106
11
228