title: Nightwatch.js set testing environment via config file
body: <p>Noob Node Warning: How do you programmatically set what config object to use when running a test?</p>
  
  <p>Have been looking pretty hard for the definitive answer.</p>
  
  <p>Setup:</p>
  
  <pre><code>/e2e-tests
      |-globals.js
      |-product.page.notify.stock.js
  |-nightwatch.json 
  |-nightwatch 
  </code></pre>
  
  <ul>
  <li><a href="https://github.com/nightwatchjs/nightwatch/blob/master/bin/nightwatch.json" rel="noreferrer">nightwatch.json = setup</a></li>
  <li>nightwatch = <code>#!/usr/bin/env node require('nightwatch/bin/runner.js');</code></li>
  <li><a href="https://github.com/nightwatchjs/nightwatch/blob/master/examples/globalsModule.js" rel="noreferrer">e2e-tests/globals.js</a> Overkill, and doesn't show implementation</li>
  <li>productpage.notify.stock.js</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var SITE_URL = 'http://dev.local/', //this needs to be set somehow production||dev
    AJAX_URL = 'ajaxproc/getrandomoutofstock', //relative so this doesn't need to change
    select = '#mysize',
    emailError = '.error-message',
    outOfStockItem = {
      id: false,
      url: false
    };
  
  module.exports = {
    'Get backorder stock url': function(browser) {
      browser.url(SITEURL + AJAX_URL)
        // ommitted for brevity
    },
    'Check notify stock on product page': function(client) {
  
      client.url(SITE_URL + outOfStockItem.url);
      // ommitted for brevity
    },
  
    // remaining test stuff - not needed
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have <a href="https://github.com/nightwatchjs/nightwatch/issues/498" rel="noreferrer">seen this method here by MateuszJeziorski </a> but omits the means to get the process arguments. The <a href="https://github.com/nightwatchjs/nightwatch/tree/master/examples" rel="noreferrer">examples</a> provided with nightwatch don't answer this question either.
  I think the end result of the command would look something like this:</p>
  
  <p><code>nightwatch -somekindofparametertosetenvironment -t e2e-tests/product.page.notify.stock</code></p>