test: fix worktree-bugfix tests for CI (git config + Windows compat)

Use separate git commands instead of && chains (fails on Windows).
Configure git user.name/email before commit (not set in CI runners).
Mirrors the pattern from worktree-e2e.test.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
deseltrus 2026-03-16 20:13:02 +01:00
parent 57529d0c7f
commit 25eab8f368

View file

@ -23,8 +23,15 @@ const { assertEq, assertTrue, report } = createTestContext();
// ─── Helpers ──────────────────────────────────────────────────────────────
function run(cmd: string, cwd: string): void {
execSync(cmd, { cwd, stdio: "ignore" });
}
function initRepo(dir: string): void {
execSync("git init && git commit --allow-empty -m init", { cwd: dir, stdio: "ignore" });
run("git init", dir);
run("git config user.email test@test.com", dir);
run("git config user.name Test", dir);
run("git commit --allow-empty -m init", dir);
}
// ─── Tests ────────────────────────────────────────────────────────────────
@ -94,7 +101,7 @@ describe("worktree-bugfix", () => {
mkdirSync(wtPath, { recursive: true });
mkdirSync(join(wtPath, ".gsd", "milestones", "M005"), { recursive: true });
// Initialize git in the worktree so getService doesn't fail
execSync("git init && git commit --allow-empty -m init", { cwd: wtPath, stdio: "ignore" });
initRepo(wtPath);
// captureIntegrationBranch should be a no-op — no META.json written
const metaPath = join(wtPath, ".gsd", "milestones", "M005", "M005-META.json");