diff --git a/hls-test-utils/hls-test-utils.cabal b/hls-test-utils/hls-test-utils.cabal index a6913ac6f9..199e874308 100644 --- a/hls-test-utils/hls-test-utils.cabal +++ b/hls-test-utils/hls-test-utils.cabal @@ -44,8 +44,6 @@ library , ghcide ^>=1.6 , hls-graph , hls-plugin-api ^>=1.3 - , hspec <2.8 - , hspec-core , lens , lsp ^>=1.4 , lsp-test ^>=0.14 diff --git a/hls-test-utils/src/Test/Hls/Util.hs b/hls-test-utils/src/Test/Hls/Util.hs index cd385a1925..d826b3058f 100644 --- a/hls-test-utils/src/Test/Hls/Util.hs +++ b/hls-test-utils/src/Test/Hls/Util.hs @@ -19,7 +19,6 @@ module Test.Hls.Util , fromAction , fromCommand , getCompletionByLabel - , getHspecFormattedConfig , ghcVersion, GhcVersion(..) , hostOS, OS(..) , matchesCurrentEnv, EnvSpec(..) @@ -50,9 +49,7 @@ import Control.Monad.IO.Class import qualified Data.Aeson as A import Data.Bool (bool) import Data.Default -import Data.List (intercalate) import Data.List.Extra (find) -import Data.Maybe import qualified Data.Set as Set import qualified Data.Text as T import Development.IDE (GhcVersion(..), ghcVersion) @@ -66,15 +63,11 @@ import System.FilePath import System.IO.Temp import System.Info.Extra (isMac, isWindows) import System.Time.Extra (Seconds, sleep) -import Test.Hspec.Core.Formatters hiding (Seconds) -import Test.Hspec.Runner import Test.Tasty (TestTree) import Test.Tasty.ExpectedFailure (expectFailBecause, ignoreTestBecause) import Test.Tasty.HUnit (Assertion, assertFailure, (@?=)) -import Text.Blaze.Internal hiding (null) -import Text.Blaze.Renderer.String (renderMarkup) noLiteralCaps :: C.ClientCapabilities noLiteralCaps = def { C._textDocument = Just textDocumentCaps } @@ -167,88 +160,6 @@ hieYamlCradleDirectContents = unlines ] --- --------------------------------------------------------------------- - -getHspecFormattedConfig :: String -> IO Config -getHspecFormattedConfig name = do - -- https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables - isCI <- isJust <$> lookupEnv "CI" - - -- Only use the xml formatter on CI since it hides console output - if isCI - then do - let subdir = "test-results" name - createDirectoryIfMissing True subdir - - return $ defaultConfig { configFormatter = Just xmlFormatter - , configOutputFile = Right $ subdir "results.xml" - } - else return defaultConfig - --- | A Hspec formatter for CircleCI. --- Originally from https://github.com/LeastAuthority/hspec-jenkins -xmlFormatter :: Formatter -xmlFormatter = silent { - headerFormatter = do - writeLine "" - writeLine "" - , exampleSucceeded - , exampleFailed - , examplePending - , footerFormatter = writeLine "" - } - where - -#if MIN_VERSION_hspec(2,5,0) - exampleSucceeded path _ = -#else - exampleSucceeded path = -#endif - writeLine $ renderMarkup $ testcase path "" - -#if MIN_VERSION_hspec(2,5,0) - exampleFailed path _ err = -#else - exampleFailed path (Left err) = - writeLine $ renderMarkup $ testcase path $ - failure ! message (show err) $ "" - exampleFailed path (Right err) = -#endif - writeLine $ renderMarkup $ testcase path $ - failure ! message (reasonAsString err) $ "" - -#if MIN_VERSION_hspec(2,5,0) - examplePending path _ reason = -#else - examplePending path reason = -#endif - writeLine $ renderMarkup $ testcase path $ - case reason of - Just desc -> skipped ! message desc $ "" - Nothing -> skipped "" - - failure, skipped :: Markup -> Markup - failure = customParent "failure" - skipped = customParent "skipped" - - name, className, message :: String -> Attribute - name = customAttribute "name" . stringValue - className = customAttribute "classname" . stringValue - message = customAttribute "message" . stringValue - - testcase :: Path -> Markup -> Markup - testcase (xs,x) = customParent "testcase" ! name x ! className (intercalate "." xs) - - reasonAsString :: FailureReason -> String - reasonAsString NoReason = "no reason given" - reasonAsString (Reason x) = x - reasonAsString (ExpectedButGot Nothing expected got) = "Expected " ++ expected ++ " but got " ++ got - reasonAsString (ExpectedButGot (Just src) expected got) = src ++ " expected " ++ expected ++ " but got " ++ got -#if MIN_VERSION_hspec(2,5,0) - reasonAsString (Error Nothing err ) = show err - reasonAsString (Error (Just s) err) = s ++ show err -#endif - -- --------------------------------------------------------------------- flushStackEnvironment :: IO ()