Skip to content

Commit

Permalink
test: skip sql tests when psql binary is not installed (oven-sh#16233)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac authored Jan 8, 2025
1 parent 043cb7f commit 833b718
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion test/js/sql/sql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { $ } from "bun";
import { bunExe, isCI, withoutAggressiveGC } from "harness";
import path from "path";

if (!isCI) {
const hasPsql = Bun.which("psql");
if (!isCI && hasPsql) {
require("./bootstrap.js");

// macOS location: /opt/homebrew/var/postgresql@14/pg_hba.conf
Expand Down
32 changes: 17 additions & 15 deletions test/js/sql/tls-sql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ import { sql as SQL } from "bun";

const TLS_POSTGRES_DATABASE_URL = getSecret("TLS_POSTGRES_DATABASE_URL");

test("tls (explicit)", async () => {
const sql = new SQL({
url: TLS_POSTGRES_DATABASE_URL!,
tls: true,
adapter: "postgresql",
});
if (TLS_POSTGRES_DATABASE_URL) {
test("tls (explicit)", async () => {
const sql = new SQL({
url: TLS_POSTGRES_DATABASE_URL!,
tls: true,
adapter: "postgresql",
});

const [{ one, two }] = await sql`SELECT 1 as one, '2' as two`;
expect(one).toBe(1);
expect(two).toBe("2");
});
const [{ one, two }] = await sql`SELECT 1 as one, '2' as two`;
expect(one).toBe(1);
expect(two).toBe("2");
});

test("tls (implicit)", async () => {
const [{ one, two }] = await SQL`SELECT 1 as one, '2' as two`;
expect(one).toBe(1);
expect(two).toBe("2");
});
test("tls (implicit)", async () => {
const [{ one, two }] = await SQL`SELECT 1 as one, '2' as two`;
expect(one).toBe(1);
expect(two).toBe("2");
});
}

0 comments on commit 833b718

Please sign in to comment.