UNPKG

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