Skip to content

Commit f0924f6

Browse files
committed
test(github): keep an ambient GH_TOKEN out of the credentials tests
GitHubCredentials prefers GH_TOKEN or GITHUB_TOKEN from HostProcess.Environment over asking gh. The GitHubCredentials tests drive the gh path through a fake process runner, but they read the real environment. With either token set, as in many agent and CI shells, they never reached gh and one failed. The test layer now provides an empty HostProcess.Environment. The assertions are unchanged. Fails before (with GH_TOKEN set): 1 failure in GitHubRest.test.ts. Passes after, with the same environment. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01A1D6J2UMPo7YBWQFvbg1br
1 parent 3dcf6aa commit f0924f6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎packages/source-control-github/src/server/GitHubRest.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as Tracer from "effect/Tracer";
88
import { ChildProcessSpawner } from "effect/process";
99
import { VcsProcessTimeoutError } from "@t3tools/contracts";
1010
import { HttpClient, HttpClientResponse, type HttpClientRequest } from "effect/http";
11+
import * as HostProcess from "@t3tools/shared/HostProcess";
1112

1213
import * as GitHubRest from "./GitHubRest.ts";
1314
import * as GitHubRequestPolicy from "./GitHubRequestPolicy.ts";
@@ -246,6 +247,8 @@ describe("GitHubCredentials", () => {
246247
const credentialsWith = (run: SourceControlHost.SourceControlHost["Service"]["process"]["run"]) =>
247248
GitHubCredentials.layer.pipe(
248249
Layer.provide(TestSourceControlHost.layer({ process: { run } })),
250+
// An ambient GH_TOKEN or GITHUB_TOKEN outranks gh, so these cases would never reach it.
251+
Layer.provide(Layer.succeed(HostProcess.Environment, {})),
249252
Layer.provide(NodeCrypto.layer),
250253
Layer.provide(Layer.succeed(HttpClient.HttpClient, unexpectedHttp)),
251254
);

0 commit comments

Comments
 (0)