mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 01:53:55 +00:00
26 lines
653 B
TypeScript
26 lines
653 B
TypeScript
import { existsSync } from 'node:fs'
|
|
import { cp, rm } from 'node:fs/promises'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { dirname, join } from 'pathe'
|
|
|
|
const dir = dirname(fileURLToPath(import.meta.url))
|
|
const fixtureDir = join(dir, 'fixtures')
|
|
const tempDir = join(dir, 'fixtures-temp')
|
|
|
|
export async function setup () {
|
|
if (existsSync(tempDir)) {
|
|
await rm(tempDir, { force: true, recursive: true })
|
|
}
|
|
await cp(fixtureDir, tempDir, {
|
|
recursive: true,
|
|
filter: src => !src.includes('.cache'),
|
|
})
|
|
}
|
|
|
|
export async function teardown () {
|
|
if (existsSync(tempDir)) {
|
|
await rm(tempDir, { force: true, recursive: true })
|
|
}
|
|
}
|