Fork me on GitHub
#kaocha
<
2021-03-17
>
andrea.crotti15:03:28

is it a bad thing in general to mix standard test fixtures with a custom kaocha reporter? For example we had a test fixture that was setting a dynamic var to true, to enable some reporter logic. The fixture was something like

(binding [*enable-x?* true] (try (t) .. (catch ...))
and the reporter was enabled by default in the config. It was working fine but if an exception was thrown the actual reported status of the test was not correct, and it wasn't marking it as failed/error

andrea.crotti15:03:13

I kind of suspect that maybe mixing fixtures and kaocha reporters like this might be a bad idea, so I was thinking to create a simple plugin for that, is that the correct approach?

andrea.crotti16:03:59

actually trying to clarify the requirements a bit more, I just need something that if there is a test failure or error • runs some arbitrary code (straight away) • prints out a string So maybe even just a wrap-runhook would work, even though maybe it would be better to do the reporting in the post-summary phase

Alys Brooks20:03:54

Have you tried re-raising the exception after whatever fixture-specific logic?