2024-01-17 11:46:13 +00:00
|
|
|
import { fileURLToPath } from 'node:url'
|
2024-06-24 09:39:38 +00:00
|
|
|
import { rm } from 'node:fs/promises'
|
|
|
|
|
2024-08-23 19:59:25 +00:00
|
|
|
import { glob } from 'tinyglobby'
|
2024-08-23 19:33:47 +00:00
|
|
|
import { exec } from 'tinyexec'
|
2024-01-17 11:46:13 +00:00
|
|
|
|
|
|
|
async function initTesting () {
|
2024-08-23 19:59:25 +00:00
|
|
|
const dirs = await glob(['*'], {
|
2024-01-17 11:46:13 +00:00
|
|
|
onlyDirectories: true,
|
|
|
|
cwd: fileURLToPath(new URL('./fixtures', import.meta.url)),
|
2024-04-05 18:08:32 +00:00
|
|
|
absolute: true,
|
2024-01-17 11:46:13 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
await Promise.all([
|
|
|
|
// clear nuxt build files
|
2024-06-24 09:39:38 +00:00
|
|
|
...dirs.map(dir => rm(`${dir}/.nuxt`, { force: true, recursive: true })),
|
2024-01-17 11:46:13 +00:00
|
|
|
// clear vite cache
|
2024-06-24 09:39:38 +00:00
|
|
|
...dirs.map(dir => rm(`${dir}/node_modules/.cache`, { force: true, recursive: true })),
|
2024-01-17 11:46:13 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
await Promise.all(
|
2024-08-23 19:33:47 +00:00
|
|
|
dirs.map(dir => exec('pnpm', ['nuxi', 'prepare'], { nodeOptions: { cwd: dir } })),
|
2024-01-17 11:46:13 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
initTesting()
|