@@ -164,6 +164,34 @@ describe('loader', () => {
164
164
{ compilerOptions : { css : false } }
165
165
)
166
166
) ;
167
+
168
+ it (
169
+ 'should configure css with dev sourcemaps' ,
170
+ testLoader (
171
+ 'test/fixtures/css.html' ,
172
+ function ( err , code , map ) {
173
+ expect ( err ) . not . to . exist ;
174
+ expect ( code ) . to . contain ( 'function add_css(target)' ) ;
175
+ expect ( code ) . to . contain ( '/*# sourceMappingURL=' ) ;
176
+ expect ( map ) . to . exist ;
177
+ } ,
178
+ { compilerOptions : { dev : true , enableSourcemap : true } }
179
+ )
180
+ ) ;
181
+
182
+ it (
183
+ 'should configure css without dev sourcemaps' ,
184
+ testLoader (
185
+ 'test/fixtures/css.html' ,
186
+ function ( err , code , map ) {
187
+ expect ( err ) . not . to . exist ;
188
+ expect ( code ) . to . contain ( 'function add_css(target)' ) ;
189
+ expect ( code ) . not . to . contain ( '/*# sourceMappingURL=' ) ;
190
+ expect ( map ) . to . exist ;
191
+ } ,
192
+ { compilerOptions : { dev : true , enableSourcemap : { css : false , js : true } } }
193
+ )
194
+ ) ;
167
195
} ) ;
168
196
169
197
describe ( 'sveltePath' , ( ) => {
@@ -234,6 +262,19 @@ describe('loader', () => {
234
262
{ emitCss : true }
235
263
)
236
264
) ;
265
+
266
+ it (
267
+ 'should configure emitCss=true without css sourcemaps' ,
268
+ testLoader (
269
+ 'test/fixtures/css.html' ,
270
+ function ( err , code , map ) {
271
+ expect ( err ) . not . to . exist ;
272
+
273
+ expect ( code ) . to . match ( / ! = ! s v e l t e - l o a d e r \? c s s P a t h = / ) ;
274
+ } ,
275
+ { emitCss : true , compilerOptions : { enableSourcemap : { css : false , js : true } } }
276
+ )
277
+ ) ;
237
278
} ) ;
238
279
239
280
describe ( 'preprocess' , ( ) => {
@@ -354,6 +395,21 @@ describe('loader', () => {
354
395
)
355
396
) ;
356
397
} ) ;
398
+
399
+ describe ( 'compilerOptions' , ( ) => {
400
+ it (
401
+ 'should configure enableSourcemap=false' ,
402
+ testLoader (
403
+ 'test/fixtures/good.html' ,
404
+ function ( err , code , map ) {
405
+ expect ( err ) . not . to . exist ;
406
+ expect ( code ) . to . exist ;
407
+ expect ( map ) . not . to . exist ;
408
+ } ,
409
+ { compilerOptions : { enableSourcemap : false } }
410
+ ) ,
411
+ ) ;
412
+ } ) ;
357
413
} ) ;
358
414
359
415
// needs Svelte 5
0 commit comments