From 5521a9eb28a059cc0a9337abe93ff72f9d309c59 Mon Sep 17 00:00:00 2001 From: Mark Goho Date: Thu, 2 Jul 2020 10:23:41 -0400 Subject: [PATCH] update regex to match decimal percents --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 4e8a675..95f7695 100644 --- a/src/index.js +++ b/src/index.js @@ -40,7 +40,7 @@ const availableColorsReStr = '(:?' + availableColors.join('|') + ')' function getCoverageRe() { // note, Shields.io escaped '-' with '--' const coverageRe = new RegExp( - `https://img\\.shields\\.io/badge/code--coverage-\\d+%25-${availableColorsReStr}`, + `https://img\\.shields\\.io/badge/code--coverage-[1-9]\d?|\d+\.?\d+%25-${availableColorsReStr}`, ) return coverageRe } @@ -71,7 +71,7 @@ function getCoverageFromReadme() { const readmeText = fs.readFileSync(readmeFilename, 'utf8') const coverageRe = new RegExp( - `https://img\\.shields\\.io/badge/code--coverage-(\\d+)%25-${availableColorsReStr}`, + `https://img\\.shields\\.io/badge/code--coverage-([1-9]\d?|\d+\.?\d+)%25-${availableColorsReStr}`, ) const matches = coverageRe.exec(readmeText)