@@ -561,6 +561,41 @@ function functionWithJSDoc(param) {return "test"}`;
561561 "Build dest does contain source map reference" ) ;
562562} ) ;
563563
564+ test . serial ( "Build application.a (Custom Component preload configuration)" , async ( t ) => {
565+ const fixtureTester = new FixtureTester ( t , "application.a" ) ;
566+ const destPath = fixtureTester . destPath ;
567+
568+ // In this test, we're testing the behavior of a custom preload configuration
569+ // which is defined in "ui5-custom-preload-config.yaml".
570+ // This custom preload configuration generates a Component-preload.js similar to a default one.
571+ // However, it will omit a resource ("scriptWithSourceMap.js") from the bundle.
572+
573+ // #1 build (no cache, no changes)
574+ await fixtureTester . buildProject ( {
575+ graphConfig : { rootConfigPath : "ui5-custom-preload-config.yaml" } ,
576+ config : { destPath, cleanDest : true } ,
577+ assertions : {
578+ projects : {
579+ "application.a" : { }
580+ }
581+ }
582+ } ) ;
583+
584+ // Check that generated preload bundle doesn't contain the omitted file:
585+ t . false ( ( await fs . readFile ( `${ destPath } /Component-preload.js` , { encoding : "utf8" } ) )
586+ . includes ( "id1/thirdparty/scriptWithSourceMap.js" ) ) ;
587+
588+
589+ // #2 build (with cache, no changes)
590+ await fixtureTester . buildProject ( {
591+ graphConfig : { rootConfigPath : "ui5-custom-preload-config.yaml" } ,
592+ config : { destPath, cleanDest : true } ,
593+ assertions : {
594+ projects : { }
595+ }
596+ } ) ;
597+ } ) ;
598+
564599test . serial ( "Build library.d project multiple times" , async ( t ) => {
565600 const fixtureTester = new FixtureTester ( t , "library.d" ) ;
566601 const destPath = fixtureTester . destPath ;
@@ -651,6 +686,41 @@ test.serial("Build library.d project multiple times", async (t) => {
651686 } ) ;
652687} ) ;
653688
689+ test . serial ( "Build library.d (Custom Library preload configuration)" , async ( t ) => {
690+ const fixtureTester = new FixtureTester ( t , "library.d" ) ;
691+ const destPath = fixtureTester . destPath ;
692+
693+ // In this test, we're testing the behavior of a custom preload configuration
694+ // which is defined in "ui5-custom-preload-config.yaml".
695+ // This custom preload configuration generates a library-preload.js similar to a default one.
696+ // However, it will omit a resource ("some.js") from the bundle.
697+
698+ // #1 build (no cache, no changes)
699+ await fixtureTester . buildProject ( {
700+ graphConfig : { rootConfigPath : "ui5-custom-preload-config.yaml" } ,
701+ config : { destPath, cleanDest : true } ,
702+ assertions : {
703+ projects : {
704+ "library.d" : { }
705+ }
706+ }
707+ } ) ;
708+
709+ // Check that generated preload bundle doesn't contain the omitted file:
710+ t . false ( ( await fs . readFile ( `${ destPath } /resources/library/d/library-preload.js` , { encoding : "utf8" } ) )
711+ . includes ( "library/d/some.js" ) ) ;
712+
713+
714+ // #2 build (with cache, no changes)
715+ await fixtureTester . buildProject ( {
716+ graphConfig : { rootConfigPath : "ui5-custom-preload-config.yaml" } ,
717+ config : { destPath, cleanDest : true } ,
718+ assertions : {
719+ projects : { }
720+ }
721+ } ) ;
722+ } ) ;
723+
654724test . serial ( "Build theme.library.e project multiple times" , async ( t ) => {
655725 const fixtureTester = new FixtureTester ( t , "theme.library.e" ) ;
656726 const destPath = fixtureTester . destPath ;
@@ -886,6 +956,41 @@ test.serial("Build component.a project multiple times", async (t) => {
886956 } ) ;
887957} ) ;
888958
959+ test . serial ( "Build component.a (Custom Component preload configuration)" , async ( t ) => {
960+ const fixtureTester = new FixtureTester ( t , "component.a" ) ;
961+ const destPath = fixtureTester . destPath ;
962+
963+ // In this test, we're testing the behavior of a custom preload configuration
964+ // which is defined in "ui5-custom-preload-config.yaml".
965+ // This custom preload configuration generates a Component-preload.js similar to a default one.
966+ // However, it will omit a resource ("test.js") from the bundle.
967+
968+ // #1 build (no cache, no changes)
969+ await fixtureTester . buildProject ( {
970+ graphConfig : { rootConfigPath : "ui5-custom-preload-config.yaml" } ,
971+ config : { destPath, cleanDest : true } ,
972+ assertions : {
973+ projects : {
974+ "component.a" : { }
975+ }
976+ }
977+ } ) ;
978+
979+ // Check that generated preload bundle doesn't contain the omitted file:
980+ t . false ( ( await fs . readFile ( `${ destPath } /resources/id1/Component-preload.js` , { encoding : "utf8" } ) )
981+ . includes ( "id1/test.js" ) ) ;
982+
983+
984+ // #2 build (with cache, no changes)
985+ await fixtureTester . buildProject ( {
986+ graphConfig : { rootConfigPath : "ui5-custom-preload-config.yaml" } ,
987+ config : { destPath, cleanDest : true } ,
988+ assertions : {
989+ projects : { }
990+ }
991+ } ) ;
992+ } ) ;
993+
889994test . serial ( "Build module.b project multiple times" , async ( t ) => {
890995 const fixtureTester = new FixtureTester ( t , "module.b" ) ;
891996 const destPath = fixtureTester . destPath ;
0 commit comments