File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
angular_devkit/build_angular/test/browser Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -63,4 +63,32 @@ describe('Browser Builder AOT', () => {
6363 expect ( logs . join ( ) ) . toContain ( 'WARNING in Invalid selector' ) ;
6464 await run . stop ( ) ;
6565 } ) ;
66+
67+ it ( 'shows error when component stylesheet contains SCSS syntax error' , async ( ) => {
68+ const overrides = {
69+ aot : true ,
70+ } ;
71+
72+ host . replaceInFile (
73+ 'src/app/app.component.ts' ,
74+ 'app.component.css' ,
75+ 'app.component.scss' ,
76+ ) ;
77+
78+ host . writeMultipleFiles ( {
79+ 'src/app/app.component.scss' : `
80+ .foo {
81+ ` ,
82+ } ) ;
83+
84+ const logger = new logging . Logger ( '' ) ;
85+ const logs : string [ ] = [ ] ;
86+ logger . subscribe ( e => logs . push ( e . message ) ) ;
87+
88+ const run = await architect . scheduleTarget ( targetSpec , overrides , { logger } ) ;
89+ const output = await run . result ;
90+ expect ( output . success ) . toBe ( false ) ;
91+ expect ( logs . join ( ) ) . toContain ( `Expected "}".` ) ;
92+ await run . stop ( ) ;
93+ } ) ;
6694} ) ;
Original file line number Diff line number Diff line change @@ -99,6 +99,12 @@ export class WebpackResourceLoader {
9999 // Compile and return a promise
100100 return new Promise ( ( resolve , reject ) => {
101101 childCompiler . compile ( ( err : Error , childCompilation : any ) => {
102+ if ( err ) {
103+ reject ( err ) ;
104+
105+ return ;
106+ }
107+
102108 // Resolve / reject the promise
103109 const { warnings, errors } = childCompilation ;
104110
@@ -114,8 +120,6 @@ export class WebpackResourceLoader {
114120 . join ( '\n' ) ;
115121
116122 reject ( new Error ( 'Child compilation failed:\n' + errorDetails ) ) ;
117- } else if ( err ) {
118- reject ( err ) ;
119123 } else {
120124 Object . keys ( childCompilation . assets ) . forEach ( assetName => {
121125 // Add all new assets to the parent compilation, with the exception of
You can’t perform that action at this time.
0 commit comments