Karma + jspm + PhantomJS "Could not load PhantomJS"
<p>I'm running an Aurelia project on Windows, and I want to run Karma with PhantomJS. I also have JSPM and Babel similarly in the skeleton project <a href="https://github.com/aurelia/skeleton-navigation/tree/master/skeleton-es2016" rel="nofollow noreferrer">here</a>.</p>

<pre><code>[karma]: No captured browser, open http://localhost:9876/
[karma]: Karma v0.13.22 server started at http://localhost:9876/
[launcher]: Can not load "PhantomJS"!
  RangeError: Maximum call stack size exceeded
    at XXX\node_modules\di\lib\injector.js:119:19
    at Array.forEach (native)
    at XXX\node_modules\di\lib\injector.js:115:27
    at Array.forEach (native)
    at new Injector (XXX\node_modules\di\lib\injector.js:104:11)
    at createChild (XXX\node_modules\di\lib\injector.js:93:12)
    at module.(anonymous function) (XXX\node_modules\karma\lib\config.js:198:31)
</code></pre>

<p>Here is my karma.conf.js:</p>

<pre><code>module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jspm', 'jasmine'],
    plugins: [
        'karma-babel-preprocessor',
        'karma-jspm',
        'karma-jasmine',
        'karma-phantomjs-launcher'
    ],
    jspm: {
      loadFiles: ['src/**/*.js', 'test/**/*.js'],
      serveFiles: ['src/**/*.js'],
      paths: {
        '*': '*',
        'github:*': 'jspm_packages/github/*',
        'npm:*': 'jspm_packages/npm/*'
      }
    },
    preprocessors: {
     'test/**/*.js': ['babel'],
     'src/**/*.js': ['babel']
    },
    'babelPreprocessor': {
      options: {
        sourceMap: 'inline',
        moduleIds: false,
        optional: [
          'es7.decorators',
          'es7.classProperties'
        ]
      }
    },

    defaultJSExtensions: true,
    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    proxies : {
        '/src/': '/base/src/',
        '/jspm/': '/base/jspm/'
    },
    browsers: ['PhantomJS'],
    customLaunchers: {
        'PhantomJS': {
            base: 'PhantomJS',
            options: {
              settings: {
                webSecurityEnabled: false
              },
            },
            flags: ['--load-images=true'],
            // debug: true
        }
     },
     phantomjsLauncher: {
        exitOnResourceError: true
     },
    singleRun: false
  });
};
</code></pre>

<p>Here is my gulp file:</p>

<pre><code>var gulp = require('gulp');
var Karma = require('karma').Server;
/**
 * Run test once and exit
 */

var karmaConf = __dirname + '/../../karma.conf.js';
gulp.task('test', function(done) {
  new Karma({
    configFile: karmaConf,
    singleRun: false
  }, done).start();
});
/**
 * Watch for file changes and re-run tests on each change
 */
gulp.task('tdd', function(done) {
  new Karma({
    configFile: karmaConf
  }, done).start();
});

/**
 * Run test once with code coverage and exit
 */
gulp.task('cover', function(done) {
  new Karma({
    configFile: karmaConf,
    singleRun: true,
    reporters: ['coverage'],
    preprocessors: {
      'test/**/*.js': ['babel'],
      'src/**/*.js': ['babel', 'coverage']
    },
    coverageReporter: {
      includeAllSources: true,
      instrumenters: {
        isparta: require('isparta')
      },
      instrumenter: {
        'src/**/*.js': 'isparta'
      },
      reporters: [
        { type: 'html', dir: 'coverage' },
        { type: 'text' }
      ]
    }
  }, done).start();
});
</code></pre>

<p>My versions:</p>

<ul>
<li><strong>JSPM:</strong> 0.16.15</li>
<li><strong>NPM:</strong> 3.8.3</li>
<li><strong>Gulp:</strong> 3.9.1</li>
<li><strong>Karma:</strong> 0.13.22</li>
</ul>

<p>I do have my PhantomJS path set (running <code>&gt;phanthomjs</code> works).</p>