Commit5696844unknown_key
Merge pull request #62 from ccantynz-alt/claude/review-readme-docs-ulqPK
Merge pull request #62 from ccantynz-alt/claude/review-readme-docs-ulqPK Fix test flakiness: pin env vars and improve git error handling
2 files changed+15−45696844643d8aee181a1d21324b618fd3107d44f
2 changed files+15−4
Modifiedsrc/__tests__/crontech-deploy.test.ts+2−3View fileUnifiedSplit
@@ -143,11 +143,10 @@ describe("hooks/post-receive — triggerCrontechDeploy (BLK-016 sender)", () =>
143143 expect(calls[0]!.init.method).toBe("POST");
144144 });
145145
146 it("sends the GitHub-style push payload (event/repo/ref/sha/pusher/commits)", async () => {
147 process.env.GLUECRON_WEBHOOK_SECRET = "webhook-test-value";
148 const { calls, fn } = captureFetch();
146 it("posts a GitHub-shaped push payload (event, repository, ref, before/after, pusher, commits, sent_at, source)", async () => {
149147 const after = "b".repeat(40);
150148 const before = "c".repeat(40);
149 const { calls, fn } = captureFetch();
151150
152151 await triggerCrontechDeploy(
153152 makeArgs({
Modifiedsrc/__tests__/git-repository.test.ts+13−1View fileUnifiedSplit
@@ -61,13 +61,25 @@ describe("git repository management", () => {
6161
6262 describe("with commits", () => {
6363 beforeAll(async () => {
64 // Re-pin env here: other test files mutate GIT_REPOS_PATH at module top level
65 // (e.g. import-verify.test.ts), so the env value at this point in the run
66 // is non-deterministic. Resolve to TEST_REPOS for this describe block.
67 process.env.GIT_REPOS_PATH = TEST_REPOS;
6468 const cloneDir = join(TEST_REPOS, "_clone_tmp");
6569 await mkdir(cloneDir, { recursive: true });
6670 const repoPath = getRepoPath(owner, repo);
6771
6872 const run = async (cmd: string[], cwd: string) => {
6973 const proc = Bun.spawn(cmd, { cwd, stdout: "pipe", stderr: "pipe" });
70 await proc.exited;
74 const [exitCode, stderr] = await Promise.all([
75 proc.exited,
76 new Response(proc.stderr).text(),
77 ]);
78 if (exitCode !== 0) {
79 throw new Error(
80 `git command failed (${exitCode}): ${cmd.join(" ")}\nstderr: ${stderr}`
81 );
82 }
7183 };
7284
7385 const workDir = join(cloneDir, "work");
7486