mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Tests: tighten the hook command guard assertion
Prepared with AI assistance (Claude Code).
This commit is contained in:
@@ -36,11 +36,11 @@ function expectCommand(command, expectedScriptsDir, verb = 'hook') {
|
||||
assert.equal(typeof command, 'string');
|
||||
const launcher = `${expectedScriptsDir}/impeccable`;
|
||||
assert.ok(command.includes(launcher), `missing ${launcher} in ${command}`);
|
||||
assert.ok(
|
||||
command.endsWith(`"] || "`) === false && command.includes(`" ] || "`),
|
||||
`missing existence guard in ${command}`,
|
||||
assert.match(
|
||||
command,
|
||||
new RegExp(`^\\[ ! -f "[^"]*/impeccable" \\] \\|\\| "[^"]*/impeccable" ${verb}$`),
|
||||
`missing existence guard around the launcher in ${command}`,
|
||||
);
|
||||
assert.match(command, new RegExp(`^\\[ ! -f "[^"]*/impeccable" \\] \\|\\| "[^"]*/impeccable" ${verb}$`));
|
||||
assert.ok(!command.includes('node '), `hook command must not depend on node: ${command}`);
|
||||
assert.ok(!command.includes('.mjs'), `hook command still names a Node script: ${command}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user