summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcornmander <[email protected]>2025-08-20 21:44:34 -0400
committerGitHub <[email protected]>2025-08-21 01:44:34 +0000
commit16360588d70bde8112c1c22140c0ca2e70d98f78 (patch)
treeddcaa1785a4ffed25242f44918c610a860939249
parenta590a033be9cb35e7a51f7114b1c138b94b84156 (diff)
Add integration test to confirm environment variable propagation. (#6696)
-rw-r--r--integration-tests/shell-service.test.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/integration-tests/shell-service.test.ts b/integration-tests/shell-service.test.ts
index 387d635c..5cac4f7e 100644
--- a/integration-tests/shell-service.test.ts
+++ b/integration-tests/shell-service.test.ts
@@ -123,4 +123,34 @@ describe('ShellExecutionService programmatic integration tests', () => {
const exitedCleanly = result.exitCode === 0 && result.signal === null;
expect(exitedCleanly, 'Process should not have exited cleanly').toBe(false);
});
+
+ it('should propagate environment variables to the child process', async () => {
+ const varName = 'GEMINI_CLI_TEST_VAR';
+ const varValue = `test-value`;
+ process.env[varName] = varValue;
+
+ try {
+ const command =
+ process.platform === 'win32' ? `echo %${varName}%` : `echo $${varName}`;
+ const onOutputEvent = vi.fn();
+ const abortController = new AbortController();
+
+ const handle = await ShellExecutionService.execute(
+ command,
+ testDir,
+ onOutputEvent,
+ abortController.signal,
+ false,
+ );
+
+ const result = await handle.result;
+
+ expect(result.error).toBeNull();
+ expect(result.exitCode).toBe(0);
+ expect(result.output).toContain(varValue);
+ } finally {
+ // Clean up the env var to prevent side-effects on other tests.
+ delete process.env[varName];
+ }
+ });
});