global.window = { navigator: { userAgent: "node" }, removeEventListener() {} }; var fakeCanvas = { id: "fakecanvas", getBoundingClientRect: function() { return { bottom: 969, height: 969, left: 0, right: 980, top: 0, width: 980, x: 0, y: 0 } }, getContext() { return { getSupportedExtensions: function() { return ["OES_vertex_array_object"]; }, getContextAttributes: function() { return { "alpha": true, "antialias": true, "depth": true, "failIfMajorPerformanceCaveat": false, "powerPreference": "default", "premultipliedAlpha": true, "preserveDrawingBuffer": false, "stencil": true, "desynchronized": false, "xrCompatible": true } }, getParameter: function() { return 0; }, disable: function() {}, enable: function() {}, blendFunc: function() {}, blendEquation: function() {}, colorMask: function() {}, cullFace: function() {}, depthFunc: function() {}, depthMask: function() {}, stencilFunc: function() {}, stencilOp: function() {}, stencilMask: function() {}, clearDepth: function() {}, clearColor: function() {}, clearStencil: function() {}, hint: function() {}, pixelStorei: function() {}, } }, addEventListener() { }, removeEventListener() {}, } global.navigator = { } global.document = { getElementById: function() { return fakeCanvas; }, createElement: function() { console.log("createElement", arguments); return fakeCanvas; }, addEventListener: function() { }, removeEventListener: function() {} } function Element() { console.log("Element()"); } Element.prototype.getPointerLock = function() { console.log("requestPointerLock()") } global.Element = Element;