From f76180a6e512d5fe699f3c892455467df3000330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 25 Mar 2019 06:04:39 +0100 Subject: [PATCH 01/28] Remove whitespace on `DELIM`, PCT headers and remaining, and final delim Earned 11 extra chars for `MISSING_COL` --- packages/istanbul-reports/lib/text/index.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 538242a2..6ad08cdb 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -4,11 +4,10 @@ */ 'use strict'; -const PCT_COLS = 9; -const MISSING_COL = 18; +const PCT_COLS = 8; +const MISSING_COL = 29; const TAB_SIZE = 1; -const DELIM = ' |'; -const COL_DELIM = '-|'; +const DELIM = '|'; function padding(num, ch) { let str = ''; @@ -37,7 +36,7 @@ function fill(str, width, right, tabs) { fmtStr = right ? fillStr + str : str + fillStr; } else { fmtStr = str.substring(strlen - remaining); - fmtStr = '... ' + fmtStr.substring(4); + fmtStr = '...' + fmtStr.substring(3); } } @@ -98,7 +97,7 @@ function makeLine(nameWidth) { elements.push(pct); elements.push(pct); elements.push(padding(MISSING_COL, '-')); - return elements.join(COL_DELIM) + COL_DELIM; + return elements.join(DELIM); } function tableHeader(maxNameCols) { @@ -109,7 +108,7 @@ function tableHeader(maxNameCols) { elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); elements.push(formatPct('Uncovered Line #s', MISSING_COL)); - return elements.join(' |') + ' |'; + return elements.join('|'); } function missingLines(node, colorizer) { @@ -182,7 +181,7 @@ function tableRow( } else { elements.push(missingLines(node, colorizer)); } - return elements.join(DELIM) + DELIM; + return elements.join(DELIM); } function TextReport(opts) { From 4cbd57b8f8e8d586cd288ffd4603c6f8bcffce3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 25 Mar 2019 06:21:53 +0100 Subject: [PATCH 02/28] Set `PCT_COLS` to 7 characters except for `branches` column Earned 3 extra chars for `MISSING_COL` --- packages/istanbul-reports/lib/text/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 6ad08cdb..47cae6ea 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -4,8 +4,8 @@ */ 'use strict'; -const PCT_COLS = 8; -const MISSING_COL = 29; +const PCT_COLS = 7; +const MISSING_COL = 32; const TAB_SIZE = 1; const DELIM = '|'; @@ -93,7 +93,7 @@ function makeLine(nameWidth) { elements.push(name); elements.push(pct); - elements.push(pct); + elements.push(padding(PCT_COLS+1, '-')); elements.push(pct); elements.push(pct); elements.push(padding(MISSING_COL, '-')); @@ -104,7 +104,7 @@ function tableHeader(maxNameCols) { const elements = []; elements.push(formatName('File', maxNameCols, 0)); elements.push(formatPct('% Stmts')); - elements.push(formatPct('% Branch')); + elements.push(formatPct('% Branch', PCT_COLS+1)); elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); elements.push(formatPct('Uncovered Line #s', MISSING_COL)); @@ -173,7 +173,7 @@ function tableRow( elements.push(colorize(formatName(name, maxNameCols, level), 'statements')); elements.push(colorize(formatPct(mm.statements), 'statements')); - elements.push(colorize(formatPct(mm.branches), 'branches')); + elements.push(colorize(formatPct(mm.branches, PCT_COLS+1), 'branches')); elements.push(colorize(formatPct(mm.functions), 'functions')); elements.push(colorize(formatPct(mm.lines), 'lines')); if (mm.lines === 100) { @@ -194,7 +194,7 @@ function TextReport(opts) { } TextReport.prototype.onStart = function(root, context) { - const statsWidth = 4 * (PCT_COLS + 2) + MISSING_COL; + const statsWidth = 3 * (PCT_COLS + 2) + (PCT_COLS + 3) +MISSING_COL; this.cw = context.writer.writeFile(this.file); this.nameWidth = findNameWidth(root, context); From cf3b5dba633abef5c0283e15cc0f4f12cb25b1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 25 Mar 2019 17:06:05 +0100 Subject: [PATCH 03/28] Adjust `missing lines` column between header length and `maxCols` --- packages/istanbul-reports/lib/text/index.js | 86 ++++++++++++++++----- 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 47cae6ea..f3058b07 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -5,7 +5,7 @@ 'use strict'; const PCT_COLS = 7; -const MISSING_COL = 32; +const MISSING_COL = 17; const TAB_SIZE = 1; const DELIM = '|'; @@ -51,6 +51,28 @@ function formatPct(pct, width) { return fill(pct, width || PCT_COLS, true, 0); } +function nodeMissing(node) { + const metrics = node.getCoverageSummary(); + const isEmpty = metrics.isEmpty(); + const lines = isEmpty ? 0 : metrics.lines.pct; + + let missingLines; + + if (lines === 100) { + const branches = node.isSummary() + ? {} + : node.getFileCoverage().getBranchCoverageByLine(); + missingLines = Object.keys(branches) + .filter(key => branches[key].coverage < 100) + .map(key => key); + } else { + missingLines = node.isSummary() + ? [] + : node.getFileCoverage().getUncoveredLines(); + } + return missingLines.join(','); +} + function nodeName(node) { return node.getRelativeName() || 'All files'; } @@ -65,6 +87,22 @@ function depthFor(node) { return ret; } +function findMissingWidth(node, context) { + let last = 0; + function compareWidth(node) { + const idealWidth = nodeMissing(node).length; + if (idealWidth > last) { + last = idealWidth; + } + }; + const visitor = { + onSummary: compareWidth, + onDetail: compareWidth + }; + node.visit(context.getVisitor(visitor)); + return last; +} + function findNameWidth(node, context) { let last = 0; const compareWidth = function(node) { @@ -86,7 +124,7 @@ function findNameWidth(node, context) { return last; } -function makeLine(nameWidth) { +function makeLine(nameWidth, missingWidth) { const name = padding(nameWidth, '-'); const pct = padding(PCT_COLS, '-'); const elements = []; @@ -96,36 +134,36 @@ function makeLine(nameWidth) { elements.push(padding(PCT_COLS+1, '-')); elements.push(pct); elements.push(pct); - elements.push(padding(MISSING_COL, '-')); + elements.push(padding(missingWidth, '-')); return elements.join(DELIM); } -function tableHeader(maxNameCols) { +function tableHeader(maxNameCols, missingWidth) { const elements = []; elements.push(formatName('File', maxNameCols, 0)); elements.push(formatPct('% Stmts')); elements.push(formatPct('% Branch', PCT_COLS+1)); elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); - elements.push(formatPct('Uncovered Line #s', MISSING_COL)); + elements.push(formatPct('Uncovered Line #s', missingWidth)); return elements.join('|'); } -function missingLines(node, colorizer) { +function missingLines(node, colorizer, missingWidth) { const missingLines = node.isSummary() ? [] : node.getFileCoverage().getUncoveredLines(); - return colorizer(formatPct(missingLines.join(','), MISSING_COL), 'low'); + return colorizer(formatPct(missingLines.join(','), missingWidth), 'low'); } -function missingBranches(node, colorizer) { +function missingBranches(node, colorizer, missingWidth) { const branches = node.isSummary() ? {} : node.getFileCoverage().getBranchCoverageByLine(); const missingLines = Object.keys(branches) .filter(key => branches[key].coverage < 100) .map(key => key); - return colorizer(formatPct(missingLines.join(','), MISSING_COL), 'medium'); + return colorizer(formatPct(missingLines.join(','), missingWidth), 'medium'); } function isFull(metrics) { @@ -144,7 +182,8 @@ function tableRow( maxNameCols, level, skipEmpty, - skipFull + skipFull, + missingWidth ) { const name = nodeName(node); const metrics = node.getCoverageSummary(); @@ -177,9 +216,9 @@ function tableRow( elements.push(colorize(formatPct(mm.functions), 'functions')); elements.push(colorize(formatPct(mm.lines), 'lines')); if (mm.lines === 100) { - elements.push(missingBranches(node, colorizer)); + elements.push(missingBranches(node, colorizer, missingWidth)); } else { - elements.push(missingLines(node, colorizer)); + elements.push(missingLines(node, colorizer, missingWidth)); } return elements.join(DELIM); } @@ -194,19 +233,27 @@ function TextReport(opts) { } TextReport.prototype.onStart = function(root, context) { - const statsWidth = 3 * (PCT_COLS + 2) + (PCT_COLS + 3) +MISSING_COL; - this.cw = context.writer.writeFile(this.file); this.nameWidth = findNameWidth(root, context); + this.missingWidth = Math.max(MISSING_COL, findMissingWidth(root, context)); + if (this.maxCols > 0) { - const maxRemaining = this.maxCols - statsWidth - 2; + const pct_cols = 4 * (PCT_COLS + 2) + 1; + + const maxRemaining = this.maxCols - (pct_cols + MISSING_COL); if (this.nameWidth > maxRemaining) { this.nameWidth = maxRemaining; } + else if (this.nameWidth < maxRemaining) { + const maxRemaining = this.maxCols - (this.nameWidth + pct_cols); + if (this.missingWidth > maxRemaining) { + this.missingWidth = maxRemaining; + } + } } - const line = makeLine(this.nameWidth); + const line = makeLine(this.nameWidth, this.missingWidth); this.cw.println(line); - this.cw.println(tableHeader(this.nameWidth)); + this.cw.println(tableHeader(this.nameWidth, this.missingWidth)); this.cw.println(line); }; @@ -219,7 +266,8 @@ TextReport.prototype.onSummary = function(node, context) { this.nameWidth, nodeDepth, this.skipEmpty, - this.skipFull + this.skipFull, + this.missingWidth ); if (row) { this.cw.println(row); @@ -231,7 +279,7 @@ TextReport.prototype.onDetail = function(node, context) { }; TextReport.prototype.onEnd = function() { - this.cw.println(makeLine(this.nameWidth)); + this.cw.println(makeLine(this.nameWidth, this.missingWidth)); this.cw.close(); }; From 65f3062b908381a32fcbb6e8f64a71350130219a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Tue, 26 Mar 2019 08:24:16 +0100 Subject: [PATCH 04/28] [reports] Fixed tests --- .../test/fixtures/specs/100-line-100-branch.json | 2 +- .../test/fixtures/specs/100-line-missing-branch.json | 2 +- .../test/fixtures/specs/empty-file-skip-empty.json | 2 +- packages/istanbul-reports/test/fixtures/specs/empty-file.json | 2 +- .../test/fixtures/specs/missing-line-missing-branch.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json index bb748986..87ce2167 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json @@ -1,6 +1,6 @@ { "title": "handles 100% branch and line coverage", - "textReportExpected": "----------|----------|----------|----------|----------|-------------------|\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |\n----------|----------|----------|----------|----------|-------------------|\n\u001b[32;1mAll files\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[33;1m \u001b[0m |\n\u001b[32;1m index.js\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[33;1m \u001b[0m |\n----------|----------|----------|----------|----------|-------------------|\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "map": { "/Users/benjamincoe/oss/test-exclude/index.js": { "path": "/Users/benjamincoe/oss/test-exclude/index.js", diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json index 9abcf93b..95bd2835 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "100% line coverage, missing branch coverage", - "textReportExpected": "----------|----------|----------|----------|----------|-------------------|\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |\n----------|----------|----------|----------|----------|-------------------|\n\u001b[32;1mAll files\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 95.35\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[33;1m \u001b[0m |\n\u001b[32;1m index.js\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 95.35\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[32;1m 100\u001b[0m |\u001b[33;1m 21,29\u001b[0m |\n----------|----------|----------|----------|----------|-------------------|\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m 21,29\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "map": { "/Users/benjamincoe/oss/test-exclude/index.js": { "path": "/Users/benjamincoe/oss/test-exclude/index.js", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json b/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json index 57e3e2d7..747e27c8 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json @@ -3,7 +3,7 @@ "opts": { "skipEmpty": true }, - "textReportExpected": "----------|----------|----------|----------|----------|-------------------|\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |\n----------|----------|----------|----------|----------|-------------------|\n----------|----------|----------|----------|----------|-------------------|\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n---------|-------|--------|-------|-------|-----------------\n", "map": { "/dev/git/istanbuljs/packages/istanbul-reports/lib/text/empty.js": { "path": "/dev/git/istanbuljs/packages/istanbul-reports/lib/text/empty.js", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file.json b/packages/istanbul-reports/test/fixtures/specs/empty-file.json index 7931ec6c..df740908 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file.json @@ -1,6 +1,6 @@ { "title": "empty file - show 0%", - "textReportExpected": "----------|----------|----------|----------|----------|-------------------|\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |\n----------|----------|----------|----------|----------|-------------------|\nAll files | 0 | 0 | 0 | 0 |\u001b[31;1m \u001b[0m |\n empty.js | 0 | 0 | 0 | 0 |\u001b[31;1m \u001b[0m |\n----------|----------|----------|----------|----------|-------------------|\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\nAll files| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n empty.js| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "map": { "/dev/git/istanbuljs/packages/istanbul-reports/lib/text/empty.js": { "path": "/dev/git/istanbuljs/packages/istanbul-reports/lib/text/empty.js", diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json index e56e0c23..5b039bed 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "missing line and branch coverage", - "textReportExpected": "----------|----------|----------|----------|----------|-------------------|\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |\n----------|----------|----------|----------|----------|-------------------|\n\u001b[32;1mAll files\u001b[0m |\u001b[32;1m 98.04\u001b[0m |\u001b[32;1m 95.35\u001b[0m |\u001b[32;1m 88.89\u001b[0m |\u001b[32;1m 97.87\u001b[0m |\u001b[31;1m \u001b[0m |\n\u001b[32;1m index.js\u001b[0m |\u001b[32;1m 98.04\u001b[0m |\u001b[32;1m 95.35\u001b[0m |\u001b[32;1m 88.89\u001b[0m |\u001b[32;1m 97.87\u001b[0m |\u001b[31;1m 9\u001b[0m |\n----------|----------|----------|----------|----------|-------------------|\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m 9\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "map": { "/Users/benjamincoe/oss/test-exclude/index.js": { "path": "/Users/benjamincoe/oss/test-exclude/index.js", From 91d570a452607897df2ec8fb703e965b24aa879d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Tue, 26 Mar 2019 08:30:20 +0100 Subject: [PATCH 05/28] Fixed linting --- packages/istanbul-reports/lib/text/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index f3058b07..70757c67 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -94,7 +94,7 @@ function findMissingWidth(node, context) { if (idealWidth > last) { last = idealWidth; } - }; + } const visitor = { onSummary: compareWidth, onDetail: compareWidth @@ -131,7 +131,7 @@ function makeLine(nameWidth, missingWidth) { elements.push(name); elements.push(pct); - elements.push(padding(PCT_COLS+1, '-')); + elements.push(padding(PCT_COLS + 1, '-')); elements.push(pct); elements.push(pct); elements.push(padding(missingWidth, '-')); @@ -142,7 +142,7 @@ function tableHeader(maxNameCols, missingWidth) { const elements = []; elements.push(formatName('File', maxNameCols, 0)); elements.push(formatPct('% Stmts')); - elements.push(formatPct('% Branch', PCT_COLS+1)); + elements.push(formatPct('% Branch', PCT_COLS + 1)); elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); elements.push(formatPct('Uncovered Line #s', missingWidth)); @@ -212,7 +212,7 @@ function tableRow( elements.push(colorize(formatName(name, maxNameCols, level), 'statements')); elements.push(colorize(formatPct(mm.statements), 'statements')); - elements.push(colorize(formatPct(mm.branches, PCT_COLS+1), 'branches')); + elements.push(colorize(formatPct(mm.branches, PCT_COLS + 1), 'branches')); elements.push(colorize(formatPct(mm.functions), 'functions')); elements.push(colorize(formatPct(mm.lines), 'lines')); if (mm.lines === 100) { @@ -243,12 +243,11 @@ TextReport.prototype.onStart = function(root, context) { const maxRemaining = this.maxCols - (pct_cols + MISSING_COL); if (this.nameWidth > maxRemaining) { this.nameWidth = maxRemaining; - } - else if (this.nameWidth < maxRemaining) { - const maxRemaining = this.maxCols - (this.nameWidth + pct_cols); - if (this.missingWidth > maxRemaining) { - this.missingWidth = maxRemaining; - } + } else if (this.nameWidth < maxRemaining) { + const maxRemaining = this.maxCols - (this.nameWidth + pct_cols); + if (this.missingWidth > maxRemaining) { + this.missingWidth = maxRemaining; + } } } const line = makeLine(this.nameWidth, this.missingWidth); From 17dbcbad44998b459bc05f75414733001ce7b7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Tue, 26 Mar 2019 10:46:59 +0100 Subject: [PATCH 06/28] Added missing truncate of `missingWidth` when `nameWidth` gets truncated --- packages/istanbul-reports/lib/text/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 70757c67..22fb207b 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -243,6 +243,7 @@ TextReport.prototype.onStart = function(root, context) { const maxRemaining = this.maxCols - (pct_cols + MISSING_COL); if (this.nameWidth > maxRemaining) { this.nameWidth = maxRemaining; + this.missingWidth = MISSING_COL; } else if (this.nameWidth < maxRemaining) { const maxRemaining = this.maxCols - (this.nameWidth + pct_cols); if (this.missingWidth > maxRemaining) { From 08db1ca1ce9809a2b116d5a9f3be5b7c22f25425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Tue, 26 Mar 2019 10:47:16 +0100 Subject: [PATCH 07/28] Added missing test for `maxCols` option --- .../test/fixtures/specs/maxcols.json | 240 ++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 packages/istanbul-reports/test/fixtures/specs/maxcols.json diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json new file mode 100644 index 00000000..21b22468 --- /dev/null +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -0,0 +1,240 @@ +{ + "title": "maxCols - too much uncovered lines", + "opts": { + "maxCols": 80 + }, + "textReportExpected": "---------|-------|--------|-------|-------|----------------------------------\nFile |% Stmts|% Branch|% Funcs|% Lines| Uncovered Line #s\n---------|-------|--------|-------|-------|----------------------------------\n\u001b[31;1mAll files\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m...1,22,24,25,28,29,32,33,35,38,39\u001b[0m\n---------|-------|--------|-------|-------|----------------------------------\n", + "map": { + "/index.js": { + "path": "/index.js", + "statementMap": { + "0": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "1": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "2": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "3": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "4": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 40 + } + }, + "5": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 11 + } + }, + "6": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "7": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 81 + } + }, + "8": { + "start": { + "line": 21, + "column": 40 + }, + "end": { + "line": 21, + "column": 81 + } + }, + "9": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 69 + } + }, + "10": { + "start": { + "line": 22, + "column": 40 + }, + "end": { + "line": 22, + "column": 69 + } + }, + "11": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "12": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 63 + } + }, + "13": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 30, + "column": 3 + } + }, + "14": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 54 + } + }, + "15": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 36, + "column": 3 + } + }, + "16": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 57 + } + }, + "17": { + "start": { + "line": 35, + "column": 4 + }, + "end": { + "line": 35, + "column": 24 + } + }, + "18": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 40, + "column": 3 + } + }, + "19": { + "start": { + "line": 39, + "column": 4 + }, + "end": { + "line": 39, + "column": 43 + } + } + }, + "fnMap": {}, + "branchMap": {}, + "s": { + "0": 0, + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0 + }, + "f": {}, + "b": {} + } + } +} From 892736cb4ae1848bfd7e0c972b71964da994db3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 12 May 2019 00:16:01 +0200 Subject: [PATCH 08/28] Fix alignment of JSON fixtures --- .../test/fixtures/specs/100-line-100-branch.json | 2 +- .../test/fixtures/specs/100-line-missing-branch.json | 2 +- packages/istanbul-reports/test/fixtures/specs/empty-file.json | 2 +- .../test/fixtures/specs/missing-line-missing-branch.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json index 30988aff..1e763eef 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json @@ -1,6 +1,6 @@ { "title": "handles 100% branch and line coverage", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json index 7910b8c1..2431b7ba 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "100% line coverage, missing branch coverage", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m 21,29\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m 21,29\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file.json b/packages/istanbul-reports/test/fixtures/specs/empty-file.json index 8e11095b..0ff3b781 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file.json @@ -1,6 +1,6 @@ { "title": "empty file - show 0%", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\nAll files| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n empty.js| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\nAll files| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n empty.js| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "htmlSpaFiles": ["empty.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json index 89d334f7..4ad0d0a5 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "missing line and branch coverage", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m 9\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m 9\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", From e8282a6a8c9bc2ed32c92dfacc3bf37a4cb85334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 12 May 2019 00:16:34 +0200 Subject: [PATCH 09/28] Update `maxcols` fixture to new data format --- .../test/fixtures/specs/maxcols.json | 542 ++++++++++-------- 1 file changed, 307 insertions(+), 235 deletions(-) diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json index 21b22468..4a2f3cb5 100644 --- a/packages/istanbul-reports/test/fixtures/specs/maxcols.json +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -1,240 +1,312 @@ { - "title": "maxCols - too much uncovered lines", - "opts": { - "maxCols": 80 - }, - "textReportExpected": "---------|-------|--------|-------|-------|----------------------------------\nFile |% Stmts|% Branch|% Funcs|% Lines| Uncovered Line #s\n---------|-------|--------|-------|-------|----------------------------------\n\u001b[31;1mAll files\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m...1,22,24,25,28,29,32,33,35,38,39\u001b[0m\n---------|-------|--------|-------|-------|----------------------------------\n", - "map": { - "/index.js": { - "path": "/index.js", - "statementMap": { - "0": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 39 - } + "title": "maxCols - too much uncovered lines", + "opts": { + "maxCols": 80 + }, + "textReportExpected": "---------|-------|--------|-------|-------|----------------------------------\nFile |% Stmts|% Branch|% Funcs|% Lines| Uncovered Line #s\n---------|-------|--------|-------|-------|----------------------------------\n\u001b[31;1mAll files\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m...1,22,24,25,28,29,32,33,35,38,39\u001b[0m\n---------|-------|--------|-------|-------|----------------------------------\n", + "htmlSpaFiles": ["index.js.html", "index.html"], + "htmlSpaCoverageData": { + "file": "", + "isEmpty": false, + "metrics": { + "statements": { + "total": 20, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + }, + "branches": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 100, + "classForPercent": "high" + }, + "functions": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 100, + "classForPercent": "high" + }, + "lines": { + "total": 18, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + } }, - "1": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "2": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 40 - } - }, - "3": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "4": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 40 - } - }, - "5": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 11 - } - }, - "6": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 19, - "column": 10 - } - }, - "7": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 81 - } - }, - "8": { - "start": { - "line": 21, - "column": 40 - }, - "end": { - "line": 21, - "column": 81 - } - }, - "9": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 69 - } - }, - "10": { - "start": { - "line": 22, - "column": 40 - }, - "end": { - "line": 22, - "column": 69 - } - }, - "11": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 26, - "column": 3 - } - }, - "12": { - "start": { - "line": 25, - "column": 4 - }, - "end": { - "line": 25, - "column": 63 - } - }, - "13": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 30, - "column": 3 - } - }, - "14": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 54 - } - }, - "15": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 36, - "column": 3 - } - }, - "16": { - "start": { - "line": 33, - "column": 4 - }, - "end": { - "line": 33, - "column": 57 - } - }, - "17": { - "start": { - "line": 35, - "column": 4 - }, - "end": { - "line": 35, - "column": 24 - } - }, - "18": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 40, - "column": 3 - } - }, - "19": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 43 - } + "children": [ + { + "file": "index.js", + "isEmpty": false, + "metrics": { + "statements": { + "total": 20, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + }, + "branches": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 100, + "classForPercent": "high" + }, + "functions": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 100, + "classForPercent": "high" + }, + "lines": { + "total": 18, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + } + }, + "children": false + } + ] + }, + "map": { + "/index.js": { + "path": "/index.js", + "statementMap": { + "0": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "1": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "2": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "3": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "4": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 40 + } + }, + "5": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 11 + } + }, + "6": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "7": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 81 + } + }, + "8": { + "start": { + "line": 21, + "column": 40 + }, + "end": { + "line": 21, + "column": 81 + } + }, + "9": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 69 + } + }, + "10": { + "start": { + "line": 22, + "column": 40 + }, + "end": { + "line": 22, + "column": 69 + } + }, + "11": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "12": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 63 + } + }, + "13": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 30, + "column": 3 + } + }, + "14": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 54 + } + }, + "15": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 36, + "column": 3 + } + }, + "16": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 57 + } + }, + "17": { + "start": { + "line": 35, + "column": 4 + }, + "end": { + "line": 35, + "column": 24 + } + }, + "18": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 40, + "column": 3 + } + }, + "19": { + "start": { + "line": 39, + "column": 4 + }, + "end": { + "line": 39, + "column": 43 + } + } + }, + "fnMap": {}, + "branchMap": {}, + "s": { + "0": 0, + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0 + }, + "f": {}, + "b": {} } - }, - "fnMap": {}, - "branchMap": {}, - "s": { - "0": 0, - "1": 0, - "2": 0, - "3": 0, - "4": 0, - "5": 0, - "6": 0, - "7": 0, - "8": 0, - "9": 0, - "10": 0, - "11": 0, - "12": 0, - "13": 0, - "14": 0, - "15": 0, - "16": 0, - "17": 0, - "18": 0, - "19": 0 - }, - "f": {}, - "b": {} } - } } From 82600f85a75465a30b090ffd25e872f48b5ca25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 12 May 2019 18:08:02 +0200 Subject: [PATCH 10/28] [text reporter] Restore padding in columns delimiter --- packages/istanbul-reports/lib/text/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 22fb207b..f1a5c358 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -7,7 +7,7 @@ const PCT_COLS = 7; const MISSING_COL = 17; const TAB_SIZE = 1; -const DELIM = '|'; +const DELIM = ' | '; function padding(num, ch) { let str = ''; @@ -135,7 +135,7 @@ function makeLine(nameWidth, missingWidth) { elements.push(pct); elements.push(pct); elements.push(padding(missingWidth, '-')); - return elements.join(DELIM); + return elements.join(DELIM.replace(/ /g, '-')); } function tableHeader(maxNameCols, missingWidth) { @@ -146,7 +146,7 @@ function tableHeader(maxNameCols, missingWidth) { elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); elements.push(formatPct('Uncovered Line #s', missingWidth)); - return elements.join('|'); + return elements.join(DELIM); } function missingLines(node, colorizer, missingWidth) { @@ -238,7 +238,7 @@ TextReport.prototype.onStart = function(root, context) { this.missingWidth = Math.max(MISSING_COL, findMissingWidth(root, context)); if (this.maxCols > 0) { - const pct_cols = 4 * (PCT_COLS + 2) + 1; + const pct_cols = DELIM.length + 4 * (PCT_COLS + DELIM.length) + 1; const maxRemaining = this.maxCols - (pct_cols + MISSING_COL); if (this.nameWidth > maxRemaining) { From ee8710a8ca2770a6a3ced1949ddf637e92cd8f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 12 May 2019 18:10:19 +0200 Subject: [PATCH 11/28] [text reporter] adjust to terminal width Use 80 columns width by default, unlimited if `maxCols` option is set explicitly to zero --- packages/istanbul-reports/lib/text/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index f1a5c358..17e9f49e 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -224,9 +224,11 @@ function tableRow( } function TextReport(opts) { + const {maxCols} = opts + opts = opts || {}; this.file = opts.file || null; - this.maxCols = opts.maxCols || 0; + this.maxCols = maxCols != null ? maxCols : (process.stdout.columns || 80); this.cw = null; this.skipEmpty = opts.skipEmpty; this.skipFull = opts.skipFull; From 3aca0645ce44686016ec4fa70f8dc1f89cbffd47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 12 May 2019 18:13:19 +0200 Subject: [PATCH 12/28] [test reporter] fix destructure from undefined options --- packages/istanbul-reports/lib/text/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 17e9f49e..9eda7d24 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -224,9 +224,10 @@ function tableRow( } function TextReport(opts) { + opts = opts || {}; + const {maxCols} = opts - opts = opts || {}; this.file = opts.file || null; this.maxCols = maxCols != null ? maxCols : (process.stdout.columns || 80); this.cw = null; From 0633575553b5fa512bffd1af6ec9f1de390efa2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 13 May 2019 09:56:02 +0200 Subject: [PATCH 13/28] [text report] Short-circuit for summary lines --- packages/istanbul-reports/lib/text/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 9eda7d24..46c43d3b 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -52,6 +52,10 @@ function formatPct(pct, width) { } function nodeMissing(node) { + if (node.isSummary()) { + return ''; + } + const metrics = node.getCoverageSummary(); const isEmpty = metrics.isEmpty(); const lines = isEmpty ? 0 : metrics.lines.pct; @@ -59,16 +63,12 @@ function nodeMissing(node) { let missingLines; if (lines === 100) { - const branches = node.isSummary() - ? {} - : node.getFileCoverage().getBranchCoverageByLine(); + const branches = node.getFileCoverage().getBranchCoverageByLine(); missingLines = Object.keys(branches) .filter(key => branches[key].coverage < 100) .map(key => key); } else { - missingLines = node.isSummary() - ? [] - : node.getFileCoverage().getUncoveredLines(); + missingLines = node.getFileCoverage().getUncoveredLines(); } return missingLines.join(','); } From d8e76434de3e106c8008baf28eb2466dccf30d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 13 May 2019 09:57:06 +0200 Subject: [PATCH 14/28] [text reporter] Unified `missingLines`, `missingBranches` and `nodeMissing` --- packages/istanbul-reports/lib/text/index.js | 25 +++------------------ 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 46c43d3b..f1a5c5e0 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -149,23 +149,6 @@ function tableHeader(maxNameCols, missingWidth) { return elements.join(DELIM); } -function missingLines(node, colorizer, missingWidth) { - const missingLines = node.isSummary() - ? [] - : node.getFileCoverage().getUncoveredLines(); - return colorizer(formatPct(missingLines.join(','), missingWidth), 'low'); -} - -function missingBranches(node, colorizer, missingWidth) { - const branches = node.isSummary() - ? {} - : node.getFileCoverage().getBranchCoverageByLine(); - const missingLines = Object.keys(branches) - .filter(key => branches[key].coverage < 100) - .map(key => key); - return colorizer(formatPct(missingLines.join(','), missingWidth), 'medium'); -} - function isFull(metrics) { return ( metrics.statements.pct === 100 && @@ -215,11 +198,9 @@ function tableRow( elements.push(colorize(formatPct(mm.branches, PCT_COLS + 1), 'branches')); elements.push(colorize(formatPct(mm.functions), 'functions')); elements.push(colorize(formatPct(mm.lines), 'lines')); - if (mm.lines === 100) { - elements.push(missingBranches(node, colorizer, missingWidth)); - } else { - elements.push(missingLines(node, colorizer, missingWidth)); - } + elements.push(colorizer(formatPct(nodeMissing(node), missingWidth), + mm.lines === 100 ? 'medium' : 'low')); + return elements.join(DELIM); } From 79dae9f00b54f3be5c94a9e50eadfadcb5fbdaaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 13 May 2019 10:24:28 +0200 Subject: [PATCH 15/28] [text reporter] unified `findMissingWidth()` and `findNameWidth()` --- packages/istanbul-reports/lib/text/index.js | 39 ++++++--------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index f1a5c5e0..970b0620 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -4,6 +4,7 @@ */ 'use strict'; +const NAME_COL = 4; const PCT_COLS = 7; const MISSING_COL = 17; const TAB_SIZE = 1; @@ -87,38 +88,18 @@ function depthFor(node) { return ret; } -function findMissingWidth(node, context) { - let last = 0; - function compareWidth(node) { - const idealWidth = nodeMissing(node).length; - if (idealWidth > last) { - last = idealWidth; - } - } - const visitor = { - onSummary: compareWidth, - onDetail: compareWidth - }; - node.visit(context.getVisitor(visitor)); - return last; +function nullDepthFor() { + return 0; } -function findNameWidth(node, context) { +function findWidth(node, context, nodeExtractor, depthFor = nullDepthFor) { let last = 0; - const compareWidth = function(node) { - const depth = depthFor(node); - const idealWidth = TAB_SIZE * depth + nodeName(node).length; - if (idealWidth > last) { - last = idealWidth; - } + function compareWidth(node) { + last = Math.max(last, TAB_SIZE * depthFor(node) + nodeExtractor(node).length) }; const visitor = { - onSummary(node) { - compareWidth(node); - }, - onDetail(node) { - compareWidth(node); - } + onSummary: compareWidth, + onDetail: compareWidth }; node.visit(context.getVisitor(visitor)); return last; @@ -218,8 +199,8 @@ function TextReport(opts) { TextReport.prototype.onStart = function(root, context) { this.cw = context.writer.writeFile(this.file); - this.nameWidth = findNameWidth(root, context); - this.missingWidth = Math.max(MISSING_COL, findMissingWidth(root, context)); + this.nameWidth = Math.max(NAME_COL, findWidth(root, context, nodeName, depthFor)); + this.missingWidth = Math.max(MISSING_COL, findWidth(root, context, nodeMissing)); if (this.maxCols > 0) { const pct_cols = DELIM.length + 4 * (PCT_COLS + DELIM.length) + 1; From 71e867fe63f86d7f321411ae6bef5c3065250320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 13 May 2019 12:34:20 +0200 Subject: [PATCH 16/28] [text report] Fixed tests fixtures --- .../test/fixtures/specs/100-line-100-branch.json | 2 +- .../test/fixtures/specs/100-line-missing-branch.json | 2 +- .../test/fixtures/specs/empty-file-skip-empty.json | 2 +- packages/istanbul-reports/test/fixtures/specs/empty-file.json | 2 +- packages/istanbul-reports/test/fixtures/specs/maxcols.json | 2 +- .../test/fixtures/specs/missing-line-missing-branch.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json index 1e763eef..a0806777 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json @@ -1,6 +1,6 @@ { "title": "handles 100% branch and line coverage", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json index 2431b7ba..258973d4 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "100% line coverage, missing branch coverage", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[33;1m 21,29\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m 21,29\u001b[0m\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json b/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json index 524217cc..a4910def 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json @@ -3,7 +3,7 @@ "opts": { "skipEmpty": true }, - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["empty.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file.json b/packages/istanbul-reports/test/fixtures/specs/empty-file.json index 0ff3b781..41ffc0b8 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file.json @@ -1,6 +1,6 @@ { "title": "empty file - show 0%", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\nAll files| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n empty.js| 0| 0| 0| 0|\u001b[31;1m \u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\nAll files | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m\n empty.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["empty.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json index 4a2f3cb5..82e6a0e7 100644 --- a/packages/istanbul-reports/test/fixtures/specs/maxcols.json +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -3,7 +3,7 @@ "opts": { "maxCols": 80 }, - "textReportExpected": "---------|-------|--------|-------|-------|----------------------------------\nFile |% Stmts|% Branch|% Funcs|% Lines| Uncovered Line #s\n---------|-------|--------|-------|-------|----------------------------------\n\u001b[31;1mAll files\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[32;1m 100\u001b[0m|\u001b[31;1m 0\u001b[0m|\u001b[31;1m...1,22,24,25,28,29,32,33,35,38,39\u001b[0m\n---------|-------|--------|-------|-------|----------------------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...,25,28,29,32,33,35,38,39\u001b[0m\n----------|---------|----------|---------|---------|----------------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json index 4ad0d0a5..acf161cd 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "missing line and branch coverage", - "textReportExpected": "---------|-------|--------|-------|-------|-----------------\nFile |% Stmts|% Branch|% Funcs|% Lines|Uncovered Line #s\n---------|-------|--------|-------|-------|-----------------\n\u001b[32;1mAll files\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m|\u001b[32;1m 98.04\u001b[0m|\u001b[32;1m 95.35\u001b[0m|\u001b[32;1m 88.89\u001b[0m|\u001b[32;1m 97.87\u001b[0m|\u001b[31;1m 9\u001b[0m\n---------|-------|--------|-------|-------|-----------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m 9\u001b[0m\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", From d15eb21f18c5a21a76f88eb522d9db8904ae0d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 13 May 2019 12:36:59 +0200 Subject: [PATCH 17/28] [test reporter] Fixed linting --- packages/istanbul-reports/lib/text/index.js | 34 +++++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 970b0620..31f5c971 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -1,6 +1,7 @@ /* Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + Copyrights licensed under the New BSD License. See the accompanying LICENSE + file for terms. */ 'use strict'; @@ -54,7 +55,7 @@ function formatPct(pct, width) { function nodeMissing(node) { if (node.isSummary()) { - return ''; + return ''; } const metrics = node.getCoverageSummary(); @@ -95,8 +96,11 @@ function nullDepthFor() { function findWidth(node, context, nodeExtractor, depthFor = nullDepthFor) { let last = 0; function compareWidth(node) { - last = Math.max(last, TAB_SIZE * depthFor(node) + nodeExtractor(node).length) - }; + last = Math.max( + last, + TAB_SIZE * depthFor(node) + nodeExtractor(node).length + ); + } const visitor = { onSummary: compareWidth, onDetail: compareWidth @@ -179,8 +183,12 @@ function tableRow( elements.push(colorize(formatPct(mm.branches, PCT_COLS + 1), 'branches')); elements.push(colorize(formatPct(mm.functions), 'functions')); elements.push(colorize(formatPct(mm.lines), 'lines')); - elements.push(colorizer(formatPct(nodeMissing(node), missingWidth), - mm.lines === 100 ? 'medium' : 'low')); + elements.push( + colorizer( + formatPct(nodeMissing(node), missingWidth), + mm.lines === 100 ? 'medium' : 'low' + ) + ); return elements.join(DELIM); } @@ -188,10 +196,10 @@ function tableRow( function TextReport(opts) { opts = opts || {}; - const {maxCols} = opts + const { maxCols } = opts; this.file = opts.file || null; - this.maxCols = maxCols != null ? maxCols : (process.stdout.columns || 80); + this.maxCols = maxCols != null ? maxCols : process.stdout.columns || 80; this.cw = null; this.skipEmpty = opts.skipEmpty; this.skipFull = opts.skipFull; @@ -199,8 +207,14 @@ function TextReport(opts) { TextReport.prototype.onStart = function(root, context) { this.cw = context.writer.writeFile(this.file); - this.nameWidth = Math.max(NAME_COL, findWidth(root, context, nodeName, depthFor)); - this.missingWidth = Math.max(MISSING_COL, findWidth(root, context, nodeMissing)); + this.nameWidth = Math.max( + NAME_COL, + findWidth(root, context, nodeName, depthFor) + ); + this.missingWidth = Math.max( + MISSING_COL, + findWidth(root, context, nodeMissing) + ); if (this.maxCols > 0) { const pct_cols = DELIM.length + 4 * (PCT_COLS + DELIM.length) + 1; From 5abd59d9cbf911fbedf8a0c868ace89cc940e247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Wed, 22 May 2019 08:50:09 +0200 Subject: [PATCH 18/28] [text reporter] Left align "Uncovered lines #s" column --- packages/istanbul-reports/lib/text/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 31f5c971..6772d203 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -130,7 +130,7 @@ function tableHeader(maxNameCols, missingWidth) { elements.push(formatPct('% Branch', PCT_COLS + 1)); elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); - elements.push(formatPct('Uncovered Line #s', missingWidth)); + elements.push(formatName('Uncovered Line #s', missingWidth)); return elements.join(DELIM); } @@ -185,7 +185,7 @@ function tableRow( elements.push(colorize(formatPct(mm.lines), 'lines')); elements.push( colorizer( - formatPct(nodeMissing(node), missingWidth), + formatName(nodeMissing(node), missingWidth), mm.lines === 100 ? 'medium' : 'low' ) ); From c26ef2a1fcf67f3a2bdce6f7ec2c2e1a9a770121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Wed, 22 May 2019 08:51:37 +0200 Subject: [PATCH 19/28] [text reporter] Continuation dots at right side for left aligned tests --- packages/istanbul-reports/lib/text/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 6772d203..3b7011fb 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -29,17 +29,22 @@ function fill(str, width, right, tabs) { const remaining = width - leadingSpaces; const leader = padding(leadingSpaces); let fmtStr = ''; - let fillStr; - const strlen = str.length; if (remaining > 0) { + const strlen = str.length; + let fillStr; + if (remaining >= strlen) { fillStr = padding(remaining - strlen); - fmtStr = right ? fillStr + str : str + fillStr; } else { - fmtStr = str.substring(strlen - remaining); - fmtStr = '...' + fmtStr.substring(3); + fillStr = '...'; + const length = remaining - fillStr.length; + + str = right + ? str.substring(strlen - length) + : str.substring(0, length); } + fmtStr = right ? fillStr + str : str + fillStr; } return leader + fmtStr; From 1667c94758070f646c7c5801d915994330681e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 26 May 2019 07:32:29 +0200 Subject: [PATCH 20/28] [text reporter] Left align with continuation dots on left side --- packages/istanbul-reports/lib/text/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 3b7011fb..734ca9e0 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -40,9 +40,8 @@ function fill(str, width, right, tabs) { fillStr = '...'; const length = remaining - fillStr.length; - str = right - ? str.substring(strlen - length) - : str.substring(0, length); + str = str.substring(strlen - length); + right = true; } fmtStr = right ? fillStr + str : str + fillStr; } From bc0d1cf5eb5423136864b9033bb6219b9bfe7f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 26 May 2019 07:34:17 +0200 Subject: [PATCH 21/28] [text reporter] Remove useless `.map()` & move common `getFileCoverage()` --- packages/istanbul-reports/lib/text/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 734ca9e0..47bf845a 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -68,13 +68,14 @@ function nodeMissing(node) { let missingLines; + const fileCoverage = node.getFileCoverage(); if (lines === 100) { - const branches = node.getFileCoverage().getBranchCoverageByLine(); - missingLines = Object.keys(branches) - .filter(key => branches[key].coverage < 100) - .map(key => key); + const branches = fileCoverage.getBranchCoverageByLine(); + missingLines = Object.keys(branches).filter( + key => branches[key].coverage < 100 + ); } else { - missingLines = node.getFileCoverage().getUncoveredLines(); + missingLines = fileCoverage.getUncoveredLines(); } return missingLines.join(','); } From 9eb95610c580e73e96b917b364eddfc689a55315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 26 May 2019 07:35:35 +0200 Subject: [PATCH 22/28] [text reporter] Updated fixtures for left align with left side dots --- .../test/fixtures/specs/100-line-missing-branch.json | 2 +- packages/istanbul-reports/test/fixtures/specs/maxcols.json | 2 +- .../test/fixtures/specs/missing-line-missing-branch.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json index 258973d4..ce2cc2b3 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "100% line coverage, missing branch coverage", - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m 21,29\u001b[0m\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m21,29 \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json index 82e6a0e7..28172801 100644 --- a/packages/istanbul-reports/test/fixtures/specs/maxcols.json +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -3,7 +3,7 @@ "opts": { "maxCols": 80 }, - "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...,25,28,29,32,33,35,38,39\u001b[0m\n----------|---------|----------|---------|---------|----------------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...,25,28,29,32,33,35,38,39\u001b[0m\n----------|---------|----------|---------|---------|----------------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json index acf161cd..1c9ed39a 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "missing line and branch coverage", - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m 9\u001b[0m\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m9 \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", From 755b13adc35ce129fbdeca8133c69569291e6637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Sun, 26 May 2019 22:12:49 +0200 Subject: [PATCH 23/28] [text reporter] add right padding for `missing lines #s` column --- packages/istanbul-reports/lib/text/index.js | 8 ++++---- .../test/fixtures/specs/100-line-100-branch.json | 2 +- .../test/fixtures/specs/100-line-missing-branch.json | 2 +- .../test/fixtures/specs/empty-file-skip-empty.json | 2 +- .../istanbul-reports/test/fixtures/specs/empty-file.json | 2 +- .../istanbul-reports/test/fixtures/specs/maxcols.json | 2 +- .../test/fixtures/specs/missing-line-missing-branch.json | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 47bf845a..f558798c 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -125,7 +125,7 @@ function makeLine(nameWidth, missingWidth) { elements.push(pct); elements.push(pct); elements.push(padding(missingWidth, '-')); - return elements.join(DELIM.replace(/ /g, '-')); + return elements.join(DELIM.replace(/ /g, '-')) + '-'; } function tableHeader(maxNameCols, missingWidth) { @@ -136,7 +136,7 @@ function tableHeader(maxNameCols, missingWidth) { elements.push(formatPct('% Funcs')); elements.push(formatPct('% Lines')); elements.push(formatName('Uncovered Line #s', missingWidth)); - return elements.join(DELIM); + return elements.join(DELIM) + ' '; } function isFull(metrics) { @@ -195,7 +195,7 @@ function tableRow( ) ); - return elements.join(DELIM); + return elements.join(DELIM) + ' '; } function TextReport(opts) { @@ -222,7 +222,7 @@ TextReport.prototype.onStart = function(root, context) { ); if (this.maxCols > 0) { - const pct_cols = DELIM.length + 4 * (PCT_COLS + DELIM.length) + 1; + const pct_cols = DELIM.length + 4 * (PCT_COLS + DELIM.length) + 2; const maxRemaining = this.maxCols - (pct_cols + MISSING_COL); if (this.nameWidth > maxRemaining) { diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json index a0806777..55b61ecd 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-100-branch.json @@ -1,6 +1,6 @@ { "title": "handles 100% branch and line coverage", - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m \n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m \n----------|---------|----------|---------|---------|-------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json index ce2cc2b3..f74c640f 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "100% line coverage, missing branch coverage", - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m21,29 \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m \n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m21,29 \u001b[0m \n----------|---------|----------|---------|---------|-------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json b/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json index a4910def..dbff6a01 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file-skip-empty.json @@ -3,7 +3,7 @@ "opts": { "skipEmpty": true }, - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\n----------|---------|----------|---------|---------|-------------------\n", "htmlSpaFiles": ["empty.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/empty-file.json b/packages/istanbul-reports/test/fixtures/specs/empty-file.json index 41ffc0b8..d759d6ad 100644 --- a/packages/istanbul-reports/test/fixtures/specs/empty-file.json +++ b/packages/istanbul-reports/test/fixtures/specs/empty-file.json @@ -1,6 +1,6 @@ { "title": "empty file - show 0%", - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\nAll files | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m\n empty.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\nAll files | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n empty.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n----------|---------|----------|---------|---------|-------------------\n", "htmlSpaFiles": ["empty.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json index 28172801..755c0899 100644 --- a/packages/istanbul-reports/test/fixtures/specs/maxcols.json +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -3,7 +3,7 @@ "opts": { "maxCols": 80 }, - "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...,25,28,29,32,33,35,38,39\u001b[0m\n----------|---------|----------|---------|---------|----------------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...25,28,29,32,33,35,38,39\u001b[0m \n----------|---------|----------|---------|---------|----------------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json index 1c9ed39a..9d0d6c05 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json @@ -1,6 +1,6 @@ { "title": "missing line and branch coverage", - "textReportExpected": "----------|---------|----------|---------|---------|------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m \u001b[0m\n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m9 \u001b[0m\n----------|---------|----------|---------|---------|------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 98.04\u001b[0m | \u001b[32;1m 95.35\u001b[0m | \u001b[32;1m 88.89\u001b[0m | \u001b[32;1m 97.87\u001b[0m | \u001b[31;1m9 \u001b[0m \n----------|---------|----------|---------|---------|-------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", From b15bec46cc0418d808a5197e7ba0e8defaa10e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Wed, 11 Dec 2019 19:07:49 +0100 Subject: [PATCH 24/28] [text report] Coalesce ranges of lines --- packages/istanbul-reports/lib/text/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 0b812ee9..42c503b0 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -78,7 +78,23 @@ function nodeMissing(node) { } else { missingLines = fileCoverage.getUncoveredLines(); } - return missingLines.join(','); + return missingLines + .reduce((acum, line) => { + line = parseInt(line); + const range = acum[acum.length - 1]; + if (range && range[range.length - 1] === line - 1) range.push(line); + else acum.push([line]); + + return acum; + }, []) + .flatMap(range => { + const { length } = range; + + if (length <= 2) return range; + + return `${range[0]}-${range[length - 1]}`; + }) + .join(','); } function nodeName(node) { From 67d3510db3391cc946ec7f7f10c81a0b54b34406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Thu, 12 Dec 2019 08:51:34 +0100 Subject: [PATCH 25/28] [text report] Remove usage of `flatMap()` to be compatible with Node.js 8.x --- packages/istanbul-reports/lib/text/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 42c503b0..450013dc 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -78,7 +78,8 @@ function nodeMissing(node) { } else { missingLines = fileCoverage.getUncoveredLines(); } - return missingLines + + const ranges = missingLines .reduce((acum, line) => { line = parseInt(line); const range = acum[acum.length - 1]; @@ -87,14 +88,15 @@ function nodeMissing(node) { return acum; }, []) - .flatMap(range => { + .map(range => { const { length } = range; if (length <= 2) return range; return `${range[0]}-${range[length - 1]}`; - }) - .join(','); + }); + + return [].concat(...ranges).join(','); } function nodeName(node) { From 59dbe06488c87b74dd4b508806a7c98e45940abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Thu, 12 Dec 2019 11:48:26 +0100 Subject: [PATCH 26/28] [Text report] Test for "coalescense ranges of missing lines" --- .../test/fixtures/specs/coalescence.json | 312 ++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 packages/istanbul-reports/test/fixtures/specs/coalescence.json diff --git a/packages/istanbul-reports/test/fixtures/specs/coalescence.json b/packages/istanbul-reports/test/fixtures/specs/coalescence.json new file mode 100644 index 00000000..736cfa5b --- /dev/null +++ b/packages/istanbul-reports/test/fixtures/specs/coalescence.json @@ -0,0 +1,312 @@ +{ + "title": "coalescense ranges of missing lines", + "opts": { + "maxCols": 80 + }, + "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...21-24,28,29,32,33,35-37\u001b[0m \n----------|---------|----------|---------|---------|----------------------------\n", + "htmlSpaFiles": ["index.js.html", "index.html"], + "htmlSpaCoverageData": { + "file": "", + "isEmpty": false, + "metrics": { + "statements": { + "total": 20, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + }, + "branches": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "empty" + }, + "functions": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "empty" + }, + "lines": { + "total": 18, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + } + }, + "children": [ + { + "file": "index.js", + "isEmpty": false, + "metrics": { + "statements": { + "total": 20, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + }, + "branches": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "empty" + }, + "functions": { + "total": 0, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "empty" + }, + "lines": { + "total": 18, + "covered": 0, + "skipped": 0, + "pct": 0, + "classForPercent": "low" + } + }, + "children": false + } + ] + }, + "map": { + "/index.js": { + "path": "/index.js", + "statementMap": { + "0": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "1": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "2": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "3": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "4": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 40 + } + }, + "5": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 11 + } + }, + "6": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "7": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 81 + } + }, + "8": { + "start": { + "line": 21, + "column": 40 + }, + "end": { + "line": 21, + "column": 81 + } + }, + "9": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 69 + } + }, + "10": { + "start": { + "line": 22, + "column": 40 + }, + "end": { + "line": 22, + "column": 69 + } + }, + "11": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "12": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 63 + } + }, + "13": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 30, + "column": 3 + } + }, + "14": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 54 + } + }, + "15": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 36, + "column": 3 + } + }, + "16": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 57 + } + }, + "17": { + "start": { + "line": 35, + "column": 4 + }, + "end": { + "line": 35, + "column": 24 + } + }, + "18": { + "start": { + "line": 36, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "19": { + "start": { + "line": 37, + "column": 4 + }, + "end": { + "line": 37, + "column": 43 + } + } + }, + "fnMap": {}, + "branchMap": {}, + "s": { + "0": 0, + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0 + }, + "f": {}, + "b": {} + } + } +} From 8fecd2d881b3df19ff72e09bb06f8e2bae6a364e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 3 Feb 2020 13:04:31 +0100 Subject: [PATCH 27/28] [text report] Include empty lines in uncovered ranges --- packages/istanbul-reports/lib/text/index.js | 32 ++++++----- .../test/fixtures/specs/coalescence.json | 14 ++--- .../test/fixtures/specs/maxcols.json | 56 +++++++++---------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/packages/istanbul-reports/lib/text/index.js b/packages/istanbul-reports/lib/text/index.js index 450013dc..d87ba298 100644 --- a/packages/istanbul-reports/lib/text/index.js +++ b/packages/istanbul-reports/lib/text/index.js @@ -67,33 +67,39 @@ function nodeMissing(node) { const isEmpty = metrics.isEmpty(); const lines = isEmpty ? 0 : metrics.lines.pct; - let missingLines; + let coveredLines; const fileCoverage = node.getFileCoverage(); if (lines === 100) { const branches = fileCoverage.getBranchCoverageByLine(); - missingLines = Object.keys(branches).filter( - key => branches[key].coverage < 100 - ); + coveredLines = Object.entries(branches).map(([key, { coverage }]) => [ + key, + coverage === 100 + ]); } else { - missingLines = fileCoverage.getUncoveredLines(); + coveredLines = Object.entries(fileCoverage.getLineCoverage()); } - const ranges = missingLines - .reduce((acum, line) => { - line = parseInt(line); - const range = acum[acum.length - 1]; - if (range && range[range.length - 1] === line - 1) range.push(line); - else acum.push([line]); + let newRange = true; + const ranges = coveredLines + .reduce((acum, [line, hit]) => { + if (hit) newRange = true; + else { + line = parseInt(line); + if (newRange) { + acum.push([line]); + newRange = false; + } else acum[acum.length - 1][1] = line; + } return acum; }, []) .map(range => { const { length } = range; - if (length <= 2) return range; + if (length === 1) return range[0]; - return `${range[0]}-${range[length - 1]}`; + return `${range[0]}-${range[1]}`; }); return [].concat(...ranges).join(','); diff --git a/packages/istanbul-reports/test/fixtures/specs/coalescence.json b/packages/istanbul-reports/test/fixtures/specs/coalescence.json index 736cfa5b..987a6df4 100644 --- a/packages/istanbul-reports/test/fixtures/specs/coalescence.json +++ b/packages/istanbul-reports/test/fixtures/specs/coalescence.json @@ -3,7 +3,7 @@ "opts": { "maxCols": 80 }, - "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...21-24,28,29,32,33,35-37\u001b[0m \n----------|---------|----------|---------|---------|----------------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|----------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 30\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 33.33\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 30\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 33.33\u001b[0m | \u001b[31;1m2,4,9,21-28,32,35-37\u001b[0m \n----------|---------|----------|---------|---------|----------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", @@ -284,13 +284,13 @@ "fnMap": {}, "branchMap": {}, "s": { - "0": 0, + "0": 1, "1": 0, - "2": 0, + "2": 1, "3": 0, - "4": 0, + "4": 1, "5": 0, - "6": 0, + "6": 1, "7": 0, "8": 0, "9": 0, @@ -298,9 +298,9 @@ "11": 0, "12": 0, "13": 0, - "14": 0, + "14": 1, "15": 0, - "16": 0, + "16": 1, "17": 0, "18": 0, "19": 0 diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json index 1d677437..dffdd930 100644 --- a/packages/istanbul-reports/test/fixtures/specs/maxcols.json +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -3,7 +3,7 @@ "opts": { "maxCols": 80 }, - "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 0\u001b[0m | \u001b[31;1m...25,28,29,32,33,35,38,39\u001b[0m \n----------|---------|----------|---------|---------|----------------------------\n", + "textReportExpected": "----------|---------|----------|---------|---------|----------------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|----------------------------\n\u001b[31;1mAll files\u001b[0m | \u001b[31;1m 40\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 40\u001b[0m | \u001b[31;1m \u001b[0m \n\u001b[31;1m index.js\u001b[0m | \u001b[31;1m 40\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[31;1m 40\u001b[0m | \u001b[31;1m...11,15,19,23,27,31,35,39\u001b[0m \n----------|---------|----------|---------|---------|----------------------------\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { "file": "", @@ -132,11 +132,11 @@ }, "5": { "start": { - "line": 9, + "line": 11, "column": 2 }, "end": { - "line": 9, + "line": 11, "column": 11 } }, @@ -146,57 +146,57 @@ "column": 2 }, "end": { - "line": 19, + "line": 13, "column": 10 } }, "7": { "start": { - "line": 21, + "line": 15, "column": 2 }, "end": { - "line": 21, + "line": 15, "column": 81 } }, "8": { "start": { - "line": 21, + "line": 17, "column": 40 }, "end": { - "line": 21, + "line": 17, "column": 81 } }, "9": { "start": { - "line": 22, + "line": 19, "column": 2 }, "end": { - "line": 22, + "line": 19, "column": 69 } }, "10": { "start": { - "line": 22, + "line": 21, "column": 40 }, "end": { - "line": 22, + "line": 21, "column": 69 } }, "11": { "start": { - "line": 24, + "line": 23, "column": 2 }, "end": { - "line": 26, + "line": 23, "column": 3 } }, @@ -212,11 +212,11 @@ }, "13": { "start": { - "line": 28, + "line": 27, "column": 2 }, "end": { - "line": 30, + "line": 27, "column": 3 } }, @@ -232,11 +232,11 @@ }, "15": { "start": { - "line": 32, + "line": 31, "column": 2 }, "end": { - "line": 36, + "line": 31, "column": 3 } }, @@ -262,11 +262,11 @@ }, "18": { "start": { - "line": 38, + "line": 37, "column": 2 }, "end": { - "line": 40, + "line": 37, "column": 3 } }, @@ -288,21 +288,21 @@ "1": 0, "2": 0, "3": 0, - "4": 0, + "4": 1, "5": 0, - "6": 0, + "6": 1, "7": 0, - "8": 0, + "8": 1, "9": 0, - "10": 0, + "10": 1, "11": 0, - "12": 0, + "12": 1, "13": 0, - "14": 0, + "14": 1, "15": 0, - "16": 0, + "16": 1, "17": 0, - "18": 0, + "18": 1, "19": 0 }, "f": {}, From 4e56b41c113ceba93745705a528248991588e5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 3 Feb 2020 13:26:05 +0100 Subject: [PATCH 28/28] [reports text] Fixed specs (they are re-used by `html-spa` report) --- .../test/fixtures/specs/coalescence.json | 16 +++++++-------- .../test/fixtures/specs/maxcols.json | 20 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/istanbul-reports/test/fixtures/specs/coalescence.json b/packages/istanbul-reports/test/fixtures/specs/coalescence.json index 987a6df4..db972eb9 100644 --- a/packages/istanbul-reports/test/fixtures/specs/coalescence.json +++ b/packages/istanbul-reports/test/fixtures/specs/coalescence.json @@ -11,9 +11,9 @@ "metrics": { "statements": { "total": 20, - "covered": 0, + "covered": 6, "skipped": 0, - "pct": 0, + "pct": 30, "classForPercent": "low" }, "branches": { @@ -32,9 +32,9 @@ }, "lines": { "total": 18, - "covered": 0, + "covered": 6, "skipped": 0, - "pct": 0, + "pct": 33.33, "classForPercent": "low" } }, @@ -45,9 +45,9 @@ "metrics": { "statements": { "total": 20, - "covered": 0, + "covered": 6, "skipped": 0, - "pct": 0, + "pct": 30, "classForPercent": "low" }, "branches": { @@ -66,9 +66,9 @@ }, "lines": { "total": 18, - "covered": 0, + "covered": 6, "skipped": 0, - "pct": 0, + "pct": 33.33, "classForPercent": "low" } }, diff --git a/packages/istanbul-reports/test/fixtures/specs/maxcols.json b/packages/istanbul-reports/test/fixtures/specs/maxcols.json index dffdd930..8b7c49f4 100644 --- a/packages/istanbul-reports/test/fixtures/specs/maxcols.json +++ b/packages/istanbul-reports/test/fixtures/specs/maxcols.json @@ -11,9 +11,9 @@ "metrics": { "statements": { "total": 20, - "covered": 0, + "covered": 8, "skipped": 0, - "pct": 0, + "pct": 40, "classForPercent": "low" }, "branches": { @@ -31,10 +31,10 @@ "classForPercent": "empty" }, "lines": { - "total": 18, - "covered": 0, + "total": 20, + "covered": 8, "skipped": 0, - "pct": 0, + "pct": 40, "classForPercent": "low" } }, @@ -45,9 +45,9 @@ "metrics": { "statements": { "total": 20, - "covered": 0, + "covered": 8, "skipped": 0, - "pct": 0, + "pct": 40, "classForPercent": "low" }, "branches": { @@ -65,10 +65,10 @@ "classForPercent": "empty" }, "lines": { - "total": 18, - "covered": 0, + "total": 20, + "covered": 8, "skipped": 0, - "pct": 0, + "pct": 40, "classForPercent": "low" } },