UnkindPartition / tasty

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

Suggestion: improve the test pattern suggestion message #324

Closed Ptival closed 7 months ago

Ptival commented 2 years ago

When running tasty via cabal test with a failing test, the error message contains the mention:

Use -p '/name of some test/' to rerun this test only.

This is a nice suggestion for discoverability! But alas, a non-expert may then try:

cabal test -p '/name of some test/'

which does not work, since -p means "enable profiling" for cabal.

They may be a slightly more enlightened user, who knows that this parameter should be passed to the test executable, and will therefore resort to the more clever:

cabal test -- -p '/name of some test/'

which does not work, because for some reason cabal test does not pass parameters to the test executable.

Only through being extremely savvy, or a couple of frustrating search engine queries, will one stumble into the "arcane" knowledge that, if you want to pass parameters to the test executable via cabal, you should switch to:

cabal run <test-suite-name> -- -p '/name of some test/'

Would it be possible to include or hint at this knowledge into the error message? :-)

Bodigrim commented 2 years ago

tasty executable has no knowledge that it was invoked by cabal test.

Ptival commented 2 years ago

Yeah that's unfortunate.

Is it far-fetched to assume that a consequent portion of the users may be calling from cabal, and to have a note for them in the error message? :\

Or if not in the error message (since this is irrelevant information to non-cabal users), maybe a section of the README warning about this?

Bodigrim commented 2 years ago

(I'm not a maintainer) Well, at the very least it could be stack test instead of cabal test. Or cabal run. Or stack run.

Bodigrim commented 7 months ago

Closing, I don't believe that tasty should guess which tool has called it and how. This is more of a UI/UX issue for cabal / stack.