@@ -66,12 +66,18 @@ describe('Basic end-to-end Workflow', function () {
6666 // stuck to the first build done
6767 sh . exec ( `${ ngBin } build -prod` ) ;
6868 expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
69+ const indexHtml = fs . readFileSync ( path . join ( process . cwd ( ) , 'dist/index.html' ) , 'utf-8' ) ;
70+ // Check for cache busting hash script src
71+ expect ( indexHtml ) . to . match ( / m a i n \. [ 0 - 9 a - f ] { 20 } \. b u n d l e \. j s / ) ;
72+ // Also does not create new things in GIT.
73+ expect ( sh . exec ( 'git status --porcelain' ) . output ) . to . be . equal ( undefined ) ;
74+ } ) ;
75+
76+ it ( 'Supports production builds config file replacement' , function ( ) {
6977 var mainBundlePath = path . join ( process . cwd ( ) , 'dist' , 'main.js' ) ;
7078 var mainBundleContent = fs . readFileSync ( mainBundlePath , { encoding : 'utf8' } ) ;
7179 // production: true minimized turns into production:!0
7280 expect ( mainBundleContent ) . to . include ( 'production:!0' ) ;
73- // Also does not create new things in GIT.
74- expect ( sh . exec ( 'git status --porcelain' ) . output ) . to . be . equal ( undefined ) ;
7581 } ) ;
7682
7783 it ( 'Can run `ng build` in created project' , function ( ) {
@@ -83,11 +89,9 @@ describe('Basic end-to-end Workflow', function () {
8389 } )
8490 . then ( function ( ) {
8591 expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
86-
8792 // Check the index.html to have no handlebar tokens in it.
8893 const indexHtml = fs . readFileSync ( path . join ( process . cwd ( ) , 'dist/index.html' ) , 'utf-8' ) ;
89- expect ( indexHtml ) . to . not . include ( '{{' ) ;
90- expect ( indexHtml ) . to . include ( 'vendor/es6-shim/es6-shim.js' ) ;
94+ expect ( indexHtml ) . to . include ( 'main.bundle.js' ) ;
9195 } )
9296 . then ( function ( ) {
9397 // Also does not create new things in GIT.
@@ -139,12 +143,12 @@ describe('Basic end-to-end Workflow', function () {
139143 var ngServePid ;
140144
141145 function executor ( resolve , reject ) {
142- var serveProcess = child_process . exec ( `${ ngBin } serve` ) ;
146+ var serveProcess = child_process . exec ( `${ ngBin } serve` , { maxBuffer : 500 * 1024 } ) ;
143147 var startedProtractor = false ;
144148 ngServePid = serveProcess . pid ;
145149
146150 serveProcess . stdout . on ( 'data' , ( data ) => {
147- if ( / B u i l d s u c c e s s f u l / . test ( data ) && ! startedProtractor ) {
151+ if ( / w e b p a c k : b u n d l e i s n o w V A L I D / . test ( data . toString ( 'utf-8' ) ) && ! startedProtractor ) {
148152 startedProtractor = true ;
149153 child_process . exec ( `${ ngBin } e2e` , ( error , stdout , stderr ) => {
150154 if ( error !== null ) {
@@ -153,8 +157,6 @@ describe('Basic end-to-end Workflow', function () {
153157 resolve ( ) ;
154158 }
155159 } ) ;
156- } else if ( / f a i l e d w i t h : / . test ( data ) ) {
157- reject ( data ) ;
158160 }
159161 } ) ;
160162
@@ -441,12 +443,12 @@ describe('Basic end-to-end Workflow', function () {
441443 var ngServePid ;
442444
443445 function executor ( resolve , reject ) {
444- var serveProcess = child_process . exec ( `${ ngBin } serve` ) ;
446+ var serveProcess = child_process . exec ( `${ ngBin } serve` , { maxBuffer : 500 * 1024 } ) ;
445447 var startedProtractor = false ;
446448 ngServePid = serveProcess . pid ;
447449
448450 serveProcess . stdout . on ( 'data' , ( data ) => {
449- if ( / B u i l d s u c c e s s f u l / . test ( data ) && ! startedProtractor ) {
451+ if ( / w e b p a c k : b u n d l e i s n o w V A L I D / . test ( data . toString ( 'utf-8' ) ) && ! startedProtractor ) {
450452 startedProtractor = true ;
451453 child_process . exec ( `${ ngBin } e2e` , ( error , stdout , stderr ) => {
452454 if ( error !== null ) {
@@ -455,8 +457,6 @@ describe('Basic end-to-end Workflow', function () {
455457 resolve ( ) ;
456458 }
457459 } ) ;
458- } else if ( / f a i l e d w i t h : / . test ( data ) ) {
459- reject ( data ) ;
460460 }
461461 } ) ;
462462
0 commit comments