Fork me on GitHub

Is it okay in kaocha for a plugin to declare a test suite failed? And if yes, where in the documentation could I find how to do that?

Alys Brooks17:09:20

Your plugin would probably be a separate library, so it's up to you. Or are you asking if marking it as failed would break something? I'm pretty sure you can use a post-test hook or use post-test or post-run in your plugin to change the status of individual tests. Here's an example of using a hook to modify individual testables:


I'm looking to write a plugin that would basically make the test run fail when there were no tests found/run in certain test suites. Thank you for the pointers. I was basically just trying to check whether this is ok or an anti-pattern

Alys Brooks21:09:38

I can't think of any major issues with doing that, although I'd be interested in @U07FP7QJ0' thoughts.


yeah that is totally something a plugin should be able to do


I ended up doing this with a kaocha.output/error-and-throw :kaocha/early-exit in the post-load hook in the end, thank you for the help


Thanks @UE21H2HHD ! I actually considered hooks at some point but ended up going with a plugin as I wanted the team to be able to just reference the plugin and get some default config out of the box (namely, which suited should be checked by default). The plugin is in a lib where we keep our build/test-time utilities.

👍 2