We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc51e7f commit cc3c1c2Copy full SHA for cc3c1c2
tests/index.js
@@ -978,6 +978,21 @@ t('Query and parameters are enumerable if debug is set', async() => {
978
]
979
})
980
981
+t('connect_timeout works', async() => {
982
+ const connect_timeout = 0.2
983
+ const server = net.createServer()
984
+ server.listen()
985
+ const sql = postgres({ port: server.address().port, connect_timeout })
986
+ const start = Date.now()
987
+ let end
988
+ await sql`select 1`.catch((e) => {
989
+ if (e.code !== 'CONNECT_TIMEOUT')
990
+ throw e
991
+ end = Date.now()
992
+ })
993
+ return [connect_timeout, Math.floor((end - start) / 100) / 10]
994
+})
995
+
996
t('connect_timeout throws proper error', async() => [
997
'CONNECT_TIMEOUT',
998
await postgres({
0 commit comments