File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
packages/schematics/angular/migrations/update-6 Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,7 @@ function extractProjectsConfig(
403
403
index : `${ appRoot } /${ app . index || defaults . index } ` ,
404
404
main : `${ appRoot } /${ app . main || defaults . main } ` ,
405
405
tsConfig : `${ appRoot } /${ app . tsconfig || defaults . tsConfig } ` ,
406
+ ...( app . baseHref ? { baseHref : app . baseHref } : { } ) ,
406
407
...buildDefaults ,
407
408
} ;
408
409
Original file line number Diff line number Diff line change @@ -557,6 +557,22 @@ describe('Migration to v6', () => {
557
557
} ) ;
558
558
} ) ;
559
559
560
+ it ( 'should not set baseHref on build & serve targets if not defined' , ( ) => {
561
+ tree . create ( oldConfigPath , JSON . stringify ( baseConfig , null , 2 ) ) ;
562
+ tree = schematicRunner . runSchematic ( 'migration-01' , defaultOptions , tree ) ;
563
+ const build = getConfig ( tree ) . projects . foo . architect . build ;
564
+ expect ( build . options . baseHref ) . toBeUndefined ( ) ;
565
+ } ) ;
566
+
567
+ it ( 'should set baseHref on build & serve targets if defined' , ( ) => {
568
+ const config = { ...baseConfig } ;
569
+ config . apps [ 0 ] . baseHref = '/base/href/' ;
570
+ tree . create ( oldConfigPath , JSON . stringify ( config , null , 2 ) ) ;
571
+ tree = schematicRunner . runSchematic ( 'migration-01' , defaultOptions , tree ) ;
572
+ const build = getConfig ( tree ) . projects . foo . architect . build ;
573
+ expect ( build . options . baseHref ) . toEqual ( '/base/href/' ) ;
574
+ } ) ;
575
+
560
576
it ( 'should add serviceWorker to production configuration' , ( ) => {
561
577
baseConfig . apps [ 0 ] . serviceWorker = true ;
562
578
tree . create ( oldConfigPath , JSON . stringify ( baseConfig , null , 2 ) ) ;
You can’t perform that action at this time.
0 commit comments