Skip to content

Commit 5057067

Browse files
test: fix
1 parent ba623f6 commit 5057067

1 file changed

Lines changed: 33 additions & 36 deletions

File tree

test/server/open-option.test.js

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@ const internalIPv4 = internalIp.v4.sync();
2020

2121
describe('"open" option', () => {
2222
let compiler;
23-
let server;
2423

2524
beforeEach(() => {
2625
compiler = webpack(config);
2726
});
2827

2928
afterEach(async () => {
3029
open.mockClear();
31-
32-
await server.stop();
3330
});
3431

3532
it("should work with unspecified host", async () => {
36-
server = new Server(
33+
const server = new Server(
3734
{
3835
open: true,
3936
port,
@@ -50,7 +47,7 @@ describe('"open" option', () => {
5047
});
5148

5249
it("should work with the 'https' option", async () => {
53-
server = new Server(
50+
const server = new Server(
5451
{
5552
open: true,
5653
port,
@@ -70,7 +67,7 @@ describe('"open" option', () => {
7067
it("should work with '0.0.0.0' host", async () => {
7168
const host = "0.0.0.0";
7269

73-
server = new Server(
70+
const server = new Server(
7471
{
7572
host,
7673
port,
@@ -90,7 +87,7 @@ describe('"open" option', () => {
9087
it("should work with '::' host", async () => {
9188
const host = "::";
9289

93-
server = new Server(
90+
const server = new Server(
9491
{
9592
host,
9693
port,
@@ -110,7 +107,7 @@ describe('"open" option', () => {
110107
it("should work with 'localhost' host", async () => {
111108
const host = "localhost";
112109

113-
server = new Server(
110+
const server = new Server(
114111
{
115112
host,
116113
port,
@@ -130,7 +127,7 @@ describe('"open" option', () => {
130127
it("should work with '127.0.0.1' host", async () => {
131128
const host = "127.0.0.1";
132129

133-
server = new Server(
130+
const server = new Server(
134131
{
135132
host,
136133
port,
@@ -150,7 +147,7 @@ describe('"open" option', () => {
150147
it("should work with '::1' host", async () => {
151148
const host = "::1";
152149

153-
server = new Server(
150+
const server = new Server(
154151
{
155152
host,
156153
port,
@@ -168,7 +165,7 @@ describe('"open" option', () => {
168165
});
169166

170167
it(`should work with '${internalIPv4}' host`, async () => {
171-
server = new Server(
168+
const server = new Server(
172169
{
173170
host: internalIPv4,
174171
port,
@@ -188,7 +185,7 @@ describe('"open" option', () => {
188185
it("should work with boolean", async () => {
189186
const host = "localhost";
190187

191-
server = new Server(
188+
const server = new Server(
192189
{
193190
host,
194191
port,
@@ -208,7 +205,7 @@ describe('"open" option', () => {
208205
it("should work with boolean but don't close with 'false' value", async () => {
209206
const host = "localhost";
210207

211-
server = new Server(
208+
const server = new Server(
212209
{
213210
host,
214211
port,
@@ -226,7 +223,7 @@ describe('"open" option', () => {
226223
it("should work with relative string", async () => {
227224
const host = "localhost";
228225

229-
server = new Server(
226+
const server = new Server(
230227
{
231228
host,
232229
port,
@@ -246,7 +243,7 @@ describe('"open" option', () => {
246243
it('should work with "<url>" pattern', async () => {
247244
const host = "localhost";
248245

249-
server = new Server(
246+
const server = new Server(
250247
{
251248
host,
252249
port,
@@ -266,7 +263,7 @@ describe('"open" option', () => {
266263
it('should work with relative string starting with "/"', async () => {
267264
const host = "localhost";
268265

269-
server = new Server(
266+
const server = new Server(
270267
{
271268
host,
272269
port,
@@ -286,7 +283,7 @@ describe('"open" option', () => {
286283
it("should work with absolute string", async () => {
287284
const host = "localhost";
288285

289-
server = new Server(
286+
const server = new Server(
290287
{
291288
open: `http://${host}:${port}/index.html`,
292289
port,
@@ -306,7 +303,7 @@ describe('"open" option', () => {
306303
it("should work with multiple relative strings", async () => {
307304
const host = "localhost";
308305

309-
server = new Server(
306+
const server = new Server(
310307
{
311308
host: "localhost",
312309
port,
@@ -337,7 +334,7 @@ describe('"open" option', () => {
337334
it("should work with multiple absolute strings", async () => {
338335
const host = "localhost";
339336

340-
server = new Server(
337+
const server = new Server(
341338
{
342339
host: "localhost",
343340
port,
@@ -371,7 +368,7 @@ describe('"open" option', () => {
371368
it('should work with "<url>" pattern in multiple strings', async () => {
372369
const host = "localhost";
373370

374-
server = new Server(
371+
const server = new Server(
375372
{
376373
host: "localhost",
377374
port,
@@ -398,7 +395,7 @@ describe('"open" option', () => {
398395
it("should work with empty object", async () => {
399396
const host = "localhost";
400397

401-
server = new Server(
398+
const server = new Server(
402399
{
403400
host,
404401
port,
@@ -418,7 +415,7 @@ describe('"open" option', () => {
418415
it("should work with object and with the 'target' option", async () => {
419416
const host = "localhost";
420417

421-
server = new Server(
418+
const server = new Server(
422419
{
423420
host,
424421
port,
@@ -440,7 +437,7 @@ describe('"open" option', () => {
440437
it("should work with object and with multiple values of the 'target' option", async () => {
441438
const host = "localhost";
442439

443-
server = new Server(
440+
const server = new Server(
444441
{
445442
host,
446443
port,
@@ -473,7 +470,7 @@ describe('"open" option', () => {
473470
it("should work with object and with the 'app' option", async () => {
474471
const host = "localhost";
475472

476-
server = new Server(
473+
const server = new Server(
477474
{
478475
host,
479476
port,
@@ -496,7 +493,7 @@ describe('"open" option', () => {
496493
it("should work with object and with the 'app' and 'arguments' options", async () => {
497494
const host = "localhost";
498495

499-
server = new Server(
496+
const server = new Server(
500497
{
501498
host,
502499
port,
@@ -519,7 +516,7 @@ describe('"open" option', () => {
519516
it('should work with object with "target" and "app" options', async () => {
520517
const host = "localhost";
521518

522-
server = new Server(
519+
const server = new Server(
523520
{
524521
host,
525522
port,
@@ -543,7 +540,7 @@ describe('"open" option', () => {
543540
it('should work with <url> pattern in "target" and "app" options', async () => {
544541
const host = "localhost";
545542

546-
server = new Server(
543+
const server = new Server(
547544
{
548545
host,
549546
port,
@@ -567,7 +564,7 @@ describe('"open" option', () => {
567564
it("should work with object, with multiple value of the 'target' option and with the 'app' and 'arguments' options", async () => {
568565
const host = "localhost";
569566

570-
server = new Server(
567+
const server = new Server(
571568
{
572569
host,
573570
port,
@@ -603,7 +600,7 @@ describe('"open" option', () => {
603600
it("should work with object, with multiple value of the 'target' option (relative and absolute URLs) and with the 'app' option with arguments", async () => {
604601
const host = "localhost";
605602

606-
server = new Server(
603+
const server = new Server(
607604
{
608605
host,
609606
port,
@@ -639,7 +636,7 @@ describe('"open" option', () => {
639636
it("should work with <url> pattern in multiple open options", async () => {
640637
const host = "localhost";
641638

642-
server = new Server(
639+
const server = new Server(
643640
{
644641
host,
645642
port,
@@ -674,7 +671,7 @@ describe('"open" option', () => {
674671
it("should work with multiple open options without target", async () => {
675672
const host = "localhost";
676673

677-
server = new Server(
674+
const server = new Server(
678675
{
679676
host,
680677
port,
@@ -718,7 +715,7 @@ describe('"open" option', () => {
718715
};
719716
});
720717

721-
server = new Server(
718+
const server = new Server(
722719
{
723720
port,
724721
open: true,
@@ -754,7 +751,7 @@ describe('"open" option', () => {
754751
};
755752
});
756753

757-
server = new Server(
754+
const server = new Server(
758755
{
759756
open: "index.html",
760757
port,
@@ -790,7 +787,7 @@ describe('"open" option', () => {
790787
};
791788
});
792789

793-
server = new Server(
790+
const server = new Server(
794791
{
795792
open: {
796793
target: "index.html",
@@ -830,7 +827,7 @@ describe('"open" option', () => {
830827
};
831828
});
832829

833-
server = new Server(
830+
const server = new Server(
834831
{
835832
open: {
836833
target: "index.html",
@@ -876,7 +873,7 @@ describe('"open" option', () => {
876873
};
877874
});
878875

879-
server = new Server(
876+
const server = new Server(
880877
{
881878
open: {
882879
target: ["first.html", `http://localhost:${port}/second.html`],

0 commit comments

Comments
 (0)