Replace __dirname with import.meta.url (required by "type": "module"). Replace --wait flag with manual health polling (unsupported by podman-compose). Use explicit -p project name to isolate test containers from dev environment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
780 B
TypeScript
25 lines
780 B
TypeScript
import { execSync } from 'node:child_process'
|
|
import { rmSync } from 'node:fs'
|
|
import { dirname, resolve } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
const COMPOSE_FILE = resolve(__dirname, '../../docker-compose.test.yml')
|
|
const COMPOSE = `docker compose -p nuzlocke-test -f ${COMPOSE_FILE}`
|
|
const FIXTURES_PATH = resolve(__dirname, '.fixtures.json')
|
|
|
|
export default async function globalTeardown() {
|
|
console.log('[teardown] Stopping test containers...')
|
|
execSync(`${COMPOSE} down -v --remove-orphans`, {
|
|
encoding: 'utf-8',
|
|
stdio: 'inherit',
|
|
})
|
|
|
|
try {
|
|
rmSync(FIXTURES_PATH)
|
|
console.log('[teardown] Removed fixtures file')
|
|
} catch {
|
|
// File may not exist if setup failed
|
|
}
|
|
}
|