UnkindPartition / tasty

Modern and extensible testing framework for Haskell
640 stars 110 forks source link

Support ingredients, affecting order of tests #392

Open Bodigrim opened 1 year ago

Bodigrim commented 1 year ago

Currently there is no simple way to write a tasty ingredient (ingredient transformer, to be precise), which affects order of test execution. Two common applications are:

I do not propose to implement such mechanisms in tasty itself, we should keep the core minimalistic. The missing part, which inhibits third parties from providing such functionality, is to provide a way to configure the order of [TestAction] in launchTestTree:

https://github.com/UnkindPartition/tasty/blob/f73ce423202cab0b4e4d403e7b177d537936b1b8/core/Test/Tasty/Run.hs#L605-L610

One could extend launchTestTree with an argument (OptionSet -> [TestAction] -> [TestAction]), but that would require us to expose data TestAction, which I deem undesirable:

https://github.com/UnkindPartition/tasty/blob/f73ce423202cab0b4e4d403e7b177d537936b1b8/core/Test/Tasty/Run.hs#L304-L313

Instead I suggest adding an argument of type (OptionSet -> (a -> Path) -> [a] -> [a]: "if you tell me how to extract Path from a, I'll be able to reorder [a]".

How does it sound?