Skip to content

Commit ff404fa

Browse files
test: stability
1 parent 27d0e8e commit ff404fa

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

test/e2e/target.test.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const workerConfigDevServerFalse = require("../fixtures/worker-config-dev-server
99
const runBrowser = require("../helpers/run-browser");
1010
const port = require("../ports-map").target;
1111

12+
const sortByTerm = (data, term) =>
13+
data.sort((a, b) => (a.indexOf(term) < b.indexOf(term) ? -1 : 1));
14+
1215
describe("target", () => {
1316
const targets = [
1417
false,
@@ -114,9 +117,12 @@ describe("target", () => {
114117
waitUntil: "networkidle0",
115118
});
116119

117-
expect(consoleMessages.map((message) => message.text())).toMatchSnapshot(
118-
"console messages",
119-
);
120+
expect(
121+
sortByTerm(
122+
consoleMessages.map((message) => message.text()),
123+
"Worker said:",
124+
),
125+
).toMatchSnapshot("console messages");
120126

121127
expect(pageErrors).toMatchSnapshot("page errors");
122128
} catch (error) {
@@ -162,9 +168,12 @@ describe("target", () => {
162168
waitUntil: "networkidle0",
163169
});
164170

165-
expect(consoleMessages.map((message) => message.text())).toMatchSnapshot(
166-
"console messages",
167-
);
171+
expect(
172+
sortByTerm(
173+
consoleMessages.map((message) => message.text()),
174+
"Worker said:",
175+
),
176+
).toMatchSnapshot("console messages");
168177

169178
expect(pageErrors).toMatchSnapshot("page errors");
170179
} catch (error) {

0 commit comments

Comments
 (0)