Skip to content

Commit 833b718

Browse files
authored
test: skip sql tests when psql binary is not installed (#16233)
1 parent 043cb7f commit 833b718

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

Diff for: test/js/sql/sql.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { $ } from "bun";
44
import { bunExe, isCI, withoutAggressiveGC } from "harness";
55
import path from "path";
66

7-
if (!isCI) {
7+
const hasPsql = Bun.which("psql");
8+
if (!isCI && hasPsql) {
89
require("./bootstrap.js");
910

1011
// macOS location: /opt/homebrew/var/postgresql@14/pg_hba.conf

Diff for: test/js/sql/tls-sql.test.ts

+17-15
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ import { sql as SQL } from "bun";
44

55
const TLS_POSTGRES_DATABASE_URL = getSecret("TLS_POSTGRES_DATABASE_URL");
66

7-
test("tls (explicit)", async () => {
8-
const sql = new SQL({
9-
url: TLS_POSTGRES_DATABASE_URL!,
10-
tls: true,
11-
adapter: "postgresql",
12-
});
7+
if (TLS_POSTGRES_DATABASE_URL) {
8+
test("tls (explicit)", async () => {
9+
const sql = new SQL({
10+
url: TLS_POSTGRES_DATABASE_URL!,
11+
tls: true,
12+
adapter: "postgresql",
13+
});
1314

14-
const [{ one, two }] = await sql`SELECT 1 as one, '2' as two`;
15-
expect(one).toBe(1);
16-
expect(two).toBe("2");
17-
});
15+
const [{ one, two }] = await sql`SELECT 1 as one, '2' as two`;
16+
expect(one).toBe(1);
17+
expect(two).toBe("2");
18+
});
1819

19-
test("tls (implicit)", async () => {
20-
const [{ one, two }] = await SQL`SELECT 1 as one, '2' as two`;
21-
expect(one).toBe(1);
22-
expect(two).toBe("2");
23-
});
20+
test("tls (implicit)", async () => {
21+
const [{ one, two }] = await SQL`SELECT 1 as one, '2' as two`;
22+
expect(one).toBe(1);
23+
expect(two).toBe("2");
24+
});
25+
}

0 commit comments

Comments
 (0)