Skip to content

Commit

Permalink
Fix logic issue
Browse files Browse the repository at this point in the history
  • Loading branch information
markis committed Feb 23, 2018
1 parent f336224 commit fc4623f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/ratchet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ function ratchetSingleNumberCoverage(
category: IstanbulCoverageCategory,
options: RatchetOptions,
) {
const ratchetPct = options.ratchetPercentagePadding
? Math.round(category.pct) - options.ratchetPercentagePadding
: category.pct;
if (num && category && num > 0 && num <= ratchetPct) {
return ratchetPct;
} else if (num && category && num < 0 && num >= -category.covered) {
return -category.covered;
if (num && category) {
const ratchetPct = options.ratchetPercentagePadding
? Math.round(category.pct) - options.ratchetPercentagePadding
: category.pct;
if (num > 0 && num <= ratchetPct) {
return ratchetPct;
} else if (num < 0 && num >= -category.covered) {
return -category.covered;
}
}
}

0 comments on commit fc4623f

Please sign in to comment.