Skip to content

Commit

Permalink
Fixes microsoft#1683; column 8 is the coverage count, not a boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
kentquirk committed May 26, 2018
1 parent 54db32b commit d9ccb36
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/goCover.ts
Expand Up @@ -173,7 +173,7 @@ export function getCoverage(coverProfilePath: string, showErrOutput: boolean = f

lines.on('line', function (data: string) {
// go test coverageprofile generates output:
// filename:StartLine.StartColumn,EndLine.EndColumn Hits IsCovered
// filename:StartLine.StartColumn,EndLine.EndColumn Hits CoverCount
// The first line will be "mode: set" which will be ignored
let fileRange = data.match(/([^:]+)\:([\d]+)\.([\d]+)\,([\d]+)\.([\d]+)\s([\d]+)\s([\d]+)/);
if (!fileRange) return;
Expand All @@ -189,8 +189,8 @@ export function getCoverage(coverProfilePath: string, showErrOutput: boolean = f
// End Column converted to zero based
parseInt(fileRange[5]) - 1
);
// If is Covered
if (parseInt(fileRange[7]) === 1) {
// If is Covered (CoverCount > 0)
if (parseInt(fileRange[7]) > 0) {
coverage.coveredRange.push({ range });
}
// Not Covered
Expand Down

0 comments on commit d9ccb36

Please sign in to comment.