@@ -15,14 +15,12 @@ import {
1515 Compiler ,
1616 CompilerFactory ,
1717 Component ,
18- effect ,
1918 EnvironmentInjector ,
2019 InjectionToken ,
2120 LOCALE_ID ,
2221 NgModule ,
2322 NgZone ,
2423 PlatformRef ,
25- ProviderToken ,
2624 provideZoneChangeDetection ,
2725 RendererFactory2 ,
2826 TemplateRef ,
@@ -48,6 +46,7 @@ import {ApplicationRef} from '../src/application/application_ref';
4846import { NoopNgZone } from '../src/zone/ng_zone' ;
4947import { ComponentFixtureNoNgZone , inject , TestBed , waitForAsync , withModule } from '../testing' ;
5048import { take } from 'rxjs/operators' ;
49+ import { compileNgModuleFactory } from '../src/application/application_ngmodule_factory_compiler' ;
5150
5251let serverPlatformModule : Promise < Type < ServerModule > > | null = null ;
5352if ( isNode ) {
@@ -661,45 +660,38 @@ describe('bootstrap', () => {
661660 initializerDone = true ;
662661 } , 1 ) ;
663662
664- const compilerFactory : CompilerFactory = defaultPlatform . injector . get ( CompilerFactory , null ) ! ;
665- const moduleFactory = compilerFactory
666- . createCompiler ( )
667- . compileModuleSync (
668- await createModule ( [ { provide : APP_INITIALIZER , useValue : ( ) => promise , multi : true } ] ) ,
669- ) ;
663+ const moduleType = await createModule ( [
664+ { provide : APP_INITIALIZER , useValue : ( ) => promise , multi : true } ,
665+ ] ) ;
666+ const moduleFactory = await compileNgModuleFactory ( defaultPlatform . injector , { } , moduleType ) ;
667+
670668 defaultPlatform . bootstrapModuleFactory ( moduleFactory ) . then ( ( _ ) => {
671669 expect ( initializerDone ) . toBe ( true ) ;
672670 } ) ;
673671 } ) ) ;
674672
675673 it ( 'should rethrow sync errors even if the exceptionHandler is not rethrowing' , waitForAsync ( async ( ) => {
676- const compilerFactory : CompilerFactory = defaultPlatform . injector . get ( CompilerFactory , null ) ! ;
677- const moduleFactory = compilerFactory . createCompiler ( ) . compileModuleSync (
678- await createModule ( [
679- {
680- provide : APP_INITIALIZER ,
681- useValue : ( ) => {
682- throw 'Test' ;
683- } ,
684- multi : true ,
674+ const moduleType = await createModule ( [
675+ {
676+ provide : APP_INITIALIZER ,
677+ useValue : ( ) => {
678+ throw 'Test' ;
685679 } ,
686- ] ) ,
687- ) ;
680+ multi : true ,
681+ } ,
682+ ] ) ;
683+ const moduleFactory = await compileNgModuleFactory ( defaultPlatform . injector , { } , moduleType ) ;
688684 expect ( ( ) => defaultPlatform . bootstrapModuleFactory ( moduleFactory ) ) . toThrow ( 'Test' ) ;
689685 // Error rethrown will be seen by the exception handler since it's after
690686 // construction.
691687 expect ( mockConsole . res [ 0 ] . join ( '#' ) ) . toEqual ( 'ERROR#Test' ) ;
692688 } ) ) ;
693689
694690 it ( 'should rethrow promise errors even if the exceptionHandler is not rethrowing' , waitForAsync ( async ( ) => {
695- const compilerFactory : CompilerFactory = defaultPlatform . injector . get ( CompilerFactory , null ) ! ;
696- const moduleFactory = compilerFactory
697- . createCompiler ( )
698- . compileModuleSync (
699- await createModule ( [
700- { provide : APP_INITIALIZER , useValue : ( ) => Promise . reject ( 'Test' ) , multi : true } ,
701- ] ) ,
702- ) ;
691+ const moduleType = await createModule ( [
692+ { provide : APP_INITIALIZER , useValue : ( ) => Promise . reject ( 'Test' ) , multi : true } ,
693+ ] ) ;
694+ const moduleFactory = await compileNgModuleFactory ( defaultPlatform . injector , { } , moduleType ) ;
703695 defaultPlatform . bootstrapModuleFactory ( moduleFactory ) . then (
704696 ( ) => expect ( false ) . toBe ( true ) ,
705697 ( e ) => {
0 commit comments