From fb4abda9c55a5cac9a51e5cd31f4f8d8dadebc91 Mon Sep 17 00:00:00 2001 From: Josh Bax Date: Sun, 17 Nov 2024 15:31:04 -0800 Subject: [PATCH] Add a comment about buttercup warning and check full paths too --- lisp/test/buttercup.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/test/buttercup.el b/lisp/test/buttercup.el index 49187103..675b2a1d 100644 --- a/lisp/test/buttercup.el +++ b/lisp/test/buttercup.el @@ -27,8 +27,13 @@ (args (eask-args))) ;; buttercup-run-discover uses command-line-args-left not command-line-args (setq command-line-args-left args) - (when (cl-some (apply-partially #'string-prefix-p "..") args) - (error "Buttercup cannot run in parent directories")) + ;; Seems like buttercup-run-discover only works on directories that are children of + ;; the current directory. + ;; When given a parent directory it always fails with "No suites found", even if there are tests. + ;; Since this is a bit confusing, we warn the user specifically. + ;; See discussion https://github.com/emacs-eask/cli/pull/281 + (when-let ((bad-arg (seq-find (lambda (x) (not (file-in-directory-p x default-directory))) args))) + (error "Buttercup cannot run in parent directory: %s" bad-arg)) (buttercup-run-discover))) ;;; test/buttercup.el ends here