Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to run a Hspec test suite #208

Closed
pcarbonn opened this issue Oct 30, 2018 · 9 comments
Closed

how to run a Hspec test suite #208

pcarbonn opened this issue Oct 30, 2018 · 9 comments

Comments

@pcarbonn
Copy link

I checked #128, but it does not fully solve the problem.

When I run ghcid "--command=stack ghci H-Calc:spec" "--test=:main", it runs my test set correctly, and again correctly when I change the code of my test suite, but NOT if I change the code of my main project.

Ghcid seems to track the test folder, but not the src folder.

My project is on github, so you can see the file structure and cabal file.

@moodmosaic
Copy link

You might want to check out Run your test suite on every edit section of this post by @parsonsmatt.

@pcarbonn
Copy link
Author

OK. Thanks !

@chrissound
Copy link

Is there a solution for this with cabal as well?

ghcid --command='cabal v2-repl lib:orgmode-parse test:tests' --test 'Main.main'
Loading cabal v2-repl lib:orgmode-parse test:tests ...
cabal: Cannot open a repl for multiple components at once. The targets
'orgmode-parse' and 'tests' refer to different components..

The reason for this limitation is that current versions of ghci do not support
loading multiple components as source. Load just one component and when you
make changes to a dependent component then quit and reload.

Command "cabal v2-repl lib:orgmode-parse test:tests" exited unexpectedly with error message: 

@ndmitchell
Copy link
Owner

The underlying issue is a limitation in GHC, which is being addressed by a summer-of-code project as we speak. Cabal chooses to take that limitation and make it a fatal error. Stack chooses to continue, accepting things might not work. But I don't believe there's much to be done with Cabal, other than talking to the Cabal maintainers, or waiting for a GHC with multi-component support.

@tfc
Copy link

tfc commented May 13, 2021

is being addressed by a summer-of-code project as we speak

is there any progress by now?

@Ericson2314
Copy link

The work has not been completely merged, but stepping stones written by @fendor and also @hsyl20 have. Rest assured we will get there!

@sekunho
Copy link

sekunho commented Feb 20, 2022

Just checking in. Is there a workaround/solution for cabal repl that I missed somehow?

@ndmitchell
Copy link
Owner

@sekunho - if you are referring to the issue of loading src and test at once, then I don't think it's fully merged yet, but I'm not sure.

@gabrielsimoes
Copy link

gabrielsimoes commented Feb 12, 2024

This is now possible with cabal-head, e.g. for ghcup:

ghcup install cabal -u https://github.com/haskell/cabal/releases/download/cabal-head/cabal-head-Linux-x86_64.tar.gz head

until haskell/cabal#8726 makes into a release (probably 3.12 from the milestones).

This allows something like:

ghcid --command='cabal v2-repl --enable-multi-repl test:tests lib:orgmode-parse' --test 'Main.main'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants