2023-12-19 20:26:13 +00:00
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import { normalize } from 'pathe'
|
|
|
|
import { withoutTrailingSlash } from 'ufo'
|
|
|
|
import { loadNuxt } from '../src'
|
|
|
|
|
|
|
|
const repoRoot = withoutTrailingSlash(normalize(fileURLToPath(new URL('../../../', import.meta.url))))
|
|
|
|
|
|
|
|
describe('loadNuxt', () => {
|
|
|
|
it('respects hook overrides', async () => {
|
|
|
|
let hookRan = false
|
|
|
|
const nuxt = await loadNuxt({
|
|
|
|
cwd: repoRoot,
|
|
|
|
ready: true,
|
|
|
|
overrides: {
|
|
|
|
hooks: {
|
2024-03-09 06:48:15 +00:00
|
|
|
ready () {
|
2023-12-19 20:26:13 +00:00
|
|
|
hookRan = true
|
2024-04-05 18:08:32 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-12-19 20:26:13 +00:00
|
|
|
})
|
|
|
|
await nuxt.close()
|
|
|
|
expect(hookRan).toBe(true)
|
|
|
|
})
|
|
|
|
})
|