File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -523,6 +523,17 @@ class Server {
523
523
const isHTTPs = Boolean ( options . https ) ;
524
524
const isSPDY = Boolean ( options . http2 ) ;
525
525
526
+ if ( isHTTPs || isSPDY ) {
527
+ // TODO: remove in the next major release
528
+ util . deprecate (
529
+ ( ) => { } ,
530
+ `'${
531
+ isHTTPs ? "https" : "http2"
532
+ } ' option is deprecated. Please use the 'server' option.`,
533
+ `DEP_WEBPACK_DEV_SERVER_${ isHTTPs ? "HTTPS" : "HTTP2" } `
534
+ ) ( ) ;
535
+ }
536
+
526
537
options . server = {
527
538
type :
528
539
// eslint-disable-next-line no-nested-ternary
Original file line number Diff line number Diff line change 2
2
3
3
const path = require ( "path" ) ;
4
4
const http2 = require ( "http2" ) ;
5
+ const util = require ( "util" ) ;
5
6
const webpack = require ( "webpack" ) ;
6
7
const Server = require ( "../../lib/Server" ) ;
7
8
const config = require ( "../fixtures/static-config/webpack.config" ) ;
@@ -92,10 +93,13 @@ describe("http2 option", () => {
92
93
let browser ;
93
94
let pageErrors ;
94
95
let consoleMessages ;
96
+ let utilSpy ;
95
97
96
98
beforeEach ( async ( ) => {
97
99
compiler = webpack ( config ) ;
98
100
101
+ utilSpy = jest . spyOn ( util , "deprecate" ) ;
102
+
99
103
server = new Server (
100
104
{
101
105
static : staticDirectory ,
@@ -135,6 +139,10 @@ describe("http2 option", () => {
135
139
( ) => performance . getEntries ( ) [ 0 ] . nextHopProtocol
136
140
) ;
137
141
142
+ expect ( utilSpy . mock . calls [ 0 ] [ 1 ] ) . toBe (
143
+ "'http2' option is deprecated. Please use the 'server' option."
144
+ ) ;
145
+
138
146
expect ( HTTPVersion ) . toMatchSnapshot ( "HTTP version" ) ;
139
147
140
148
expect ( response . status ( ) ) . toMatchSnapshot ( "response status" ) ;
Original file line number Diff line number Diff line change 2
2
3
3
const https = require ( "https" ) ;
4
4
const path = require ( "path" ) ;
5
+ const util = require ( "util" ) ;
5
6
const fs = require ( "graceful-fs" ) ;
6
7
const request = require ( "supertest" ) ;
7
8
const webpack = require ( "webpack" ) ;
@@ -30,10 +31,13 @@ describe("https option", () => {
30
31
let browser ;
31
32
let pageErrors ;
32
33
let consoleMessages ;
34
+ let utilSpy ;
33
35
34
36
beforeEach ( async ( ) => {
35
37
compiler = webpack ( config ) ;
36
38
39
+ utilSpy = jest . spyOn ( util , "deprecate" ) ;
40
+
37
41
server = new Server (
38
42
{
39
43
static : {
@@ -72,6 +76,10 @@ describe("https option", () => {
72
76
waitUntil : "networkidle0" ,
73
77
} ) ;
74
78
79
+ expect ( utilSpy . mock . calls [ 0 ] [ 1 ] ) . toBe (
80
+ "'https' option is deprecated. Please use the 'server' option."
81
+ ) ;
82
+
75
83
expect ( response . status ( ) ) . toMatchSnapshot ( "response status" ) ;
76
84
77
85
expect ( await response . text ( ) ) . toMatchSnapshot ( "response text" ) ;
You can’t perform that action at this time.
0 commit comments