@@ -3,7 +3,8 @@ import {oneLine} from 'common-tags';
3
3
4
4
import { ng , npm } from '../../utils/process' ;
5
5
import { addImportToModule } from '../../utils/ast' ;
6
- import { appendToFile } from '../../utils/fs' ;
6
+ import { appendToFile , expectFileToExist } from '../../utils/fs' ;
7
+ import { expectToFail } from '../../utils/utils' ;
7
8
8
9
9
10
export default function ( ) {
@@ -42,13 +43,24 @@ export default function() {
42
43
console.log(moment);
43
44
` ) )
44
45
. then ( ( ) => ng ( 'build' ) )
46
+ . then ( ( ) => expectFileToExist ( 'dist/common.chunk.js' ) )
45
47
. then ( ( ) => readdirSync ( 'dist' ) . length )
46
48
. then ( currentNumberOfDistFiles => {
47
49
if ( oldNumberOfFiles >= currentNumberOfDistFiles ) {
48
- throw new Error ( 'A bundle for the common async module was not created.' ) ;
50
+ throw new Error ( oneLine `The build contains the wrong number of files.
51
+ The test for 'dist/common.chunk.js' to exist should have failed.` ) ;
49
52
}
50
53
oldNumberOfFiles = currentNumberOfDistFiles ;
51
54
} )
55
+ . then ( ( ) => ng ( 'build' , '--no-common-chunk' ) )
56
+ . then ( ( ) => expectToFail ( ( ) => expectFileToExist ( 'dist/common.chunk.js' ) ) )
57
+ . then ( ( ) => readdirSync ( 'dist' ) . length )
58
+ . then ( currentNumberOfDistFiles => {
59
+ if ( oldNumberOfFiles <= currentNumberOfDistFiles ) {
60
+ throw new Error ( oneLine `The build contains the wrong number of files.
61
+ The test for 'dist/common.chunk.js' not to exist should have failed.` ) ;
62
+ }
63
+ } )
52
64
// Check for AoT and lazy routes.
53
65
. then ( ( ) => ng ( 'build' , '--aot' ) )
54
66
. then ( ( ) => readdirSync ( 'dist' ) . length )
0 commit comments