From 92ec3ddc143fdf2f16e2a39a9fb62f7000ba03ba Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Feb 2026 04:35:54 +0000 Subject: [PATCH] test: drop brittle pre-commit script structure test --- test/git-hooks-pre-commit.test.ts | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 test/git-hooks-pre-commit.test.ts diff --git a/test/git-hooks-pre-commit.test.ts b/test/git-hooks-pre-commit.test.ts deleted file mode 100644 index f3cb0f2b6..000000000 --- a/test/git-hooks-pre-commit.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { readFileSync } from "node:fs"; -import path from "node:path"; -import { describe, expect, it } from "vitest"; - -describe("git-hooks/pre-commit", () => { - it("avoids option injection and unsafe whitespace parsing", () => { - const scriptPath = path.join(process.cwd(), "git-hooks", "pre-commit"); - const script = readFileSync(scriptPath, "utf8"); - - // NUL-delimited list: supports spaces/newlines in filenames. - expect(script).toMatch(/--name-only/); - expect(script).toMatch(/--diff-filter=ACMR/); - expect(script).toMatch(/\s-z\b/); - expect(script).toMatch(/mapfile -d '' -t files/); - - // Option-injection hardening: always pass paths after "--". - expect(script).toMatch(/\ngit add -- /); - - // The original bug used whitespace + xargs. - expect(script).not.toMatch(/xargs\s+git add/); - - // Expected helper wiring for consistent tool invocation. - expect(script).toMatch(/scripts\/pre-commit\/run-node-tool\.sh/); - expect(script).toMatch(/scripts\/pre-commit\/filter-staged-files\.mjs/); - }); -});