UNPKG

1.19 kBJavaScriptView Raw
1const {JSDOM} = require("jsdom");
2
3const jsdom = new JSDOM("<!DOCTYPE html><html><head></head><body></body></html>", JSON.parse(process.env.JSDOM_CONFIG));
4
5global.XMLHttpRequest = jsdom.window.XMLHttpRequest;
6global.window = jsdom.window;
7global.document = jsdom.window.document;
8global.location = jsdom.window.location;
9global.navigator = jsdom.window.navigator;
10global.localStorage = {
11 getItem: function (key) {
12 return this[key];
13 },
14 setItem: function (key, value) {
15 this[key] = value;
16 }
17};
18
19global.Event = jsdom.window.Event;
20global.FocusEvent = jsdom.window.FocusEvent;
21global.KeyboardEvent = jsdom.window.KeyboardEvent;
22
23global.File = jsdom.window.File;
24global.FileReader = jsdom.window.FileReader;
25
26global.WebSocket = jsdom.window.WebSocket;
27
28global.Node = jsdom.window.Node;
29global.Element = jsdom.window.Element;
30global.HTMLElement = jsdom.window.HTMLElement;
31
32global.confirm = () => true;
33
34global.window = jsdom.window;
35global.window.ResizeObserver = function () {
36};
37global.window.ResizeObserver.prototype.observe = function () {
38};
39global.window.ResizeObserver.prototype.disconnect = function () {
40};
41
42global.CSS = null;
\No newline at end of file