kaocha icon indicating copy to clipboard operation
kaocha copied to clipboard

Interpret the "0 test" situation as a failure

Open gracechin opened this issue 3 years ago • 5 comments

Currently tests pass and no fails are thrown when there are 0 tests.

0 tests, 0 assertions, 0 failures.

Not sure if this kind of kaocha configuration is possible in the tests.edn, but it would be useful to have the kaocha fail when 0 tests are detected. This would help indicate that configurations are incorrect, similar to how an error is thrown, if a deftest doesn't contain any assertions. This will ensure that any mis-configurations can be brought to attention

gracechin avatar Mar 22 '21 02:03 gracechin

Recommendation on Slack, by @lread :

@onetom, I would prefer a non zero exit in this scenario as well. But... it is also pretty easy to write a kaocha hook to achieve this.

onetom avatar Mar 22 '21 11:03 onetom

Thanks for suggesting this improvement! I think this makes a lot of sense. Maybe not as default behavior, but as an option you can enable.

alysbrooks avatar Mar 22 '21 17:03 alysbrooks

This could be a good candidate for https://github.com/lambdaisland/kaocha/issues/183 , we can already introduce a flag to opt-in, then change the default for #kaocha/v2

plexus avatar Mar 23 '21 08:03 plexus

Along similar lines, the No tests found situation might also be considered a failure.

https://github.com/lambdaisland/kaocha/blob/3d834940d420d6490a2290f809526fff07ef7775/src/kaocha/api.clj#L104-L106

That might also make internal bugs like https://github.com/lambdaisland/kaocha/issues/208 more apparent.

frenchy64 avatar May 08 '21 03:05 frenchy64

It seems that it can be related the PR https://github.com/lambdaisland/kaocha/pull/404

humorless avatar Apr 21 '23 08:04 humorless