@@ -312,8 +312,12 @@ describe('PostgreSQL - helper', async () => {
312312
313313 describe ( 'getSessionStore' , ( ) => {
314314 it ( 'throws when no connection is configured — no MemoryStore fallback' , ( ) => {
315- const savedPgHost = process . env . PGHOST ;
316- delete process . env . PGHOST ;
315+ // GitHub-hosted runners preset PGUSER/PGPASSWORD for their bundled
316+ // postgres tooling, and the connection guard honours the PG* family, so
317+ // every variable it reads must be cleared here.
318+ const PG_VARS = [ 'PGHOST' , 'PGHOSTADDR' , 'PGUSER' , 'PGDATABASE' ] as const ;
319+ const saved = PG_VARS . map ( ( v ) => [ v , process . env [ v ] ] as const ) ;
320+ for ( const v of PG_VARS ) delete process . env [ v ] ;
317321 getDatabaseMock . mockReturnValue ( {
318322 type : 'postgres' ,
319323 enabled : true ,
@@ -324,7 +328,9 @@ describe('PostgreSQL - helper', async () => {
324328 / P o s t g r e s c o n n e c t i o n i s r e q u i r e d f o r s e s s i o n s t o r a g e / ,
325329 ) ;
326330
327- if ( savedPgHost !== undefined ) process . env . PGHOST = savedPgHost ;
331+ for ( const [ v , val ] of saved ) {
332+ if ( val !== undefined ) process . env [ v ] = val ;
333+ }
328334 } ) ;
329335
330336 it ( 'passes the shared pool to connect-pg-simple with createTableIfMissing' , ( ) => {
0 commit comments