File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1430,11 +1430,15 @@ describe('RipGrepTool', () => {
14301430 } ) ;
14311431 const result = await invocation . execute ( abortSignal ) ;
14321432
1433- expect ( mockSpawn ) . toHaveBeenLastCalledWith (
1434- expect . anything ( ) ,
1435- expect . arrayContaining ( [ '--fixed-strings' ] ) ,
1436- expect . anything ( ) ,
1437- ) ;
1433+ const spawnArgs = mockSpawn . mock . calls [ 0 ] [ 1 ] ;
1434+ expect ( spawnArgs ) . toContain ( '--fixed-strings' ) ;
1435+ expect ( spawnArgs ) . toContain ( '--regexp' ) ;
1436+ expect ( spawnArgs ) . toContain ( 'hello.world' ) ;
1437+
1438+ // Verify --fixed-strings doesn't have the pattern as its next argument
1439+ const fixedStringsIdx = spawnArgs . indexOf ( '--fixed-strings' ) ;
1440+ expect ( spawnArgs [ fixedStringsIdx + 1 ] ) . not . toBe ( 'hello.world' ) ;
1441+
14381442 expect ( result . llmContent ) . toContain (
14391443 'Found 1 match for pattern "hello.world"' ,
14401444 ) ;
Original file line number Diff line number Diff line change @@ -387,11 +387,10 @@ class GrepToolInvocation extends BaseToolInvocation<
387387
388388 if ( fixed_strings ) {
389389 rgArgs . push ( '--fixed-strings' ) ;
390- rgArgs . push ( pattern ) ;
391- } else {
392- rgArgs . push ( '--regexp' , pattern ) ;
393390 }
394391
392+ rgArgs . push ( '--regexp' , pattern ) ;
393+
395394 if ( context ) {
396395 rgArgs . push ( '--context' , context . toString ( ) ) ;
397396 }
You can’t perform that action at this time.
0 commit comments