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
stack new blah and cd blahecho "module A where" > test/A.hsecho "import A" > test/Spec.hsstack 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?
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.
Most helpful comment
This is because
stack ghciwith no arguments means "load executable and library components", so it does not include the test dir. Trystack ghci --test.