2023-12-20 22:18:31 +00:00
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { bench, describe } from 'vitest'
|
|
|
|
import { normalize } from 'pathe'
|
|
|
|
import { withoutTrailingSlash } from 'ufo'
|
|
|
|
import { loadNuxt } from '../src'
|
|
|
|
|
|
|
|
const emptyDir = withoutTrailingSlash(normalize(fileURLToPath(new URL('../../../node_modules/fixture', import.meta.url))))
|
|
|
|
const basicTestFixtureDir = withoutTrailingSlash(normalize(fileURLToPath(new URL('../../../test/fixtures/basic', import.meta.url))))
|
|
|
|
|
|
|
|
describe('loadNuxt', () => {
|
|
|
|
bench('empty directory', async () => {
|
|
|
|
const nuxt = await loadNuxt({
|
|
|
|
cwd: emptyDir,
|
2024-04-05 18:08:32 +00:00
|
|
|
ready: true,
|
2023-12-20 22:18:31 +00:00
|
|
|
})
|
|
|
|
await nuxt.close()
|
|
|
|
})
|
|
|
|
|
|
|
|
bench('basic test fixture', async () => {
|
|
|
|
const nuxt = await loadNuxt({
|
|
|
|
cwd: basicTestFixtureDir,
|
2024-04-05 18:08:32 +00:00
|
|
|
ready: true,
|
2023-12-20 22:18:31 +00:00
|
|
|
})
|
|
|
|
await nuxt.close()
|
|
|
|
})
|
|
|
|
})
|