Skip to content

Commit dede38f

Browse files
authored
Fix UnexpectedError renders correctly flake (#1865)
1 parent fcb272f commit dede38f

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

spec/services/output/report.spec.ts

+8-11
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,19 @@ describe("UnexpectedError", () => {
4343
const cause = new Error("Whoops!");
4444

4545
const error = new UnexpectedError(cause);
46-
const rendered = error.sprint();
47-
48-
expect(rendered.replace(/at .*node_modules.*$/gm, "at ...")).toMatchInlineSnapshot(`
46+
const rendered = error
47+
.sprint()
48+
// replace node_module stack lines with "at ..."
49+
.replace(/at .*node_modules.*$/gm, "at ...")
50+
// replace sequential "at ..." lines into a single line
51+
.replace(/at \.\.\.(\n\s*at \.\.\.)+/g, "at ...");
52+
53+
expect(rendered).toMatchInlineSnapshot(`
4954
"An unexpected error occurred.
5055
5156
Error: Whoops!
5257
at spec/services/output/report.spec.ts:43:19
5358
at ...
54-
at ...
55-
at ...
56-
at ...
57-
at ...
58-
at ...
59-
at ...
60-
at ...
61-
at ...
6259
6360
This is a bug, use the link below to create an issue on GitHub.
6461

0 commit comments

Comments
 (0)