Clean up processes in integration tests (#15102)

This commit is contained in:
Tommaso Sciortino
2025-12-15 11:11:08 -08:00
committed by GitHub
parent 217e2b0eb4
commit ec665ef405
19 changed files with 184 additions and 92 deletions
+14
View File
@@ -274,6 +274,7 @@ export class TestRig {
fakeResponsesPath?: string;
// Original fake responses file path for rewriting goldens in record mode.
originalFakeResponsesPath?: string;
private _interactiveRuns: InteractiveRun[] = [];
constructor() {
this.bundlePath = join(__dirname, '..', 'bundle/gemini.js');
@@ -586,6 +587,18 @@ export class TestRig {
}
async cleanup() {
// Kill any interactive runs that are still active
for (const run of this._interactiveRuns) {
try {
await run.kill();
} catch (error) {
if (env['VERBOSE'] === 'true') {
console.warn('Failed to kill interactive run during cleanup:', error);
}
}
}
this._interactiveRuns = [];
if (
process.env['REGENERATE_MODEL_GOLDENS'] === 'true' &&
this.fakeResponsesPath
@@ -1054,6 +1067,7 @@ export class TestRig {
const ptyProcess = pty.spawn(executable, commandArgs, ptyOptions);
const run = new InteractiveRun(ptyProcess);
this._interactiveRuns.push(run);
// Wait for the app to be ready
await run.expectText(' Type your message or @path/to/file', 30000);
return run;