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