I have a Haskell package I've installed from Hackage, using cabal
and would like to run the tests suites that are part of the package, but it isn't clear to me from the cabal
documentation how to do this.
I've tried:
cabal install --reinstall --enable-tests --run-tests the-package
and its various combinations and permutations, but no tests seem to run: I get no report about the test running, and none of the output that I know the test should produce is generated.
How do I run the tests that are part of an installed cabal
package, or a package that I'm in the process of installing?
The --run-tests
flag does not appear to be working in the current version of cabal
. The --enable-tests
flag no longer runs tests as a new feature of cabal
. Until the issue is resolved you can manually verify that a package passes it's test suite by doing the following:
cabal
to download the package sourcecabal
to build the package in a sandboxcabal
to run the tests in the sandboxUse this series of cabal commands to run the test for the-package
:
cabal get the-package
cd the-package*
cabal sandbox init
cabal install --dependencies-only
cabal configure --enable-tests
cabal build
cabal test
cd ../
rm -r the-package*
Or use this equivalent one-liner:
cabal get the-package && cd the-package* && cabal sandbox init && cabal install --dependencies-only && cabal configure --enable-tests && cabal build && cabal test && cd ../ && rm -r the-package*
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