-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmocha.start.js
51 lines (44 loc) · 1.44 KB
/
mocha.start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*global assert:true */
'use strict';
var assert = require('chai').assert;
var mocha = require('mocha');
var sinon = require('sinon');
var Schemator = require('./');
var globals = module.exports = {
fail: function (msg) {
assert.equal('should not reach this!: ' + msg, 'failure');
},
TYPES_EXCEPT_STRING: [123, 123.123, null, undefined, {}, [], true, false, function () {
}],
TYPES_EXCEPT_STRING_OR_ARRAY: [123, 123.123, null, undefined, {}, true, false, function () {
}],
TYPES_EXCEPT_STRING_OR_NUMBER: [null, undefined, {}, [], true, false, function () {
}],
TYPES_EXCEPT_STRING_OR_ARRAY_OR_NUMBER: [null, undefined, {}, true, false, function () {
}],
TYPES_EXCEPT_NUMBER: ['string', null, undefined, {}, [], true, false, function () {
}],
TYPES_EXCEPT_OBJECT: ['string', 123, 123.123, null, undefined, true, false, function () {
}],
TYPES_EXCEPT_BOOLEAN: ['string', 123, 123.123, null, undefined, {}, [], function () {
}],
TYPES_EXCEPT_FUNCTION: ['string', 123, 123.123, null, undefined, {}, [], true, false],
assert: assert,
sinon: sinon,
schemator: undefined
};
var test = new mocha();
var testGlobals = [];
for (var key in globals) {
global[key] = globals[key];
testGlobals.push(globals[key]);
}
test.globals(testGlobals);
beforeEach(function () {
globals.schemator = new Schemator();
global.schemator = globals.schemator;
});
afterEach(function () {
globals.schemator = null;
global.schemator = null;
});