Hi. I am trying to make tests stop on first error in each test and continue with the rest of the tests. Since the "is" macro counteracts this feature, I am trying to use exceptions as a way to "report" errors. Is there a way to avoid the tests from failing with "Test ran without assertions. Did you forget an (is ...)?", when there is no "is" statements? Since I do not want to use "is".
hey @mogenslund, interesting use case. This is not directly configurable as such, but you can work around it like this
#kaocha/v1
{:plugins [:kaocha.plugin/hooks]
:kaocha.hooks/pre-run [(fn [test-plan]
(alter-var-root (var kaocha.hierarchy/hierarchy)
underive
:kaocha.type.var/zero-assertions :kaocha/fail-type)
test-plan)]}
at least in theory, but it seems this underive
blows up at the moment because there is another key in there that has an ancestor via two different paths, which it doesn't like. I'll have to fix that in Kaocha. This seems to work though.
#kaocha/v1
{:plugins [:kaocha.plugin/hooks]
:kaocha.hooks/pre-run [(fn [test-plan]
(alter-var-root (var kaocha.hierarchy/hierarchy)
underive
:end-test-var :kaocha/known-key)
(alter-var-root (var kaocha.hierarchy/hierarchy)
underive
:kaocha.type.var/zero-assertions :kaocha/fail-type)
test-plan)]}
That is great. Thank you for your quick answer.
I'm releasing a new kaocha, with that the first version should work. Also note that your hooks can be in a regular namespace, you don't have to have an ugly inline function like that.
#kaocha/v1
{:plugins [:kaocha.plugin/hooks]
:kaocha.hooks/pre-run [my.kaocha.hooks/remove-zero-assertions]}
(ns my.kaocha.hooks)
(defn remove-zero-assertions [test-plan]
...
test-plan)
Great. Thank you very much. I will try it out 🙂