@@ -112,5 +112,60 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
112
112
113
113
expect ( buildCount ) . toBe ( 3 ) ;
114
114
} ) ;
115
+
116
+ it ( 'rebuilds dependent Sass stylesheets after error on initial build from import' , async ( ) => {
117
+ harness . useTarget ( 'build' , {
118
+ ...BASE_OPTIONS ,
119
+ watch : true ,
120
+ styles : [
121
+ { bundleName : 'styles' , input : 'src/styles.scss' } ,
122
+ { bundleName : 'other' , input : 'src/other.scss' } ,
123
+ ] ,
124
+ } ) ;
125
+
126
+ await harness . writeFile ( 'src/styles.scss' , "@import './a';" ) ;
127
+ await harness . writeFile ( 'src/other.scss' , "@import './a'; h1 { color: green; }" ) ;
128
+ await harness . writeFile ( 'src/a.scss' , 'invalid-invalid-invalid\\nh1 { color: $primary; }' ) ;
129
+
130
+ const buildCount = await harness
131
+ . execute ( { outputLogsOnFailure : false } )
132
+ . pipe (
133
+ timeout ( 30000 ) ,
134
+ concatMap ( async ( { result } , index ) => {
135
+ switch ( index ) {
136
+ case 0 :
137
+ expect ( result ?. success ) . toBe ( false ) ;
138
+
139
+ await harness . writeFile ( 'src/a.scss' , '$primary: aqua;\\nh1 { color: $primary; }' ) ;
140
+ break ;
141
+ case 1 :
142
+ expect ( result ?. success ) . toBe ( true ) ;
143
+ harness . expectFile ( 'dist/browser/styles.css' ) . content . toContain ( 'color: aqua' ) ;
144
+ harness . expectFile ( 'dist/browser/styles.css' ) . content . not . toContain ( 'color: blue' ) ;
145
+
146
+ harness . expectFile ( 'dist/browser/other.css' ) . content . toContain ( 'color: green' ) ;
147
+ harness . expectFile ( 'dist/browser/other.css' ) . content . toContain ( 'color: aqua' ) ;
148
+ harness . expectFile ( 'dist/browser/other.css' ) . content . not . toContain ( 'color: blue' ) ;
149
+
150
+ await harness . writeFile ( 'src/a.scss' , '$primary: blue;\\nh1 { color: $primary; }' ) ;
151
+ break ;
152
+ case 2 :
153
+ expect ( result ?. success ) . toBe ( true ) ;
154
+ harness . expectFile ( 'dist/browser/styles.css' ) . content . not . toContain ( 'color: aqua' ) ;
155
+ harness . expectFile ( 'dist/browser/styles.css' ) . content . toContain ( 'color: blue' ) ;
156
+
157
+ harness . expectFile ( 'dist/browser/other.css' ) . content . toContain ( 'color: green' ) ;
158
+ harness . expectFile ( 'dist/browser/other.css' ) . content . not . toContain ( 'color: aqua' ) ;
159
+ harness . expectFile ( 'dist/browser/other.css' ) . content . toContain ( 'color: blue' ) ;
160
+ break ;
161
+ }
162
+ } ) ,
163
+ take ( 3 ) ,
164
+ count ( ) ,
165
+ )
166
+ . toPromise ( ) ;
167
+
168
+ expect ( buildCount ) . toBe ( 3 ) ;
169
+ } ) ;
115
170
} ) ;
116
171
} ) ;
0 commit comments