Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Self-dependency in test suite fails with hie #1786

Open
IlyaBizyaev opened this issue Jun 13, 2020 · 3 comments
Open

Self-dependency in test suite fails with hie #1786

IlyaBizyaev opened this issue Jun 13, 2020 · 3 comments

Comments

@IlyaBizyaev
Copy link

Hello! I have the following hashtable.cabal file:

cabal-version:       2.2

name:                hashtable
version:             0.1.0.0
-- description etc.

common shared-properties
  build-depends: -- packages
  ghc-options: -Wall -Werror -O2
  default-language:    Haskell2010

library
  import: shared-properties
  hs-source-dirs:  src
  exposed-modules: Hashtable
  default-language:    Haskell2010

-- executable

test-suite hashtable-tests
  import:              shared-properties
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test/unit
  main-is:             Spec.hs
  other-modules:       HashtableSpec
  build-depends:       hashtable
                     , hspec
                     , hspec-discover
  default-language:    Haskell2010

And the following hie.yaml file:

cradle:
  stack:
    - path: ./src
      component: "hashtable:lib"
    - path: ./test/unit
      component: "hashtable:test:hashtable-tests"

It worked fine before I added the test suite, but now I get:

"cannot satisfy -package hashtable-0.1.0.0\n    (use -v for more information)"

stack build runs successfully.
Since self-dependency seems to be the canonical way to test a library in Haskell, how can I fix this issue?

@fendor
Copy link
Collaborator

fendor commented Jun 14, 2020

Can not reproduce, I did stack new example, followed by creating this hie.yaml:

cradle:
  stack:
    - path: ./src
      component: "example:lib"
    - path: ./test
      component: "example:test:example-test"

and then hie --debug test/Spec.hs which claims that everything worked correctly.

@klardotsh
Copy link

I can confirm this, even with an explicit hie.yaml generated by https://github.com/Avi-D-coder/implicit-hie

hie Version 1.4 x86_64 ghc-8.8.3 (Void Linux x86_64-musl)
"cannot satisfy -package resonator-0.1.0\n (use -v for more information)"

with an hie.yaml of

cradle:
  stack:
    - path: "./src"
      component: "resonator:lib"

    - path: "./app/Main.hs"
      component: "resonator:exe:resonator-exe"

    - path: "./test"
      component: "resonator:test:resonator-test"

@jneira
Copy link
Member

jneira commented Jun 22, 2020

@klardotsh @IlyaBizyaev hi, thanks for reporting this, could you add a link to the project , if it is public, and the full log when calling hie-wrapper in the project root directory.

The error involves stack and a test component so this could be caused by #1564. I would call stack test --no-run-tests before opening the project again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants