This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +20
-18
lines changed Expand file tree Collapse file tree 4 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ require('reflect-metadata');
6
6
7
7
require ( 'zone.js/dist/zone' ) ;
8
8
require ( 'zone.js/dist/long-stack-trace-zone' ) ;
9
- require ( 'zone.js/dist/jasmine-patch' ) ;
10
9
require ( 'zone.js/dist/async-test' ) ;
11
10
require ( 'zone.js/dist/fake-async-test' ) ;
11
+ require ( 'zone.js/dist/sync-test' ) ;
12
+ require ( 'zone.js/dist/proxy-zone' ) ;
13
+ require ( 'zone.js/dist/jasmine-patch' ) ;
12
14
13
15
var appContext = require . context ( '../src' , true , / \. s p e c \. t s / ) ;
14
16
@@ -17,7 +19,4 @@ appContext.keys().forEach(appContext);
17
19
var testing = require ( '@angular/core/testing' ) ;
18
20
var browser = require ( '@angular/platform-browser-dynamic/testing' ) ;
19
21
20
- testing . setBaseTestProviders (
21
- browser . TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS ,
22
- browser . TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
23
- ) ;
22
+ testing . TestBed . initTestEnvironment ( browser . BrowserDynamicTestingModule , browser . platformBrowserDynamicTesting ( ) ) ;
Original file line number Diff line number Diff line change 1
1
// #docregion
2
+ var helpers = require ( './helpers' ) ;
3
+
2
4
module . exports = {
3
5
devtool : 'inline-source-map' ,
4
6
@@ -23,7 +25,13 @@ module.exports = {
23
25
} ,
24
26
{
25
27
test : / \. c s s $ / ,
28
+ exclude : helpers . root ( 'src' , 'app' ) ,
26
29
loader : 'null'
30
+ } ,
31
+ {
32
+ test : / \. c s s $ / ,
33
+ include : helpers . root ( 'src' , 'app' ) ,
34
+ loader : 'raw'
27
35
}
28
36
]
29
37
}
Original file line number Diff line number Diff line change 1
1
// #docregion
2
- import {
3
- addProviders ,
4
- inject ,
5
- } from '@angular/core/testing' ;
2
+ import { TestBed } from '@angular/core/testing' ;
6
3
7
4
import { AppComponent } from './app.component' ;
8
5
9
6
describe ( 'App' , ( ) => {
10
7
beforeEach ( ( ) => {
11
- addProviders ( [
12
- AppComponent
13
- ] ) ;
8
+ TestBed . configureTestingModule ( { declarations : [ AppComponent ] } ) ;
14
9
} ) ;
15
10
16
- it ( 'should work' , inject ( [ AppComponent ] , ( app : AppComponent ) => {
17
- // Add real test here
18
- expect ( 2 ) . toBe ( 2 ) ;
19
- } ) ) ;
11
+ it ( 'should work' , ( ) => {
12
+ let fixture = TestBed . createComponent ( AppComponent ) ;
13
+ expect ( fixture . componentInstance instanceof AppComponent ) . toBe ( true , 'should create AppComponent' ) ;
14
+ } ) ;
20
15
} ) ;
21
16
// #enddocregion
Original file line number Diff line number Diff line change @@ -360,8 +360,8 @@ a(id="test-configuration")
360
360
361
361
We don't need much configuration to run unit tests.
362
362
We don't need the loaders and plugins that we declared for our development and production builds.
363
- We probably don't need to load and process `css` files for unit tests and doing so would slow us down;
364
- we'll use the `null` loader for all CSS.
363
+ We probably don't need to load and process the application-wide styles files for unit tests and doing so would slow us down;
364
+ we'll use the `null` loader for those CSS.
365
365
366
366
We could merge our test configuration into the `webpack.common` configuration and override the parts we don't want or need.
367
367
But it might be simpler to start over with a completely fresh configuration.
You can’t perform that action at this time.
0 commit comments