File tree 2 files changed +34
-2
lines changed
angular_devkit/build_angular/test/browser
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', () => {
63
63
expect ( logs . join ( ) ) . toContain ( 'WARNING in Invalid selector' ) ;
64
64
await run . stop ( ) ;
65
65
} ) ;
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
+ } ) ;
66
94
} ) ;
Original file line number Diff line number Diff line change @@ -99,6 +99,12 @@ export class WebpackResourceLoader {
99
99
// Compile and return a promise
100
100
return new Promise ( ( resolve , reject ) => {
101
101
childCompiler . compile ( ( err : Error , childCompilation : any ) => {
102
+ if ( err ) {
103
+ reject ( err ) ;
104
+
105
+ return ;
106
+ }
107
+
102
108
// Resolve / reject the promise
103
109
const { warnings, errors } = childCompilation ;
104
110
@@ -114,8 +120,6 @@ export class WebpackResourceLoader {
114
120
. join ( '\n' ) ;
115
121
116
122
reject ( new Error ( 'Child compilation failed:\n' + errorDetails ) ) ;
117
- } else if ( err ) {
118
- reject ( err ) ;
119
123
} else {
120
124
Object . keys ( childCompilation . assets ) . forEach ( assetName => {
121
125
// Add all new assets to the parent compilation, with the exception of
You can’t perform that action at this time.
0 commit comments