haskell-ide-engine
haskell-ide-engine copied to clipboard
Self-dependency in test suite fails with hie
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?
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.
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"
@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.