Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run test suite in ghcid with cabal?

I've found a reference for doing this in stack in https://www.parsonsmatt.org/2018/05/19/ghcid_for_the_win.html and some mention of it here: https://github.com/ndmitchell/ghcid/issues/128

What I've tried:

[nix-shell:~/NewProjects/orgmode-parse]$ cabal v2-repl test
cabal: Cannot open a repl for the package test, it is not in this project
(either directly or indirectly). If you want to add it to the project then
edit the cabal.project file.

[nix-shell:~/NewProjects/orgmode-parse]$ cabal v2-repl Test.test
cabal: Unknown target 'Test.test'.
There is no component 'Test.test'.


[nix-shell:~/NewProjects/orgmode-parse]$ cabal v2-repl Test.test
cabal: Unknown target 'Test.test'.
There is no component 'Test.test'.
like image 599
Chris Stryczynski Avatar asked Sep 19 '25 22:09

Chris Stryczynski


1 Answers

ghcid --command='cabal v2-repl test:tests' --test 'Main.main'

Where tests is the name of the test-suite defined in the cabal file. And Main.main refers to the Main module's main function.

like image 138
Chris Stryczynski Avatar answered Sep 23 '25 00:09

Chris Stryczynski