1 | const jsdom = require('jsdom').jsdom;
|
2 | const exposedProperties = ['window', 'navigator', 'document'];
|
3 |
|
4 | global.document = jsdom('');
|
5 | global.window = document.defaultView;
|
6 | Object.keys(document.defaultView).forEach((property) => {
|
7 | if (typeof global[property] === 'undefined') {
|
8 | exposedProperties.push(property);
|
9 | global[property] = document.defaultView[property];
|
10 | }
|
11 | });
|
12 |
|
13 | global.navigator = {
|
14 | userAgent: 'node.js'
|
15 | };
|
16 |
|
17 | const documentRef = document;
|