[Feature Request] Enable custom macro as clojure test
Problem
We have some custom macros for state-flow tests, that can be named as "defflow-i18n" or different names. When we have a file with integration tests, where the tests are defined with those macro names, we are not able to execut them
Possible how
Customize "alias" for test macros, so we can extend it anyway we want (defflow, defflow-i18n,defflow-br...)
Do you mean you are unable to run those tests using Calva's test running commands?
Do your macros add the test body to :test on the metadata of the var they define? It seems that should cause them to be seen as tests, but I haven't dug in to know that for sure - it's just an educated guess right now based on a few things:
- How
deftestworks - Calva uses cider-nrepl (which uses orchard) to run tests. We set
:test?totruefor the var-query we send through cider-nrepl, at least for running a single test and all tests. - orchard checks for
:teston the metadata of vars if:test?istrue: https://github.com/clojure-emacs/orchard/blob/febf8169675af1b11a8c00cfe1155ed40db8be42/src/orchard/query.clj#L83
If the above isn't helpful, I think we can provide this functionality by adjusting how we use orchard's var query, maybe in combination with a user-provided regex or array of regexes that match their test vars. The var-query is based on var names, metadata, and doc strings, not on the macros that define the vars: https://github.com/clojure-emacs/orchard/blob/febf8169675af1b11a8c00cfe1155ed40db8be42/src/orchard/query.clj#L45-L52.
I suspect there is a way to run your tests without a change in Calva, though. Maybe @PEZ can help us here.
Do you mean you are unable to run those tests using Calva's test running commands?
Yes.
Do your macros add the test body to
:teston the metadata of the var they define?
They are just a variation of stateflow tests (that works fine, so i suppose they have the :test meta, but i will double check that)
Thanks for your response, and clear explanation!