修 CI:git-hooks 回归用例跟上 lint-staged 新增的 *.rs 守卫

- scripts/git-hooks.test.mjs 用 assert.deepEqual 钉住 package.json 的 lint-staged 整份配置形状,dd7cf401a 新增 *.rs 键时漏了同步,Repository checks(经 npm run lint → check:git-hooks)deepStrictEqual 失败
- 按新形态补上 '*.rs': ['node scripts/lint-staged-rustfmt.mjs'],不放宽断言:仍是整份配置的 deepStrictEqual,改回「只要含 js 那条就算过」这类弱化写法一律不做
- 第 2 个用例里的本地 lintStagedConfig 是 temp repo 的测试替身,不是对真实配置的期望:temp repo 里没有 Rust 文件,加 *.rs 只会命中 0 个文件,故不动
- 变异验证:把 *.rs 从 package.json 摘掉 → 本用例以同样的 deepStrictEqual operator 变红(# fail 2);还原(package.json 字节级哈希一致)后复跑该用例回到 ok
This commit is contained in:
2026-09-12 00:43:49 +08:00
parent 77871bfa56
commit 2a7bfadd72
+1
View File
@@ -27,6 +27,7 @@ test('pre-commit hook fixes staged imports and formatting without swallowing uns
'node scripts/lint-staged-eslint.mjs',
'prettier --write',
],
'*.rs': ['node scripts/lint-staged-rustfmt.mjs'],
});
assert.equal(
readFileSync(join(repoRoot, '.husky', 'pre-commit'), 'utf8'),