33 lines
966 B
TypeScript
33 lines
966 B
TypeScript
/**
|
|
* Runs every pgTAP file under supabase/tests against a migrated PGlite
|
|
* database. One vitest case per SQL file: the failing TAP lines are the
|
|
* assertion message, so a red test names the exact pgTAP check.
|
|
*/
|
|
import type { PGlite } from '@electric-sql/pglite'
|
|
import { createMigratedDatabase, listPgTapTests, runPgTapFile } from './harness'
|
|
|
|
const files = await listPgTapTests()
|
|
|
|
describe('pgTAP suite (supabase/tests) on PGlite', () => {
|
|
let db: PGlite
|
|
|
|
beforeAll(async () => {
|
|
db = await createMigratedDatabase()
|
|
})
|
|
|
|
afterAll(async () => {
|
|
await db?.close()
|
|
})
|
|
|
|
it('finds at least one pgTAP file', () => {
|
|
expect(files.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
it.each(files)('%s passes', async (file) => {
|
|
const report = await runPgTapFile(db, file)
|
|
const okCount = report.lines.filter((l) => /^ok\b/.test(l)).length
|
|
expect(report.failures, report.lines.join('\n')).toEqual([])
|
|
expect(okCount).toBeGreaterThan(0)
|
|
})
|
|
})
|