summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/read-many-files.test.ts
diff options
context:
space:
mode:
authorAllen Hutchison <[email protected]>2025-08-07 15:38:21 -0700
committerGitHub <[email protected]>2025-08-07 22:38:21 +0000
commit0c32a4061dc008f6483918a9e53cba8914e88bef (patch)
tree33c4e03e20ad13dc6a7f496e48e27f3b91ca10db /packages/core/src/tools/read-many-files.test.ts
parent9fc7115b8654fc193f948570293485f16d89f60a (diff)
fix(core): Replace flaky performance tests with robust correctness tests (#5795)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src/tools/read-many-files.test.ts')
-rw-r--r--packages/core/src/tools/read-many-files.test.ts22
1 files changed, 6 insertions, 16 deletions
diff --git a/packages/core/src/tools/read-many-files.test.ts b/packages/core/src/tools/read-many-files.test.ts
index 4035a6b7..c6b34665 100644
--- a/packages/core/src/tools/read-many-files.test.ts
+++ b/packages/core/src/tools/read-many-files.test.ts
@@ -523,7 +523,7 @@ describe('ReadManyFilesTool', () => {
fs.writeFileSync(fullPath, content);
};
- it('should process files in parallel for performance', async () => {
+ it('should process files in parallel', async () => {
// Mock detectFileType to add artificial delay to simulate I/O
const detectFileTypeSpy = vi.spyOn(
await import('../utils/fileUtils.js'),
@@ -534,31 +534,21 @@ describe('ReadManyFilesTool', () => {
const fileCount = 4;
const files = createMultipleFiles(fileCount, 'Batch test');
- // Mock with 100ms delay per file to simulate I/O operations
+ // Mock with 10ms delay per file to simulate I/O operations
detectFileTypeSpy.mockImplementation(async (_filePath: string) => {
- await new Promise((resolve) => setTimeout(resolve, 100));
+ await new Promise((resolve) => setTimeout(resolve, 10));
return 'text';
});
- const startTime = Date.now();
const params = { paths: files };
const result = await tool.execute(params, new AbortController().signal);
- const endTime = Date.now();
-
- const processingTime = endTime - startTime;
-
- console.log(
- `Processing time: ${processingTime}ms for ${fileCount} files`,
- );
-
- // Verify parallel processing performance improvement
- // Parallel processing should complete in ~100ms (single file time)
- // Sequential would take ~400ms (4 files × 100ms each)
- expect(processingTime).toBeLessThan(200); // Should PASS with parallel implementation
// Verify all files were processed
const content = result.llmContent as string[];
expect(content).toHaveLength(fileCount);
+ for (let i = 0; i < fileCount; i++) {
+ expect(content.join('')).toContain(`Batch test ${i}`);
+ }
// Cleanup mock
detectFileTypeSpy.mockRestore();