UNPKG

1.08 kBPlain TextView Raw
1// This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
3import 'zone.js/dist/long-stack-trace-zone';
4import 'zone.js/dist/proxy.js';
5import 'zone.js/dist/sync-test';
6import 'zone.js/dist/jasmine-patch';
7import 'zone.js/dist/async-test';
8import 'zone.js/dist/fake-async-test';
9import { getTestBed } from '@angular/core/testing';
10import {
11 BrowserDynamicTestingModule,
12 platformBrowserDynamicTesting
13} from '@angular/platform-browser-dynamic/testing';
14
15// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16declare var __karma__: any;
17declare var require: any;
18
19// Prevent Karma from running prematurely.
20__karma__.loaded = function () {};
21
22// First, initialize the Angular testing environment.
23getTestBed().initTestEnvironment(
24 BrowserDynamicTestingModule,
25 platformBrowserDynamicTesting()
26);
27// Then we find all the tests.
28const context = require.context('./', true, /\.spec\.ts$/);
29// And load the modules.
30context.keys().map(context);
31// Finally, start Karma to run the tests.
32__karma__.start();