This repository was archived by the owner on Mar 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ require('core-js/es6');
55require ( 'reflect-metadata' ) ;
66
77require ( 'zone.js/dist/zone' ) ;
8- require ( 'zone.js/dist/long-stack-trace-zone' ) ;
9- require ( 'zone.js/dist/jasmine-patch' ) ;
108require ( 'zone.js/dist/async-test' ) ;
119require ( 'zone.js/dist/fake-async-test' ) ;
10+ require ( 'zone.js/dist/sync-test' ) ;
11+ require ( 'zone.js/dist/proxy-zone' ) ;
1212
1313var appContext = require . context ( '../src' , true , / \. s p e c \. t s / ) ;
1414
@@ -17,7 +17,4 @@ appContext.keys().forEach(appContext);
1717var testing = require ( '@angular/core/testing' ) ;
1818var browser = require ( '@angular/platform-browser-dynamic/testing' ) ;
1919
20- testing . setBaseTestProviders (
21- browser . TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS ,
22- browser . TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
23- ) ;
20+ testing . TestBed . initTestEnvironment ( browser . BrowserDynamicTestingModule , browser . platformBrowserDynamicTesting ( ) ) ;
Original file line number Diff line number Diff line change 11// #docregion
2+ var helpers = require ( './helpers' ) ;
3+
24module . exports = {
35 devtool : 'inline-source-map' ,
46
@@ -23,7 +25,13 @@ module.exports = {
2325 } ,
2426 {
2527 test : / \. c s s $ / ,
28+ exclude : helpers . root ( 'src' , 'app' ) ,
2629 loader : 'null'
30+ } ,
31+ {
32+ test : / \. c s s $ / ,
33+ include : helpers . root ( 'src' , 'app' ) ,
34+ loader : 'raw'
2735 }
2836 ]
2937 }
Original file line number Diff line number Diff line change 11// #docregion
2- import {
3- addProviders ,
4- inject ,
5- } from '@angular/core/testing' ;
2+ import { TestBed } from '@angular/core/testing' ;
63
74import { AppComponent } from './app.component' ;
85
96describe ( 'App' , ( ) => {
107 beforeEach ( ( ) => {
11- addProviders ( [
12- AppComponent
13- ] ) ;
8+ TestBed . configureTestingModule ( { declarations : [ AppComponent ] } ) ;
149 } ) ;
1510
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+ } ) ;
2015} ) ;
2116// #enddocregion
Original file line number Diff line number Diff line change @@ -360,8 +360,8 @@ a(id="test-configuration")
360360
361361 We don't need much configuration to run unit tests.
362362 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.
365365
366366 We could merge our test configuration into the `webpack.common` configuration and override the parts we don't want or need.
367367 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