@@ -319,120 +319,93 @@ describe('Basic end-to-end Workflow', function () {
319319 expect ( existsSync ( tmpFileLocation ) ) . to . be . equal ( true ) ;
320320 } ) ;
321321
322- it . skip ( 'Installs sass support successfully' , function ( ) {
322+ // Mobile mode doesn't have styles
323+ it_not_mobile ( 'Supports scss in styleUrls' , function ( ) {
323324 this . timeout ( 420000 ) ;
324325
325- sh . exec ( 'npm install node-sass' , { silent : true } ) ;
326- return ng ( [ 'generate' , 'component' , 'test-component' ] )
327- . then ( ( ) => {
328- let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' , 'test-component' ) ;
329- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
330- let scssFile = path . join ( componentPath , 'test-component.component.scss' ) ;
331- let scssPartialFile = path . join ( componentPath , '_test-component.component.partial.scss' ) ;
332-
333- let scssPartialExample = '.partial {\n @extend .outer;\n }' ;
334- fs . writeFileSync ( scssPartialFile , scssPartialExample , 'utf8' ) ;
335- expect ( existsSync ( scssPartialFile ) ) . to . be . equal ( true ) ;
336-
337- expect ( existsSync ( componentPath ) ) . to . be . equal ( true ) ;
338- sh . mv ( cssFile , scssFile ) ;
339- expect ( existsSync ( scssFile ) ) . to . be . equal ( true ) ;
340- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
341- let scssExample = '@import "test-component.component.partial";\n\n.outer {\n .inner { background: #fff; }\n }' ;
342- fs . writeFileSync ( scssFile , scssExample , 'utf8' ) ;
343-
344- sh . exec ( `${ ngBin } build` ) ;
345- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
346- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
347- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
348- expect ( contents ) . to . include ( '.outer .inner' ) ;
349- expect ( contents ) . to . include ( '.partial .inner' ) ;
350-
351- sh . rm ( '-f' , destCss ) ;
352- process . chdir ( 'src' ) ;
353- sh . exec ( `${ ngBin } build` ) ;
354- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
355- contents = fs . readFileSync ( destCss , 'utf8' ) ;
356- expect ( contents ) . to . include ( '.outer .inner' ) ;
357- expect ( contents ) . to . include ( '.partial .inner' ) ;
358-
359- process . chdir ( '..' ) ;
360- sh . exec ( 'npm uninstall node-sass' , { silent : true } ) ;
361- } ) ;
326+ let cssFilename = 'app.component.css' ;
327+ let scssFilename = 'app.component.scss' ;
328+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' ) ;
329+ let componentFile = path . join ( componentPath , 'app.component.ts' ) ;
330+ let cssFile = path . join ( componentPath , cssFilename ) ;
331+ let scssFile = path . join ( componentPath , scssFilename ) ;
332+ let scssExample = '@import "app.component.partial";\n\n.outer {\n .inner { background: #fff; }\n }' ;
333+ let scssPartialFile = path . join ( componentPath , '_app.component.partial.scss' ) ;
334+ let scssPartialExample = '.partial {\n @extend .outer;\n }' ;
335+ let componentContents = fs . readFileSync ( componentFile , 'utf8' ) ;
336+
337+ sh . mv ( cssFile , scssFile ) ;
338+ fs . writeFileSync ( scssFile , scssExample , 'utf8' ) ;
339+ fs . writeFileSync ( scssPartialFile , scssPartialExample , 'utf8' ) ;
340+ fs . writeFileSync ( componentFile , componentContents . replace ( new RegExp ( cssFilename , 'g' ) , scssFilename ) , 'utf8' ) ;
341+
342+ sh . exec ( `${ ngBin } build` ) ;
343+ let destCssBundle = path . join ( process . cwd ( ) , 'dist' , 'main.bundle.js' ) ;
344+ let contents = fs . readFileSync ( destCssBundle , 'utf8' ) ;
345+ expect ( contents ) . to . include ( '.outer .inner' ) ;
346+ expect ( contents ) . to . include ( '.partial .inner' ) ;
347+
348+ sh . mv ( scssFile , cssFile ) ;
349+ fs . writeFileSync ( cssFile , '' , 'utf8' ) ;
350+ fs . writeFileSync ( componentFile , componentContents , 'utf8' ) ;
351+ sh . rm ( '-f' , scssPartialFile ) ;
362352 } ) ;
363353
364- it . skip ( 'Installs less support successfully' , function ( ) {
354+ // Mobile mode doesn't have styles
355+ it_not_mobile ( 'Supports less in styleUrls' , function ( ) {
365356 this . timeout ( 420000 ) ;
366357
367- sh . exec ( 'npm install less' , { silent : true } ) ;
368- return ng ( [ 'generate' , 'component' , 'test-component' ] )
369- . then ( ( ) => {
370- let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' , 'test-component' ) ;
371- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
372- let lessFile = path . join ( componentPath , 'test-component.component.less' ) ;
373-
374- expect ( existsSync ( componentPath ) ) . to . be . equal ( true ) ;
375- sh . mv ( cssFile , lessFile ) ;
376- expect ( existsSync ( lessFile ) ) . to . be . equal ( true ) ;
377- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
378- let lessExample = '.outer {\n .inner { background: #fff; }\n }' ;
379- fs . writeFileSync ( lessFile , lessExample , 'utf8' ) ;
380-
381- sh . exec ( `${ ngBin } build` ) ;
382- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
383- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
384- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
385- expect ( contents ) . to . include ( '.outer .inner' ) ;
386-
387- sh . rm ( '-f' , destCss ) ;
388- process . chdir ( 'src' ) ;
389- sh . exec ( `${ ngBin } build` ) ;
390- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
391- contents = fs . readFileSync ( destCss , 'utf8' ) ;
392- expect ( contents ) . to . include ( '.outer .inner' ) ;
393-
394- process . chdir ( '..' ) ;
395- sh . exec ( 'npm uninstall less' , { silent : true } ) ;
396- } ) ;
358+ let cssFilename = 'app.component.css' ;
359+ let lessFilename = 'app.component.less' ;
360+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' ) ;
361+ let componentFile = path . join ( componentPath , 'app.component.ts' ) ;
362+ let cssFile = path . join ( componentPath , cssFilename ) ;
363+ let lessFile = path . join ( componentPath , lessFilename ) ;
364+ let lessExample = '.outer {\n .inner { background: #fff; }\n }' ;
365+ let componentContents = fs . readFileSync ( componentFile , 'utf8' ) ;
366+
367+ sh . mv ( cssFile , lessFile ) ;
368+ fs . writeFileSync ( lessFile , lessExample , 'utf8' ) ;
369+ fs . writeFileSync ( componentFile , componentContents . replace ( new RegExp ( cssFilename , 'g' ) , lessFilename ) , 'utf8' ) ;
370+
371+ sh . exec ( `${ ngBin } build` ) ;
372+ let destCssBundle = path . join ( process . cwd ( ) , 'dist' , 'main.bundle.js' ) ;
373+ let contents = fs . readFileSync ( destCssBundle , 'utf8' ) ;
374+ expect ( contents ) . to . include ( '.outer .inner' ) ;
375+
376+ fs . writeFileSync ( lessFile , '' , 'utf8' ) ;
377+ sh . mv ( lessFile , cssFile ) ;
378+ fs . writeFileSync ( componentFile , componentContents , 'utf8' ) ;
397379 } ) ;
398380
399- it . skip ( 'Installs stylus support successfully' , function ( ) {
381+ // Mobile mode doesn't have styles
382+ it_not_mobile ( 'Supports stylus in styleUrls' , function ( ) {
400383 this . timeout ( 420000 ) ;
401384
402- sh . exec ( 'npm install stylus' , { silent : true } ) ;
403- return ng ( [ 'generate' , 'component' , 'test-component' ] )
404- . then ( ( ) => {
405- let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' , 'test-component' ) ;
406- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
407- let stylusFile = path . join ( componentPath , 'test-component.component.styl' ) ;
408-
409- sh . mv ( cssFile , stylusFile ) ;
410- expect ( existsSync ( stylusFile ) ) . to . be . equal ( true ) ;
411- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
412- let stylusExample = '.outer {\n .inner { background: #fff; }\n }' ;
413- fs . writeFileSync ( stylusFile , stylusExample , 'utf8' ) ;
414-
415- sh . exec ( `${ ngBin } build` ) ;
416- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
417- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
418- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
419- expect ( contents ) . to . include ( '.outer .inner' ) ;
420-
421- sh . rm ( '-f' , destCss ) ;
422- process . chdir ( 'src' ) ;
423- sh . exec ( `${ ngBin } build` ) ;
424- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
425- contents = fs . readFileSync ( destCss , 'utf8' ) ;
426- expect ( contents ) . to . include ( '.outer .inner' ) ;
427-
428- process . chdir ( '..' ) ;
429- sh . exec ( 'npm uninstall stylus' , { silent : true } ) ;
430- } ) ;
385+ let cssFilename = 'app.component.css' ;
386+ let stylusFilename = 'app.component.scss' ;
387+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' ) ;
388+ let componentFile = path . join ( componentPath , 'app.component.ts' ) ;
389+ let cssFile = path . join ( componentPath , cssFilename ) ;
390+ let stylusFile = path . join ( componentPath , stylusFilename ) ;
391+ let stylusExample = '.outer {\n .inner { background: #fff; }\n }' ;
392+ let componentContents = fs . readFileSync ( componentFile , 'utf8' ) ;
393+
394+ sh . mv ( cssFile , stylusFile ) ;
395+ fs . writeFileSync ( stylusFile , stylusExample , 'utf8' ) ;
396+ fs . writeFileSync ( componentFile , componentContents . replace ( new RegExp ( cssFilename , 'g' ) , stylusFilename ) , 'utf8' ) ;
397+
398+ sh . exec ( `${ ngBin } build` ) ;
399+ let destCssBundle = path . join ( process . cwd ( ) , 'dist' , 'main.bundle.js' ) ;
400+ let contents = fs . readFileSync ( destCssBundle , 'utf8' ) ;
401+ expect ( contents ) . to . include ( '.outer .inner' ) ;
402+
403+ fs . writeFileSync ( stylusFile , '' , 'utf8' ) ;
404+ sh . mv ( stylusFile , cssFile ) ;
405+ fs . writeFileSync ( componentFile , componentContents , 'utf8' ) ;
431406 } ) ;
432407
433- // This test causes complications with path resolution in TS broccoli plugin,
434- // and isn't mobile specific
435- it_not_mobile ( 'Turn on `noImplicitAny` in tsconfig.json and rebuild' , function ( ) {
408+ it ( 'Turn on `noImplicitAny` in tsconfig.json and rebuild' , function ( ) {
436409 this . timeout ( 420000 ) ;
437410
438411 const configFilePath = path . join ( process . cwd ( ) , 'src' , 'tsconfig.json' ) ;
@@ -443,10 +416,8 @@ describe('Basic end-to-end Workflow', function () {
443416
444417 sh . rm ( '-rf' , path . join ( process . cwd ( ) , 'dist' ) ) ;
445418
446- return ng ( [ 'build' ] )
447- . then ( ( ) => {
448- expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
449- } ) ;
419+ sh . exec ( `${ ngBin } build` ) ;
420+ expect ( existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
450421 } ) ;
451422
452423 it ( 'Turn on path mapping in tsconfig.json and rebuild' , function ( ) {
0 commit comments