You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there's an error in a library, stack ghci can load it, which is great.
However, if it's in a test suite, stack ghci fails.
Steps to reproduce
Introduce a typed hole in a package's test suite.
Run stack ghci :test
Expected
ghci loads the sources and displays the error message
Actual
% stack ghci :test
mutate-1.0: build (lib + exe + test)
Preprocessing library mutate-1.0...
Preprocessing executable 'mutate' for mutate-1.0...
Preprocessing test suite 'test' for mutate-1.0...
[1 of 1] Compiling Main ( tests/test.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/test/test-tmp/Main.o )
/home/feuerbach/prog/mutate/tests/test.hs:11:7: error:
• Found hole: _ :: Assertion
• In a stmt of a 'do' block: _
In the second argument of ‘($)’, namely ‘do { _ }’
In the expression:
testCase "Read the first two sequences from test.fastq" $ do { _ }
• Relevant bindings include
main :: IO () (bound at tests/test.hs:8:1)
-- While building package mutate-1.0 using:
/home/feuerbach/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.24.0.0-ghc-8.0.1 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.0.0 build lib:mutate exe:mutate test:test --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Warning: build failed, but optimistically launching GHCi anyway
Using main module: 1. Package `mutate' component test:test with main-is file: /home/feuerbach/prog/mutate/tests/test.hs
Configuring GHCi with the following packages: mutate
Progress: 1/2GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
<command line>: cannot satisfy -package mutate-1.0
(use -v for more information)
Yes, I can understand that this would be very confusing! Here's what's happening:
The dependencies of whatever is loaded into ghci need to be installed for it to work. In this case, it is the mutate package.
You're asking it to build just the :test component.
If the build or run of a test component fails, the library doesn't get installed.
The solution for now is to do stack build followed by stack ghci --no-build :test to skip the build step.
The build step being applied to your targets and not just your dependencies is an ugly hack that I hope to resolve soon: #1364
So, since there is a direct work-around and a good solution in the works, closing this issue. Thanks for reporting! A good reminder that there is still important improvements to implement for stack ghci.
General summary/comments (optional)
When there's an error in a library,
stack ghci
can load it, which is great.However, if it's in a test suite,
stack ghci
fails.Steps to reproduce
stack ghci :test
Expected
ghci loads the sources and displays the error message
Actual
Stack version
Method of installation
Built from git
The text was updated successfully, but these errors were encountered: