UNPKG

react-ace

Version:
23 lines (18 loc) 599 B
const { JSDOM } = require('jsdom'); const jsdom = new JSDOM('<!doctype html><html><body></body></html>'); const { window } = jsdom; function copyProps(src, target) { const props = Object.getOwnPropertyNames(src) .filter(prop => typeof target[prop] === 'undefined') .map(prop => Object.getOwnPropertyDescriptor(src, prop)); Object.defineProperties(target, props); } global.window = window; global.document = window.document; global.HTMLElement = window.HTMLElement; copyProps(window, global); global.navigator = { appName: 'other', userAgent: 'node.js', platform: 'node.js', };