UnkindPartition / tasty

Modern and extensible testing framework for Haskell
639 stars 108 forks source link

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

Closed Bodigrim closed 3 months ago

Bodigrim commented 5 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 4 months ago

This is ready for reivew, CC @martijnbastiaan.

martijnbastiaan commented 4 months ago

Oh, changelog + since annotation perhaps?

Bodigrim commented 4 months ago

Oh, changelog + since annotation perhaps?

Done, thanks.