remove Test.Spec.Mocha from src and add it as an external dependency

This commit is contained in:
KtorZ 2017-07-06 15:37:34 +02:00
parent 9ab34a7d7b
commit 564ff75c8e
No known key found for this signature in database
GPG Key ID: 3F72E8BC2894C015
3 changed files with 7 additions and 93 deletions

View File

@ -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"
}
}

View File

@ -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();
});
};
};
};
};

View File

@ -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)