From b2e903826e9baf1b0a1a8c400c90625022a00dd8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 21 Apr 2026 20:38:18 -0500 Subject: fix(hooks): run validate-el test phase from tests/ directory Test files start with (require 'test-bootstrap (expand-file-name "test-bootstrap.el")). The expand-file-name call resolves against default-directory, which in batch mode is the directory the shell was in when emacs started. The hook ran emacs from the project root, so the require looked for the bootstrap at the project root and could not find it. Every Edit or Write to a test file failed the hook. The fix is to cd into PROJECT_ROOT/tests inside the subshell before launching emacs, so the bootstrap require resolves to tests/test-bootstrap.el where the file actually lives. --- .claude/hooks/validate-el.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.claude/hooks/validate-el.sh b/.claude/hooks/validate-el.sh index 803badf..0c3a46c 100755 --- a/.claude/hooks/validate-el.sh +++ b/.claude/hooks/validate-el.sh @@ -88,7 +88,10 @@ count="${#tests[@]}" if [ "$count" -ge 1 ] && [ "$count" -le "$MAX_AUTO_TEST_FILES" ]; then load_args=() for t in "${tests[@]}"; do load_args+=("-l" "$t"); done - if ! output="$(emacs --batch --no-site-file --no-site-lisp \ + # Run from tests/ so each file's `(require 'test-bootstrap (expand-file-name + # "test-bootstrap.el"))` resolves against the directory the bootstrap lives in, + # not the project root. + if ! output="$(cd "$PROJECT_ROOT/tests" && emacs --batch --no-site-file --no-site-lisp \ -L "$PROJECT_ROOT" \ -L "$PROJECT_ROOT/modules" \ -L "$PROJECT_ROOT/tests" \ -- cgit v1.2.3