import { readFileSync, existsSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); /** * Get the seeded test token. * The token is created by global-setup.ts before tests run via Docker. */ export function getTestToken(): string { const tokenFile = join(__dirname, '.test-token'); if (existsSync(tokenFile)) { return readFileSync(tokenFile, 'utf-8').trim(); } throw new Error( 'No .test-token file found. Make sure Docker is running and global-setup.ts executed successfully.' ); }