fix(lanes): add error handling for unreadable hook files in checkProfile
This commit is contained in:
@@ -325,4 +325,19 @@ describe("checkProfile", () => {
|
||||
const result = await detect.checkProfile(repo);
|
||||
assert.ok(result.warnings.some((w) => /secrets\.env/.test(w)));
|
||||
});
|
||||
|
||||
it("fails when a hook file becomes unreadable (permission or race condition)", async () => {
|
||||
const repo = makeRepo();
|
||||
writePkg(repo, { start: "node index.js" });
|
||||
detect.scaffoldProfile(repo, detect.detectNode(repo));
|
||||
const hookPath = path.join(repo, ".ccam", "profile", "hooks", "health.sh");
|
||||
fs.chmodSync(hookPath, 0o000);
|
||||
try {
|
||||
const result = await detect.checkProfile(repo);
|
||||
assert.equal(result.ok, false);
|
||||
assert.ok(result.errors.some((e) => /not readable/.test(e)));
|
||||
} finally {
|
||||
fs.chmodSync(hookPath, 0o755);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user