aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CoverageListing.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/CoverageListing.js b/src/CoverageListing.js
index 6b5bc6d..72a5ea8 100644
--- a/src/CoverageListing.js
+++ b/src/CoverageListing.js
@@ -65,6 +65,13 @@ export class CoverageListing extends Component {
65 .then(content => this.setState({ listingContent: content })); 65 .then(content => this.setState({ listingContent: content }));
66 } 66 }
67 67
68 _lineCoverageString(coverage) {
69 const instructionCount = parseInt(coverage.ci) + parseInt(coverage.mi);
70 const branchCount = parseInt(coverage.cb) + parseInt(coverage.mb);
71 return coverage.ci + '/' + instructionCount + ' instructions covered, ' +
72 coverage.cb + '/' + branchCount + ' branches covered';
73 }
74
68 _renderNone() { 75 _renderNone() {
69 return (<div>No source file provided.</div>); 76 return (<div>No source file provided.</div>);
70 } 77 }
@@ -76,10 +83,15 @@ export class CoverageListing extends Component {
76 _renderLine(lineContent, lineNumber) { 83 _renderLine(lineContent, lineNumber) {
77 if (!(lineNumber in this.state.coverageMap)) 84 if (!(lineNumber in this.state.coverageMap))
78 return (<li key={lineNumber}><pre>{lineContent}</pre></li>); 85 return (<li key={lineNumber}><pre>{lineContent}</pre></li>);
79 86
80 const coverage = this.state.coverageMap[lineNumber]; 87 const coverage = this.state.coverageMap[lineNumber];
81 const wellCovered = parseInt(coverage.mi) === 0 && parseInt(coverage.mb) === 0; 88 const wellCovered = parseInt(coverage.mi) === 0 && parseInt(coverage.mb) === 0;
82 return (<li key={lineNumber} well-covered={wellCovered.toString()}><pre>{lineContent}</pre></li>); 89
90 return (
91 <li key={lineNumber} well-covered={wellCovered.toString()} title={this._lineCoverageString(coverage)}>
92 <pre>{lineContent}</pre>
93 </li>
94 );
83 } 95 }
84 96
85 _renderListing() { 97 _renderListing() {