ReviewOS

also looking at this

stacks/bun-query-builder

test(pg): make the Postgres-gated tests actually run in CI

#1077
Merged glennmichael123 wants to merge test/pg-gated-tests-in-ci into main
4 files +68 -35
packages/bun-query-builder/test/integration.postgres.test.tsmodified+6-12
Changes to packages/bun-query-builder/test/integration.postgres.test.ts
@@ -14,18 +14,10 @@ import { tmpdir } from 'node:os'
1414import { join, resolve } from 'node:path'
1515import { SQL } from 'bun'
1616import { describe, expect, it } from 'bun:test'
17import { PG_URL, probePostgres } from './pg'
18
19const pgAvailable = await probePostgres()
1720
18const PG_URL = `postgres://${process.env.USER}@localhost:5432/postgres`
19let pgAvailable = false
20try {
21 const probe = new SQL(PG_URL)
22 await probe.unsafe('SELECT 1')
23 await probe.end()
24 pgAvailable = true
25}
26catch {
27 pgAvailable = false
28}
2921
3022describe.skipIf(!pgAvailable)('Postgres integration (#1038)', () => {
3123 it('runs ORM CRUD + relations + raw builder against live Postgres', () => {
@@ -47,7 +39,9 @@ await raw.unsafe('CREATE TABLE _qb_users (id serial primary key, name text, age
4739await raw.unsafe('CREATE TABLE _qb_posts (id serial primary key, title text, pguser_id int)')
4840await raw.end()
4941
50setConfig({ dialect: 'postgres', database: { database: 'postgres', username: process.env.USER, host: 'localhost', port: 5432, password: '' } })
42// Configure from the same URL the gate probed, not a second hand-built copy of
43// it — the two drifting is what made this file skip in CI.
44setConfig({ dialect: 'postgres', database: { url: URL } })
5145resetConnection()
5246
5347// defineModel registers in the model registry, so relations resolve to the