History

Assert frontend error reports are not synthetic

Rhys Sullivan committed 2 months ago

Commit 77131a11 parent 0edd4dd1 file · +13 −0Browse files

Unified · Split

e2e/cloud/frontend-error-reporting.test.ts+13−0
@@ -21,6 +21,10 @@ import { revisit, visit } from "../src/surfaces/browser"; · 20 unmodified lines
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( · 83 unmodified lines
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");