diff --git a/CHANGELOG.md b/CHANGELOG.md index ec5bf95..952d702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Changelog ========= +### 1.0.3 +- Quickfix for istanbul parser + ### 1.0.2 - Fix lcov issue - Fix istanbul issue diff --git a/package.json b/package.json index ed70185..36d349d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-coverage-highlighter", "displayName": "Code Coverage Highlighter", "description": "Displays Your Code Coverage", - "version": "1.0.2", + "version": "1.0.3", "icon": "images/icon.png", "publisher": "brainfit", "author": { diff --git a/src/parsers/istanbulParser.ts b/src/parsers/istanbulParser.ts index d52a645..4caf118 100644 --- a/src/parsers/istanbulParser.ts +++ b/src/parsers/istanbulParser.ts @@ -92,7 +92,14 @@ export class IstanbulParser implements IParser { // Refactor it: just "else not taken" mark const branches = this.makeCollection(entry.b, entry.branchMap, (item) => item, - (map_) => map_.locations, + (map_) => { + if (map_.type === 'if') { + // 'if' is a special case. TODO: Insert marker instead coverage region + return []; // ignore them + } else { + return map_.locations + } + }, (map_) => map_.type); const statements = this.makeCollection(entry.s, entry.statementMap, (item) => [item], @@ -103,7 +110,7 @@ export class IstanbulParser implements IParser { const coverage = new CoverageCollection(); coverage - // .merge(branches) + .merge(branches) .merge(statements) .merge(functions) .normalize(); @@ -174,6 +181,10 @@ export class IstanbulParser implements IParser { a.start.column = 0; a.end.column = 1; } + if (a.start.line && a.start.column && a.end.line && !a.end.column) { + // whole line in branches + a.end.column = 10000; // TODO: Fix it + } if (a.start.column < 0 || a.end.column < 0) { return