Skip to content

Commit e9fc45b

Browse files
authored
Merge pull request #5731 from mpilgrem/fix5713
Fix #5713 Don't assume unified coverage report redundant if only one *.tix file
2 parents 9907aa3 + b06a523 commit e9fc45b

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Major changes:
1111

1212
Behavior changes:
1313

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

1621
* Bump to `hpack-0.35.0`.

src/Stack/Coverage.hs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,25 @@ generateHpcUnifiedReport = do
288288
extraTixFiles <- findExtraTixFiles
289289
let tixFiles = tixFiles0 ++ extraTixFiles
290290
reportDir = outputDir </> relDirCombined </> relDirAll
291-
if length tixFiles < 2
292-
then logInfo $
293-
(if null tixFiles then "No tix files" else "Only one tix file") <>
294-
" found in " <>
291+
-- Previously, the test below was:
292+
--
293+
-- if length tixFiles < 2
294+
-- then logInfo $
295+
-- (if null tixFiles then "No tix files" else "Only one tix file") <>
296+
-- " found in " <>
297+
-- fromString (toFilePath outputDir) <>
298+
-- ", so not generating a unified coverage report."
299+
-- else ...
300+
--
301+
-- However, a single *.tix file does not necessarily mean that a unified
302+
-- coverage report is redundant. For example, one package may test the library
303+
-- of another package that does not test its own library. See
304+
-- https://github.com/commercialhaskell/stack/issues/5713
305+
--
306+
-- As an interim solution, a unified coverage report will always be produced
307+
-- even if may be redundant in some circumstances.
308+
if null tixFiles
309+
then logInfo $ "No tix files found in " <>
295310
fromString (toFilePath outputDir) <>
296311
", so not generating a unified coverage report."
297312
else do

0 commit comments

Comments
 (0)