diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-21 20:38:18 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-21 20:38:18 -0500 |
| commit | b2e903826e9baf1b0a1a8c400c90625022a00dd8 (patch) | |
| tree | 539770a407f71b59665f234e3cf9ea7f62481deb | |
| parent | 4e26a316a638d47c181e23945703f417ff713a8a (diff) | |
| download | chime-b2e903826e9baf1b0a1a8c400c90625022a00dd8.tar.gz chime-b2e903826e9baf1b0a1a8c400c90625022a00dd8.zip | |
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.
| -rwxr-xr-x | .claude/hooks/validate-el.sh | 5 |
1 files changed, 4 insertions, 1 deletions
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" \ |
