cabal and integration tests or how to get code coverage for binaries
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
My project structure:
- library
- binary (depends library)
- unit tests
- integration tests (written in pytest)
The integration tests call the binary. To get code coverage for those calls, I tried to call pytest via `system` from an extra cabal _test-suite_. Turns out that this doesen't help. Also wrapping the binary into the test-suite [(details)](https://stackoverflow.com/questions/39561978/haskell-using-cabal-test-for-integration-tests-with-code-coverage) does not help. Seems like only the call from `cabal test` counts into the coverage report.
So I went back to calling the binary directly and generating reports via hpc manually. First problem: I need to add an obscure `--hpcdir` for the library (`dist/hpc/dyn/mix/-//`). Second: I get 100% (0/0) coverage. So the library is not included in the report of the binary?
This was all working when I didn't had the split into library/binary. Is it really impossible to build a binary+library with working coverage via cabal?
Contributor guide
Assessment
This issue has not been assessed yet.