@@ -31,17 +31,20 @@ module.exports = (api, options) => {
3131 return serverPromise . then ( ( { server, url } ) => {
3232 // expose dev server url to tests
3333 process . env . VUE_DEV_SERVER_URL = url
34- // expose user options to config file
35- const fs = require ( 'fs' )
36- let userOptionsPath , userOptions
37- if ( fs . existsSync ( userOptionsPath = api . resolve ( 'nightwatch.config.js' ) ) ) {
38- userOptions = require ( userOptionsPath )
39- } else if ( fs . existsSync ( userOptionsPath = api . resolve ( 'nightwatch.json' ) ) ) {
40- userOptions = require ( userOptionsPath )
34+ if ( rawArgs . indexOf ( '--config' ) === - 1 ) {
35+ // expose user options to config file
36+ const fs = require ( 'fs' )
37+ let userOptionsPath , userOptions
38+ if ( fs . existsSync ( userOptionsPath = api . resolve ( 'nightwatch.config.js' ) ) ) {
39+ userOptions = require ( userOptionsPath )
40+ } else if ( fs . existsSync ( userOptionsPath = api . resolve ( 'nightwatch.json' ) ) ) {
41+ userOptions = require ( userOptionsPath )
42+ }
43+ process . env . VUE_NIGHTWATCH_USER_OPTIONS = JSON . stringify ( userOptions || { } )
44+
45+ rawArgs . push ( '--config' , require . resolve ( './nightwatch.config.js' ) )
4146 }
42- process . env . VUE_NIGHTWATCH_USER_OPTIONS = JSON . stringify ( userOptions || { } )
4347
44- rawArgs . push ( '--config' , require . resolve ( './nightwatch.config.js' ) )
4548 if ( rawArgs . indexOf ( '--env' ) === - 1 ) {
4649 rawArgs . push ( '--env' , 'chrome' )
4750 }
0 commit comments