18 lines
505 B
TypeScript
18 lines
505 B
TypeScript
import { readFileSync, rmSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
|
|
export default function globalTeardown() {
|
|
const statePath = join(process.cwd(), 'e2e', '.runtime', 'state.json')
|
|
try {
|
|
const { tempDir } = JSON.parse(readFileSync(statePath, 'utf8')) as { tempDir: string }
|
|
rmSync(tempDir, { recursive: true, force: true })
|
|
} catch {
|
|
// ignore
|
|
}
|
|
try {
|
|
rmSync(join(process.cwd(), 'e2e', '.runtime'), { recursive: true, force: true })
|
|
} catch {
|
|
// ignore
|
|
}
|
|
}
|