@@ -588,6 +588,31 @@ describe('The config-generator function', () => {
588
588
expect ( actualConfig . devServer . hot ) . to . be . true ;
589
589
} ) ;
590
590
591
+ it ( 'devServer with custom options' , ( ) => {
592
+ const config = createConfig ( ) ;
593
+ config . runtimeConfig . useDevServer = true ;
594
+ config . runtimeConfig . devServerUrl = 'http://localhost:8080/' ;
595
+ config . outputPath = isWindows ? 'C:\\tmp\\public' : '/tmp/public' ;
596
+ config . setPublicPath ( '/' ) ;
597
+ config . addEntry ( 'main' , './main' ) ;
598
+
599
+ config . configureDevServerOptions ( options => {
600
+ options . https = {
601
+ key : 'https.key' ,
602
+ cert : 'https.cert' ,
603
+ } ;
604
+ } ) ;
605
+
606
+ const actualConfig = configGenerator ( config ) ;
607
+
608
+ expect ( actualConfig . devServer ) . to . containSubset ( {
609
+ https : {
610
+ key : 'https.key' ,
611
+ cert : 'https.cert' ,
612
+ } ,
613
+ } ) ;
614
+ } ) ;
615
+
591
616
it ( 'devServer with custom watch options' , ( ) => {
592
617
const config = createConfig ( ) ;
593
618
config . runtimeConfig . useDevServer = true ;
@@ -602,6 +627,7 @@ describe('The config-generator function', () => {
602
627
} ) ;
603
628
604
629
const actualConfig = configGenerator ( config ) ;
630
+
605
631
expect ( actualConfig . watchOptions ) . to . deep . equals ( {
606
632
'ignored' : / n o d e _ m o d u l e s / ,
607
633
'poll' : 250 ,
@@ -611,6 +637,34 @@ describe('The config-generator function', () => {
611
637
'poll' : 250 ,
612
638
} ) ;
613
639
} ) ;
640
+
641
+ it ( 'devServer with custom options and watch options' , ( ) => {
642
+ const config = createConfig ( ) ;
643
+ config . runtimeConfig . useDevServer = true ;
644
+ config . runtimeConfig . devServerUrl = 'http://localhost:8080/' ;
645
+ config . runtimeConfig . useHotModuleReplacement = true ;
646
+ config . outputPath = isWindows ? 'C:\\tmp\\public' : '/tmp/public' ;
647
+ config . setPublicPath ( '/' ) ;
648
+ config . addEntry ( 'main' , './main' ) ;
649
+
650
+ config . configureWatchOptions ( watchOptions => {
651
+ watchOptions . poll = 250 ;
652
+ } ) ;
653
+ config . configureDevServerOptions ( options => {
654
+ // should take precedence over `configureWatchOptions()`
655
+ options . watchOptions . poll = 500 ;
656
+ } ) ;
657
+
658
+ const actualConfig = configGenerator ( config ) ;
659
+ expect ( actualConfig . watchOptions ) . to . deep . equals ( {
660
+ 'ignored' : / n o d e _ m o d u l e s / ,
661
+ 'poll' : 250 ,
662
+ } ) ;
663
+ expect ( actualConfig . devServer . watchOptions ) . to . deep . equals ( {
664
+ 'ignored' : / n o d e _ m o d u l e s / ,
665
+ 'poll' : 500 ,
666
+ } ) ;
667
+ } ) ;
614
668
} ) ;
615
669
616
670
describe ( 'test for addPlugin config' , ( ) => {
0 commit comments