@@ -48,7 +48,7 @@ describe('Browser Builder scripts array', () => {
4848 afterEach ( async ( ) => host . restore ( ) . toPromise ( ) ) ;
4949
5050 it ( 'works' , async ( ) => {
51- const matches : { [ path : string ] : string } = {
51+ const matches : Record < string , string > = {
5252 'scripts.js' : 'input-script' ,
5353 'lazy-script.js' : 'lazy-script' ,
5454 'renamed-script.js' : 'pre-rename-script' ,
@@ -71,8 +71,41 @@ describe('Browser Builder scripts array', () => {
7171 scripts : getScriptsOption ( ) ,
7272 } as { } ) ;
7373
74- for ( const fileName of Object . keys ( matches ) ) {
75- expect ( await files [ fileName ] ) . toMatch ( matches [ fileName ] ) ;
74+ for ( const [ fileName , content ] of Object . entries ( matches ) ) {
75+ expect ( await files [ fileName ] ) . toMatch ( content ) ;
76+ }
77+ } ) ;
78+
79+ it ( 'works in watch mode with differential loading' , async ( ) => {
80+ const matches : Record < string , string > = {
81+ 'scripts.js' : 'input-script' ,
82+ 'lazy-script.js' : 'lazy-script' ,
83+ 'renamed-script.js' : 'pre-rename-script' ,
84+ 'renamed-lazy-script.js' : 'pre-rename-lazy-script' ,
85+ 'main.js' : 'input-script' ,
86+ 'index.html' : '<script src="runtime.js" type="module"></script>'
87+ + '<script src="polyfills.js" type="module"></script>'
88+ + '<script src="scripts.js" defer></script>'
89+ + '<script src="renamed-script.js" defer></script>'
90+ + '<script src="vendor.js" type="module"></script>'
91+ + '<script src="main.js" type="module"></script>' ,
92+ } ;
93+
94+ host . writeMultipleFiles ( scripts ) ;
95+ host . appendToFile ( 'src/main.ts' , '\nimport \'./input-script.js\';' ) ;
96+
97+ // Enable differential loading
98+ host . appendToFile ( 'browserslist' , '\nIE 10' ) ;
99+
100+ // Remove styles so we don't have to account for them in the index.html order check.
101+ const { files } = await browserBuild ( architect , host , target , {
102+ styles : [ ] ,
103+ scripts : getScriptsOption ( ) ,
104+ watch : true ,
105+ } as { } ) ;
106+
107+ for ( const [ fileName , content ] of Object . entries ( matches ) ) {
108+ expect ( await files [ fileName ] ) . toMatch ( content ) ;
76109 }
77110 } ) ;
78111
0 commit comments