test: revert to scanning tmpdir because readToolLogs does not expose tool result metadata

This commit is contained in:
Spencer
2026-04-10 05:08:54 +00:00
parent c1297436b9
commit c2a17ae257
@@ -48,16 +48,39 @@ describe('run_shell_command streaming to file regression', () => {
await rig.run({ args: prompt }); await rig.run({ args: prompt });
let savedFilePath = ''; let savedFilePath = '';
const toolLogs = rig.readToolLogs(); const tmpdir = path.join(rig.homeDir!, '.gemini', 'tmp');
const shellCall = toolLogs.find( if (fs.existsSync(tmpdir)) {
(log) => log.toolRequest.name === 'run_shell_command', const findFiles = (dir: string): string[] => {
); let results: string[] = [];
expect(shellCall).toBeTruthy(); const list = fs.readdirSync(dir, { withFileTypes: true });
savedFilePath = shellCall?.toolResponse?.result?.outputFile; for (const file of list) {
const fullPath = path.join(dir, file.name);
if (file.isDirectory()) {
results = results.concat(findFiles(fullPath));
} else if (file.isFile() && file.name.endsWith('.txt')) {
results.push(fullPath);
} else if (file.isFile() && file.name.endsWith('.log')) {
results.push(fullPath);
}
}
return results;
};
const files = findFiles(tmpdir);
files.sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs);
for (const p of files) {
const stat = fs.statSync(p);
if (stat.size >= 20000000) {
savedFilePath = p;
break;
}
}
}
expect( expect(
savedFilePath, savedFilePath,
`Expected the tool response to contain an outputFile`, `Expected to find a saved output file >= 20MB in ${tmpdir}`,
).toBeTruthy(); ).toBeTruthy();
const savedContent = fs.readFileSync(savedFilePath, 'utf8'); const savedContent = fs.readFileSync(savedFilePath, 'utf8');
@@ -99,16 +122,39 @@ describe('run_shell_command streaming to file regression', () => {
await rig.run({ args: prompt }); await rig.run({ args: prompt });
let savedFilePath = ''; let savedFilePath = '';
const toolLogs = rig.readToolLogs(); const tmpdir = path.join(rig.homeDir!, '.gemini', 'tmp');
const shellCall = toolLogs.find( if (fs.existsSync(tmpdir)) {
(log) => log.toolRequest.name === 'run_shell_command', const findFiles = (dir: string): string[] => {
); let results: string[] = [];
expect(shellCall).toBeTruthy(); const list = fs.readdirSync(dir, { withFileTypes: true });
savedFilePath = shellCall?.toolResponse?.result?.outputFile; for (const file of list) {
const fullPath = path.join(dir, file.name);
if (file.isDirectory()) {
results = results.concat(findFiles(fullPath));
} else if (file.isFile() && file.name.endsWith('.txt')) {
results.push(fullPath);
} else if (file.isFile() && file.name.endsWith('.log')) {
results.push(fullPath);
}
}
return results;
};
const files = findFiles(tmpdir);
files.sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs);
for (const p of files) {
const stat = fs.statSync(p);
if (stat.size >= 20000000) {
savedFilePath = p;
break;
}
}
}
expect( expect(
savedFilePath, savedFilePath,
`Expected the tool response to contain an outputFile`, `Expected to find a saved output file >= 20MB in ${tmpdir}`,
).toBeTruthy(); ).toBeTruthy();
const savedContent = fs.readFileSync(savedFilePath, 'utf8'); const savedContent = fs.readFileSync(savedFilePath, 'utf8');