-
-
Notifications
You must be signed in to change notification settings - Fork 652
Refine cider-test-run-test
#3481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #2958 Fixes #3279 Co-authored-by: tvirolai <[email protected]>
(found-ns (car found)) | ||
(found-var (cadr found))) | ||
(if (not found-var) | ||
(message "No test found at point") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could be a (user-error
instead?
cider-test.el
Outdated
;; we're in a `cider-test-report-mode' buffer | ||
;; or on a highlighted failed/erred test definition | ||
(get-text-property (point) 'var))) | ||
(found (or (when (and var-from-text-property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this can be extracted to a private function.
(cider-resolve--get-in ns "interns" var "test") | ||
(equal "true" | ||
(nrepl-dict-get (cider-sync-tooling-eval | ||
(format "(clojure.core/-> %s var clojure.core/meta (clojure.core/contains? :test))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will do for now, but it'd be nice if we made something more portable at some point. I was also thinking it'd be handy to have a command that just dumps a var metadata in an overlay or a buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will do for now, but it'd be nice if we made something more portable at some point.
Speaking of, cljs functionality for our test-related functionality doesn't seem as hard as it might have been in the past.
Inspecting the cljs env, and eval
ing cljs code seem pretty vanilla things to do nowadays. We could look into it soon enough.
Thanks for the review! |
Rehash of #3480 with all my feedback directly applied.
Under this approach, cider-test-run-test will run the first valid test found by:
cider-test-defining-forms
is no longer necessary)cider-test-infer-test-ns
foo-test
, falling back tofoo
(e.g.deftest foo
- less idiomatic, but quite frequent)All this lookup is very fast when cider-nrepl is present, since we use
cider-resolve--get-in
. It falls back to eval if we're on bare nrepl.In a future, we can further search tests by leveraging
xref
functionality - but it's not as important now.Special thanks to @tvirolai!