mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 08:31:14 -07:00
refactor(test): separate directory initialization from configuration in TestRig
- Refactor TestRig.setup to handle only directory creation by default. - Add TestRig.configure to apply settings and fake responses. - Update hook integration tests to use the new setup/configure pattern, avoiding brittle double setup calls.
This commit is contained in:
@@ -361,6 +361,20 @@ export class TestRig {
|
||||
this.homeDir = join(testFileDir, sanitizedName + '-home');
|
||||
mkdirSync(this.testDir, { recursive: true });
|
||||
mkdirSync(this.homeDir, { recursive: true });
|
||||
|
||||
if (options.settings || options.fakeResponsesPath) {
|
||||
this.configure(options);
|
||||
}
|
||||
}
|
||||
|
||||
configure(options: {
|
||||
settings?: Record<string, unknown>;
|
||||
fakeResponsesPath?: string;
|
||||
}) {
|
||||
if (!this.testDir || !this.homeDir) {
|
||||
throw new Error('TestRig must be setup before calling configure');
|
||||
}
|
||||
|
||||
if (options.fakeResponsesPath) {
|
||||
this.fakeResponsesPath = join(this.testDir, 'fake-responses.json');
|
||||
this.originalFakeResponsesPath = options.fakeResponsesPath;
|
||||
|
||||
Reference in New Issue
Block a user