@@ -39,9 +39,9 @@ describe('Server', () => {
39
39
return relative ( '.' , p ) . split ( sep ) ;
40
40
} )
41
41
) . toMatchSnapshot ( ) ;
42
- expect (
43
- server . middleware . context . compiler . options . plugins
44
- ) . toMatchSnapshot ( ) ;
42
+ expect ( server . middleware . context . compiler . options . plugins ) . toEqual ( [
43
+ new webpack . HotModuleReplacementPlugin ( ) ,
44
+ ] ) ;
45
45
46
46
compiler . hooks . done . tap ( 'webpack-dev-server' , ( ) => {
47
47
server . close ( done ) ;
@@ -64,9 +64,9 @@ describe('Server', () => {
64
64
return relative ( '.' , p ) . split ( sep ) ;
65
65
} )
66
66
) . toMatchSnapshot ( ) ;
67
- expect (
68
- server . middleware . context . compiler . options . plugins
69
- ) . toMatchSnapshot ( ) ;
67
+ expect ( server . middleware . context . compiler . options . plugins ) . toEqual ( [
68
+ new webpack . HotModuleReplacementPlugin ( ) ,
69
+ ] ) ;
70
70
71
71
compiler . hooks . done . tap ( 'webpack-dev-server' , ( ) => {
72
72
server . close ( done ) ;
@@ -78,14 +78,6 @@ describe('Server', () => {
78
78
79
79
// issue: https://github.com/webpack/webpack-dev-server/issues/1724
80
80
describe ( 'express.static.mine.types' , ( ) => {
81
- beforeEach ( ( ) => {
82
- jest . resetModules ( ) ;
83
- } ) ;
84
-
85
- afterEach ( ( ) => {
86
- jest . unmock ( 'express' ) ;
87
- } ) ;
88
-
89
81
it ( "should success even if mine.types doesn't exist" , ( done ) => {
90
82
jest . mock ( 'express' , ( ) => {
91
83
const data = jest . requireActual ( 'express' ) ;
@@ -118,31 +110,6 @@ describe('Server', () => {
118
110
} ) ;
119
111
} ) ;
120
112
121
- describe ( 'WEBPACK_DEV_SERVER environment variable' , ( ) => {
122
- const OLD_ENV = process . env ;
123
-
124
- beforeEach ( ( ) => {
125
- // this is important - it clears the cache
126
- jest . resetModules ( ) ;
127
-
128
- process . env = { ...OLD_ENV } ;
129
-
130
- delete process . env . WEBPACK_DEV_SERVER ;
131
- } ) ;
132
-
133
- afterEach ( ( ) => {
134
- process . env = OLD_ENV ;
135
- } ) ;
136
-
137
- it ( 'should be present' , ( ) => {
138
- expect ( process . env . WEBPACK_DEV_SERVER ) . toBeUndefined ( ) ;
139
-
140
- require ( '../../lib/Server' ) ;
141
-
142
- expect ( process . env . WEBPACK_DEV_SERVER ) . toBe ( true ) ;
143
- } ) ;
144
- } ) ;
145
-
146
113
describe ( 'Invalidate Callback' , ( ) => {
147
114
describe ( 'Testing callback functions on calling invalidate without callback' , ( ) => {
148
115
it ( 'should be `noop` (the default callback function)' , ( done ) => {
@@ -178,4 +145,29 @@ describe('Server', () => {
178
145
} ) ;
179
146
} ) ;
180
147
} ) ;
148
+
149
+ describe ( 'WEBPACK_DEV_SERVER environment variable' , ( ) => {
150
+ const OLD_ENV = process . env ;
151
+
152
+ beforeEach ( ( ) => {
153
+ // this is important - it clears the cache
154
+ jest . resetModules ( ) ;
155
+
156
+ process . env = { ...OLD_ENV } ;
157
+
158
+ delete process . env . WEBPACK_DEV_SERVER ;
159
+ } ) ;
160
+
161
+ afterEach ( ( ) => {
162
+ process . env = OLD_ENV ;
163
+ } ) ;
164
+
165
+ it ( 'should be present' , ( ) => {
166
+ expect ( process . env . WEBPACK_DEV_SERVER ) . toBeUndefined ( ) ;
167
+
168
+ require ( '../../lib/Server' ) ;
169
+
170
+ expect ( process . env . WEBPACK_DEV_SERVER ) . toBe ( true ) ;
171
+ } ) ;
172
+ } ) ;
181
173
} ) ;
0 commit comments