fix: resolve remaining Windows test failures and revert empty env check

This commit is contained in:
Bryan Morgan
2026-01-31 18:34:53 -05:00
parent cc1e0edfa1
commit 784530d52f
3 changed files with 14 additions and 1287 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1707,15 +1707,20 @@ describe('Settings Loading and Merging', () => {
isWorkspaceTrustedValue = true as boolean | undefined,
}) {
delete process.env['TESTTEST']; // reset
const geminiEnvPath = path.join(MOCK_WORKSPACE_DIR, GEMINI_DIR, '.env');
const geminiEnvPath = path.resolve(
path.join(MOCK_WORKSPACE_DIR, GEMINI_DIR, '.env'),
);
vi.spyOn(trustedFolders, 'isWorkspaceTrusted').mockReturnValue({
isTrusted: isWorkspaceTrustedValue,
source: 'file',
});
(mockFsExistsSync as Mock).mockImplementation((p: fs.PathLike) =>
[USER_SETTINGS_PATH, geminiEnvPath].includes(p.toString()),
);
(mockFsExistsSync as Mock).mockImplementation((p: fs.PathLike) => {
const normalizedP = path.resolve(p.toString());
return [path.resolve(USER_SETTINGS_PATH), geminiEnvPath].includes(
normalizedP,
);
});
const userSettingsContent: Settings = {
ui: {
theme: 'dark',
@@ -1731,9 +1736,10 @@ describe('Settings Loading and Merging', () => {
};
(fs.readFileSync as Mock).mockImplementation(
(p: fs.PathOrFileDescriptor) => {
if (p === USER_SETTINGS_PATH)
const normalizedP = path.resolve(p.toString());
if (normalizedP === path.resolve(USER_SETTINGS_PATH))
return JSON.stringify(userSettingsContent);
if (p === geminiEnvPath) return 'TESTTEST=1234';
if (normalizedP === geminiEnvPath) return 'TESTTEST=1234';
return '{}';
},
);

View File

@@ -469,8 +469,8 @@ export function loadEnvironment(
continue;
}
// Load variable only if it's not already set in the environment or if it's an empty string.
if (!Object.hasOwn(process.env, key) || process.env[key] === '') {
// Load variable only if it's not already set in the environment.
if (!Object.hasOwn(process.env, key)) {
process.env[key] = parsedEnv[key];
}
}