From 86241bdb01fba835563b8942c05d65a04c300aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 14 Oct 2026 14:28:06 +0200 Subject: [PATCH] test: keep the developer's gateway key out of the test environment The fixture copied process.env, so an exported AI_GATEWAY_API_KEY made the default gateway Vercel and broke every test expecting the Callstack portal. Drop non-Callstack gateway keys and XDG_DATA_HOME (OpenCode's key store) too. --- test/apex.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/apex.test.js b/test/apex.test.js index f00aa66..3af8a24 100644 --- a/test/apex.test.js +++ b/test/apex.test.js @@ -33,6 +33,10 @@ async function fixture(context) { // `npm test` and `npx` set this, and it decides how follow-up commands are spelled. delete env.CI; delete env.npm_command; + // A gateway key in the developer's shell would change the default gateway, and their own + // XDG_DATA_HOME would point OpenCode's key store at their real one. + for (const provider of Object.values(PROVIDERS)) if (provider !== CALLSTACK) delete env[provider.envVar]; + delete env.XDG_DATA_HOME; return { home, env, journal: join(home, '.apex-state', 'journal.json') }; }