diff --git a/package.json b/package.json index d3b645b..0f51ad5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rianbotha/coverage-summary", - "version": "1.1.3", + "version": "1.1.4", "description": "Summarizes istanbul coverage report for specified folders.", "main": "index.js", "bin": { diff --git a/src/format-percent.js b/src/format-percent.js index 4989c09..b02c6e2 100644 --- a/src/format-percent.js +++ b/src/format-percent.js @@ -1,6 +1,7 @@ const formatThreshold = require('./format-threshold'); const formatPercent = (number, total) => { + if (number === 0 || total === 0) return formatThreshold('0%', 0); const percent = Math.round(number / total * 100 * 100) / 100; return formatThreshold(percent + '%', percent); };