@@ -66,12 +66,18 @@ describe('Basic end-to-end Workflow', function () {
66
66
// stuck to the first build done
67
67
sh . exec ( `${ ngBin } build -prod` ) ;
68
68
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 ( ) {
69
77
var mainBundlePath = path . join ( process . cwd ( ) , 'dist' , 'main.js' ) ;
70
78
var mainBundleContent = fs . readFileSync ( mainBundlePath , { encoding : 'utf8' } ) ;
71
79
// production: true minimized turns into production:!0
72
80
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 ) ;
75
81
} ) ;
76
82
77
83
it ( 'Can run `ng build` in created project' , function ( ) {
@@ -83,11 +89,9 @@ describe('Basic end-to-end Workflow', function () {
83
89
} )
84
90
. then ( function ( ) {
85
91
expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
86
-
87
92
// Check the index.html to have no handlebar tokens in it.
88
93
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' ) ;
91
95
} )
92
96
. then ( function ( ) {
93
97
// Also does not create new things in GIT.
@@ -139,12 +143,12 @@ describe('Basic end-to-end Workflow', function () {
139
143
var ngServePid ;
140
144
141
145
function executor ( resolve , reject ) {
142
- var serveProcess = child_process . exec ( `${ ngBin } serve` ) ;
146
+ var serveProcess = child_process . exec ( `${ ngBin } serve` , { maxBuffer : 500 * 1024 } ) ;
143
147
var startedProtractor = false ;
144
148
ngServePid = serveProcess . pid ;
145
149
146
150
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 ) {
148
152
startedProtractor = true ;
149
153
child_process . exec ( `${ ngBin } e2e` , ( error , stdout , stderr ) => {
150
154
if ( error !== null ) {
@@ -153,8 +157,6 @@ describe('Basic end-to-end Workflow', function () {
153
157
resolve ( ) ;
154
158
}
155
159
} ) ;
156
- } else if ( / f a i l e d w i t h : / . test ( data ) ) {
157
- reject ( data ) ;
158
160
}
159
161
} ) ;
160
162
@@ -441,12 +443,12 @@ describe('Basic end-to-end Workflow', function () {
441
443
var ngServePid ;
442
444
443
445
function executor ( resolve , reject ) {
444
- var serveProcess = child_process . exec ( `${ ngBin } serve` ) ;
446
+ var serveProcess = child_process . exec ( `${ ngBin } serve` , { maxBuffer : 500 * 1024 } ) ;
445
447
var startedProtractor = false ;
446
448
ngServePid = serveProcess . pid ;
447
449
448
450
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 ) {
450
452
startedProtractor = true ;
451
453
child_process . exec ( `${ ngBin } e2e` , ( error , stdout , stderr ) => {
452
454
if ( error !== null ) {
@@ -455,8 +457,6 @@ describe('Basic end-to-end Workflow', function () {
455
457
resolve ( ) ;
456
458
}
457
459
} ) ;
458
- } else if ( / f a i l e d w i t h : / . test ( data ) ) {
459
- reject ( data ) ;
460
460
}
461
461
} ) ;
462
462
0 commit comments