Skip to content

Commit

Permalink
statusbar reports floor of coverage (resolves #423)
Browse files Browse the repository at this point in the history
* in a 200 line file with 1 missed line, statusbar would report 100%
  coverage with `Math.round`, which is misleading; there is still one
  missed line, so use `Math.floor` instead (which would report 99%
  coverage)
  • Loading branch information
guppy0130 committed Sep 17, 2023
1 parent 7b40ddc commit a6c10bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coverage-system/coverageservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class CoverageService {
const covered = fileCoverage?.lines?.hit;
const total = fileCoverage?.lines?.found;

return this.statusBar.setCoverage(Math.round((covered / total) * 100 ));
return this.statusBar.setCoverage(Math.floor((covered / total) * 100 ));
} catch {
return this.statusBar.setCoverage(undefined);
}
Expand Down

0 comments on commit a6c10bc

Please sign in to comment.