Mercurial > hg > ugly-duckling
comparison src/test.ts @ 25:aa2075b2a702
angular-cli updates.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Tue, 29 Nov 2016 10:35:36 +0000 |
parents | 340ce94899fd |
children | 53ea6406d601 |
comparison
equal
deleted
inserted
replaced
24:25e46f24a0e8 | 25:aa2075b2a702 |
---|---|
4 import 'zone.js/dist/proxy.js'; | 4 import 'zone.js/dist/proxy.js'; |
5 import 'zone.js/dist/sync-test'; | 5 import 'zone.js/dist/sync-test'; |
6 import 'zone.js/dist/jasmine-patch'; | 6 import 'zone.js/dist/jasmine-patch'; |
7 import 'zone.js/dist/async-test'; | 7 import 'zone.js/dist/async-test'; |
8 import 'zone.js/dist/fake-async-test'; | 8 import 'zone.js/dist/fake-async-test'; |
9 import { getTestBed } from '@angular/core/testing'; | |
10 import { | |
11 BrowserDynamicTestingModule, | |
12 platformBrowserDynamicTesting | |
13 } from '@angular/platform-browser-dynamic/testing'; | |
9 | 14 |
10 // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. | 15 // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. |
11 declare var __karma__: any; | 16 declare var __karma__: any; |
12 declare var require: any; | 17 declare var require: any; |
13 | 18 |
14 // Prevent Karma from running prematurely. | 19 // Prevent Karma from running prematurely. |
15 __karma__.loaded = function () {}; | 20 __karma__.loaded = function () {}; |
16 | 21 |
17 | 22 // First, initialize the Angular testing environment. |
18 Promise.all([ | 23 getTestBed().initTestEnvironment( |
19 System.import('@angular/core/testing'), | 24 BrowserDynamicTestingModule, |
20 System.import('@angular/platform-browser-dynamic/testing') | 25 platformBrowserDynamicTesting() |
21 ]) | 26 ); |
22 // First, initialize the Angular testing environment. | 27 // Then we find all the tests. |
23 .then(([testing, testingBrowser]) => { | 28 let context = require.context('./', true, /\.spec\.ts/); |
24 testing.getTestBed().initTestEnvironment( | 29 // And load the modules. |
25 testingBrowser.BrowserDynamicTestingModule, | 30 context.keys().map(context); |
26 testingBrowser.platformBrowserDynamicTesting() | 31 // Finally, start Karma to run the tests. |
27 ); | 32 __karma__.start(); |
28 }) | |
29 // Then we find all the tests. | |
30 .then(() => require.context('./', true, /\.spec\.ts/)) | |
31 // And load the modules. | |
32 .then(context => context.keys().map(context)) | |
33 // Finally, start Karma to run the tests. | |
34 .then(__karma__.start, __karma__.error); |