1
- import { expectFileToMatch } from '../../utils/fs' ;
1
+ import { expectFileToMatch , replaceInFile } from '../../utils/fs' ;
2
2
import { ng } from '../../utils/process' ;
3
3
4
4
@@ -12,8 +12,34 @@ export default async function() {
12
12
await ng ( 'build' , 'test-project' , '--no-progress' ) ;
13
13
await ng ( 'build' , '--no-progress' , 'test-project' ) ;
14
14
15
+ // Enable Differential loading to run both size checks
16
+ await replaceInFile (
17
+ '.browserslistrc' ,
18
+ 'not IE 11' ,
19
+ 'IE 11' ,
20
+ ) ;
15
21
// 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
+ }
19
45
}
0 commit comments