haskell / haskell/cabal

Coverage does not work for packages that use internal libraries or library components

Open
#6,440 13 comments 8 reactions 0 assignees View on GitHub
Cabal: code-coverage re: internal library type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
Coverage does not work for packages that use internal libraries or library components. This is true even if package is only a build dependency, making it very easy encounter this issue on any reasonably sized project.

**To Reproduce**
Steps to reproduce the behavior:

```
$ git clone git@github.com:haskell-works/hw-ip.git
$ cd hw-ip
$ cabal v2-test --enable-coverage
Error:
Internal libraries only supported with per-component builds.
Per-component builds were disabled because program coverage is enabled
In the package 'hw-ip-2.4.0.1'
```

Please use version-prefixed commands (e.g. `v2-build` or `v1-build`) to avoid ambiguity.

**Expected behavior**
I expect coverage to just work for any typical package that has been published to hackage.

**System information**
```
$ cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ uname -a
Darwin INTLKyMac.local 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64
```

**Additional context**
None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.