forked from jquense/yup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-setup.js
35 lines (25 loc) · 801 Bytes
/
test-setup.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
// require('babel-polyfill')
global.chai = require('chai')
global.sinon = require('sinon')
global.chai.use(require('sinon-chai'))
global.chai.use(require('chai-as-promised'))
global.chai.use(require('dirty-chai'))
global.expect = global.chai.expect;
global.chai.should();
// WTF???
Object.defineProperty(
Promise.prototype,
'should',
Object.getOwnPropertyDescriptor(Object.prototype, 'should')
);
global.TestHelpers = require('./test/helpers');
global.specify = global.it
if (global.YUP_USE_SYNC) {
const mixed = require('./src/mixed'); // eslint-disable-line global-require
const { validate } = mixed.prototype;
mixed.prototype.validate = function (value, options = {}) {
options.sync = true;
return validate.call(this, value, options);
}
}
global.specify = global.it