File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 11import constants from '@socketsecurity/registry/lib/constants'
2+ import { escapeRegExp } from '@socketsecurity/registry/lib/regexps'
23import { spawn } from '@socketsecurity/registry/lib/spawn'
34
45/**
@@ -22,12 +23,15 @@ export async function getTypeCoverage() {
2223 // Parse the output to find the line containing the percentage.
2324 const output = result . stdout || ''
2425 const lines = output . split ( '\n' )
26+ const percentSymbol = escapeRegExp ( '%' )
2527 const percentageLine = lines . find ( line => line . includes ( '%' ) )
2628
2729 // Extract the percentage value from the line using regex.
2830 if ( percentageLine ) {
2931 // Matches patterns like "95.12%" or "100%" and extracts the numeric part.
30- const match = percentageLine . match ( / ( \d + (?: \. \d + ) ? ) % / )
32+ const match = percentageLine . match (
33+ new RegExp ( `(\\d+(?:\\.\\d+)?)${ percentSymbol } ` ) ,
34+ )
3135 if ( match ) {
3236 return parseFloat ( match [ 1 ] )
3337 }
You can’t perform that action at this time.
0 commit comments