hspec-discover
file fails with "could not execute: hspec-discover"
#544
Labels
can-workaround
component: hie-bios
status: blocked
Not actionable, because blocked by upstream/GHC etc.
type: bug
Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Subject of the issue
Problems tab has a persistent issue (sometimes 2 copies) of
haskell-language-server-8.10.2: could not execute: hspec-discover
Background
Hspec-Discover is a "magic" tool that allows you to just have test files that get auto-assembled into a main method such that the "spec :: Spec" signature is evaluated in Hspec's environment. I do not understand in the slightest how it works under the hood, but it involves a single
{-# OPTIONS_GHC ... #-}
pragma that can discover all these test modules.My Details
{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}
Relevant stanza in
package.yaml
Your environment
Steps to reproduce
I have not put together a minimal repro, but I suspect this can be done by having a "trivial" library, and a test module that follows the instructions here: https://hspec.github.io/hspec-discover.html
Expected behaviour
I'd expect that there was no error in my problems tab.
Actual behaviour
There is an error in my problems tab, enumerated in the subject
Speculation
I'm guessing based on how the error is worded, that hls is attempting to execute hspec-discover itself. If it is not in hls's "PATH" then it could just not be finding it. That said, my project is stack based, and a
stack exec hspec-discover
yields usage info, so it is definitely available inside the stack environment which I'd imagine hls has access to.The next guess is that for some reason the arguments aren't being properly given to it by hls. But I would have guessed that this would be delegated to GHC and GHC has well defined semantics around how arguments are supplied to these sorts of pragmas: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/phases.html#ghc-flag--F
I don't have any ideas besides that. Open to thoughts.
The text was updated successfully, but these errors were encountered: