@@ -13,10 +13,11 @@ import {
1313} from './utils' ;
1414import type { ExecOptions } from '@actions/exec/lib/interfaces' ;
1515
16+ const PLATFORM = platform ( ) ;
1617// REFER: https://docs.codeclimate.com/docs/configuring-test-coverage#locations-of-pre-built-binaries
1718/** Canonical download URL for the official CodeClimate reporter. */
1819export const DOWNLOAD_URL = `https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${
19- platform ( ) === 'win32' ? 'windows' : platform ( )
20+ PLATFORM === 'win32' ? 'windows' : PLATFORM
2021} -${ arch ( ) === 'arm64' ? 'arm64' : 'amd64' } `;
2122/** Local file name of the CodeClimate reporter. */
2223export const EXECUTABLE = './cc-reporter' ;
@@ -144,7 +145,13 @@ async function getLocationLines(
144145 . map ( ( pat ) => pat . trim ( ) ) ;
145146
146147 const patternsAndFormats = coverageLocationPatternsLines . map ( ( line ) => {
147- const lineParts = line . split ( ':' ) ;
148+ let lineParts = line . split ( ':' ) ;
149+ // On Windows, if the glob received an absolute path, the path will
150+ // include the Drive letter and the path – for example, `C:\Users\gp\projects\cc\*.lcov:lcov`
151+ // which leads to 2 colons. So we handle this special case.
152+ if ( PLATFORM === 'win32' && ( line . match ( / : / g) || [ ] ) . length > 1 ) {
153+ lineParts = [ lineParts . slice ( 0 , - 1 ) . join ( ':' ) , lineParts . slice ( - 1 ) [ 0 ] ] ;
154+ }
148155 const format = lineParts . slice ( - 1 ) [ 0 ] ;
149156 const pattern = lineParts . slice ( 0 , - 1 ) [ 0 ] ;
150157 return { format, pattern } ;
0 commit comments