mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
chore: simplify loadFixture
This commit is contained in:
parent
2f2ec7ac30
commit
e1d4dd59c7
@ -16,12 +16,13 @@ export const loadFixture = async function (fixture, overrides) {
|
||||
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
|
||||
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`)
|
||||
try {
|
||||
await import(`../fixtures/${fixture}/nuxt.config`)
|
||||
config = config.default || config
|
||||
break
|
||||
} catch (e) {
|
||||
// Ignore MODULE_NOT_FOUND
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user