forked from avral/golos-ui
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmocha.setup.js
37 lines (28 loc) · 978 Bytes
/
mocha.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
36
37
require('babel-register')();
const Enzyme = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');
process.env.NODE_PATH = require('path').resolve(__dirname, '.');
require('module').Module._initPaths();
const jsdom = require('jsdom');
const { JSDOM } = jsdom;
const exposedProperties = ['window', 'navigator', 'document'];
global.document = (new JSDOM('')).window.document;
global.$GLS_Config = {currency: 'USD'}
global.window = document.defaultView;
Object.keys(document.defaultView).forEach((property) => {
if (typeof global[property] === 'undefined') {
exposedProperties.push(property);
global[property] = document.defaultView[property];
}
});
global.navigator = {
userAgent: 'node.js'
};
documentRef = document;
function donothing() {
return null;
}
require.extensions['.svg'] = donothing;
require.extensions['.css'] = donothing;
require.extensions['.scss'] = donothing;
Enzyme.configure({ adapter: new Adapter() });