@@ -107,14 +107,14 @@ describe('Enhanced Module Auto-Discovery System', () => {
107107 let modules : any [ ] = [ ] ;
108108 let discoveryError : any = null ;
109109 let debugInfo : string [ ] = [ ] ;
110-
110+
111111 try {
112112 debugInfo . push ( '=== TESTING CORE LOGIC DIRECTLY ===' ) ;
113-
113+
114114 // Test the individual methods to see where it fails
115115 const testSearchPath = join ( tempDir , 'modules' ) ;
116116 debugInfo . push ( `Testing search path: ${ testSearchPath } ` ) ;
117-
117+
118118 // Check if the ModuleDiscovery instance can access the path
119119 const { access } = await import ( 'fs/promises' ) ;
120120 try {
@@ -123,40 +123,40 @@ describe('Enhanced Module Auto-Discovery System', () => {
123123 } catch ( e ) {
124124 debugInfo . push ( `Search path accessible: NO - ${ e } ` ) ;
125125 }
126-
126+
127127 // Test the glob detection logic directly
128128 const isCI = process . env . CI === 'true' || process . env . GITHUB_ACTIONS === 'true' ;
129129 const nodeVersion = process . version ;
130130 debugInfo . push ( `CI detected: ${ isCI } , Node: ${ nodeVersion } ` ) ;
131-
132- // DIRECTLY TEST THE FALLBACK METHOD
131+
132+ // DIRECTLY TEST THE FALLBACK METHOD (use relative path like the real code)
133133 const fallbackFiles = await ( discovery as any ) . findMatchingFilesFallback (
134- testSearchPath ,
134+ 'modules' , // Use relative path, not absolute
135135 config . patterns ,
136136 config . ignorePatterns ,
137137 config . maxDepth
138138 ) ;
139139 debugInfo . push ( `Fallback found ${ fallbackFiles . length } files: ${ JSON . stringify ( fallbackFiles ) } ` ) ;
140-
140+
141141 // DIRECTLY TEST PATTERN MATCHING
142142 const testPaths = [ 'modules/users/index.ts' , 'modules/orders/index.ts' ] ;
143143 const testPatterns = [ '**/index.{ts,js}' , '**/*.module.{ts,js}' ] ;
144-
144+
145145 for ( const testPath of testPaths ) {
146146 for ( const testPattern of testPatterns ) {
147147 const matches = ( discovery as any ) . matchesSimplePattern ( testPath , testPattern ) ;
148148 debugInfo . push ( `Pattern test: "${ testPath } " vs "${ testPattern } " = ${ matches } ` ) ;
149149 }
150150 }
151-
151+
152152 // Now call the discovery method
153153 modules = await discovery . discoverModulesAdvanced ( config ) ;
154154 debugInfo . push ( '=== DISCOVERY COMPLETED ===' ) ;
155155 } catch ( error ) {
156156 debugInfo . push ( `=== ERROR === ${ error } ` ) ;
157157 discoveryError = error ;
158158 }
159-
159+
160160 debugInfo . push ( `Final modules count: ${ modules . length } ` ) ;
161161 debugInfo . push ( `Final modules: ${ JSON . stringify ( modules . map ( m => ( { name : m . name , version : m . version } ) ) ) } ` ) ;
162162 debugInfo . push ( `Discovery error: ${ discoveryError } ` ) ;
0 commit comments