Skip to content

Commit e9db4e2

Browse files
bjohansebasclaude
andcommitted
test(e2e): assert the multi-bundle problem union in the browser
Breaking both bundles shows the union of their problems in the shared overlay — paginated one per page, in whichever order the compilers finished. The two jsdom equivalents are removed: the union test, and no-apply-on-errored-builds, which the multi-compiler console snapshot already documents (no "Checking for updates" follows a bundle's error report). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 9515eb2 commit e9db4e2

2 files changed

Lines changed: 43 additions & 60 deletions

File tree

test/client.test.js

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,6 @@ describe("client", () => {
114114
jest.restoreAllMocks();
115115
});
116116

117-
it("does not trigger webpack on errored builds", () => {
118-
EventSourceStub.lastInstance().onmessage(
119-
makeMessage({
120-
action: "built",
121-
time: 100,
122-
hash: "1234567890abcdef",
123-
errors: ["Something broke"],
124-
warnings: [],
125-
modules: [],
126-
}),
127-
);
128-
expect(processUpdate).not.toHaveBeenCalled();
129-
});
130-
131117
it("updates overlay when an errored build becomes a warning", () => {
132118
const es = EventSourceStub.lastInstance();
133119
es.onmessage(
@@ -202,52 +188,6 @@ describe("client", () => {
202188
});
203189
});
204190

205-
describe("with multi-compiler payloads", () => {
206-
let EventSourceStub;
207-
208-
beforeEach(() => {
209-
EventSourceStub = makeEventSourceStub();
210-
globalThis.EventSource = EventSourceStub;
211-
jest.spyOn(console, "info").mockImplementation(() => {});
212-
jest.spyOn(console, "log").mockImplementation(() => {});
213-
jest.spyOn(console, "warn").mockImplementation(() => {});
214-
jest.spyOn(console, "error").mockImplementation(() => {});
215-
loadClient();
216-
});
217-
218-
afterEach(() => {
219-
jest.restoreAllMocks();
220-
});
221-
222-
it("shows the union of problems from every broken bundle", () => {
223-
const es = EventSourceStub.lastInstance();
224-
es.onmessage(
225-
makeMessage({
226-
action: "built",
227-
name: "app",
228-
time: 100,
229-
hash: "app-hash",
230-
errors: ["app broke"],
231-
warnings: [],
232-
}),
233-
);
234-
es.onmessage(
235-
makeMessage({
236-
action: "built",
237-
name: "admin",
238-
time: 100,
239-
hash: "admin-hash",
240-
errors: ["admin broke too"],
241-
warnings: [],
242-
}),
243-
);
244-
expect(clientOverlay.showProblems).toHaveBeenLastCalledWith("errors", [
245-
"app broke",
246-
"admin broke too",
247-
]);
248-
});
249-
});
250-
251191
describe("with overlay warnings enabled via the dev-server-shaped option", () => {
252192
let EventSourceStub;
253193

test/e2e/multi-compiler.test.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,49 @@ describe("multi-compiler (browser)", () => {
151151
expect(normalizeConsole(console_.messages)).toMatchSnapshot();
152152
});
153153

154+
it("shows the union of problems from every broken bundle", async () => {
155+
app = await createHotApp({
156+
apps: [
157+
{ name: "app", code: bundleApp("app", "app-v1") },
158+
{ name: "widget", code: bundleApp("widget", "widget-v1") },
159+
],
160+
});
161+
({ page, browser } = await runBrowser());
162+
163+
await page.goto(app.url);
164+
await waitForText(page, "out-app", "app-v1");
165+
await waitForText(page, "out-widget", "widget-v1");
166+
167+
app.edit("app", "broken app {{{");
168+
app.edit("widget", "broken widget {{{");
169+
170+
const handle = await page.waitForSelector(`#${OVERLAY_ID}`, {
171+
timeout: 30000,
172+
});
173+
const frame = await handle.contentFrame();
174+
175+
// Both bundles' problems share the overlay: the pager counts the union
176+
// (one problem per page; which bundle finishes breaking first varies).
177+
await frame.waitForFunction(
178+
() => document.body.textContent.includes("1 / 2"),
179+
{ timeout: 30000 },
180+
);
181+
182+
const firstPage = await frame.evaluate(() => document.body.textContent);
183+
184+
await frame.click('[aria-label="Next problem"]');
185+
await frame.waitForFunction(
186+
() => document.body.textContent.includes("2 / 2"),
187+
{ timeout: 30000 },
188+
);
189+
190+
const secondPage = await frame.evaluate(() => document.body.textContent);
191+
const union = firstPage + secondPage;
192+
193+
expect(union).toContain("> broken app");
194+
expect(union).toContain("> broken widget");
195+
});
196+
154197
it("keeps one bundle's overlay errors while a sibling rebuilds successfully", async () => {
155198
app = await createHotApp({
156199
apps: [

0 commit comments

Comments
 (0)