@@ -14,8 +14,7 @@ module Stack.Coverage
1414 , generateHpcMarkupIndex
1515 ) where
1616
17- import qualified Data.ByteString.Char8 as S8
18- import qualified Data.ByteString.Lazy as BL
17+ import qualified Data.ByteString.Lazy.Char8 as L8
1918import qualified Data.List as L
2019import qualified Data.Map.Strict as Map
2120import qualified Data.Set as Set
@@ -32,6 +31,7 @@ import Path.IO
3231 , ignoringAbsence , listDir , removeDirRecur , removeFile
3332 , resolveDir' , resolveFile'
3433 )
34+ import RIO.ByteString.Lazy ( putStrLn )
3535import RIO.Process ( ProcessException , proc , readProcess_ )
3636import Stack.Build.Target ( NeedTargets (.. ) )
3737import Stack.Constants
@@ -212,9 +212,9 @@ generateHpcReport pkgDir package tests = do
212212 tixSrc <- tixFilePath (packageName package) (T. unpack testName)
213213 let report = fillSep
214214 [ flow " coverage report for"
215- , fromString pkgName' <> " 's"
215+ , style Current ( fromString pkgName') <> " 's"
216216 , " test-suite"
217- , fromString $ " \" " <> T. unpack testName <> " \" "
217+ , style PkgComponent ( fromString $ T. unpack testName)
218218 ]
219219 reportHtml =
220220 " coverage report for"
@@ -289,14 +289,15 @@ generateHpcReportInternal tixSrc reportDir report reportHtml extraMarkupArgs ext
289289 [ " Generating"
290290 , report <> " ."
291291 ]
292- outputLines <- map (S8. filter (/= ' \r ' )) . S8. lines . BL. toStrict . fst <$>
292+ -- Strip @\r@ characters because Windows.
293+ outputLines <- map (L8. filter (/= ' \r ' )) . L8. lines . fst <$>
293294 proc " hpc"
294295 ( " report"
295296 : toFilePath tixSrc
296297 : (args ++ extraReportArgs)
297298 )
298299 readProcess_
299- if all (" (0/0)" `S8 .isSuffixOf` ) outputLines
300+ if all (" (0/0)" `L8 .isSuffixOf` ) outputLines
300301 then do
301302 let msgHtml =
302303 " Error: [S-6829]\n \
@@ -327,9 +328,16 @@ generateHpcReportInternal tixSrc reportDir report reportHtml extraMarkupArgs ext
327328 pure Nothing
328329 else do
329330 let reportPath = reportDir </> relFileHpcIndexHtml
330- -- Print output, stripping @\r@ characters because Windows.
331- forM_ outputLines (logInfo . displayBytesUtf8)
332- -- Generate the markup.
331+ -- Print the summary report to the standard output stream.
332+ putUtf8Builder =<< displayWithColor
333+ ( fillSep
334+ [ " Summary"
335+ , report <> " :"
336+ ]
337+ <> line
338+ )
339+ forM_ outputLines putStrLn
340+ -- Generate the HTML markup.
333341 void $ proc " hpc"
334342 ( " markup"
335343 : toFilePath tixSrc
@@ -392,8 +400,8 @@ generateHpcReportForTargets opts tixFiles targetNames = do
392400 dest <- resolveDir' destDir
393401 ensureDir dest
394402 pure dest
395- let report = flow " combined report"
396- reportHtml = " combined report"
403+ let report = flow " combined coverage report"
404+ reportHtml = " combined coverage report"
397405 mreportPath <- generateUnionReport report reportHtml reportDir tixPaths
398406 forM_ mreportPath $ \ reportPath ->
399407 if hroptsOpenBrowser opts
@@ -429,8 +437,8 @@ generateHpcUnifiedReport = do
429437 , flow " so not generating a unified coverage report."
430438 ]
431439 else do
432- let report = flow " unified report"
433- reportHtml = " unified report"
440+ let report = flow " unified coverage report"
441+ reportHtml = " unified coverage report"
434442 mreportPath <- generateUnionReport report reportHtml reportDir tixFiles
435443 forM_ mreportPath (displayReportPath " The" report . pretty)
436444
0 commit comments