All files mocha-setup.js

100% Statements 11/11
100% Branches 2/2
100% Functions 1/1
100% Lines 11/11
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              1x   1x   1x   1x 1x 1x 81x 63x 63x       1x       1x
/**
 * Setup jsdom headless browser for running unit-tests.
 * See https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md
 *
 * This file is included using mocha's --require command line option. See mocha-webpack.opts
 */
 
require('babel-register')();
 
var jsdom = require('jsdom').jsdom;
 
var exposedProperties = ['window', 'navigator', 'document'];
 
global.document = jsdom('');
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;