tasty icon indicating copy to clipboard operation
tasty copied to clipboard

Suggestion: improve the test pattern suggestion message

Open Ptival opened this issue 3 years ago • 3 comments

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? :-)

Ptival avatar Feb 24 '22 22:02 Ptival

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

Bodigrim avatar Feb 24 '22 22:02 Bodigrim

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?

Ptival avatar Feb 24 '22 22:02 Ptival

(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 avatar Feb 24 '22 22:02 Bodigrim

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.

Bodigrim avatar Apr 20 '24 21:04 Bodigrim