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

danger-plugin-coverage

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

danger-plugin-coverage - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

tests/specs/__snapshots__/plugin.spec.js.snap

20

dist/plugin.js

@@ -84,3 +84,4 @@ "use strict";

lines: lines.length,
coveredlines: lines.length - uncoveredLines.length
coveredlines: lines.length - uncoveredLines.length,
uncoveredLines
};

@@ -94,3 +95,3 @@ };

const getShortPath = filePath => {
const maxChars = 50;
const maxChars = 40;
const parts = filePath.split('/').reverse().filter(x => x);

@@ -154,3 +155,14 @@

return ['', fileCell, noLines ? '-' : percentages.statements, noLines ? '-' : percentages.branches, noLines ? '-' : percentages.functions, noLines ? '-' : percentages.lines, emoji, ''].join('|');
const maxUncovered = 3;
let uncoveredCell = fileMetrics.uncoveredLines.slice(0, maxUncovered).map(line => {
const lineNumber = line.$.num;
const anchor = `#L${lineNumber}`;
return sha ? `[${lineNumber}](${fileLink + anchor})` : lineNumber;
}).join(', ');
if (fileMetrics.uncoveredLines.length > maxUncovered) {
uncoveredCell += '...';
}
return ['', fileCell, noLines ? '-' : percentages.statements, noLines ? '-' : percentages.branches, noLines ? '-' : percentages.functions, noLines ? '-' : percentages.lines, uncoveredCell, emoji, ''].join('|');
};

@@ -169,3 +181,3 @@ /**

const buildTable = (files, maxRows, threshold, showAllFiles) => {
const headings = [`${showAllFiles ? '' : 'Impacted '}Files`, '% Stmts', '% Branch', '% Funcs', '% Lines', ''];
const headings = [`${showAllFiles ? '' : 'Impacted '}Files`, '% Stmts', '% Branch', '% Funcs', '% Lines', 'Uncovered Lines', ''];
const headingRow = joinRow(headings);

@@ -172,0 +184,0 @@ const seperator = joinRow(new Array(headings.length).fill().reduce((acc, _, index) => [...acc, index === 0 ? '---' : ':-:' // Center align all but the first column

2

package.json
{
"name": "danger-plugin-coverage",
"version": "1.4.1",
"version": "1.5.0",
"description": "A Danger plugin to report code coverage.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -34,9 +34,9 @@ # danger-plugin-coverage

|Impacted Files|% Stmts|% Branch|% Funcs|% Line||
|Impacted Files|% Stmts|% Branch|% Funcs|% Line|Uncovered Lines|
|---|:-:|:-:|:-:|:-:|:-:|
|[src/module-one.js]()|100|100|100|100|:white_check_mark:|
|[src/module-two.js]()|95.24|33.33|66.67|100|:x:|
|[src/module-three.js]()|82.33|10.25|44.55|100|:x:|
|[src/module-four.js]()|100|0|10|100|:x:|
|[src/module-five.js]()|100|100|100|100|:white_check_mark:|
|[src/module-one.js]()|100|100|100|100||:white_check_mark:|
|[src/module-two.js]()|95.24|33.33|66.67|80|[1](), [42](), [1337]()...|:x:|
|[src/module-three.js]()|82.33|10.25|44.55|45.55|[12](), [15](), [32]()...|:x:|
|[src/module-four.js]()|100|0|10|32.5|[54](), [65](), [94]()...|:x:|
|[src/module-five.js]()|100|100|100|100||:white_check_mark:|

@@ -50,4 +50,4 @@ <details>

|---|:-:|:-:|:-:|:-:|:-:|
|[src/module-six.js]()|100|100|100|100|:white_check_mark:|
|[src/module-seven.js]()|100|100|100|100|:white_check_mark:|
|[src/module-six.js]()|100|100|100|100||:white_check_mark:|
|[src/module-seven.js]()|100|100|100|100||:white_check_mark:|
</details>

@@ -85,3 +85,3 @@

| `successMessage` | A custom message to show when coverage is above the threshold. |
| `failureMessage` | A custom message to show when coverage is bellow the threshold. |
| `failureMessage` | A custom message to show when coverage is below the threshold. |
| `cloverReportPath` | Override automatic coverage report detection to provide the relative path to a report. |

@@ -92,3 +92,3 @@ | `maxRows` | The number of rows to show (additional rows will be collapsed within a `<details>` element). |

**Example:**
**Example (defaults shown):**

@@ -100,6 +100,8 @@ ```js

successMessage: ':+1: Test coverage is looking good.',
failureMessage: ':-1: Test coverage is not looking so good.',
warnOnNoReport: true,
failureMessage: 'Test coverage is looking a little low for the files created '
+ 'or modified in this PR, perhaps we need to improve this.',
cloverReportPath: './coverage/clover.xml',
maxRows: 5,
warnOnNoReport: true,
showAllFiles: false,
threshold: {

@@ -106,0 +108,0 @@ statements: 80,

@@ -69,2 +69,3 @@ import path from 'path';

coveredlines: lines.length - uncoveredLines.length,
uncoveredLines,
};

@@ -77,3 +78,3 @@ };

const getShortPath = (filePath) => {
const maxChars = 50;
const maxChars = 40;
const parts = filePath.split('/').reverse().filter((x) => x);

@@ -139,2 +140,18 @@

const maxUncovered = 3;
let uncoveredCell = fileMetrics
.uncoveredLines
.slice(0, maxUncovered)
.map((line) => {
const lineNumber = line.$.num;
const anchor = `#L${lineNumber}`;
return sha ? `[${lineNumber}](${fileLink + anchor})` : lineNumber;
})
.join(', ');
if (fileMetrics.uncoveredLines.length > maxUncovered) {
uncoveredCell += '...';
}
return [

@@ -147,2 +164,3 @@ '',

noLines ? '-' : percentages.lines,
uncoveredCell,
emoji,

@@ -168,2 +186,3 @@ '',

'% Lines',
'Uncovered Lines',
'',

@@ -170,0 +189,0 @@ ];

@@ -99,3 +99,3 @@ import path from 'path';

expect(lines).toContain('|from-custom-report.js|100|100|100|100|:white_check_mark:|');
expect(lines).toContain('|from-custom-report.js|100|100|100|100||:white_check_mark:|');
});

@@ -149,4 +149,4 @@

expect(lines).toContain('|Files|% Stmts|% Branch|% Funcs|% Lines||');
expect(lines).toContain('|src/one.js|100|100|100|100|:white_check_mark:|');
expect(lines).toContain('|Files|% Stmts|% Branch|% Funcs|% Lines|Uncovered Lines||');
expect(lines).toContain('|src/one.js|100|100|100|100||:white_check_mark:|');
});

@@ -201,4 +201,4 @@

expect(lines).toContain('> Not good');
expect(lines).toContain('|src/one.js|90|90|90|50|:x:|');
expect(lines).toContain('|src/one.js|90|90|90|50|1|:x:|');
});
});

Sorry, the diff of this file is not supported yet

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