mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-18 07:40:09 +02:00
test: unit coverage for conductor-env-shim
Refactor lib/conductor-env-shim.ts to export promoteConductorEnv() so unit tests can manipulate env and call it directly (a bare side- effect IIFE on import isn't reachable from bun:test once cached). The on-import IIFE still runs — existing four-entry-point imports keep working unchanged. test/conductor-env-shim.test.ts covers all three branches: GSTACK_FOO present + FOO empty → promotion; FOO already set → no-overwrite; nothing in env → no-op. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,12 @@
|
||||
*
|
||||
* Import this for its side effect: `import "../lib/conductor-env-shim";`
|
||||
*/
|
||||
for (const key of ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"] as const) {
|
||||
if (!process.env[key] && process.env[`GSTACK_${key}`]) {
|
||||
process.env[key] = process.env[`GSTACK_${key}`];
|
||||
export function promoteConductorEnv(): void {
|
||||
for (const key of ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"] as const) {
|
||||
if (!process.env[key] && process.env[`GSTACK_${key}`]) {
|
||||
process.env[key] = process.env[`GSTACK_${key}`];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
promoteConductorEnv();
|
||||
|
||||
Reference in New Issue
Block a user