Skip to content

Commit

Permalink
Merge pull request #5731 from mpilgrem/fix5713
Browse files Browse the repository at this point in the history
Fix #5713 Don't assume unified coverage report redundant if only one *.tix file
  • Loading branch information
NorfairKing authored May 4, 2022
2 parents 9907aa3 + b06a523 commit e9fc45b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Major changes:

Behavior changes:

* `stack build --coverage` will generate a unified coverage report, even if
there is only one `*.tix` file, in case a package has tested the library of
another package that has not tested its own library. See
[#5713](https://github.com/commercialhaskell/stack/issues/5713)

Other enhancements:

* Bump to `hpack-0.35.0`.
Expand Down
23 changes: 19 additions & 4 deletions src/Stack/Coverage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,25 @@ generateHpcUnifiedReport = do
extraTixFiles <- findExtraTixFiles
let tixFiles = tixFiles0 ++ extraTixFiles
reportDir = outputDir </> relDirCombined </> relDirAll
if length tixFiles < 2
then logInfo $
(if null tixFiles then "No tix files" else "Only one tix file") <>
" found in " <>
-- Previously, the test below was:
--
-- if length tixFiles < 2
-- then logInfo $
-- (if null tixFiles then "No tix files" else "Only one tix file") <>
-- " found in " <>
-- fromString (toFilePath outputDir) <>
-- ", so not generating a unified coverage report."
-- else ...
--
-- However, a single *.tix file does not necessarily mean that a unified
-- coverage report is redundant. For example, one package may test the library
-- of another package that does not test its own library. See
-- https://github.com/commercialhaskell/stack/issues/5713
--
-- As an interim solution, a unified coverage report will always be produced
-- even if may be redundant in some circumstances.
if null tixFiles
then logInfo $ "No tix files found in " <>
fromString (toFilePath outputDir) <>
", so not generating a unified coverage report."
else do
Expand Down

0 comments on commit e9fc45b

Please sign in to comment.