2023-01-22 16:46:45 +00:00
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { dirname, join } from 'node:path'
|
|
|
|
import fs from 'fs-extra'
|
|
|
|
|
|
|
|
const dir = dirname(fileURLToPath(import.meta.url))
|
|
|
|
const fixtureDir = join(dir, 'fixtures')
|
|
|
|
const tempDir = join(dir, 'fixtures-temp')
|
|
|
|
|
|
|
|
export async function setup () {
|
|
|
|
if (fs.existsSync(tempDir)) {
|
|
|
|
await fs.remove(tempDir)
|
|
|
|
}
|
2023-07-19 14:43:28 +00:00
|
|
|
await fs.copy(fixtureDir, tempDir, {
|
|
|
|
filter: src => !src.includes('.cache')
|
|
|
|
})
|
2023-01-22 16:46:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function teardown () {
|
|
|
|
if (fs.existsSync(tempDir)) {
|
|
|
|
await fs.remove(tempDir)
|
|
|
|
}
|
|
|
|
}
|