@@ -5923,6 +5923,7 @@ function commentForMonorepo(
5923
5923
const baseLcov = lcovBaseArrayForMonorepo . find (
5924
5924
el => el . packageName === lcovObj . packageName ,
5925
5925
) ;
5926
+
5926
5927
const pbefore = baseLcov ? percentage ( baseLcov ) : 0 ;
5927
5928
const pafter = baseLcov ? percentage ( lcovObj . lcov ) : 0 ;
5928
5929
const pdiff = pafter - pbefore ;
@@ -6094,15 +6095,36 @@ var github_1$1 = github$2.upsertComment;
6094
6095
* @function getLcovFiles
6095
6096
* @param {string } dir Dir path string.
6096
6097
* @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.
6098
6098
*/
6099
- const getLcovFiles = ( dir , filelist = [ ] , lcovFileName = "lcov.info" ) => {
6099
+ const getLcovFiles = ( dir , filelist = [ ] ) => {
6100
6100
fs__default . readdirSync ( dir ) . forEach ( file => {
6101
6101
filelist = fs__default . statSync ( path . join ( dir , file ) ) . isDirectory ( )
6102
6102
? getLcovFiles ( path . join ( dir , file ) , filelist )
6103
6103
: filelist
6104
6104
. 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" ) ;
6106
6128
} )
6107
6129
. concat ( {
6108
6130
name : dir . split ( "/" ) [ 1 ] ,
@@ -6138,7 +6160,7 @@ async function main() {
6138
6160
6139
6161
let lcovArray = monorepoBasePath ? getLcovFiles ( monorepoBasePath ) : [ ] ;
6140
6162
let lcovBaseArray = monorepoBasePath
6141
- ? getLcovFiles ( monorepoBasePath , [ ] , "lcov-base.info" )
6163
+ ? getLcovBaseFiles ( monorepoBasePath )
6142
6164
: [ ] ;
6143
6165
6144
6166
const lcovArrayForMonorepo = [ ] ;
0 commit comments