title: Why can't I determine the path for require.context in a karma shim by passing a variable?
body: <p>I want to set the path for require.context(path, ...) in a shim file called by karma (set in the files parameter in the config) dynamically, but somehow, as soon as I use a variable for path, I get the error 'Cannot find module "."' in the CLI. This is very odd, because if I hardcode the <em>very same</em> path into the call, it runs without a problem. Aka, if I do</p>
  
  <pre><code>var testPath = '../src';
  console.log("PATH 2 " + testPath); // ../src
  var appContext = require.context(testPath, true, /\.spec\.ts/);
  </code></pre>
  
  <p>I'll get an error, if I do</p>
  
  <pre><code>var appContext = require.context('../src', true, /\.spec\.ts/);
  </code></pre>
  
  <p>everything is fine.</p>
  
  <p>In the full shim file the code appears exactly as I have written it here, aka there is no other code between the definition of testPath and require.context, I just included the console.log to check for some inexplicable voodoo.</p>
  
  <p>The shim is invoked as follows in the karma.conf.js:</p>
  
  <pre><code>module.exports = function (config) {
    var _config = {
      .....
      files: [
        {pattern: './karma-test-shim.js', watched: true}
      ],
      preprocessors: {
        './karma-test-shim.js': ['webpack', 'sourcemap']
      },
      .....
    };
    config.set(_config);
  };
  </code></pre>
  
  <p>What am I missing? Does the call to the same shim by preprocessors mess things up?</p>