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

stack ghci foo:test:bar uses library dependencies unless --test is passed #1845

Closed
bergmark opened this issue Feb 26, 2016 · 5 comments
Closed

stack ghci foo:test:bar uses library dependencies unless --test is passed #1845

bergmark opened this issue Feb 26, 2016 · 5 comments

Comments

@bergmark
Copy link
Member

@bergmark bergmark commented Feb 26, 2016

stack: Version 1.0.4 x86_64

This took me a while to figure out because the error message isn't clear, it turns out that you need to pass --test when ghci'ing a test suite, otherwise the library dependencies will be in scope instead.

Edit: I would expect --main-is *:test:* to either imply --test or produce an error message without it, the former sounds nicer to me.

$ stack ghci feed --main-is feed:test:tests
Using main module: 1. Package `feed' component test:tests with main-is file: /Users/adam/repos/feed/tests/Main.hs
Configuring GHCi with the following packages: feed
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help

/Users/adam/repos/feed/tests/Main.hs:3:8:
    Could not find module ‘Test.Framework’
    It is a member of the hidden package ‘test-framework-0.8.1.1@testf_4H0ct1ddVB2I2MqugXDYyk’.
    Use -v to see a list of the files searched for.

/Users/adam/repos/feed/tests/Main.hs:4:8:
    Could not find module ‘Text.RSS.Tests’
    Use -v to see a list of the files searched for.

/Users/adam/repos/feed/tests/Main.hs:5:8:
    Could not find module ‘Text.Atom.Tests’
    Perhaps you meant
      Text.Atom.Feed (needs flag -package-key feed-0.3.11.1@feed_8KHXLrW8hznKHgeejBEybf)
    Use -v to see a list of the files searched for.

/Users/adam/repos/feed/tests/Main.hs:6:8:
    Could not find module ‘Text.Feed.Util.Tests’
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.

<no location info>:
    Could not find module ‘Paths_feed’
    It is a member of the hidden package ‘feed-0.3.11.1@feed_8KHXLrW8hznKHgeejBEybf’.
@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Feb 27, 2016

Does stack ghci feed:test:tests not work?

I don't think there's any logic currently that has stack ghci --main-is feed:test:tests imply loading that component. It definitely makes sense to add that.

@bergmark
Copy link
Member Author

@bergmark bergmark commented Feb 28, 2016

Does stack ghci feed:test:tests not work?

It works, I wasn't aware that syntax was allowed outside of --main-is.

@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Feb 29, 2016

Yes, stack ghci takes all the arguments that stack build takes, including target selection.

@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Oct 18, 2016

@bergmark This is now fixed! --main-is TARGET will now imply that it is also a plain target.

@mgsloan mgsloan closed this Oct 18, 2016
mgsloan added a commit that referenced this issue Oct 18, 2016
@bergmark
Copy link
Member Author

@bergmark bergmark commented Oct 19, 2016

Thanks Michael!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants