kaocha
kaocha copied to clipboard
Kaocha --print-test-plan does not print valid/readable edn
When running --print-test-plan
kaocha does not print valid readable edn, as clojure vars are printed as:
:kaocha.var/var #'foo.bar/baz
Trying to read something like this raises an error:
(clojure.edn/read-string {:default tagged-literal} "{#'foo :bar}") ;; => RuntimeException: No dispatch macro for: '
This makes it unsuitable for its intended purpose: an interface that other tools/scripts can consume.
@plexus said the following in #kaocha
on clojurians which I also agree with:
Either we should add print handlers so things like vars/ns/atoms etc print as tagged literals, or we should do a pre-processing pass to filter them out or replace them with placeholders.
A PR for this would be more than welcome, perhaps integrating https://github.com/lambdaisland/data-printers . I'm quite partial to the tagged literals approach, my only concern with that is that Kaocha then modifies the global environment. But maybe we can only load the print handlers when calling --print-test-plan or --print-result. (--print-config is also in this list but is less likely to contain unprintable objects)
For context: https://clojurians-log.clojureverse.org/kaocha/2021-03-24/1616596900.019400