mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(test/utils): check both ts and js for nuxt.config
This commit is contained in:
parent
b0ca62d0c7
commit
5b66afc23a
@ -14,9 +14,16 @@ export const version = `v${coreVersion}`
|
|||||||
|
|
||||||
export const loadFixture = async function (fixture, overrides) {
|
export const loadFixture = async function (fixture, overrides) {
|
||||||
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
|
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
|
||||||
const configFile = path.resolve(rootDir, `nuxt.config${process.env.NUXT_TS === 'true' ? '.ts' : '.js'}`)
|
let config = {}
|
||||||
|
|
||||||
|
for (const ext of ['ts', 'js']) {
|
||||||
|
const configFile = path.resolve(rootDir, `nuxt.config.${ext}`)
|
||||||
|
if (fs.existsSync(configFile)) {
|
||||||
|
config = (await import(`../fixtures/${fixture}/nuxt.config`)).default
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let config = fs.existsSync(configFile) ? (await import(`../fixtures/${fixture}/nuxt.config`)).default : {}
|
|
||||||
if (typeof config === 'function') {
|
if (typeof config === 'function') {
|
||||||
config = await config()
|
config = await config()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user