Skip to content

Commit 92f6156

Browse files
committed
feat: update client.test.js
1 parent 954904b commit 92f6156

13 files changed

+37
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200

test/e2e/client.test.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
"use strict";
22

33
const webpack = require("webpack");
4-
const { describe, test, beforeEach, afterEach } = require("@playwright/test");
54
const Server = require("../../lib/Server");
5+
const { test } = require("../helpers/playwright-test");
66
const { expect } = require("../helpers/playwright-custom-expects");
77
const config = require("../fixtures/simple-config-other/webpack.config");
88
const port = require("../ports-map")["client-option"];
99

10-
describe("client option", () => {
11-
describe("default behaviour", () => {
10+
test.describe("client option", () => {
11+
test.describe("default behaviour", () => {
1212
let compiler;
1313
let server;
1414
let pageErrors;
1515
let consoleMessages;
1616

17-
beforeEach(async () => {
17+
test.beforeEach(async () => {
1818
compiler = webpack(config);
1919

2020
server = new Server(
@@ -34,7 +34,7 @@ describe("client option", () => {
3434
consoleMessages = [];
3535
});
3636

37-
afterEach(async () => {
37+
test.afterEach(async () => {
3838
await server.stop();
3939
});
4040

@@ -54,23 +54,23 @@ describe("client option", () => {
5454
// overlay should be true by default
5555
expect(server.options.client.overlay).toBe(true);
5656

57-
expect(response.status()).toMatchSnapshotWithArray();
57+
expect(response.status()).toMatchSnapshotWithArray("response status");
5858

5959
expect(
60-
consoleMessages.map((message) => message.text()))
61-
.toMatchSnapshotWithArray();
60+
consoleMessages.map((message) => message.text()),
61+
).toMatchSnapshotWithArray("console messages");
6262

63-
expect(pageErrors).toMatchSnapshotWithArray();
63+
expect(pageErrors).toMatchSnapshotWithArray("page errors");
6464
});
6565
});
6666

67-
describe("should respect path option", () => {
67+
test.describe("should respect path option", () => {
6868
let compiler;
6969
let server;
7070
let pageErrors;
7171
let consoleMessages;
7272

73-
beforeEach(async () => {
73+
test.beforeEach(async () => {
7474
compiler = webpack(config);
7575

7676
server = new Server(
@@ -97,7 +97,7 @@ describe("client option", () => {
9797
consoleMessages = [];
9898
});
9999

100-
afterEach(async () => {
100+
test.afterEach(async () => {
101101
await server.stop();
102102
});
103103

@@ -119,23 +119,23 @@ describe("client option", () => {
119119
},
120120
);
121121

122-
expect(response.status()).toMatchSnapshotWithArray();
122+
expect(response.status()).toMatchSnapshotWithArray("response status");
123123

124124
expect(
125-
consoleMessages.map((message) => message.text()))
126-
.toMatchSnapshotWithArray();
125+
consoleMessages.map((message) => message.text()),
126+
).toMatchSnapshotWithArray("console messages");
127127

128-
expect(pageErrors).toMatchSnapshotWithArray();
128+
expect(pageErrors).toMatchSnapshotWithArray("page errors");
129129
});
130130
});
131131

132-
describe("configure client entry", () => {
132+
test.describe("configure client entry", () => {
133133
let compiler;
134134
let server;
135135
let pageErrors;
136136
let consoleMessages;
137137

138-
beforeEach(async () => {
138+
test.beforeEach(async () => {
139139
compiler = webpack(config);
140140

141141
server = new Server(
@@ -152,7 +152,7 @@ describe("client option", () => {
152152
consoleMessages = [];
153153
});
154154

155-
afterEach(async () => {
155+
test.afterEach(async () => {
156156
await server.stop();
157157
});
158158

@@ -169,19 +169,19 @@ describe("client option", () => {
169169
waitUntil: "networkidle0",
170170
});
171171

172-
expect(response.status()).toMatchSnapshotWithArray();
172+
expect(response.status()).toMatchSnapshotWithArray("response status");
173173

174174
expect(await response.text()).not.toMatch(/client\/index\.js/);
175175

176176
expect(
177-
consoleMessages.map((message) => message.text()))
178-
.toMatchSnapshotWithArray();
177+
consoleMessages.map((message) => message.text()),
178+
).toMatchSnapshotWithArray("console messages");
179179

180-
expect(pageErrors).toMatchSnapshotWithArray();
180+
expect(pageErrors).toMatchSnapshotWithArray("page errors");
181181
});
182182
});
183183

184-
describe("webSocketTransport", () => {
184+
test.describe("webSocketTransport", () => {
185185
const clientModes = [
186186
{
187187
title: 'as a string ("sockjs")',
@@ -237,7 +237,7 @@ describe("client option", () => {
237237
},
238238
];
239239

240-
describe("passed to server", () => {
240+
test.describe("passed to server", () => {
241241
clientModes.forEach((data) => {
242242
test(`${data.title} ${
243243
data.shouldThrow ? "should throw" : "should not throw"

0 commit comments

Comments
 (0)