also looking at this
test(pg): make the Postgres-gated tests actually run in CI
#1077
4 files
+68
-35
| @@ -24,20 +24,12 @@ import { join, resolve } from 'node:path' | ||
| 24 | 24 | import process from 'node:process' |
| 25 | 25 | import { SQL } from 'bun' |
| 26 | 26 | import { describe, expect, it } from 'bun:test' |
| 27 | import { PG_URL, probePostgres } from './pg' | |
| 28 | ||
| 29 | const pgAvailable = await probePostgres() | |
| 27 | 30 | |
| 28 | 31 | const SRC = resolve(import.meta.dir, '../src/index.ts') |
| 29 | const PG_URL = `postgres://${process.env.USER}@localhost:5432/postgres` | |
| 30 | ||
| 31 | let pgAvailable = false | |
| 32 | try { | |
| 33 | const probe = new SQL(PG_URL) | |
| 34 | await probe.unsafe('SELECT 1') | |
| 35 | await probe.end() | |
| 36 | pgAvailable = true | |
| 37 | } | |
| 38 | catch { | |
| 39 | pgAvailable = false | |
| 40 | } | |
| 32 | ||
| 41 | 33 | |
| 42 | 34 | /** A throwaway workspace with a migrations directory. */ |
| 43 | 35 | function workspace(files: Record<string, string>): string { |