summaryrefslogtreecommitdiff
path: root/packages/core/src/utils/memoryDiscovery.test.ts
diff options
context:
space:
mode:
authorBrandon Keiji <[email protected]>2025-07-23 14:48:35 -0700
committerGitHub <[email protected]>2025-07-23 21:48:35 +0000
commitd7a304bcffc7d2340f3de762f14286596954ce4e (patch)
tree6625f9cf3f3c560a595f2f232292c22499276660 /packages/core/src/utils/memoryDiscovery.test.ts
parent9d3164621a8bb0e2bbf8d2309fba1d8678c0abe2 (diff)
feat(memory): make directory search limit on memory discovery configurable with settings.json (#4460)
Diffstat (limited to 'packages/core/src/utils/memoryDiscovery.test.ts')
-rw-r--r--packages/core/src/utils/memoryDiscovery.test.ts31
1 files changed, 24 insertions, 7 deletions
diff --git a/packages/core/src/utils/memoryDiscovery.test.ts b/packages/core/src/utils/memoryDiscovery.test.ts
index 3051da0e..2fb2fcb1 100644
--- a/packages/core/src/utils/memoryDiscovery.test.ts
+++ b/packages/core/src/utils/memoryDiscovery.test.ts
@@ -319,18 +319,35 @@ My code memory
});
});
- it('should respect MAX_DIRECTORIES_TO_SCAN_FOR_MEMORY during downward scan', async () => {
- // the max depth is 200 so it will give up before searching all these.
- for (let i = 0; i < 250; i++) {
+ it('should respect the maxDirs parameter during downward scan', async () => {
+ const consoleDebugSpy = vi
+ .spyOn(console, 'debug')
+ .mockImplementation(() => {});
+
+ for (let i = 0; i < 100; i++) {
await createEmptyDir(path.join(cwd, `deep_dir_${i}`));
}
- // "much_deeper" is alphabetically after "deep_dir_*" so it won't be loaded
- await createTestFile(
- path.join(cwd, 'much_deeper', DEFAULT_CONTEXT_FILENAME),
- 'Ignored memory',
+ // Pass the custom limit directly to the function
+ await loadServerHierarchicalMemory(
+ cwd,
+ true,
+ new FileDiscoveryService(projectRoot),
+ [],
+ {
+ respectGitIgnore: true,
+ respectGeminiIgnore: true,
+ },
+ 50, // maxDirs
);
+ expect(consoleDebugSpy).toHaveBeenCalledWith(
+ expect.stringContaining('[DEBUG] [BfsFileSearch]'),
+ expect.stringContaining('Scanning [50/50]:'),
+ );
+
+ vi.mocked(console.debug).mockRestore();
+
const result = await loadServerHierarchicalMemory(
cwd,
false,