2 * Copyright (c) 2017 ZTE Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and the Apache License 2.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * ZTE - initial API and implementation and/or initial documentation
13 // This file is required by karma.conf.js and loads recursively all the .spec and framework files
15 import 'zone.js/dist/long-stack-trace-zone';
16 import 'zone.js/dist/proxy.js';
17 import 'zone.js/dist/sync-test';
18 import 'zone.js/dist/jasmine-patch';
19 import 'zone.js/dist/async-test';
20 import 'zone.js/dist/fake-async-test';
21 import { getTestBed } from '@angular/core/testing';
23 BrowserDynamicTestingModule,
24 platformBrowserDynamicTesting
25 } from '@angular/platform-browser-dynamic/testing';
27 // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
28 declare const __karma__: any;
29 declare const require: any;
31 // Prevent Karma from running prematurely.
32 __karma__.loaded = function () {};
34 // First, initialize the Angular testing environment.
35 getTestBed().initTestEnvironment(
36 BrowserDynamicTestingModule,
37 platformBrowserDynamicTesting()
39 // Then we find all the tests.
40 const context = require.context('./', true, /\.spec\.ts$/);
41 // And load the modules.
42 context.keys().map(context);
43 // Finally, start Karma to run the tests.