Skip to content

Commit 373c73f

Browse files
committed
Test debug has longer async stack
1 parent a74e015 commit 373c73f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/index.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -882,10 +882,27 @@ function get() {
882882
t('Async stack trace', async() => {
883883
return [
884884
parseInt(new Error().stack.split('\n')[1].split(':')[1]) + 1,
885-
parseInt(await sql.begin(sql => sql`select.sql`).catch(x => x.stack.split('\n').pop().split(':')[1]))
885+
parseInt(await sql`select.sql`.catch(x => x.stack.split('\n').pop().split(':')[1]))
886886
]
887887
})
888888

889+
t('Debug has long async stack trace', async() => {
890+
const sql = postgres({ debug: true })
891+
892+
return [
893+
'watyo',
894+
await yo().catch(x => x.stack.match(/wat|yo/g).join(''))
895+
]
896+
897+
function yo() {
898+
return wat()
899+
}
900+
901+
function wat() {
902+
return sql`selec 1`
903+
}
904+
})
905+
889906
t('Error contains query string', async() => [
890907
'selec 1',
891908
(await sql`selec 1`.catch(err => err.query))

0 commit comments

Comments
 (0)