All files / enzyme withDom.js

100% Statements 11/11
75% Branches 3/4
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 231x 1x 1x   1x   1x 1x 1x 183x 176x 176x       1x              
Eif (!global.document) {
  try {
    const jsdom = require('jsdom').jsdom; // could throw
 
    const 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',
    };
  } catch (e) {
    // jsdom is not supported...
  }
}