@@ -19,6 +19,9 @@ function existsSync(path) {
1919 }
2020}
2121
22+ const bin = path . normalize ( './node_modules/angular-cli/bin/ng' ) ;
23+
24+
2225describe ( 'Basic end-to-end Workflow' , function ( ) {
2326 before ( conf . setup ) ;
2427
@@ -62,7 +65,7 @@ describe('Basic end-to-end Workflow', function () {
6265
6366 // Can't user the `ng` helper because somewhere the environment gets
6467 // stuck to the first build done
65- sh . exec ( 'ng build --environment=production --silent' ) ;
68+ sh . exec ( ` ${ bin } build --environment=production --silent` ) ;
6669 expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
6770 var envPath = path . join ( process . cwd ( ) , 'dist' , 'app' , 'environment.js' ) ;
6871 var envContent = fs . readFileSync ( envPath , { encoding : 'utf8' } ) ;
@@ -77,13 +80,9 @@ describe('Basic end-to-end Workflow', function () {
7780 return ng ( [ 'build' , '--silent' ] )
7881 . then ( function ( ) {
7982 expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
80- } )
81- . then ( function ( ) {
83+
8284 // Also does not create new things in GIT.
8385 expect ( sh . exec ( 'git status --porcelain' ) . output ) . to . be . equal ( '' ) ;
84- } )
85- . catch ( ( ) => {
86- throw new Error ( 'Build failed.' ) ;
8786 } ) ;
8887 } ) ;
8988
@@ -190,45 +189,41 @@ describe('Basic end-to-end Workflow', function () {
190189 return ng ( [ 'build' , '--silent' ] )
191190 . then ( function ( ) {
192191 expect ( existsSync ( tmpFileLocation ) ) ;
193- } )
194- . catch ( err => {
195- throw new Error ( err )
196192 } ) ;
197193 } ) ;
198194
199195 it ( 'Installs sass support successfully' , function ( ) {
200196 this . timeout ( 420000 ) ;
201197
202198 sh . exec ( 'npm install node-sass' , { silent : true } ) ;
203- return ng ( [ 'generate' , 'component' , 'test-component' ] )
204- . then ( ( ) => {
205- let componentPath = path . join ( process . cwd ( ) , 'src' , 'client' , 'app' , 'test-component' ) ;
206- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
207- let scssFile = path . join ( componentPath , 'test-component.component.scss' ) ;
208-
209- expect ( existsSync ( componentPath ) ) . to . be . equal ( true ) ;
210- sh . mv ( cssFile , scssFile ) ;
211- expect ( existsSync ( scssFile ) ) . to . be . equal ( true ) ;
212- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
213- let scssExample = '.outer {\n .inner { background: #fff; }\n }' ;
214- fs . writeFileSync ( scssFile , scssExample , 'utf8' ) ;
215-
216- sh . exec ( 'ng build --silent' ) ;
217- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
218- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
219- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
220- expect ( contents ) . to . include ( '.outer .inner' ) ;
221-
222- sh . rm ( '-f' , destCss ) ;
223- process . chdir ( 'src' ) ;
224- sh . exec ( 'ng build --silent' ) ;
225- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
226- contents = fs . readFileSync ( destCss , 'utf8' ) ;
227- expect ( contents ) . to . include ( '.outer .inner' ) ;
228-
229- process . chdir ( '..' ) ;
230- sh . exec ( 'npm uninstall node-sass' , { silent : true } ) ;
231- } ) ;
199+ sh . exec ( `${ bin } generate component test-component` ) ;
200+
201+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'client' , 'app' , 'test-component' ) ;
202+ let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
203+ let scssFile = path . join ( componentPath , 'test-component.component.scss' ) ;
204+
205+ expect ( existsSync ( componentPath ) ) . to . be . equal ( true ) ;
206+ sh . mv ( cssFile , scssFile ) ;
207+ expect ( existsSync ( scssFile ) ) . to . be . equal ( true ) ;
208+ expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
209+ let scssExample = '.outer {\n .inner { background: #fff; }\n }' ;
210+ fs . writeFileSync ( scssFile , scssExample , 'utf8' ) ;
211+
212+ sh . exec ( `${ bin } build --silent` ) ;
213+ let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
214+ expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
215+ let contents = fs . readFileSync ( destCss , 'utf8' ) ;
216+ expect ( contents ) . to . include ( '.outer .inner' ) ;
217+
218+ sh . rm ( '-f' , destCss ) ;
219+ process . chdir ( 'src' ) ;
220+ sh . exec ( `../${ bin } build --silent` ) ;
221+ expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
222+ contents = fs . readFileSync ( destCss , 'utf8' ) ;
223+ expect ( contents ) . to . include ( '.outer .inner' ) ;
224+
225+ process . chdir ( '..' ) ;
226+ sh . exec ( 'npm uninstall node-sass' , { silent : true } ) ;
232227 } ) ;
233228
234229 it ( 'Installs less support successfully' , function ( ) {
@@ -248,15 +243,15 @@ describe('Basic end-to-end Workflow', function () {
248243 let lessExample = '.outer {\n .inner { background: #fff; }\n }' ;
249244 fs . writeFileSync ( lessFile , lessExample , 'utf8' ) ;
250245
251- sh . exec ( 'ng build --silent' ) ;
246+ sh . exec ( ` ${ bin } build --silent` ) ;
252247 let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
253248 expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
254249 let contents = fs . readFileSync ( destCss , 'utf8' ) ;
255250 expect ( contents ) . to . include ( '.outer .inner' ) ;
256251
257252 sh . rm ( '-f' , destCss ) ;
258253 process . chdir ( 'src' ) ;
259- sh . exec ( 'ng build --silent' ) ;
254+ sh . exec ( `../ ${ bin } build --silent` ) ;
260255 expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
261256 contents = fs . readFileSync ( destCss , 'utf8' ) ;
262257 expect ( contents ) . to . include ( '.outer .inner' ) ;
@@ -282,15 +277,15 @@ describe('Basic end-to-end Workflow', function () {
282277 let stylusExample = '.outer {\n .inner { background: #fff; }\n }' ;
283278 fs . writeFileSync ( stylusFile , stylusExample , 'utf8' ) ;
284279
285- sh . exec ( 'ng build --silent' ) ;
280+ sh . exec ( ` ${ bin } build --silent` ) ;
286281 let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
287282 expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
288283 let contents = fs . readFileSync ( destCss , 'utf8' ) ;
289284 expect ( contents ) . to . include ( '.outer .inner' ) ;
290285
291286 sh . rm ( '-f' , destCss ) ;
292287 process . chdir ( 'src' ) ;
293- sh . exec ( 'ng build --silent' ) ;
288+ sh . exec ( `../ ${ bin } build --silent` ) ;
294289 expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
295290 contents = fs . readFileSync ( destCss , 'utf8' ) ;
296291 expect ( contents ) . to . include ( '.outer .inner' ) ;
@@ -314,11 +309,7 @@ describe('Basic end-to-end Workflow', function () {
314309 return ng ( [ 'build' , '--silent' ] )
315310 . then ( function ( ) {
316311 expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
317- } )
318- . catch ( ( ) => {
319- throw new Error ( 'Build failed.' ) ;
320- } )
321- . finally ( function ( ) {
312+
322313 // Clean `tmp` folder
323314 process . chdir ( path . resolve ( root , '..' ) ) ;
324315 sh . rm ( '-rf' , './tmp' ) ; // tmp.teardown takes too long
0 commit comments