title: Jenkins Javascript Path Failure
body: <p>I'm building a small test framework running Mocha + WebDriverIO via Jenkins. For some reason, the relative path isn't showing up as expected. As a result, fs.js is throwing an error:</p>
  
  <blockquote>
    <p>Error:</p>
    
    <blockquote>
      <p>Error: ENOENT, no such file or directory 'C:\workspaces\nodejstest\jenkins\JENKINS_HOME\jobs\browse_test\workspace\login.js'</p>
    </blockquote>
  </blockquote>
  
  <p>The path should be: 'C:\workspaces\nodejstest\login.js' (the absolute location of the executed script). Anybody, have any insight as to why the directory path is wrong even though I'm executing the script from the same directory, NOT the Jenkins workspace directory as the error states. When I run it from the cli, it works fine. Weird.</p>
  
  <p>Test Script (run_test.js):</p>
  
  <pre><code>var common      = require('./common/common.js'), // INCLUDES FS LIBRARY
      scriptList  = ['login', 'browse_price_ascending'];
  
  // ITERATE THROUGH SCRIPT NAMES AND EXECUTE
  for(var currentScript in scriptList){
  
      // BUILD SCRIPT PATH
      var scriptPath = './' + scriptList[currentScript] + '.js';
  
      // EVAL IS NOT ALWAYS EVIL ;)
      eval(common.fs.readFile(scriptPath) + '');
  
  }
  </code></pre>
  
  <p>Start Jenkins (run.sh):</p>
  
  <pre><code>#!/bin/bash
  export JENKINS_HOME=./jenkins/JENKINS_HOME
  java -jar ./jenkins/jenkins.war
  </code></pre>
  
  <p>Jenkins Job:</p>
  
  <pre><code>mocha $JENKINS_HOME/../../run_test.js --brand=IBSD --country=UK --env=PROD
  </code></pre>