@@ -416,4 +416,36 @@ describe('The config-generator function', () => {
416
416
expect ( ignorePlugin ) . to . not . be . undefined ;
417
417
} ) ;
418
418
} ) ;
419
+
420
+ describe ( 'disableAssetsLoaders() removes the default assets loaders' , ( ) => {
421
+ it ( 'without disableAssetsLoaders()' , ( ) => {
422
+ const config = createConfig ( ) ;
423
+ config . outputPath = '/tmp/output/public-path' ;
424
+ config . publicPath = '/public-path' ;
425
+ config . addEntry ( 'main' , './main' ) ;
426
+ // do not call disableAssetsLoaders
427
+
428
+ const actualConfig = configGenerator ( config ) ;
429
+
430
+ expect ( function ( ) {
431
+ findRule ( / \. ( p n g | j p g | j p e g | g i f | i c o | s v g ) $ / , actualConfig . module . rules ) ;
432
+ findRule ( / \. ( w o f f | w o f f 2 | t t f | e o t | o t f ) $ / , actualConfig . module . rules ) ;
433
+ } ) . to . not . throw ( ) ;
434
+ } ) ;
435
+
436
+ it ( 'with disableAssetsLoaders()' , ( ) => {
437
+ const config = createConfig ( ) ;
438
+ config . outputPath = '/tmp/output/public-path' ;
439
+ config . publicPath = '/public-path' ;
440
+ config . addEntry ( 'main' , './main' ) ;
441
+ config . disableAssetsLoaders ( ) ;
442
+
443
+ const actualConfig = configGenerator ( config ) ;
444
+
445
+ expect ( function ( ) {
446
+ findRule ( / \. ( p n g | j p g | j p e g | g i f | i c o | s v g ) $ / , actualConfig . module . rules ) ;
447
+ findRule ( / \. ( w o f f | w o f f 2 | t t f | e o t | o t f ) $ / , actualConfig . module . rules ) ;
448
+ } ) . to . throw ( ) ;
449
+ } ) ;
450
+ } ) ;
419
451
} ) ;
0 commit comments