0
votes

I have a project structure that looks like this

enter image description here

Note that the 'api/test' directory contains 'Spec.hs', and 'api' is my project root directory containing my '.cabal' and '.yaml' files.

When I run $ stack ghci from the project root (api), api/test/Spec.hs is not in scope. Whereas my modules in api/src/ are in scope.

Why are the modules defined in api/test not in scope?

My .cabal file is configured properly such that $ stack test is able to successfully run the code of api/test/Spec.hs.

I am not able to even load the Spec.hs module from ghci. Attempting to do so by running > :l test/Spec.hs from within ghci gives many 'Failed to load interface' errors.

1

1 Answers

2
votes

By default "stack ghci" just loads the library in, not tests, executables, or benchmarks. Use "stack ghci --test" to also try to load all tests.