Skip to content

Commit

Permalink
fix: Add "missed" column to html-spa report (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Feb 21, 2021
1 parent 42e233c commit e03c464
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/istanbul-reports/lib/html-spa/assets/spa.css
Expand Up @@ -252,8 +252,8 @@ a:hover {
color: #666;
}

.coverage-summary .headercell:nth-child(4n - 2),
.coverage-summary td:nth-child(4n - 2) {
.coverage-summary .headercell:nth-child(5n - 2),
.coverage-summary td:nth-child(5n - 2) {
border-left: 2px solid #fcfcfc;
padding-left: 2em;
}
Expand Down
1 change: 1 addition & 0 deletions packages/istanbul-reports/lib/html-spa/index.js
Expand Up @@ -99,6 +99,7 @@ class HtmlSpaReport extends ReportBase {
total: metric.total,
covered: metric.covered,
skipped: metric.skipped,
missed: metric.total - metric.covered,
pct: isEmpty ? 0 : metric.pct,
classForPercent: isEmpty
? 'empty'
Expand Down
Expand Up @@ -64,6 +64,12 @@ function SubHeadings({ sortKeyPrefix, onSort, activeSort }) {
sortKey={sortKeyPrefix + '.covered'}
activeSort={activeSort}
/>
<SummaryTableHeaderCell
name="Missed"
onSort={onSort}
sortKey={sortKeyPrefix + '.missed'}
activeSort={activeSort}
/>
<SummaryTableHeaderCell
name="Total"
onSort={onSort}
Expand Down
@@ -1,7 +1,7 @@
const React = require('react');

function MetricCells({ metrics }) {
const { classForPercent, pct, covered, total } = metrics;
const { classForPercent, pct, covered, missed, total } = metrics;

return (
<>
Expand All @@ -15,6 +15,7 @@ function MetricCells({ metrics }) {
</div>
</td>
<td className={'abs ' + classForPercent}>{covered}</td>
<td className={'abs ' + classForPercent}>{missed}</td>
<td className={'abs ' + classForPercent}>{total}</td>
</>
);
Expand Down
Expand Up @@ -9,27 +9,31 @@
"statements": {
"total": 50,
"covered": 50,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"branches": {
"total": 39,
"covered": 39,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"functions": {
"total": 8,
"covered": 8,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"lines": {
"total": 46,
"covered": 46,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
Expand All @@ -43,20 +47,23 @@
"statements": {
"total": 50,
"covered": 50,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"branches": {
"total": 39,
"covered": 39,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"functions": {
"total": 8,
"covered": 8,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
Expand All @@ -65,6 +72,7 @@
"total": 46,
"covered": 46,
"skipped": 0,
"missed": 0,
"pct": 100,
"classForPercent": "high"
}
Expand Down
Expand Up @@ -9,27 +9,31 @@
"statements": {
"total": 50,
"covered": 50,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"branches": {
"total": 43,
"covered": 41,
"missed": 2,
"skipped": 0,
"pct": 95.35,
"classForPercent": "high"
},
"functions": {
"total": 8,
"covered": 8,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"lines": {
"total": 46,
"covered": 46,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
Expand All @@ -43,27 +47,31 @@
"statements": {
"total": 50,
"covered": 50,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"branches": {
"total": 43,
"covered": 41,
"missed": 2,
"skipped": 0,
"pct": 95.35,
"classForPercent": "high"
},
"functions": {
"total": 8,
"covered": 8,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
},
"lines": {
"total": 46,
"covered": 46,
"missed": 0,
"skipped": 0,
"pct": 100,
"classForPercent": "high"
Expand Down
Expand Up @@ -12,27 +12,31 @@
"statements": {
"total": 20,
"covered": 6,
"missed": 14,
"skipped": 0,
"pct": 30,
"classForPercent": "low"
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"functions": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"lines": {
"total": 18,
"covered": 6,
"missed": 12,
"skipped": 0,
"pct": 33.33,
"classForPercent": "low"
Expand All @@ -46,27 +50,31 @@
"statements": {
"total": 20,
"covered": 6,
"missed": 14,
"skipped": 0,
"pct": 30,
"classForPercent": "low"
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"functions": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"lines": {
"total": 18,
"covered": 6,
"missed": 12,
"skipped": 0,
"pct": 33.33,
"classForPercent": "low"
Expand Down
Expand Up @@ -12,27 +12,31 @@
"statements": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"functions": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"lines": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
Expand All @@ -46,27 +50,31 @@
"statements": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"functions": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"lines": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
Expand Down
8 changes: 8 additions & 0 deletions packages/istanbul-reports/test/fixtures/specs/empty-file.json
Expand Up @@ -9,27 +9,31 @@
"statements": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"functions": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"lines": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
Expand All @@ -43,27 +47,31 @@
"statements": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"functions": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
},
"lines": {
"total": 0,
"covered": 0,
"missed": 0,
"skipped": 0,
"pct": 0,
"classForPercent": "empty"
Expand Down

0 comments on commit e03c464

Please sign in to comment.