@@ -66,6 +66,40 @@ describe('Browser Builder unused files warnings', () => {
6666 await run . stop ( ) ;
6767 } ) ;
6868
69+ it ( 'should not show warning when excluded files are unused' , async ( ) => {
70+ if ( veEnabled ) {
71+ // TODO: https://github.com/angular/angular-cli/issues/15056
72+ pending ( 'Only supported in Ivy.' ) ;
73+
74+ return ;
75+ }
76+
77+ const ignoredFiles = {
78+ 'src/file.d.ts' : 'export type MyType = number;' ,
79+ 'src/file.ngsummary.ts' : 'export const hello = 42;' ,
80+ 'src/file.ngfactory.ts' : 'export const hello = 42;' ,
81+ 'src/file.ngstyle.ts' : 'export const hello = 42;' ,
82+ 'src/file.ng_typecheck__.ts' : 'export const hello = 42;' ,
83+ } ;
84+
85+ host . writeMultipleFiles ( ignoredFiles ) ;
86+
87+ host . replaceInFile (
88+ 'src/tsconfig.app.json' ,
89+ '"main.ts"' ,
90+ `"main.ts", ${ Object . keys ( ignoredFiles ) . map ( f => `"${ f . replace ( 'src/' , '' ) } "` ) . join ( ',' ) } ` ,
91+ ) ;
92+
93+ const logger = new TestLogger ( 'unused-files-warnings' ) ;
94+ const run = await architect . scheduleTarget ( targetSpec , undefined , { logger } ) ;
95+ const output = await run . result as BrowserBuilderOutput ;
96+ expect ( output . success ) . toBe ( true ) ;
97+ expect ( logger . includes ( warningMessageSuffix ) ) . toBe ( false ) ;
98+ logger . clear ( ) ;
99+
100+ await run . stop ( ) ;
101+ } ) ;
102+
69103 it ( 'should not show warning when type files are used' , async ( ) => {
70104 if ( veEnabled ) {
71105 // TODO: https://github.com/angular/angular-cli/issues/15056
0 commit comments