mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
test(perf): stub pre-commit helpers in hook integration test
This commit is contained in:
@@ -13,20 +13,25 @@ describe("git-hooks/pre-commit (integration)", () => {
|
||||
const dir = mkdtempSync(path.join(os.tmpdir(), "openclaw-pre-commit-"));
|
||||
run(dir, "git", ["init", "-q"]);
|
||||
|
||||
// Copy the hook + helpers so the test exercises real on-disk wiring.
|
||||
// Use the real hook script and lightweight helper stubs.
|
||||
mkdirSync(path.join(dir, "git-hooks"), { recursive: true });
|
||||
mkdirSync(path.join(dir, "scripts", "pre-commit"), { recursive: true });
|
||||
symlinkSync(
|
||||
path.join(process.cwd(), "git-hooks", "pre-commit"),
|
||||
path.join(dir, "git-hooks", "pre-commit"),
|
||||
);
|
||||
symlinkSync(
|
||||
path.join(process.cwd(), "scripts", "pre-commit", "run-node-tool.sh"),
|
||||
writeFileSync(
|
||||
path.join(dir, "scripts", "pre-commit", "run-node-tool.sh"),
|
||||
"#!/usr/bin/env bash\nexit 0\n",
|
||||
{
|
||||
encoding: "utf8",
|
||||
mode: 0o755,
|
||||
},
|
||||
);
|
||||
symlinkSync(
|
||||
path.join(process.cwd(), "scripts", "pre-commit", "filter-staged-files.mjs"),
|
||||
writeFileSync(
|
||||
path.join(dir, "scripts", "pre-commit", "filter-staged-files.mjs"),
|
||||
"process.exit(0);\n",
|
||||
"utf8",
|
||||
);
|
||||
|
||||
// Create an untracked file that should NOT be staged by the hook.
|
||||
|
||||
Reference in New Issue
Block a user