mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-23 03:24:42 -07:00
refactor(core): consolidate execute() arguments into ExecuteOptions (#25101)
This commit is contained in:
@@ -127,7 +127,7 @@ describe('LSTool', () => {
|
||||
);
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('[DIR] subdir');
|
||||
expect(result.llmContent).toContain('file1.txt');
|
||||
@@ -146,7 +146,7 @@ describe('LSTool', () => {
|
||||
);
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempSecondaryDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('secondary-file.txt');
|
||||
expect(result.returnDisplay).toEqual({
|
||||
@@ -159,7 +159,7 @@ describe('LSTool', () => {
|
||||
const emptyDir = path.join(tempRootDir, 'empty');
|
||||
await fs.mkdir(emptyDir);
|
||||
const invocation = lsTool.build({ dir_path: emptyDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toBe(`Directory ${emptyDir} is empty.`);
|
||||
expect(result.returnDisplay).toBe('Directory is empty.');
|
||||
@@ -173,7 +173,7 @@ describe('LSTool', () => {
|
||||
dir_path: tempRootDir,
|
||||
ignore: ['*.log'],
|
||||
});
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('file1.txt');
|
||||
expect(result.llmContent).not.toContain('file2.log');
|
||||
@@ -189,7 +189,7 @@ describe('LSTool', () => {
|
||||
await fs.writeFile(path.join(tempRootDir, '.git'), '');
|
||||
await fs.writeFile(path.join(tempRootDir, '.gitignore'), '*.log');
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('file1.txt');
|
||||
expect(result.llmContent).not.toContain('file2.log');
|
||||
@@ -207,7 +207,7 @@ describe('LSTool', () => {
|
||||
'*.log',
|
||||
);
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('file1.txt');
|
||||
expect(result.llmContent).not.toContain('file2.log');
|
||||
@@ -221,7 +221,7 @@ describe('LSTool', () => {
|
||||
await fs.writeFile(testPath, 'content1');
|
||||
|
||||
const invocation = lsTool.build({ dir_path: testPath });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('Path is not a directory');
|
||||
expect(result.returnDisplay).toBe('Error: Path is not a directory.');
|
||||
@@ -231,7 +231,7 @@ describe('LSTool', () => {
|
||||
it('should handle non-existent paths', async () => {
|
||||
const testPath = path.join(tempRootDir, 'does-not-exist');
|
||||
const invocation = lsTool.build({ dir_path: testPath });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('Error listing directory');
|
||||
expect(result.returnDisplay).toBe('Error: Failed to list directory.');
|
||||
@@ -245,7 +245,7 @@ describe('LSTool', () => {
|
||||
await fs.mkdir(path.join(tempRootDir, 'y-dir'));
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
const lines = (
|
||||
typeof result.llmContent === 'string' ? result.llmContent : ''
|
||||
@@ -270,7 +270,7 @@ describe('LSTool', () => {
|
||||
vi.spyOn(fs, 'readdir').mockRejectedValueOnce(error);
|
||||
|
||||
const invocation = lsTool.build({ dir_path: restrictedDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('Error listing directory');
|
||||
expect(result.llmContent).toContain('permission denied');
|
||||
@@ -295,7 +295,7 @@ describe('LSTool', () => {
|
||||
});
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
// Should still list the other files
|
||||
expect(result.llmContent).toContain('file1.txt');
|
||||
@@ -360,7 +360,7 @@ describe('LSTool', () => {
|
||||
);
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempSecondaryDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).toContain('secondary-file.txt');
|
||||
expect(result.returnDisplay).toEqual({
|
||||
@@ -378,7 +378,7 @@ describe('LSTool', () => {
|
||||
await fs.writeFile(path.join(tempRootDir, 'jit-file.txt'), 'content');
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(discoverJitContext).toHaveBeenCalled();
|
||||
expect(result.llmContent).toContain('Newly Discovered Project Context');
|
||||
@@ -395,7 +395,7 @@ describe('LSTool', () => {
|
||||
);
|
||||
|
||||
const invocation = lsTool.build({ dir_path: tempRootDir });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).not.toContain(
|
||||
'Newly Discovered Project Context',
|
||||
|
||||
Reference in New Issue
Block a user