Skip to content

Commit fa2f080

Browse files
committed
fix: prettify hot-and-live-reload.test.js file
1 parent 451c63e commit fa2f080

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

test/e2e/hot-and-live-reload.test.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const multiCompilerConfig = require("../fixtures/multi-compiler-one-configuratio
2525

2626
const cssFilePath = path.resolve(
2727
__dirname,
28-
"../fixtures/reload-config/main.css"
28+
"../fixtures/reload-config/main.css",
2929
);
3030

3131
const INVALID_MESSAGE = "[webpack-dev-server] App updated. Recompiling...";
@@ -366,7 +366,7 @@ describe("hot and live reload", () => {
366366
host: `127.0.0.1:${devServerOptions.port}`,
367367
origin: `http://127.0.0.1:${devServerOptions.port}`,
368368
},
369-
}
369+
},
370370
);
371371

372372
let opened = false;
@@ -406,7 +406,7 @@ describe("hot and live reload", () => {
406406
});
407407
} else {
408408
const sockjs = new SockJS(
409-
`http://127.0.0.1:${devServerOptions.port}/ws`
409+
`http://127.0.0.1:${devServerOptions.port}/ws`,
410410
);
411411

412412
let opened = false;
@@ -476,18 +476,16 @@ describe("hot and live reload", () => {
476476
});
477477

478478
const backgroundColorBefore = await page.evaluate(() => {
479-
480479
const body = document.body;
481480

482-
483481
return getComputedStyle(body)["background-color"];
484482
});
485483

486484
expect(backgroundColorBefore).toEqual("rgb(0, 0, 255)");
487485

488486
fs.writeFileSync(
489487
cssFilePath,
490-
"body { background-color: rgb(255, 0, 0); }"
488+
"body { background-color: rgb(255, 0, 0); }",
491489
);
492490

493491
let waitHot =
@@ -521,7 +519,7 @@ describe("hot and live reload", () => {
521519
waitLiveReload = true;
522520
} else if (
523521
webpackOptions.entry.some((item) =>
524-
item.includes("live-reload=false")
522+
item.includes("live-reload=false"),
525523
)
526524
) {
527525
waitLiveReload = false;
@@ -541,9 +539,8 @@ describe("hot and live reload", () => {
541539
if (waitHot) {
542540
await page.waitForFunction(
543541
() =>
544-
545542
getComputedStyle(document.body)["background-color"] ===
546-
"rgb(255, 0, 0)"
543+
"rgb(255, 0, 0)",
547544
);
548545

549546
expect(doneHotUpdate).toBe(true);
@@ -564,10 +561,8 @@ describe("hot and live reload", () => {
564561
}
565562

566563
const backgroundColorAfter = await page.evaluate(() => {
567-
568564
const body = document.body;
569565

570-
571566
return getComputedStyle(body)["background-color"];
572567
});
573568

@@ -639,7 +634,7 @@ describe("simple hot config HMR plugin", () => {
639634
expect(JSON.stringify(response.status())).toMatchSnapshot();
640635

641636
expect(
642-
JSON.stringify(consoleMessages.map((message) => message.text()))
637+
JSON.stringify(consoleMessages.map((message) => message.text())),
643638
).toMatchSnapshot();
644639

645640
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
@@ -703,7 +698,7 @@ describe("simple hot config HMR plugin with already added HMR plugin", () => {
703698
expect(JSON.stringify(response.status())).toMatchSnapshot();
704699

705700
expect(
706-
JSON.stringify(consoleMessages.map((message) => message.text()))
701+
JSON.stringify(consoleMessages.map((message) => message.text())),
707702
).toMatchSnapshot();
708703

709704
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
@@ -747,7 +742,7 @@ describe("simple config with already added HMR plugin", () => {
747742
await server.start();
748743

749744
expect(loggerWarnSpy).toHaveBeenCalledWith(
750-
`"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`
745+
`"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`,
751746
);
752747

753748
await server.stop();
@@ -759,7 +754,7 @@ describe("simple config with already added HMR plugin", () => {
759754
await server.start();
760755

761756
expect(loggerWarnSpy).toHaveBeenCalledWith(
762-
`"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`
757+
`"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`,
763758
);
764759

765760
await server.stop();
@@ -771,7 +766,7 @@ describe("simple config with already added HMR plugin", () => {
771766
await server.start();
772767

773768
expect(loggerWarnSpy).not.toHaveBeenCalledWith(
774-
`"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`
769+
`"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`,
775770
);
776771

777772
await server.stop();
@@ -831,7 +826,7 @@ describe("multi compiler hot config HMR plugin", () => {
831826
expect(JSON.stringify(response.status())).toMatchSnapshot();
832827

833828
expect(
834-
JSON.stringify(consoleMessages.map((message) => message.text()))
829+
JSON.stringify(consoleMessages.map((message) => message.text())),
835830
).toMatchSnapshot();
836831

837832
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
@@ -891,7 +886,7 @@ describe("hot disabled HMR plugin", () => {
891886
expect(JSON.stringify(response.status())).toMatchSnapshot();
892887

893888
expect(
894-
JSON.stringify(consoleMessages.map((message) => message.text()))
889+
JSON.stringify(consoleMessages.map((message) => message.text())),
895890
).toMatchSnapshot();
896891

897892
expect(JSON.stringify(pageErrors)).toMatchSnapshot();

0 commit comments

Comments
 (0)