packages feed

tasty-test-reporter 0.1.1.1 → 0.1.1.2

raw patch · 4 files changed

+71/−31 lines, 4 filesdep ~ansi-terminaldep ~tastynew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ansi-terminal, tasty

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.1.1.2++- Relax version bounds of `tasty` and `ansi-terminal` dependencies.+ # 0.1.0.0  - Initial implementation.
src/Test/Console/Color.hs view
@@ -9,28 +9,54 @@     underlined,     Colored (Colors, NoColors),     Style,+    Styled (..),+    unlines,+    style,     styled,-    maybeStyled,+    unstyled,   ) where -import qualified Data.Text-import Data.Text (Text)+import Data.Function (on)+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq+import Data.String (IsString (..))+import Prelude hiding (unlines) import qualified System.Console.ANSI as Console+import System.Console.Concurrent (Outputable (..))  type Style = [Console.SGR] -code :: Style -> Text-code = Data.Text.pack . Console.setSGRCode+code :: IsString a => Style -> a+code = fromString . Console.setSGRCode -styled :: Style -> Text -> Text-styled col t = code col <> t <> code [reset]+newtype Styled a = Styled { getStyled :: Seq (Either [Console.SGR] a) } -maybeStyled :: Colored -> Style -> Text -> Text-maybeStyled colored styles text =-  case colored of-    Colors -> styled styles text-    NoColors -> text+instance Semigroup (Styled a) where+  (<>) a b = Styled (on (<>) getStyled a b)++instance Monoid (Styled a) where+  mempty = Styled mempty++instance IsString a => IsString (Styled a) where+  fromString = Styled . Seq.singleton . Right . fromString++instance (IsString a, Outputable a) => Outputable (Styled a) where+  toOutput = foldMap (either code toOutput) . getStyled++unlines :: IsString t => [Styled t] -> Styled t+unlines [] = mempty+unlines (t : ts) = t <> fromString "\n" <> unlines ts++style :: Style -> Styled a+style col = (Styled . Seq.singleton) (Left col)++styled :: Style -> t -> Styled t+styled col t =+  style col <> (Styled . Seq.singleton) (Right t) <> style [reset]++unstyled :: Monoid a => Styled a -> a+unstyled = foldMap (either mempty id) . getStyled  data Colored = Colors | NoColors 
src/Test/Tasty/Runners/Reporter.hs view
@@ -73,15 +73,19 @@ import Data.Monoid (Monoid (mappend, mempty), Sum (getSum)) import Data.Proxy (Proxy (Proxy)) import Data.Semigroup+import Data.String (fromString) import Data.Tagged (Tagged (Tagged)) import qualified Data.Text as Text import Data.Text (Text) import Data.Typeable (Typeable) import Numeric (showFFloat)+import Prelude hiding (unlines)+import System.Console.ANSI (hSupportsANSIColor) import System.Console.Concurrent (outputConcurrent, withConcurrentOutput) import System.Directory (canonicalizePath, createDirectoryIfMissing) import System.FilePath (FilePath, takeDirectory)-import Test.Console.Color (Style, black, green, grey, red, styled, underlined, yellow)+import System.IO (stdout)+import Test.Console.Color (Style, Styled, black, green, grey, red, styled, underlined, unlines, unstyled, yellow) import qualified Test.Tasty as Tasty import qualified Test.Tasty.Options as Tasty import qualified Test.Tasty.Runners as Tasty@@ -255,7 +259,7 @@             & pure         Just (TestOnly (OnlyTestPassed _)) -> do           let errorMessage =-                Text.unlines+                unlines                   [ "This test passed, but there is a `Test.only` in your test.",                     "I failed the test, because it's easy to forget to remove `Test.only`."                   ]@@ -268,7 +272,7 @@             { testSuites =                 [ JUnit.errored testName                     & JUnit.time resultTime-                    & JUnit.errorMessage errorMessage+                    & JUnit.errorMessage (unstyled errorMessage)                     & inSuite groupNames                 ],               hasOnly = True,@@ -278,7 +282,7 @@         Just (TestOnly (OnlyTestFailed str)) -> do           printLines             [ prettyPath [red] testName groupNames_,-              Text.pack str,+              fromString str,               "\n"             ]           mempty@@ -297,14 +301,14 @@           printLines             [ prettyPath [red] testName groupNames_,               errorMessage,-              Text.pack (displayException err),+              fromString (displayException err),               "\n"             ]           mempty             { testSuites =                 [ JUnit.errored testName                     & JUnit.stderr (Text.pack (displayException err))-                    & JUnit.errorMessage errorMessage+                    & JUnit.errorMessage (unstyled errorMessage)                     & JUnit.time resultTime                     & inSuite groupNames                 ],@@ -325,7 +329,7 @@     Tasty.Failure _ -> do       printLines         [ prettyPath [red] testName groupNames_,-          Text.pack resultDescription,+          fromString resultDescription,           "\n"         ]       mempty@@ -354,7 +358,8 @@     & TraversalT  printSummary :: Summary -> Tasty.Time -> IO ()-printSummary Summary {failures, errors, successes, skipped, hasOnly} duration =+printSummary Summary {failures, errors, successes, skipped, hasOnly} duration = do+  color <- hSupportsANSIColor stdout   [ -- Title "TEST RUN ..."     if hasOnly       then@@ -386,26 +391,31 @@       else "",     styled [black] ("Failed:    " <> fromInt failedTestsTotal),     "\n\n"-  ]-    & outputConcurrent . mconcat+    ]+    & mconcat+    & if color then outputConcurrent else outputConcurrent . unstyled   where     failedTestsTotal = getSum (failures <> errors)     skippedTestsTotal = getSum skipped -prettyPath :: Style -> Text -> [Text] -> Text+prettyPath :: Style -> Text -> [Text] -> Styled Text prettyPath style name path =   mconcat     [ reverse path         & map (styled [grey] . (<>) "↓ ")-        & Text.unlines,+        & unlines,       styled style ("✗ " <> name) <> "\n"     ]  inSuite :: GroupNames -> JUnit.TestReport outcome -> JUnit.TestSuite inSuite (GroupNames groupNames) = JUnit.inSuite (Text.intercalate "." groupNames) -printLines :: [Text] -> IO ()-printLines = outputConcurrent . Text.unlines+printLines :: [Styled Text] -> IO ()+printLines ts = do+  color <- hSupportsANSIColor stdout+  if color+    then outputConcurrent (unlines ts)+    else outputConcurrent (unstyled $ unlines ts)  timeDigits :: Num p => p timeDigits = 3
tasty-test-reporter.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: f7eba2269195afe0c4f0b053b6950b6c17313c931ced729b83cf7e14fad68edd+-- hash: 680fba18f273b6e9eb28be202c91eed0057b1f6383dd32d0f3792181add68988  name:           tasty-test-reporter-version:        0.1.1.1+version:        0.1.1.2 synopsis:       Producing JUnit-style XML test reports. description:    Please see the README at <https://github.com/stoeffel/tasty-test-reporter>. category:       Testing@@ -36,7 +36,7 @@   hs-source-dirs:       src   build-depends:-      ansi-terminal >=0.8 && <0.11+      ansi-terminal >=0.8 && <0.12     , base >=4.10.1.0 && <5     , concurrent-output >=1.10 && <1.11     , containers >=0.5 && <0.7@@ -47,7 +47,7 @@     , safe-exceptions >=0.1 && <0.2     , stm >=2.4 && <2.6     , tagged >=0.8 && <0.9-    , tasty >=0.1 && <1.3+    , tasty >=0.1 && <1.4     , text >=1.2 && <1.3   default-language: Haskell2010 @@ -60,7 +60,7 @@       test   build-depends:       base-    , tasty >=1.1 && <1.3+    , tasty >=1.1 && <1.4     , tasty-hunit     , tasty-test-reporter   default-language: Haskell2010