Skip to content

test: move test case to appropriate place #3871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions test/server/client-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,6 @@ describe("client option", () => {

await server.stop();
});

it("disables hot entry", async () => {
const compiler = webpack(config);

server = new Server(
{
hot: false,
port,
},
compiler
);

await server.start();

const res = await request(server.app).get("/main.js");

expect(res.text).not.toMatch(/webpack\/hot\/dev-server\.js/);

await server.stop();
});
});

describe("webSocketTransport", () => {
Expand Down
29 changes: 29 additions & 0 deletions test/server/hot-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,35 @@ describe("hot option", () => {
});
});

describe("simple config with hot: false", () => {
beforeAll(async () => {
const compiler = webpack(config);

server = new Server(
{
port,
hot: false,
},
compiler
);

await server.start();

req = request(server.app);
});

afterAll(async () => {
await server.stop();
});

it("should not include hot script in the bundle", async () => {
const response = await req.get("/main.js");

expect(response.status).toEqual(200);
expect(response.text).not.toContain("webpack/hot/dev-server.js");
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add test for open browser, we should see no output for hot log

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is already present -

{
title: "should not refresh content when hot and no live reload disabled",
options: {
hot: false,
liveReload: false,
},
},

{
title: "should work and refresh content using live reload",
options: {
liveReload: true,
hot: false,
},
},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, looks like duplicate test, but here we test webpack/hot/dev-server.js, I am fine with this


describe("simple hot-only config entries", () => {
beforeAll(async () => {
const compiler = webpack(config);
Expand Down