Skip to content

Commit 5fe8ba5

Browse files
mdesmetclaude
andcommitted
fix: properly restore OPENCODE_TEST_HOME env var in test cleanup
Use delete when originalHome is undefined instead of assigning the string "undefined" back to the env var. Also remove unused Global import. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7d23401 commit 5fe8ba5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

packages/opencode/test/provider/provider.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Instance } from "../../src/project/instance"
77
import { Provider } from "../../src/provider/provider"
88
import { ProviderID, ModelID } from "../../src/provider/schema"
99
import { Env } from "../../src/env"
10-
import { Global } from "../../src/global"
1110

1211
test("provider loaded from env variable", async () => {
1312
await using tmp = await tmpdir({
@@ -2367,7 +2366,8 @@ test("defaultModel returns altimate-backend when altimate credentials exist and
23672366
},
23682367
})
23692368
} finally {
2370-
process.env.OPENCODE_TEST_HOME = originalHome
2369+
if (originalHome === undefined) delete process.env.OPENCODE_TEST_HOME
2370+
else process.env.OPENCODE_TEST_HOME = originalHome
23712371
}
23722372
})
23732373

@@ -2412,7 +2412,8 @@ test("defaultModel prefers altimate-backend over other providers when altimate i
24122412
},
24132413
})
24142414
} finally {
2415-
process.env.OPENCODE_TEST_HOME = originalHome
2415+
if (originalHome === undefined) delete process.env.OPENCODE_TEST_HOME
2416+
else process.env.OPENCODE_TEST_HOME = originalHome
24162417
}
24172418
})
24182419

@@ -2453,7 +2454,8 @@ test("defaultModel respects explicit config model over altimate-backend", async
24532454
},
24542455
})
24552456
} finally {
2456-
process.env.OPENCODE_TEST_HOME = originalHome
2457+
if (originalHome === undefined) delete process.env.OPENCODE_TEST_HOME
2458+
else process.env.OPENCODE_TEST_HOME = originalHome
24572459
}
24582460
})
24592461

0 commit comments

Comments
 (0)