22 lines
609 B
TypeScript
22 lines
609 B
TypeScript
|
|
import { execSync } from 'node:child_process'
|
||
|
|
import { rmSync } from 'node:fs'
|
||
|
|
import { resolve } from 'node:path'
|
||
|
|
|
||
|
|
const COMPOSE_FILE = resolve(__dirname, '../../docker-compose.test.yml')
|
||
|
|
const FIXTURES_PATH = resolve(__dirname, '.fixtures.json')
|
||
|
|
|
||
|
|
export default async function globalTeardown() {
|
||
|
|
console.log('[teardown] Stopping test containers...')
|
||
|
|
execSync(`docker compose -f ${COMPOSE_FILE} down -v`, {
|
||
|
|
encoding: 'utf-8',
|
||
|
|
stdio: 'inherit',
|
||
|
|
})
|
||
|
|
|
||
|
|
try {
|
||
|
|
rmSync(FIXTURES_PATH)
|
||
|
|
console.log('[teardown] Removed fixtures file')
|
||
|
|
} catch {
|
||
|
|
// File may not exist if setup failed
|
||
|
|
}
|
||
|
|
}
|