From 5b66afc23ac4dacfef850a2eb1bd4ee97f117d66 Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Sun, 20 Jan 2019 22:13:27 +0330 Subject: [PATCH] fix(test/utils): check both ts and js for nuxt.config --- test/utils/nuxt.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/utils/nuxt.js b/test/utils/nuxt.js index d6397a9b00..8b715536cb 100644 --- a/test/utils/nuxt.js +++ b/test/utils/nuxt.js @@ -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() }