mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +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) {
|
||||
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') {
|
||||
config = await config()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user