From 25cda2b24c197f317e1da3830213ca5f23271cf1 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Wed, 13 May 2026 13:24:02 +0530 Subject: [PATCH] test(scripts): simplify worktree lock setup --- test/scripts/local-heavy-check-runtime.test.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/test/scripts/local-heavy-check-runtime.test.ts b/test/scripts/local-heavy-check-runtime.test.ts index 36f9d1c1cbf..b16208b3abb 100644 --- a/test/scripts/local-heavy-check-runtime.test.ts +++ b/test/scripts/local-heavy-check-runtime.test.ts @@ -1,4 +1,4 @@ -import { spawnSync } from "node:child_process"; +import { execFileSync } from "node:child_process"; import fs from "node:fs"; import path from "node:path"; import { describe, expect, it } from "vitest"; @@ -35,17 +35,6 @@ function makeEnv(overrides: Record = {}) { return env; } -function runGit(cwd: string, args: string[]) { - const result = spawnSync("git", args, { - cwd, - encoding: "utf8", - stdio: ["ignore", "pipe", "pipe"], - }); - if (result.status !== 0) { - throw new Error(`git ${args.join(" ")} failed: ${result.stderr || result.stdout}`); - } -} - describe("local-heavy-check-runtime", () => { it("reenables local heavy-check policy for local wrapper entrypoints", () => { expect(resolveLocalHeavyCheckEnv({ OPENCLAW_LOCAL_CHECK: "0", PATH: "/usr/bin" })).toEqual({ @@ -376,7 +365,7 @@ describe("local-heavy-check-runtime", () => { it("uses a worktree-local heavy-check lock when explicitly requested", () => { const repoRoot = createTempDir("openclaw-local-heavy-check-worktree-"); - runGit(repoRoot, ["init"]); + execFileSync("git", ["init"], { cwd: repoRoot, stdio: "ignore" }); const cwd = path.join(repoRoot, "nested", "tooling"); fs.mkdirSync(cwd, { recursive: true }); const commonLockDir = path.join(repoRoot, ".git", "openclaw-local-checks", "heavy-check.lock");