This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # babashka (18)
- # babashka-sci-dev (42)
- # beginners (84)
- # calva (11)
- # cider (5)
- # clj-kondo (11)
- # cljdoc (70)
- # cljs-dev (34)
- # clojure-europe (1)
- # clojurescript (3)
- # conjure (1)
- # core-async (29)
- # data-oriented-programming (10)
- # emacs (13)
- # fulcro (8)
- # gratitude (2)
- # honeysql (1)
- # introduce-yourself (4)
- # kaocha (10)
- # missionary (8)
- # nrepl (4)
- # off-topic (27)
- # portal (32)
- # releases (11)
- # tools-deps (11)
- # xtdb (19)
Is there a way to extract the full file path (relative to the project) of a test in a kaocha plugin? As far as I can tell, the
:file property in
:kaocha.testable/meta is relative to one of the entries in the
:kaocha/test-paths vector, and which
test-path is used for a given test isn’t retained anywhere. Is that correct?
or joining the
:file entry to each element of the test-paths vector, and testing if it exists?
also happy to submit a PR to add
:test-path into the
testable/meta map, since that may be a more direct way of achieving this?
> (http://clojure.java.io/resource (get-in m [::testable/meta :file]))
> or joining the :file entry to each element of the test-paths vector, and testing if it exists?
don't do that, the
:file var metadata you get from clojure is relative to the classpath, the correct way to resolve something on the classpath is with
The way Kaocha works it'll scan
test-paths for namespaces, and will then require those namespaces through standard clojure mechanisms, and then use runtime inspection to find the vars. So the actual loading happens based on the classpath (since that's what clojure does)
> also happy to submit a PR to add :test-path into the testable/meta map, since that may be a more direct way of achieving this?
testable/meta is not something we build up, it's just the metadata that clojure puts on the test var, so we don't add anything to it. You could add it to the testable, but classpath lookups aren't free, I don't think we should impose this cost just in case a plugin might want it, since it's trivial for a plugin to the do the lookup itself.
( gives me
nil unfortunately. I have an example here:
• https://github.com/MIJOTHY/kaocha-junit-xml/pull/1 (relevant https://github.com/MIJOTHY/kaocha-junit-xml/pull/1/files#diff-b473b0e1c4485db625efdb427433a77ea0ccaf378797e1d1a7ad76d13a604c82R92-R95)