import { readFile } from 'node:fs/promises' import { join, relative } from 'node:path' import { listSeeds, seedDir, supabaseDir } from './harness' /** * The CLI applies only the literal files of config.toml sql_paths, while the * harness applies every seed on disk: a seed forgotten in the list would pass * here and never reach `supabase db reset`. */ describe('versioned seeds', () => { it('are all listed in config.toml [db.seed] sql_paths', async () => { const config = await readFile(join(supabaseDir, 'config.toml'), 'utf8') const line = config.match(/^sql_paths\s*=\s*\[(.*)\]/m)?.[1] ?? '' const listed = [...line.matchAll(/"([^"]+)"/g)].map((m) => m[1]) for (const file of await listSeeds()) { const path = './' + relative(supabaseDir, join(seedDir, file)) expect(listed, `${path} missing from sql_paths`).toContain(path) } }) })