@@ -294,10 +294,12 @@ describe('loader', () => {
294
294
} ) ;
295
295
const callbackSpy = spy ( cb ) ;
296
296
const options = {
297
- style : ( { content } ) => {
298
- return {
299
- code : content . replace ( / \$ s i z e / gi, '50px' ) ,
300
- } ;
297
+ preprocess : {
298
+ style : ( { content } ) => {
299
+ return {
300
+ code : content . replace ( / \$ s i z e / gi, '50px' ) ,
301
+ } ;
302
+ }
301
303
} ,
302
304
} ;
303
305
@@ -321,9 +323,11 @@ describe('loader', () => {
321
323
const cacheableSpy = spy ( ( ) => {
322
324
} ) ;
323
325
const options = {
324
- style : ( ) => {
325
- throw new Error ( 'Error while preprocessing' ) ;
326
- } ,
326
+ preprocess : {
327
+ style : ( ) => {
328
+ throw new Error ( 'Error while preprocessing' ) ;
329
+ }
330
+ }
327
331
} ;
328
332
329
333
loader . call (
@@ -342,6 +346,32 @@ describe('loader', () => {
342
346
} ) ;
343
347
} ) ;
344
348
349
+
350
+ describe ( 'deprecations' , ( ) => {
351
+ it ( 'should warn on options.style' , done => {
352
+ const { warn } = console ;
353
+ const warnings = [ ] ;
354
+
355
+ console . warn = ( msg ) => {
356
+ warnings . push ( msg ) ;
357
+ } ;
358
+
359
+ testLoader ( 'test/fixtures/style-valid.html' , ( err , code , map ) => {
360
+ expect ( code ) . to . contain ( '50px' ) ;
361
+ expect ( warnings ) . to . deep . equal ( [
362
+ '[svelte-loader] DEPRECATION: options.style is now options.preprocess.style'
363
+ ] ) ;
364
+ console . warn = warn ;
365
+ } , {
366
+ style : ( { content } ) => {
367
+ return {
368
+ code : content . replace ( / \$ s i z e / gi, '50px' ) ,
369
+ } ;
370
+ }
371
+ } ) ( done ) ;
372
+ } ) ;
373
+ } ) ;
374
+
345
375
describe ( 'hotReload' , ( ) => {
346
376
it (
347
377
'should configure hotReload=false (default)' ,
0 commit comments