Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esnext-coverage-format-text

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esnext-coverage-format-text - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

26

dist/index.js
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /**
* Text reporter.
* @module text-reporter
*/
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
* Text reporter.
* @module text-reporter
*/

@@ -50,14 +50,12 @@ var _reportSummary = require('./reporters/report-summary');

module.exports = function textReporter(coverage) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _options$environment = options.environment;
var environment = _options$environment === undefined ? {} : _options$environment;
var _options$thresholds = options.thresholds;
var thresholds = _options$thresholds === undefined ? {} : _options$thresholds;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$environment = options.environment,
environment = _options$environment === undefined ? {} : _options$environment,
_options$thresholds = options.thresholds,
thresholds = _options$thresholds === undefined ? {} : _options$thresholds;
var _computeMetrics = (0, _computeMetrics3.default)(coverage);
var _computeMetrics = (0, _computeMetrics3.default)(coverage),
projectMetrics = _computeMetrics.projectMetrics,
filesMetrics = _computeMetrics.filesMetrics;
var projectMetrics = _computeMetrics.projectMetrics;
var filesMetrics = _computeMetrics.filesMetrics;
var isGlobalSuccess = isValidThresholdsConfig(thresholds.global) ? (0, _checkAgainstThresholds.areMetricsAboveThresholds)(projectMetrics, thresholds.global) : null;

@@ -64,0 +62,0 @@ var isLocalSuccess = isValidThresholdsConfig(thresholds.local) ? (0, _checkAgainstThresholds.areFilesMetricsAboveThresholds)(filesMetrics, thresholds.local) : null;

@@ -61,4 +61,4 @@ 'use strict';

return function reportFailedFile(_ref) {
var name = _ref.name;
var metrics = _ref.metrics;
var name = _ref.name,
metrics = _ref.metrics;

@@ -65,0 +65,0 @@ return (0, _reportUnit2.default)(name, metrics, localThresholds);

@@ -25,2 +25,5 @@ 'use strict';

}
if (isGlobalSuccess === false && isLocalSuccess === false) {
return (0, _colors.failed)('Failed') + ' test coverage on ' + envName;
}
if (isGlobalSuccess === false) {

@@ -32,5 +35,2 @@ return (0, _colors.failed)('Failed') + ' global test coverage on ' + envName;

}
if (isGlobalSuccess === false && isLocalSuccess === false) {
return (0, _colors.failed)('Failed') + ' test coverage on ' + envName;
}

@@ -37,0 +37,0 @@ return (0, _colors.optimal)('Passed') + ' test coverage on ' + envName;

@@ -48,3 +48,3 @@ 'use strict';

function tagMetricsReporterFactory(metrics) {
var thresholds = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var thresholds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -62,4 +62,4 @@

var tagStats = metrics[tagName];
var covered = tagStats.covered;
var total = tagStats.total;
var covered = tagStats.covered,
total = tagStats.total;

@@ -66,0 +66,0 @@ var percentage = total ? (0, _toRoundedPercentage2.default)(covered / total) : 100;

@@ -26,3 +26,3 @@ 'use strict';

function isNotEmpty(value) {
return !!value;
return Boolean(value);
}

@@ -29,0 +29,0 @@

@@ -22,5 +22,5 @@ "use strict";

return Object.keys(thresholds).every(function (tagName) {
var _metrics$tagName = metrics[tagName];
var covered = _metrics$tagName.covered;
var total = _metrics$tagName.total;
var _metrics$tagName = metrics[tagName],
covered = _metrics$tagName.covered,
total = _metrics$tagName.total;

@@ -27,0 +27,0 @@ var ratio = total ? covered / total : 1;

@@ -58,4 +58,3 @@ 'use strict';

Object.keys(coverage).forEach(function (fileName) {
var locations = coverage[fileName].locations;
var locations = coverage[fileName];
var locationsByTag = (0, _esnextCoverageAnalytics.tags)(locations, tagsToSelect);

@@ -70,7 +69,6 @@ var lineMetrics = (0, _esnextCoverageAnalytics.metrics)((0, _esnextCoverageAnalytics.lines)(locations));

var _metrics = (0, _esnextCoverageAnalytics.metrics)(tagLocations);
var _metrics = (0, _esnextCoverageAnalytics.metrics)(tagLocations),
covered = _metrics.covered,
total = _metrics.total;
var covered = _metrics.covered;
var total = _metrics.total;
result.projectMetrics[tagName].covered += covered;

@@ -77,0 +75,0 @@ result.projectMetrics[tagName].total += total;

{
"name": "esnext-coverage-format-text",
"version": "0.0.4",
"version": "0.0.5",
"description": "esnext-coverage output formatter to human-readable text",

@@ -30,3 +30,3 @@ "main": "dist/index.js",

"chalk": "^1.1.3",
"esnext-coverage-analytics": "^0.0.3"
"esnext-coverage-analytics": "^0.0.5"
},

@@ -39,6 +39,6 @@ "devDependencies": {

"eslint": "^3.5.0",
"eslint-config-meetic": "^2.0.0",
"esnext-coverage": "^0.0.3",
"eslint-config-meetic": "^4.0.0",
"esnext-coverage": "^0.0.4",
"mocha": "^3.0.2"
}
}
{
"foo.js": {
"path": "foo.js",
"locations": [
{
"id": 0,
"loc": {
"start": {
"line": 0,
"column": 0
},
"end": {
"line": 0,
"column": 10
}
},
"tags": ["statement"],
"count": 1
},
{
"id": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"tags": ["expression"],
"count": 1
},
{
"id": 2,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"tags": ["function"],
"count": 1
}
]
},
"bar.js": {
"path": "bar.js",
"locations": [
{
"id": 0,
"loc": {
"start": {
"line": 0,
"column": 0
},
"end": {
"line": 0,
"column": 10
}
},
"tags": ["statement"],
"count": 0
},
{
"id": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"tags": ["expression"],
"count": 0
},
{
"id": 2,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"tags": ["function"],
"count": 0
}
]
}
"foo.js": [
[1, 0, 0, 10, 0, 0],
[1, 0, 1, 10, 1, 1],
[1, 0, 2, 10, 2, 2]
],
"bar.js": [
[0, 0, 0, 10, 0, 0],
[0, 0, 1, 10, 1, 1],
[0, 0, 2, 10, 2, 2]
]
}
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