From 637bd900735944cfb3a41ec841acc3c7b24fcc79 Mon Sep 17 00:00:00 2001 From: Linghong Date: Sun, 13 Sep 2026 11:46:45 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Windows=20Git=20hook=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=93=BE=E6=8E=A5=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows 测试 fixture 使用 junction 创建 node_modules 目录链接 保留 Linux 目录符号链接行为并消除普通权限下的 EPERM --- scripts/git-hooks.test.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/git-hooks.test.mjs b/scripts/git-hooks.test.mjs index d140f87d7..c285265cb 100644 --- a/scripts/git-hooks.test.mjs +++ b/scripts/git-hooks.test.mjs @@ -56,7 +56,10 @@ test('pre-commit hook fixes staged imports and formatting without swallowing uns symlinkSync( join(repoRoot, 'node_modules'), join(tempRepo, 'node_modules'), - 'dir', + // Windows directory symlinks require an elevated token unless Developer + // Mode is enabled; junctions provide the same fixture semantics without + // that privilege requirement. + process.platform === 'win32' ? 'junction' : 'dir', ); const sourcePath = join(tempRepo, 'sample.ts');