2026-02-20 20:08:17 +01:00
|
|
|
import { execSync } from 'node:child_process'
|
|
|
|
|
import { rmSync } from 'node:fs'
|
2026-02-20 20:19:17 +01:00
|
|
|
import { dirname, resolve } from 'node:path'
|
|
|
|
|
import { fileURLToPath } from 'node:url'
|
2026-02-20 20:08:17 +01:00
|
|
|
|
2026-02-20 20:19:17 +01:00
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
2026-02-20 20:08:17 +01:00
|
|
|
const COMPOSE_FILE = resolve(__dirname, '../../docker-compose.test.yml')
|
2026-02-20 20:19:17 +01:00
|
|
|
const COMPOSE = `docker compose -p nuzlocke-test -f ${COMPOSE_FILE}`
|
2026-02-20 20:08:17 +01:00
|
|
|
const FIXTURES_PATH = resolve(__dirname, '.fixtures.json')
|
|
|
|
|
|
|
|
|
|
export default async function globalTeardown() {
|
|
|
|
|
console.log('[teardown] Stopping test containers...')
|
2026-02-20 20:19:17 +01:00
|
|
|
execSync(`${COMPOSE} down -v --remove-orphans`, {
|
2026-02-20 20:08:17 +01:00
|
|
|
encoding: 'utf-8',
|
|
|
|
|
stdio: 'inherit',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
rmSync(FIXTURES_PATH)
|
|
|
|
|
console.log('[teardown] Removed fixtures file')
|
|
|
|
|
} catch {
|
|
|
|
|
// File may not exist if setup failed
|
|
|
|
|
}
|
|
|
|
|
}
|