stack repl doesn't search in test subfolder

Created on 31 May 2016  路  1Comment  路  Source: commercialhaskell/stack

I want to write tests for different modules in separate test modules and import them in a main test file, Spec.hs.

Steps to reproduce

  1. Run stack new blah and cd blah
  2. Run echo "module A where" > test/A.hs
  3. Run echo "import A" > test/Spec.hs
  4. Run stack repl and enter :l test/Spec.hs

Expected:

Loading Spec.hs in stack repl works.

Actual:

Test modules imported in Spec.hs aren't found since the test/ directory is not in the module import search paths.

Are there workarounds other than typing :set -itest in the repl?

Most helpful comment

This is because stack ghci with no arguments means "load executable and library components", so it does not include the test dir. Try stack ghci --test.

>All comments

This is because stack ghci with no arguments means "load executable and library components", so it does not include the test dir. Try stack ghci --test.

Was this page helpful?
0 / 5 - 0 ratings