1- import { expectFileToMatch } from '../../utils/fs' ;
1+ import { expectFileToMatch , replaceInFile } from '../../utils/fs' ;
22import { ng } from '../../utils/process' ;
33
44
@@ -12,8 +12,34 @@ export default async function() {
1212 await ng ( 'build' , 'test-project' , '--no-progress' ) ;
1313 await ng ( 'build' , '--no-progress' , 'test-project' ) ;
1414
15+ // Enable Differential loading to run both size checks
16+ await replaceInFile (
17+ '.browserslistrc' ,
18+ 'not IE 11' ,
19+ 'IE 11' ,
20+ ) ;
1521 // Production build
16- await ng ( 'build' , '--prod' ) ;
17- await expectFileToMatch ( 'dist/test-project/index.html' , / m a i n \. [ a - z A - Z 0 - 9 ] { 20 } \. j s / ) ;
18- await ng ( 'build' , '--prod' , '--no-progress' , 'test-project' ) ;
22+ const { stderr : stderrProgress } = await ng ( 'build' , '--prod' , '--progress' ) ;
23+ await expectFileToMatch ( 'dist/test-project/index.html' , / m a i n - e s 5 \. [ a - z A - Z 0 - 9 ] { 20 } \. j s / ) ;
24+ await expectFileToMatch ( 'dist/test-project/index.html' , / m a i n - e s 2 0 1 5 \. [ a - z A - Z 0 - 9 ] { 20 } \. j s / ) ;
25+
26+ const logs : string [ ] = [
27+ 'Browser application bundle generation complete' ,
28+ 'ES5 bundle generation complete' ,
29+ 'Copying assets complete' ,
30+ 'Index html generation complete' ,
31+ ] ;
32+
33+ for ( const log of logs ) {
34+ if ( ! stderrProgress . includes ( log ) ) {
35+ throw new Error ( `Expected stderr to contain '${ log } ' but didn't.\n${ stderrProgress } ` ) ;
36+ }
37+ }
38+
39+ const { stderr : stderrNoProgress } = await ng ( 'build' , '--prod' , '--no-progress' ) ;
40+ for ( const log of logs ) {
41+ if ( stderrNoProgress . includes ( log ) ) {
42+ throw new Error ( `Expected stderr not to contain '${ log } ' but it did.\n${ stderrProgress } ` ) ;
43+ }
44+ }
1945}
0 commit comments