mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-13 12:18:15 +00:00
29 lines
969 B
TypeScript
29 lines
969 B
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { loadNuxtConfig } from '@nuxt/kit'
|
|
|
|
describe('loadNuxtConfig', () => {
|
|
it('should add named aliases for local layers', async () => {
|
|
const cwd = fileURLToPath(new URL('./layer-fixture', import.meta.url))
|
|
const config = await loadNuxtConfig({ cwd })
|
|
for (const alias in config.alias) {
|
|
config.alias[alias] = config.alias[alias]!.replace(cwd, '<rootDir>')
|
|
}
|
|
expect(config.alias).toMatchInlineSnapshot(`
|
|
{
|
|
"#build": "<rootDir>/.nuxt",
|
|
"#internal/nuxt/paths": "<rootDir>/.nuxt/paths.mjs",
|
|
"#layers/layer-fixture": "<rootDir>",
|
|
"#layers/test": "<rootDir>/layers/test",
|
|
"#shared": "<rootDir>/shared",
|
|
"@": "<rootDir>",
|
|
"@@": "<rootDir>",
|
|
"assets": "<rootDir>/assets",
|
|
"public": "<rootDir>/public",
|
|
"~": "<rootDir>",
|
|
"~~": "<rootDir>",
|
|
}
|
|
`)
|
|
})
|
|
})
|