lambdaisland / lambdaisland/kaocha
Kaocha --print-test-plan does not print valid/readable edn
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 860
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
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)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the implementation of the --print-test-plan option and reproduce the output containing #'foo.bar/baz. Trace how the test plan is serialized, then determine whether the output should use tagged literals or placeholders. Done means clojure.edn/read-string can consume the printed plan as valid, readable EDN without the current dispatch-macro error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100