@@ -5923,6 +5923,7 @@ function commentForMonorepo(
59235923 const baseLcov = lcovBaseArrayForMonorepo . find (
59245924 el => el . packageName === lcovObj . packageName ,
59255925 ) ;
5926+
59265927 const pbefore = baseLcov ? percentage ( baseLcov ) : 0 ;
59275928 const pafter = baseLcov ? percentage ( lcovObj . lcov ) : 0 ;
59285929 const pdiff = pafter - pbefore ;
@@ -6094,15 +6095,36 @@ var github_1$1 = github$2.upsertComment;
60946095 * @function getLcovFiles
60956096 * @param {string } dir Dir path string.
60966097 * @return {string[{<package_name>: <path_to_lcov_file>}] } Array with lcove file names with package names as key.
6097- * @param {string } lcovFileName path string for lcov file for PR or base lcov file.
60986098 */
6099- const getLcovFiles = ( dir , filelist = [ ] , lcovFileName = "lcov.info" ) => {
6099+ const getLcovFiles = ( dir , filelist = [ ] ) => {
61006100 fs__default . readdirSync ( dir ) . forEach ( file => {
61016101 filelist = fs__default . statSync ( path . join ( dir , file ) ) . isDirectory ( )
61026102 ? getLcovFiles ( path . join ( dir , file ) , filelist )
61036103 : filelist
61046104 . filter ( file => {
6105- return file . path . includes ( lcovFileName ) ;
6105+ return file . path . includes ( "lcov.info" ) ;
6106+ } )
6107+ . concat ( {
6108+ name : dir . split ( "/" ) [ 1 ] ,
6109+ path : path . join ( dir , file ) ,
6110+ } ) ;
6111+ } ) ;
6112+ return filelist ;
6113+ } ;
6114+
6115+ /**
6116+ * Find all files inside a dir, recursively for base branch.
6117+ * @function getLcovBaseFiles
6118+ * @param {string } dir Dir path string.
6119+ * @return {string[{<package_name>: <path_to_lcov_file>}] } Array with lcove file names with package names as key.
6120+ */
6121+ const getLcovBaseFiles = ( dir , filelist = [ ] ) => {
6122+ fs__default . readdirSync ( dir ) . forEach ( file => {
6123+ filelist = fs__default . statSync ( path . join ( dir , file ) ) . isDirectory ( )
6124+ ? getLcovBaseFiles ( path . join ( dir , file ) , filelist )
6125+ : filelist
6126+ . filter ( file => {
6127+ return file . path . includes ( "lcov-base.info" ) ;
61066128 } )
61076129 . concat ( {
61086130 name : dir . split ( "/" ) [ 1 ] ,
@@ -6138,7 +6160,7 @@ async function main() {
61386160
61396161 let lcovArray = monorepoBasePath ? getLcovFiles ( monorepoBasePath ) : [ ] ;
61406162 let lcovBaseArray = monorepoBasePath
6141- ? getLcovFiles ( monorepoBasePath , [ ] , "lcov-base.info" )
6163+ ? getLcovBaseFiles ( monorepoBasePath )
61426164 : [ ] ;
61436165
61446166 const lcovArrayForMonorepo = [ ] ;
0 commit comments