I created a very simple project with stack. It contains: an executable, a library and test targets in the associated cabal file. When I load the code to ghci via stack ghci, I can't access test there, even if they are in separate module. Is there any way to use it in such a way?
stack ghci allows you to load components and files of your project into ghci . It uses the same TARGET syntax as stack build , and can also take options like --test , --bench , and --flag . Similarly to stack build , the default is to load up ghci with all libraries and executables in the project.
html -> click on system information-> login with admin rights -> you can get all details about the installed server.
Try stack ghci (your project name):(the test suite name)
. Then you should be able to enter main
and your tests will run.
Example:
If your .cabal project file had the following values:
name: ExampleProject
...
test-suite Example-test
Then the command to run would be stack ghci ExampleProject:Example-test
(edit suggested by @Chris Stryczynski)
To watch the test
and src
directories so they are updated when you reload with :r
, run:
stack ghci --ghci-options -isrc --ghci-options -itest ExampleProduct:Example-test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With