1 | require('babel-core/register');
|
2 | require('babel-polyfill');
|
3 |
|
4 |
|
5 | var jsdom = require('jsdom').jsdom;
|
6 |
|
7 | var exposedProperties = ['window', 'navigator', 'document'];
|
8 |
|
9 | global.document = jsdom('');
|
10 | global.window = document.defaultView;
|
11 | Object.keys(document.defaultView).forEach((property) => {
|
12 | if (typeof global[property] === 'undefined') {
|
13 | exposedProperties.push(property);
|
14 | global[property] = document.defaultView[property];
|
15 | }
|
16 | });
|
17 |
|
18 | global.navigator = {
|
19 | userAgent: 'node.js'
|
20 | };
|
21 |
|
22 | process.on('unhandledRejection', function (error) {
|
23 | console.error('Unhandled Promise Rejection:');
|
24 | console.error(error && error.stack || error);
|
25 | });
|