From 27b727a92f63418cb9b593cd09e6b5ca9823882b Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Mon, 17 Aug 2026 21:32:14 -0700 Subject: [PATCH] Tests: tighten the hook command guard assertion Prepared with AI assistance (Claude Code). --- tests/hook-build.test.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/hook-build.test.mjs b/tests/hook-build.test.mjs index 8fee374ad..05652586e 100644 --- a/tests/hook-build.test.mjs +++ b/tests/hook-build.test.mjs @@ -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}`); }