@@ -3,7 +3,8 @@ import {oneLine} from 'common-tags';
33
44import { ng , npm } from '../../utils/process' ;
55import { addImportToModule } from '../../utils/ast' ;
6- import { appendToFile } from '../../utils/fs' ;
6+ import { appendToFile , expectFileToExist } from '../../utils/fs' ;
7+ import { expectToFail } from '../../utils/utils' ;
78
89
910export default function ( ) {
@@ -42,13 +43,24 @@ export default function() {
4243 console.log(moment);
4344 ` ) )
4445 . then ( ( ) => ng ( 'build' ) )
46+ . then ( ( ) => expectFileToExist ( 'dist/common.chunk.js' ) )
4547 . then ( ( ) => readdirSync ( 'dist' ) . length )
4648 . then ( currentNumberOfDistFiles => {
4749 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.` ) ;
4952 }
5053 oldNumberOfFiles = currentNumberOfDistFiles ;
5154 } )
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+ } )
5264 // Check for AoT and lazy routes.
5365 . then ( ( ) => ng ( 'build' , '--aot' ) )
5466 . then ( ( ) => readdirSync ( 'dist' ) . length )
0 commit comments