From d8520456f4c5ed89321e9ec58f23f98838d67fde Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Tue, 16 Jun 2026 13:28:10 -0700 Subject: [PATCH] test(sql): cover both adapters in the synchronous-tls-rejection test Extends the existing postgres-only test to mysql via test.each. The constructor throws synchronously and createPooledConnectionHandle defers onClose via process.nextTick (since #32145) so the pending query rejects cleanly; this locks that in for both adapters. --- test/js/sql/sql.test.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/js/sql/sql.test.ts b/test/js/sql/sql.test.ts index 462b1fdd5700..890229ea1d68 100644 --- a/test/js/sql/sql.test.ts +++ b/test/js/sql/sql.test.ts @@ -12804,16 +12804,21 @@ describe("shared createInstance validation (no server)", () => { expect(err?.code).toBe("ERR_BORINGSSL"); }); - test.concurrent("rejects tls that is neither a boolean nor an object", async () => { - // A truthy non-boolean/non-object upgrades sslMode to `require` in JS and - // reaches the native parser as-is. - await using sql = new SQL({ ...base, username: "u", tls: 1 as any }); - const err: any = await sql`select 1`.then( - () => null, - e => e, - ); - expect(err?.message).toBe("tls must be a boolean or an object"); - }); + test.concurrent.each(["postgres", "mysql"] as const)( + "%s: rejects tls that is neither a boolean nor an object", + async adapter => { + // A truthy non-boolean/non-object upgrades sslMode to `require` in JS and + // reaches the native parser as-is. The constructor throws synchronously, + // and createPooledConnectionHandle defers onClose via process.nextTick so + // the pending query rejects cleanly instead of hanging (see #32145). + await using sql = new SQL({ ...base, adapter, username: "u", tls: 1 as any }); + const err: any = await sql`select 1`.then( + () => null, + e => e, + ); + expect(err?.message).toBe("tls must be a boolean or an object"); + }, + ); test.concurrent("rejects simple queries with parameters", async () => { await using sql = new SQL({ ...base, username: "u" });