2012-10-14 13:04:24 +00:00
|
|
|
if (!process.env.TRAVIS) {
|
|
|
|
var semicov = require('semicov');
|
2013-03-24 21:29:07 +00:00
|
|
|
semicov.init('lib', 'JugglingDB');
|
2012-10-14 13:04:24 +00:00
|
|
|
process.on('exit', semicov.report);
|
|
|
|
}
|
2012-04-18 23:20:44 +00:00
|
|
|
|
2011-10-03 17:18:44 +00:00
|
|
|
try {
|
|
|
|
global.sinon = require('sinon');
|
|
|
|
} catch (e) {
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
var group_name = false, EXT_EXP;
|
2013-02-19 08:32:44 +00:00
|
|
|
function it(should, test_case) {
|
2011-10-03 17:18:44 +00:00
|
|
|
check_external_exports();
|
|
|
|
if (group_name) {
|
|
|
|
EXT_EXP[group_name][should] = test_case;
|
|
|
|
} else {
|
|
|
|
EXT_EXP[should] = test_case;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
global.it = it;
|
|
|
|
|
|
|
|
function context(name, tests) {
|
|
|
|
check_external_exports();
|
|
|
|
EXT_EXP[name] = {};
|
|
|
|
group_name = name;
|
|
|
|
tests({
|
|
|
|
before: function (f) {
|
|
|
|
it('setUp', f);
|
|
|
|
},
|
|
|
|
after: function (f) {
|
|
|
|
it('tearDown', f);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
group_name = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
global.context = context;
|
|
|
|
|
2013-02-19 08:32:44 +00:00
|
|
|
exports.init = function init(external_exports) {
|
2011-10-03 17:18:44 +00:00
|
|
|
EXT_EXP = external_exports;
|
|
|
|
if (external_exports.done) {
|
|
|
|
external_exports.done();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function check_external_exports() {
|
|
|
|
if (!EXT_EXP) throw new Error(
|
|
|
|
'Before run this, please ensure that ' +
|
|
|
|
'require("spec_helper").init(exports); called');
|
|
|
|
}
|
|
|
|
|