@@ -18,9 +18,8 @@ const contentBasePublic = path.join(
18
18
describe ( 'HTTPS' , ( ) => {
19
19
let server ;
20
20
let req ;
21
- afterEach ( helper . close ) ;
22
21
23
- describe ( 'to directory ' , ( ) => {
22
+ describe ( 'is boolean ' , ( ) => {
24
23
beforeAll ( ( done ) => {
25
24
server = helper . start (
26
25
config ,
@@ -36,6 +35,10 @@ describe('HTTPS', () => {
36
35
it ( 'Request to index' , ( done ) => {
37
36
req . get ( '/' ) . expect ( 200 , / H e y o / , done ) ;
38
37
} ) ;
38
+
39
+ afterAll ( ( ) => {
40
+ helper . close ( ) ;
41
+ } ) ;
39
42
} ) ;
40
43
41
44
describe ( 'ca, pfx, key and cert are buffer' , ( ) => {
@@ -68,7 +71,7 @@ describe('HTTPS', () => {
68
71
} ) ;
69
72
} ) ;
70
73
71
- describe ( 'ca, pfx, key and cert are string ' , ( ) => {
74
+ describe ( 'ca, pfx, key and cert are paths ' , ( ) => {
72
75
beforeAll ( ( done ) => {
73
76
server = helper . start (
74
77
config ,
@@ -91,4 +94,39 @@ describe('HTTPS', () => {
91
94
req . get ( '/' ) . expect ( 200 , / H e y o / , done ) ;
92
95
} ) ;
93
96
} ) ;
97
+
98
+ describe ( 'ca, pfx, key and cert are raw strings' , ( ) => {
99
+ beforeAll ( ( done ) => {
100
+ server = helper . start (
101
+ config ,
102
+ {
103
+ contentBase : contentBasePublic ,
104
+ https : {
105
+ ca : fs
106
+ . readFileSync ( path . join ( httpsCertificateDirectory , 'ca.pem' ) )
107
+ . toString ( ) ,
108
+ // pfx can't be string because it is binary format
109
+ pfx : fs . readFileSync (
110
+ path . join ( httpsCertificateDirectory , 'server.pfx' )
111
+ ) ,
112
+ key : fs
113
+ . readFileSync ( path . join ( httpsCertificateDirectory , 'server.key' ) )
114
+ . toString ( ) ,
115
+ cert : fs
116
+ . readFileSync ( path . join ( httpsCertificateDirectory , 'server.crt' ) )
117
+ . toString ( ) ,
118
+ passphrase : 'webpack-dev-server' ,
119
+ } ,
120
+ } ,
121
+ done
122
+ ) ;
123
+ req = request ( server . app ) ;
124
+ } ) ;
125
+
126
+ it ( 'Request to index' , ( done ) => {
127
+ req . get ( '/' ) . expect ( 200 , / H e y o / , done ) ;
128
+ } ) ;
129
+ } ) ;
130
+
131
+ afterEach ( helper . close ) ;
94
132
} ) ;
0 commit comments