1 |
|
2 | Error.stackTraceLimit = Infinity;
|
3 | jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
4 |
|
5 | __karma__.loaded = function () { };
|
6 | window.expect = chai.expect;
|
7 |
|
8 | var basePath = '/base/';
|
9 |
|
10 | function isJsFile(path) {
|
11 | return endsWith(path, '.js');
|
12 | }
|
13 |
|
14 | function isSpecFile(path) {
|
15 | return endsWith(path, '.tests.js');
|
16 | }
|
17 |
|
18 | function endsWith(path, ending) {
|
19 | return path.slice(-ending.length) == ending;
|
20 | }
|
21 |
|
22 | var allSpecFiles = Object.keys(window.__karma__.files)
|
23 | .filter(isSpecFile);
|
24 |
|
25 |
|
26 | System.config({
|
27 | baseURL: basePath
|
28 | });
|
29 |
|
30 | System.import('system.config.js').then(function () {
|
31 |
|
32 | return Promise.all([
|
33 | System.import('@angular/core/testing'),
|
34 | System.import('@angular/platform-browser-dynamic/testing')
|
35 | ]).then(function (providers) {
|
36 | var testing = providers[0];
|
37 | var testingBrowser = providers[1];
|
38 |
|
39 | testing.TestBed.initTestEnvironment(testingBrowser.BrowserDynamicTestingModule
|
40 | , testingBrowser.platformBrowserDynamicTesting());
|
41 | });
|
42 | }).then(function () {
|
43 |
|
44 |
|
45 | return Promise.all(
|
46 | allSpecFiles.map(function (moduleName) {
|
47 | return System.import(moduleName);
|
48 | }));
|
49 | }).then(__karma__.start, __karma__.error);
|