Skip to content

Commit 77131a1

Browse files
committed
Assert frontend error reports are not synthetic
1 parent 0edd4dd commit 77131a1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

e2e/cloud/frontend-error-reporting.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import { revisit, visit } from "../src/surfaces/browser";
2121
type ReportedException = {
2222
readonly type?: string;
2323
readonly value?: string;
24+
// The reporter marks an exception `synthetic` when it was handed something
25+
// that was not a real error and had to invent a stack for it — the stack of
26+
// whatever frame did the reporting.
27+
readonly mechanism?: { readonly synthetic?: boolean };
2428
};
2529

2630
type ReportedEvent = {
@@ -110,6 +114,15 @@ scenario(
110114
expect(failure.value ?? "", "no report is a bag of keys").not.toMatch(
111115
/captured as exception with keys/,
112116
);
117+
// The other half of the bug, and the half a readable message can hide:
118+
// handed a non-error, the reporter still has no stack of its own to
119+
// group on and invents one from the reporting frame, so unrelated
120+
// failures keep merging into a single bucket. Only a real error clears
121+
// this flag.
122+
expect(
123+
failure.mechanism?.synthetic ?? false,
124+
"the report carries the failure's own stack, not the reporter's frame",
125+
).toBe(false);
113126
}
114127

115128
await page.unroute("**/api/integrations");

0 commit comments

Comments
 (0)