Open peterbecich opened 10 months ago
Why could not hspec
determine its parent process? E. g., https://hackage.haskell.org/package/unix-2.8.3.0/docs/System-Posix-Process-ByteString.html#v:getParentProcessID.
Finding its ppid is POSIX-portable; finding out anything about its parent isn't (/proc
doesn't always exist and when it does isn't necessarily Linux-compatible).
Also note that Windows is a wildcard here.
True, and nevertheless pretty much every OS provides means to determine a parent process. We might lack a crossplatform Haskell library to do this reliably, in which case it would be better to write one instead of establishing an ad-hoc communication channel between cabal
and hspec
. (But I've been just passing by, nevermind)
note that running a testsuite already does affect the environment, in that it ensures datadir
is set. Testing for this is slightly ad-hoc as opposed to a distinguished variable, but it has the great advantage of already existing and working!
@peterbecich a totally under-engineered option is to expand the message to the user:
To rerun use: --match "/someFailingTest/".
If you are using cabal use: cabal test --test-options="--match \"/someFailingTest/\""
(maybe --test-options='--match "/someFailingTest/"'
would also work?)
Describe the feature request I have a feature request in Hspec to make it easier to run specific tests with Cabal: https://github.com/hspec/hspec/issues/862
Hspec needs to know if it is run by Cabal.
@sol suggests this can be implemented if
cabal test
sets the environment variableCABAL_TEST_COMMAND=cabal
Additional context
Currently a failing test will print:
To use this suggestion with Cabal, it must be modified to this:
With this environment variable, Hspec will print out this feedback for Cabal.