diff --git a/bower.json b/bower.json index 4931d0a..6a4cad1 100644 --- a/bower.json +++ b/bower.json @@ -25,13 +25,14 @@ "url": "git://github.com/KtorZ/purescript-ifrit.git" }, "dependencies": { - "purescript-maybe": "3.0.0", - "purescript-aff": "3.1.0", - "purescript-datetime": "3.2.0" + "purescript-maybe": "^3.0.0", + "purescript-aff": "^3.1.0", + "purescript-datetime": "^3.2.0" }, "devDependencies": { - "purescript-spec": "1.0.0", - "purescript-psci-support": "3.0.0", - "purescript-now": "3.0.0" + "purescript-spec": "^1.0.0", + "purescript-psci-support": "^3.0.0", + "purescript-now": "^3.0.0", + "purescript-spec-mocha": "https://github.com/truqu/purescript-spec-mocha.git#0.5.0" } } diff --git a/src/Test/Spec/Mocha.js b/src/Test/Spec/Mocha.js deleted file mode 100644 index 43faf5c..0000000 --- a/src/Test/Spec/Mocha.js +++ /dev/null @@ -1,46 +0,0 @@ -/* global exports, it */ - -// module Test.Spec.Mocha - -if (typeof describe !== 'function' || typeof it !== 'function') { - throw new Error('Mocha globals seem to be unavailable!'); -} - -exports.itAsync = function (only) { - "use strict"; - return function (name) { - return function (aff) { - return function () { - var f = only ? it.only : it; - f(name, function (done) { - aff(function () { - done(); - }, function (err) { - done(err); - }); - }); - }; - }; - }; -}; - -exports.itPending = function (name) { - "use strict"; - return function () { - it(name); - }; -}; - -exports.describe = function (only) { - "use strict"; - return function (name) { - return function (nested) { - return function () { - var f = only ? describe.only : describe; - f(name, function () { - nested(); - }); - }; - }; - }; -}; diff --git a/src/Test/Spec/Mocha.purs b/src/Test/Spec/Mocha.purs deleted file mode 100644 index 28f97f3..0000000 --- a/src/Test/Spec/Mocha.purs +++ /dev/null @@ -1,41 +0,0 @@ -module Test.Spec.Mocha ( - runMocha, - MOCHA() - ) where - -import Prelude - -import Control.Monad.Aff (Aff()) -import Control.Monad.Eff (kind Effect, Eff()) - -import Data.Foldable (traverse_) - -import Test.Spec (Spec, Group(..), collect) - -foreign import data MOCHA :: Effect - -foreign import itAsync :: forall e. - Boolean - -> String - -> Aff e Unit - -> Eff (mocha :: MOCHA | e) Unit - -foreign import itPending :: forall e. String - -> Eff (mocha :: MOCHA | e) Unit - -foreign import describe :: forall e. - Boolean - -> String - -> Eff (mocha :: MOCHA | e) Unit - -> Eff (mocha :: MOCHA | e) Unit - -registerGroup :: forall e. (Group (Aff e Unit)) - -> Eff (mocha :: MOCHA | e) Unit -registerGroup (It only name test) = itAsync only name test -registerGroup (Pending name) = itPending name -registerGroup (Describe only name groups) = - describe only name (traverse_ registerGroup groups) - -runMocha :: forall e. Spec e Unit - -> Eff (mocha :: MOCHA | e) Unit -runMocha spec = traverse_ registerGroup (collect spec)