mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-17 21:40:39 -07:00
test: fix hook integration test flakiness on Windows CI
- Increase default timeout for TestRig.run and TestRig.runCommand to 10 minutes on Windows CI to handle slow environments. - Replace inline 'node -e' hook commands with script files to avoid brittle quoting and escaping issues on Windows shells. - Add 'TestRig.createScript' helper to simplify script creation in tests. - Fix path escaping for hook output files in 'hooks-agent-flow.test.ts' using JSON.stringify. - Ensure 'TestRig.setup' is called before performing file operations in tests.
This commit is contained in:
@@ -438,6 +438,17 @@ export class TestRig {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
createScript(fileName: string, content: string) {
|
||||
if (!this.testDir) {
|
||||
throw new Error(
|
||||
'TestRig.setup must be called before creating files or scripts',
|
||||
);
|
||||
}
|
||||
const scriptPath = join(this.testDir, fileName);
|
||||
writeFileSync(scriptPath, content);
|
||||
return scriptPath;
|
||||
}
|
||||
|
||||
mkdir(dir: string) {
|
||||
mkdirSync(join(this.testDir!, dir), { recursive: true });
|
||||
}
|
||||
@@ -572,7 +583,8 @@ export class TestRig {
|
||||
}
|
||||
});
|
||||
|
||||
const timeout = options.timeout ?? 300000;
|
||||
const isWinCI = os.platform() === 'win32' && process.env['CI'] === 'true';
|
||||
const timeout = options.timeout ?? (isWinCI ? 600000 : 300000); // 10 mins on Win CI, 5 mins otherwise
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
const timer = setTimeout(() => {
|
||||
child.kill('SIGKILL');
|
||||
@@ -743,7 +755,8 @@ export class TestRig {
|
||||
}
|
||||
});
|
||||
|
||||
const timeout = options.timeout ?? 300000;
|
||||
const isWinCI = os.platform() === 'win32' && process.env['CI'] === 'true';
|
||||
const timeout = options.timeout ?? (isWinCI ? 600000 : 300000); // 10 mins on Win CI, 5 mins otherwise
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
const timer = setTimeout(() => {
|
||||
child.kill('SIGKILL');
|
||||
|
||||
Reference in New Issue
Block a user