File tree 2 files changed +26
-5
lines changed
2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -674,14 +674,21 @@ class Server {
674
674
const isHTTPs = Boolean ( options . https ) ;
675
675
const isSPDY = Boolean ( options . http2 ) ;
676
676
677
- if ( isHTTPs || isSPDY ) {
677
+ if ( isHTTPs ) {
678
678
// TODO: remove in the next major release
679
679
util . deprecate (
680
680
( ) => { } ,
681
- `'${
682
- isHTTPs ? "https" : "http2"
683
- } ' option is deprecated. Please use the 'server' option.`,
684
- `DEP_WEBPACK_DEV_SERVER_${ isHTTPs ? "HTTPS" : "HTTP2" } `
681
+ "'https' option is deprecated. Please use the 'server' option." ,
682
+ "DEP_WEBPACK_DEV_SERVER_HTTPS"
683
+ ) ( ) ;
684
+ }
685
+
686
+ if ( isSPDY ) {
687
+ // TODO: remove in the next major release
688
+ util . deprecate (
689
+ ( ) => { } ,
690
+ "'http2' option is deprecated. Please use the 'server' option." ,
691
+ "DEP_WEBPACK_DEV_SERVER_HTTP2"
685
692
) ( ) ;
686
693
}
687
694
Original file line number Diff line number Diff line change @@ -21,10 +21,13 @@ describe("http2 option", () => {
21
21
let page ;
22
22
let browser ;
23
23
let HTTPVersion ;
24
+ let utilSpy ;
24
25
25
26
beforeEach ( async ( ) => {
26
27
compiler = webpack ( config ) ;
27
28
29
+ utilSpy = jest . spyOn ( util , "deprecate" ) ;
30
+
28
31
server = new Server (
29
32
{
30
33
static : staticDirectory ,
@@ -49,6 +52,7 @@ describe("http2 option", () => {
49
52
} ) ;
50
53
51
54
afterEach ( async ( ) => {
55
+ utilSpy . mockRestore ( ) ;
52
56
await browser . close ( ) ;
53
57
await server . stop ( ) ;
54
58
} ) ;
@@ -82,6 +86,15 @@ describe("http2 option", () => {
82
86
83
87
expect ( HTTPVersion ) . toEqual ( "h2" ) ;
84
88
89
+ // should show deprecated warning for both `https` and `http2`
90
+ expect ( utilSpy . mock . calls [ 0 ] [ 1 ] ) . toBe (
91
+ "'https' option is deprecated. Please use the 'server' option."
92
+ ) ;
93
+
94
+ expect ( utilSpy . mock . calls [ 1 ] [ 1 ] ) . toBe (
95
+ "'http2' option is deprecated. Please use the 'server' option."
96
+ ) ;
97
+
85
98
http2Req . end ( ) ;
86
99
} ) ;
87
100
} ) ;
@@ -118,6 +131,7 @@ describe("http2 option", () => {
118
131
} ) ;
119
132
120
133
afterEach ( async ( ) => {
134
+ utilSpy . mockRestore ( ) ;
121
135
await browser . close ( ) ;
122
136
await server . stop ( ) ;
123
137
} ) ;
You can’t perform that action at this time.
0 commit comments