sensei 0.6.0 → 0.6.1
raw patch · 3 files changed
+48/−56 lines, 3 filesdep −hspec-metadep −interpolatedep ~hspec
Dependencies removed: hspec-meta, interpolate
Dependency ranges changed: hspec
Files
- sensei.cabal +3/−5
- test/Helper.hs +30/−31
- test/TriggerSpec.hs +15/−20
sensei.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.34.5. -- -- see: https://github.com/sol/hpack name: sensei-version: 0.6.0+version: 0.6.1 synopsis: Automatically run Hspec tests on file modifications category: Development homepage: https://github.com/hspec/sensei#readme@@ -151,12 +151,10 @@ , directory , filepath , fsnotify- , hspec >=2.2.1- , hspec-meta+ , hspec >=2.9.0 , hspec-wai , http-client >=0.5.0 , http-types- , interpolate , mockery , network , process
test/Helper.hs view
@@ -12,7 +12,6 @@ import Imports -import Data.String.Interpolate import System.IO.Silently as Imports import System.Process as Imports (readProcess, callCommand) import Test.Hspec as Imports@@ -29,40 +28,40 @@ withSomeSpec = (inTempDirectory . (writeFile "Spec.hs" passingSpec >>)) passingSpec :: String-passingSpec = [i|-module Spec (spec) where--import Test.Hspec--spec :: Spec-spec = do- it "foo" True- it "bar" True-|]+passingSpec = unlines [+ "module Spec (spec) where"+ , ""+ , "import Test.Hspec"+ , ""+ , "spec :: Spec"+ , "spec = do"+ , " it \"foo\" True"+ , " it \"bar\" True"+ ] passingMetaSpec :: String-passingMetaSpec = [i|-module Spec (spec) where--import Test.Hspec.Meta--spec :: Spec-spec = do- it "foo" True- it "bar" True-|]+passingMetaSpec = unlines [+ "module Spec (spec) where"+ , ""+ , "import Test.Hspec.Meta"+ , ""+ , "spec :: Spec"+ , "spec = do"+ , " it \"foo\" True"+ , " it \"bar\" True"+ ] failingSpec :: String-failingSpec = [i|-module Spec (spec) where--import Test.Hspec--spec :: Spec-spec = do- it "foo" True- it "bar" False-|]+failingSpec = unlines [+ "module Spec (spec) where"+ , ""+ , "import Test.Hspec"+ , ""+ , "spec :: Spec"+ , "spec = do"+ , " it \"foo\" True"+ , " it \"bar\" False"+ ] data Status = Ok | Failed deriving (Eq, Show)
test/TriggerSpec.hs view
@@ -22,15 +22,10 @@ normalizeErrors :: [String] -> [String] normalizeErrors xs = case xs of- y : ys | "Spec.hs:" `isPrefixOf` y -> "Spec.hs:..." : normalizeErrors (removeErrorDetails ys)+ y : ys | "Spec.hs:" `isPrefixOf` y -> "Spec.hs:..." : normalizeErrors ys y : ys -> y : normalizeErrors ys [] -> [] - removeErrorDetails :: [String] -> [String]- removeErrorDetails xs = case xs of- (_ : _ : ' ' : '|' : _) : ys -> removeErrorDetails ys- _ -> xs- stripAnsiColors xs = case xs of '\ESC' : '[' : ';' : ys | 'm' : zs <- dropWhile isNumber ys -> stripAnsiColors zs '\ESC' : '[' : ys | 'm' : zs <- dropWhile isNumber ys -> stripAnsiColors zs@@ -70,12 +65,12 @@ normalize xs `shouldBe` [ modulesLoaded Ok ["Spec"] , ""- , "foo"- , "bar FAILED [1]"+ , "foo [✔]"+ , "bar [✘]" , "" , "Failures:" , ""- , " Spec.hs:9:3: "+ , " Spec.hs:8:3: " , " 1) bar" , "" , " To rerun use: --match \"/bar/\""@@ -94,8 +89,8 @@ fmap normalize result `shouldBe` (True, [ modulesLoaded Ok ["Spec"] , ""- , "foo"- , "bar"+ , "foo [✔]"+ , "bar [✔]" , "" , "Finished in ..." , "2 examples, 0 failures"@@ -104,7 +99,7 @@ context "with a module that does not compile" $ do it "stops after reloading" $ do- withSession ["Spec.hs"] $ \session -> do+ withSession ["-fno-diagnostics-show-caret", "Spec.hs"] $ \session -> do writeFile "Spec.hs" (passingSpec ++ "foo = bar") (False, xs) <- silence (trigger session >> trigger session) normalize xs `shouldBe` [@@ -129,11 +124,11 @@ normalize xs `shouldBe` [ modulesLoaded Ok ["Spec"] , ""- , "bar FAILED [1]"+ , "bar [✘]" , "" , "Failures:" , ""- , " Spec.hs:9:3: "+ , " Spec.hs:8:3: " , " 1) bar" , "" , " To rerun use: --match \"/bar/\""@@ -156,14 +151,14 @@ "[1 of 1] Compiling Spec ( Spec.hs, interpreted )" , modulesLoaded Ok ["Spec"] , ""- , "bar"+ , "bar [✔]" , "" , "Finished in ..." , "1 example, 0 failures" , "Summary {summaryExamples = 1, summaryFailures = 0}" , ""- , "foo"- , "bar"+ , "foo [✔]"+ , "bar [✔]" , "" , "Finished in ..." , "2 examples, 0 failures"@@ -178,14 +173,14 @@ context "with an hspec-meta spec" $ do it "reloads and runs spec" $ do- withSession ["Spec.hs", "--no-color"] $ \session -> do+ withSession ["-package hspec-meta", "Spec.hs", "--no-color"] $ \session -> do writeFile "Spec.hs" passingMetaSpec result <- silence (trigger session >> trigger session) fmap normalize result `shouldBe` (True, [ modulesLoaded Ok ["Spec"] , ""- , "foo"- , "bar"+ , "foo [✔]"+ , "bar [✔]" , "" , "Finished in ..." , "2 examples, 0 failures"