Show cumulative times for tests with dependents

This commit is contained in:
George Thomas 2026-01-11 23:52:19 +00:00
parent 86e2ff6c62
commit 4aa4216354

View File

@ -107,6 +107,7 @@ import Control.Monad.Writer
import Data.Bifunctor
import Data.Bool
import Data.Char
import Data.Either.Extra
import Data.Finite
import Data.Fixed (Fixed (MkFixed))
import Data.Foldable hiding (foldl1, foldr1, maximum, maximumBy, minimum, minimumBy)
@ -433,8 +434,10 @@ runTests opts r0 (TestTree name tc ts) =
pure $ Left e
Right (Left e) ->
pure $ Left $ ExceptionFailure e
Right (Right (r, dt)) ->
Right . (dt,) <$> for ts (runTests opts r)
Right (Right (r, dt)) -> do
rs <- for ts $ runTests opts r
let childTimes = fromMaybe 0 $ eitherToMaybe $ fmap (sum . map fst) $ traverse (.result) rs
pure $ Right (dt + childTimes, rs)
where
runTest = \case
TestCase f -> timed (liftIO . evaluate . DeepSeq.force) $ f r0