1 | const {JSDOM} = require('jsdom');
|
2 |
|
3 | const jsdom = new JSDOM('<!doctype html><html><body></body></html>', JSON.parse(process.env.JSDOM_CONFIG));
|
4 | global.XMLHttpRequest = jsdom.window.XMLHttpRequest;
|
5 |
|
6 | require('core-js/es7/reflect');
|
7 | require('zone.js/dist/zone');
|
8 | require('zone.js/dist/long-stack-trace-zone');
|
9 |
|
10 | const testing = require('@angular/core/testing');
|
11 | const browser = require('@angular/platform-browser-dynamic/testing');
|
12 |
|
13 | testing.TestBed.initTestEnvironment(
|
14 | browser.BrowserDynamicTestingModule,
|
15 | browser.platformBrowserDynamicTesting()
|
16 | );
|
17 |
|
18 | global.window = jsdom.window;
|
19 | global.document = jsdom.window.document;
|
20 | global.location = jsdom.window.location;
|
21 | global.navigator = jsdom.window.navigator;
|
22 | global.localStorage = {
|
23 | getItem: function (key) {
|
24 | return this[key];
|
25 | },
|
26 | setItem: function (key, value) {
|
27 | this[key] = value;
|
28 | }
|
29 | };
|
30 |
|
31 | global.Event = jsdom.window.Event;
|
32 | global.FocusEvent = jsdom.window.FocusEvent;
|
33 | global.KeyboardEvent = jsdom.window.KeyboardEvent;
|
34 |
|
35 | global.File = jsdom.window.File;
|
36 | global.FileReader = jsdom.window.FileReader;
|
37 |
|
38 | global.WebSocket = jsdom.window.WebSocket;
|
39 |
|
40 | global.Node = jsdom.window.Node;
|
41 | global.Element = jsdom.window.Element;
|
42 | global.HTMLElement = jsdom.window.HTMLElement;
|
43 |
|
44 | global.confirm = () => true;
|
45 |
|
46 | global.window = jsdom.window;
|
47 | global.window.ResizeObserver = function () {
|
48 | };
|
49 | global.window.ResizeObserver.prototype.observe = function () {
|
50 | };
|
51 | global.window.ResizeObserver.prototype.disconnect = function () {
|
52 | };
|
53 |
|
54 | global.CSS = null; |
\ | No newline at end of file |