diff --git a/CHANGELOG.md b/CHANGELOG.md index 9984d5610..82efbd661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Add new customization variable `cider-special-mode-truncate-lines`. * Add an option `cider-inspector-fill-frame` to control whether the cider inspector window fills its frame. * [#1893](https://github.com/clojure-emacs/cider/issues/1893)Add negative prefix argument to `cider-refresh` to inhibit invoking of cider-refresh-functions +* [#1776](https://github.com/clojure-emacs/cider/issues/1776)Add new customization variable `cider-test-defining-forms` allowing new test defining forms to be recognized. ### Changes diff --git a/cider-test.el b/cider-test.el index f5fd3e6c8..8aa7a4d27 100644 --- a/cider-test.el +++ b/cider-test.el @@ -59,6 +59,15 @@ :group 'cider-test :package-version '(cider . "0.9.0")) +(defcustom cider-test-defining-forms '("deftest" "defspec") + "Forms that define individual tests. +CIDER considers the top-level form around point to define a test if the +form starts with one of these forms. +Add to this list to have CIDER recognize additional test defining macros." + :type '(repeat string) + :group 'cider-test + :package-version '(cider . "0.15.0")) + (defvar cider-test-last-summary nil "The summary of the last run test.") @@ -680,7 +689,7 @@ is searched." (cider-test-execute ns (list var))) (let ((ns (clojure-find-ns)) (def (clojure-find-def))) - (if (and ns (member (car def) '("deftest" "defspec"))) + (if (and ns (member (car def) cider-test-defining-forms)) (progn (cider-test-update-last-test ns (cdr def)) (cider-test-execute ns (cdr def))) diff --git a/doc/running_tests.md b/doc/running_tests.md index 8c7cd4fbc..fce7ba6ab 100644 --- a/doc/running_tests.md +++ b/doc/running_tests.md @@ -35,6 +35,11 @@ customize the variable `cider-test-infer-test-ns`. It should be bound to a function that takes the current namespace and returns the matching test namespace (which may be the same as the current namespace). +* If your individual tests are not defined by `deftest` or `defspec`, CIDER will +not recognize them when searching for a test at point in `cider-test-run-test`. +You can customize the variable `cider-test-defining-forms` to add additional +forms for CIDER to recognize as individual test definitions. + * If you want to view the test report regardless of whether the tests have passed or failed: