Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Quickfix for istanbul parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir K Urushev committed Feb 26, 2019
1 parent 93c9862 commit 0187987
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

### 1.0.3
- Quickfix for istanbul parser

### 1.0.2
- Fix lcov issue
- Fix istanbul issue
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
15 changes: 13 additions & 2 deletions src/parsers/istanbulParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ export class IstanbulParser implements IParser {
// Refactor it: just "else not taken" mark
const branches = this.makeCollection<number[], IIstanbul.IBranch>(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<number, IIstanbul.ILocation>(entry.s, entry.statementMap,
(item) => [item],
Expand All @@ -103,7 +110,7 @@ export class IstanbulParser implements IParser {

const coverage = new CoverageCollection();
coverage
// .merge(branches)
.merge(branches)
.merge(statements)
.merge(functions)
.normalize();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0187987

Please sign in to comment.