Update spec-mocha for purescript 0.12

This commit is contained in:
Alexandra DeWit 2018-06-16 15:21:01 +02:00 committed by Oskar Wickström
parent 8c7930e124
commit 955752033a
3 changed files with 26 additions and 30 deletions

View File

@ -15,9 +15,9 @@
"output" "output"
], ],
"dependencies": { "dependencies": {
"purescript-console": "^3.0.0", "purescript-console": "^4.0.0",
"purescript-foldable-traversable": "^3.0.0", "purescript-foldable-traversable": "^4.0.0",
"purescript-exceptions": "^3.0.0", "purescript-exceptions": "^4.0.0",
"purescript-spec": "^2.0.0" "purescript-spec": "^3.0.0"
} }
} }

View File

@ -4,39 +4,35 @@ module Test.Spec.Mocha (
) where ) where
import Prelude import Prelude
import Control.Monad.Aff (Aff, Error, runAff_) import Effect.Aff (Aff, Error, runAff_)
import Control.Monad.Eff (Eff, kind Effect) import Effect (Effect)
import Data.Either (either) import Data.Either (either)
import Data.Foldable (traverse_) import Data.Foldable (traverse_)
import Test.Spec (Spec, Group(..), collect) import Test.Spec (Spec, Group(..), collect)
foreign import data MOCHA :: Effect foreign import data MOCHA :: Type
foreign import itAsync foreign import itAsync
:: forall e :: Boolean
. Boolean
-> String -> String
-> (Eff e Unit -> (Effect Unit
-> (Error -> Eff e Unit) -> (Error -> Effect Unit)
-> Eff e Unit) -> Effect Unit)
-> Eff (mocha :: MOCHA | e) Unit -> Effect Unit
foreign import itPending foreign import itPending
:: forall e :: String
. String -> Effect Unit
-> Eff (mocha :: MOCHA | e) Unit
foreign import describe foreign import describe
:: forall e :: Boolean
. Boolean
-> String -> String
-> Eff (mocha :: MOCHA | e) Unit -> Effect Unit
-> Eff (mocha :: MOCHA | e) Unit -> Effect Unit
registerGroup registerGroup
:: forall e :: Group (Aff Unit)
. (Group (Aff e Unit)) -> Effect Unit
-> Eff (mocha :: MOCHA | e) Unit
registerGroup (It only name test) = registerGroup (It only name test) =
itAsync only name cb itAsync only name cb
where where
@ -48,6 +44,6 @@ registerGroup (Describe only name groups) =
runMocha runMocha
:: forall e :: forall e
. Spec e Unit . Spec Unit
-> Eff (mocha :: MOCHA | e) Unit -> Effect Unit
runMocha spec = traverse_ registerGroup (collect spec) runMocha spec = traverse_ registerGroup (collect spec)

View File

@ -1,14 +1,14 @@
module Test.Main where module Test.Main where
import Prelude import Prelude
import Control.Monad.Aff (delay) import Effect.Aff (delay)
import Control.Monad.Eff (Eff) import Effect (Effect)
import Data.Time.Duration (Milliseconds(..)) import Data.Time.Duration (Milliseconds(..))
import Test.Spec (SpecEffects, describe, it, pending) import Test.Spec (describe, it, pending)
import Test.Spec.Assertions (shouldEqual) import Test.Spec.Assertions (shouldEqual)
import Test.Spec.Mocha (MOCHA, runMocha) import Test.Spec.Mocha (runMocha)
main :: Eff (SpecEffects (mocha :: MOCHA)) Unit main :: Effect Unit
main = runMocha do main = runMocha do
describe "test" $ describe "test" $
describe "nested" do describe "nested" do