Skip to content

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

@bergmark

Description

@bergmark

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions