summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommaso Sciortino <[email protected]>2025-07-25 14:32:28 -0700
committerGitHub <[email protected]>2025-07-25 21:32:28 +0000
commitaa71438684dd0350acf62fc01d1e6244fd4d3f51 (patch)
tree721cd6162b74604dc52dc1f7b7f645c39969bd9d
parent23e0dc69603bd60e3985167d68c81e3713a4cfcf (diff)
Fix grep.test to work on windows. (#4889)
-rw-r--r--packages/core/src/tools/grep.test.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/core/src/tools/grep.test.ts b/packages/core/src/tools/grep.test.ts
index 09dec35f..01295083 100644
--- a/packages/core/src/tools/grep.test.ts
+++ b/packages/core/src/tools/grep.test.ts
@@ -125,7 +125,9 @@ describe('GrepTool', () => {
expect(result.llmContent).toContain('File: fileA.txt');
expect(result.llmContent).toContain('L1: hello world');
expect(result.llmContent).toContain('L2: second line with world');
- expect(result.llmContent).toContain('File: sub/fileC.txt');
+ expect(result.llmContent).toContain(
+ `File: ${path.join('sub', 'fileC.txt')}`,
+ );
expect(result.llmContent).toContain('L1: another world in sub dir');
expect(result.returnDisplay).toBe('Found 3 matches');
});
@@ -235,7 +237,7 @@ describe('GrepTool', () => {
it('should generate correct description with pattern and path', () => {
const params: GrepToolParams = {
pattern: 'testPattern',
- path: 'src/app',
+ path: path.join('src', 'app'),
};
// The path will be relative to the tempRootDir, so we check for containment.
expect(grepTool.getDescription(params)).toContain("'testPattern' within");
@@ -248,12 +250,14 @@ describe('GrepTool', () => {
const params: GrepToolParams = {
pattern: 'testPattern',
include: '*.ts',
- path: 'src/app',
+ path: path.join('src', 'app'),
};
expect(grepTool.getDescription(params)).toContain(
"'testPattern' in *.ts within",
);
- expect(grepTool.getDescription(params)).toContain('src/app');
+ expect(grepTool.getDescription(params)).toContain(
+ path.join('src', 'app'),
+ );
});
it('should use ./ for root path in description', () => {