From 21da7b5751f826ffeaaaa6aa17472cb55499c4fa Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 17 Oct 2025 14:11:56 +0000 Subject: [PATCH] test(e2e): robust .env.local loader for VS Code extension host tests --- apps/vscode-e2e/src/suite/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/vscode-e2e/src/suite/index.ts b/apps/vscode-e2e/src/suite/index.ts index 2ef827e132..be9f020ad9 100644 --- a/apps/vscode-e2e/src/suite/index.ts +++ b/apps/vscode-e2e/src/suite/index.ts @@ -26,15 +26,17 @@ export async function run() { for (const rawLine of content.split("\n")) { const line = rawLine.trim() if (!line || line.startsWith("#")) continue - const match = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/) - if (!match) continue - const key = match[1] - let val = match[2] + const m = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/.exec(line) + if (!m) continue + const key: string = m[1] ?? "" + let val: string = m[2] ?? "" // Strip surrounding quotes if present if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) { val = val.slice(1, -1) } - if (!process.env[key]) process.env[key] = val + if (key && !(key in process.env)) { + ;(process.env as Record)[key] = val + } } } catch { // ignore env load errors; tests may still pass without API calls