Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load a test suite with errors in ghci #2613

Closed
UnkindPartition opened this issue Sep 20, 2016 · 1 comment
Closed

Cannot load a test suite with errors in ghci #2613

UnkindPartition opened this issue Sep 20, 2016 · 1 comment

Comments

@UnkindPartition
Copy link
Contributor

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

  1. Introduce a typed hole in a package's test suite.
  2. 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)

Stack version

$ stack --version
Version 1.2.1, Git revision f28002bdea51468566fd9370f7f9e801c2b51bc5 (4141 commits) x86_64 hpack-0.14.1

Method of installation

Built from git

@mgsloan
Copy link
Contributor

mgsloan commented Sep 26, 2016

Yes, I can understand that this would be very confusing! Here's what's happening:

  1. The dependencies of whatever is loaded into ghci need to be installed for it to work. In this case, it is the mutate package.

  2. You're asking it to build just the :test component.

  3. 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.

@mgsloan mgsloan closed this as completed Sep 26, 2016
@mgsloan mgsloan added this to the Support milestone Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants