Skip to content

Commit 3b780fa

Browse files
committed
fix code coverage
1 parent 0fa7153 commit 3b780fa

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/__tests__/wait-for.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('can timeout after the given timeout time', async () => {
2323
expect(result).toBe(error)
2424
})
2525

26-
test('uses generic error if there was no last error', async () => {
26+
test('if no error is thrown then throws a timeout error', async () => {
2727
const result = await waitFor(
2828
() => {
2929
// eslint-disable-next-line no-throw-literal
@@ -34,6 +34,17 @@ test('uses generic error if there was no last error', async () => {
3434
expect(result).toMatchInlineSnapshot(`[Error: Timed out in waitFor.]`)
3535
})
3636

37+
test('if showOriginalStackTrace on a timeout error then the stack trace does not include this file', async () => {
38+
const result = await waitFor(
39+
() => {
40+
// eslint-disable-next-line no-throw-literal
41+
throw undefined
42+
},
43+
{timeout: 8, interval: 5, showOriginalStackTrace: true},
44+
).catch(e => e)
45+
expect(result.stack).not.toMatch(__dirname)
46+
})
47+
3748
test('uses full stack error trace when showOriginalStackTrace present', async () => {
3849
const error = new Error('Throws the full stack trace')
3950
// even if the error is a TestingLibraryElementError

src/wait-for.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function waitFor(
2828
attributes: true,
2929
characterData: true,
3030
},
31-
} = {},
31+
},
3232
) {
3333
if (typeof callback !== 'function') {
3434
throw new TypeError('Received `callback` arg must be a function')

0 commit comments

Comments
 (0)