Skip to content

Commit f3be6ce

Browse files
committed
tests: elide stack in error snapshot assertion
1 parent ca635f6 commit f3be6ce

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

test/__snapshots__/extend.test.ts.snap

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ exports[`lib/extend.ts should handle the get* method failures 1`] = `
1616
1717
1818
</div>
19-
at getElementError <stack>:X:X
20-
at __puppeteer_evaluation_script__<stack>:X:X
21-
at Object.<anonymous> <stack>:X:X
22-
at anonymous <stack>:X:X"
19+
<stack>:X:X"
2320
`;
2421
2522
exports[`lib/extend.ts should handle the get* methods 1`] = `"<input type=\\"text\\" data-testid=\\"testid-text-input\\">"`;

test/extend.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('lib/extend.ts', () => {
5656
await scope.getByTitle('missing')
5757
fail()
5858
} catch (err) {
59-
err.message = err.message.replace(/(\(.*?)?:\d+:\d+\)?/g, '<stack>:X:X')
59+
err.message = err.message.replace(/(\s*at .*(\n|$))+/gm, '\n <stack>:X:X')
6060
expect(err.message).toMatchSnapshot()
6161
}
6262
})

0 commit comments

Comments
 (0)