mirror of
https://github.com/ilyakooo0/purescript-spec-mocha.git
synced 2024-11-22 02:32:08 +03:00
Update spec-mocha for purescript 0.12
This commit is contained in:
parent
8c7930e124
commit
955752033a
@ -15,9 +15,9 @@
|
||||
"output"
|
||||
],
|
||||
"dependencies": {
|
||||
"purescript-console": "^3.0.0",
|
||||
"purescript-foldable-traversable": "^3.0.0",
|
||||
"purescript-exceptions": "^3.0.0",
|
||||
"purescript-spec": "^2.0.0"
|
||||
"purescript-console": "^4.0.0",
|
||||
"purescript-foldable-traversable": "^4.0.0",
|
||||
"purescript-exceptions": "^4.0.0",
|
||||
"purescript-spec": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -4,39 +4,35 @@ module Test.Spec.Mocha (
|
||||
) where
|
||||
|
||||
import Prelude
|
||||
import Control.Monad.Aff (Aff, Error, runAff_)
|
||||
import Control.Monad.Eff (Eff, kind Effect)
|
||||
import Effect.Aff (Aff, Error, runAff_)
|
||||
import Effect (Effect)
|
||||
import Data.Either (either)
|
||||
import Data.Foldable (traverse_)
|
||||
import Test.Spec (Spec, Group(..), collect)
|
||||
|
||||
foreign import data MOCHA :: Effect
|
||||
foreign import data MOCHA :: Type
|
||||
|
||||
foreign import itAsync
|
||||
:: forall e
|
||||
. Boolean
|
||||
:: Boolean
|
||||
-> String
|
||||
-> (Eff e Unit
|
||||
-> (Error -> Eff e Unit)
|
||||
-> Eff e Unit)
|
||||
-> Eff (mocha :: MOCHA | e) Unit
|
||||
-> (Effect Unit
|
||||
-> (Error -> Effect Unit)
|
||||
-> Effect Unit)
|
||||
-> Effect Unit
|
||||
|
||||
foreign import itPending
|
||||
:: forall e
|
||||
. String
|
||||
-> Eff (mocha :: MOCHA | e) Unit
|
||||
:: String
|
||||
-> Effect Unit
|
||||
|
||||
foreign import describe
|
||||
:: forall e
|
||||
. Boolean
|
||||
:: Boolean
|
||||
-> String
|
||||
-> Eff (mocha :: MOCHA | e) Unit
|
||||
-> Eff (mocha :: MOCHA | e) Unit
|
||||
-> Effect Unit
|
||||
-> Effect Unit
|
||||
|
||||
registerGroup
|
||||
:: forall e
|
||||
. (Group (Aff e Unit))
|
||||
-> Eff (mocha :: MOCHA | e) Unit
|
||||
:: Group (Aff Unit)
|
||||
-> Effect Unit
|
||||
registerGroup (It only name test) =
|
||||
itAsync only name cb
|
||||
where
|
||||
@ -48,6 +44,6 @@ registerGroup (Describe only name groups) =
|
||||
|
||||
runMocha
|
||||
:: forall e
|
||||
. Spec e Unit
|
||||
-> Eff (mocha :: MOCHA | e) Unit
|
||||
. Spec Unit
|
||||
-> Effect Unit
|
||||
runMocha spec = traverse_ registerGroup (collect spec)
|
||||
|
@ -1,14 +1,14 @@
|
||||
module Test.Main where
|
||||
|
||||
import Prelude
|
||||
import Control.Monad.Aff (delay)
|
||||
import Control.Monad.Eff (Eff)
|
||||
import Effect.Aff (delay)
|
||||
import Effect (Effect)
|
||||
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.Mocha (MOCHA, runMocha)
|
||||
import Test.Spec.Mocha (runMocha)
|
||||
|
||||
main :: Eff (SpecEffects (mocha :: MOCHA)) Unit
|
||||
main :: Effect Unit
|
||||
main = runMocha do
|
||||
describe "test" $
|
||||
describe "nested" do
|
||||
|
Loading…
Reference in New Issue
Block a user