UnkindPartition / tasty

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

How to ignore unrecognized options? #338

Closed effectfully closed 4 months ago

effectfully commented 2 years ago

We use tasty with cabal's internal libraries and some of our test suites depend on tasty-golden while others don't, so running cabal test library-test --test-options "--accept" fails with

Running 1 test suites...
Test suite sublibrary-test: RUNNING...
Invalid option `--accept'

which sometimes terminates the other tests and sometimes doesn't.

I guess it would be possible to implement an Ingredient that comes last, accepts any option and ignores it? But at that point it would be simpler to just introduce a dummy dependency on tasty-golden.

Am I missing something? Is there a way to ignore unrecognized options?

Thank you for the great library!

andreasabel commented 2 years ago

Dunno, but maybe ignoring unrecognized options with a warning rather than failing hard would be a more flexible and forward-compatible approach in a test suite runner like tasty?

Bodigrim commented 2 years ago

Ignoring unrecognized options is dangerous: it is too easy for a typo to remain unnoticed with potentially disastrous effect.

It is easy to introduce a dummy dependency or add a dummy Ingredient or (even better) combine all test suites into a single executable, so I don't find fiddling with command line parsing justified.

Bodigrim commented 4 months ago

I'm inclined to close as won't fix. There is includingOptions ingredient precisely to register additional command-line options if needed.