UnkindPartition / tasty

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

Add ability to supply options for launchers and reporters at the top-level of test tree #417

Closed Bodigrim closed 5 months ago

Bodigrim commented 6 months ago

While tasty allows to configure OptionSet at any level of test tree, it often has any effect only on options of test providers (class IsTest). But test runners and reporters typically only look into the OptionSet they were given as an argument. This is not unreasonable: e. g., if an option is a log filename you cannot expect to change it in the middle of the run. It is however too restrictive: there is no way to use defaultMain but hardcode a global option, without passing it via command line.

applyTopLevelPlusTestOptions allows for a compromise: unwrap top-level PlusTestOptions from the TestTree and apply them to the OptionSet from command line. This way a user can wrap their tests in adjustOption / localOption forcing, for instance, NumThreads to 1.

Related to #406 and #414.

Bodigrim commented 5 months ago

This is ready for reivew, CC @martijnbastiaan.

martijnbastiaan commented 5 months ago

Oh, changelog + since annotation perhaps?

Bodigrim commented 5 months ago

Oh, changelog + since annotation perhaps?

Done, thanks.