From a4092dfdc0f42cc04df55f5b6dfdba8bfda7a206 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Tue, 20 Mar 2018 18:33:22 +0000 Subject: [PATCH] feat(e2e nightwatch): allow setting cli config option. --- .../@vue/cli-plugin-e2e-nightwatch/index.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/@vue/cli-plugin-e2e-nightwatch/index.js b/packages/@vue/cli-plugin-e2e-nightwatch/index.js index b43ea6b550..4a655f16b0 100644 --- a/packages/@vue/cli-plugin-e2e-nightwatch/index.js +++ b/packages/@vue/cli-plugin-e2e-nightwatch/index.js @@ -31,17 +31,20 @@ module.exports = (api, options) => { return serverPromise.then(({ server, url }) => { // expose dev server url to tests process.env.VUE_DEV_SERVER_URL = url - // expose user options to config file - const fs = require('fs') - let userOptionsPath, userOptions - if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.config.js'))) { - userOptions = require(userOptionsPath) - } else if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.json'))) { - userOptions = require(userOptionsPath) + if (rawArgs.indexOf('--config') === -1) { + // expose user options to config file + const fs = require('fs') + let userOptionsPath, userOptions + if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.config.js'))) { + userOptions = require(userOptionsPath) + } else if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.json'))) { + userOptions = require(userOptionsPath) + } + process.env.VUE_NIGHTWATCH_USER_OPTIONS = JSON.stringify(userOptions || {}) + + rawArgs.push('--config', require.resolve('./nightwatch.config.js')) } - process.env.VUE_NIGHTWATCH_USER_OPTIONS = JSON.stringify(userOptions || {}) - rawArgs.push('--config', require.resolve('./nightwatch.config.js')) if (rawArgs.indexOf('--env') === -1) { rawArgs.push('--env', 'chrome') }