File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
src/services/code-index/processors/__tests__ Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,30 @@ describe("FileWatcher", () => {
275275 expect ( processedFiles ) . not . toContain ( ".hidden/src/components/Button.tsx" )
276276 expect ( processedFiles ) . not . toContain ( "src/components/.hidden/Button.tsx" )
277277 } )
278+
279+ it ( "should process files when workspace is under hidden parent directory" , async ( ) => {
280+ // Create file watcher with workspace under hidden parent directory
281+ const watcherUnderHidden = new FileWatcher (
282+ "/Users/test/.config/project" ,
283+ mockContext ,
284+ mockCacheManager ,
285+ mockEmbedder ,
286+ mockVectorStore ,
287+ mockIgnoreInstance ,
288+ )
289+
290+ await watcherUnderHidden . initialize ( )
291+
292+ // Simulate file creation in workspace under hidden parent
293+ await mockOnDidCreate ( { fsPath : "/Users/test/.config/project/src/file.ts" } )
294+
295+ // Wait for batch processing
296+ await new Promise ( ( resolve ) => setTimeout ( resolve , 600 ) )
297+
298+ // File should be processed, not filtered out
299+ // The key assertion is that upsertPoints was called, meaning the file wasn't filtered
300+ expect ( mockVectorStore . upsertPoints ) . toHaveBeenCalled ( )
301+ } )
278302 } )
279303
280304 describe ( "dispose" , ( ) => {
Original file line number Diff line number Diff line change @@ -259,6 +259,32 @@ describe("DirectoryScanner", () => {
259259 expect ( mockCodeParser . parseFile ) . toHaveBeenCalledTimes ( 2 )
260260 } )
261261
262+ it ( "should process files when workspace is under hidden parent directory" , async ( ) => {
263+ const { listFiles } = await import ( "../../../glob/list-files" )
264+ // Simulate workspace at /Users/test/.root-project
265+ vi . mocked ( listFiles ) . mockResolvedValue ( [ [ "src/file1.js" ] , false ] )
266+
267+ const mockBlocks : any [ ] = [
268+ {
269+ file_path : "src/file1.js" ,
270+ content : "test content" ,
271+ start_line : 1 ,
272+ end_line : 5 ,
273+ identifier : "test" ,
274+ type : "function" ,
275+ fileHash : "hash" ,
276+ segmentHash : "segment-hash" ,
277+ } ,
278+ ]
279+ ; ( mockCodeParser . parseFile as any ) . mockResolvedValue ( mockBlocks )
280+
281+ const result = await scanner . scanDirectory ( "/Users/test/.root-project" )
282+
283+ // File should be processed, not filtered out
284+ expect ( result . stats . processed ) . toBe ( 1 )
285+ expect ( mockCodeParser . parseFile ) . toHaveBeenCalledWith ( "src/file1.js" , expect . any ( Object ) )
286+ } )
287+
262288 it ( "should process markdown files alongside code files" , async ( ) => {
263289 // Create scanner without embedder to test the non-embedding path
264290 const scannerNoEmbeddings = new DirectoryScanner (
You can’t perform that action at this time.
0 commit comments