@@ -60,4 +60,60 @@ describe("migrateBootstrapApplication", () => {
6060 ` ) ,
6161 ) ;
6262 } ) ;
63+
64+ it ( "order of providers should not impact migration" , async ( ) => {
65+ const project = new Project ( { useInMemoryFileSystem : true } ) ;
66+
67+ const main = dedent ( `
68+ import { enableProdMode, importProvidersFrom } from '@angular/core';
69+ import { bootstrapApplication } from '@angular/platform-browser';
70+ import { RouteReuseStrategy, provideRouter } from '@angular/router';
71+ import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
72+
73+ import { routes } from './app/app.routes';
74+ import { AppComponent } from './app/app.component';
75+ import { environment } from './environments/environment';
76+
77+ if (environment.production) {
78+ enableProdMode();
79+ }
80+
81+ bootstrapApplication(AppComponent, {
82+ providers: [
83+ { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
84+ provideRouter(routes),
85+ importProvidersFrom(IonicModule.forRoot({ mode: 'ios' })),
86+ ],
87+ });
88+ ` ) ;
89+
90+ const mainSourceFile = project . createSourceFile ( "src/main.ts" , main ) ;
91+
92+ await migrateBootstrapApplication ( project , { dryRun : false } ) ;
93+
94+ expect ( dedent ( mainSourceFile . getText ( ) ) ) . toBe (
95+ dedent ( `
96+ import { enableProdMode, importProvidersFrom } from '@angular/core';
97+ import { bootstrapApplication } from '@angular/platform-browser';
98+ import { RouteReuseStrategy, provideRouter } from '@angular/router';
99+ import { IonicRouteStrategy, provideIonicAngular } from '@ionic/angular/standalone';
100+
101+ import { routes } from './app/app.routes';
102+ import { AppComponent } from './app/app.component';
103+ import { environment } from './environments/environment';
104+
105+ if (environment.production) {
106+ enableProdMode();
107+ }
108+
109+ bootstrapApplication(AppComponent, {
110+ providers: [
111+ { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
112+ provideRouter(routes),
113+ provideIonicAngular({ mode: 'ios' })
114+ ],
115+ });
116+ ` ) ,
117+ ) ;
118+ } ) ;
63119} ) ;
0 commit comments