title: Angular2 RC1 Karma Error - unable to find @angular/core/testing
body: <p>I am trying to setup <strong>Angular2 (RC1 version)</strong> project with Karma. I was able to do this setup for ng2 beta.17, but for RC1 I am getting the following error:  </p>
  
  <blockquote>
    <p>Error: Error: XHR error (404 Not Found) loading
    <a href="http://localhost:9876/@angular/core/testing" rel="nofollow">http://localhost:9876/@angular/core/testing</a> at XMLHttpRequest.wrapFn [as _onreadystatechange] (<a href="http://localhost:9876/base/node_modules/zone.js/dist/zone.js?11128be53f306ea156f04e90b0fb7f23fc2104a5:748:30" rel="nofollow">http://localhost:9876/base/node_modules/zone.js/dist/zone.js?11128be53f306ea156f04e90b0fb7f23fc2104a5:748:30</a>)
     at ZoneDelegate.invokeTask (<a href="http://localhost:9876/base/node_modules/" rel="nofollow">http://localhost:9876/base/node_modules/</a>
        zone.js/dist/zone.js?11128be53f306ea156f04e90b0fb7f23fc2104a5:341:38)
                    at Zone.runTask (<a href="http://localhost:9876/base/node_modules/zone.js/dis" rel="nofollow">http://localhost:9876/base/node_modules/zone.js/dis</a>
        t/zone.js?11128be53f306ea156f04e90b0fb7f23fc2104a5:238:48)
    at XMLHttpRequest.ZoneTask.invoke (<a href="http://localhost:9876/base/node_modules/zone.js/dist/zone.js?11128be53f306ea156f04e90b0fb7f23fc2104a5:408:34" rel="nofollow">http://localhost:9876/base/node_modules/zone.js/dist/zone.js?11128be53f306ea156f04e90b0fb7f23fc2104a5:408:34</a>)<br>
    Error loading <a href="http://localhost:9876/@angular/core/testing" rel="nofollow">http://localhost:9876/@angular/core/testing</a>'</p>
  </blockquote>
  
  <p>Following is my <code>Karma.conf.js</code></p>
  
  <pre><code>// Karma configuration
  // Generated on Thu May 12 2016 10:43:29 GMT+0530 (India Standard Time)
  
  module.exports = function(config) {
    config.set({
  
      // base path that will be used to resolve all patterns (eg. files, exclude)
      basePath: '',
  
  
      // frameworks to use
      // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
      frameworks: ['jasmine'],
      plugins: [
        require('karma-jasmine'),
        require('karma-chrome-launcher')
      ],
  
      // list of files / patterns to load in the browser
      files: [
        {pattern: 'dist/src/**/*.js', included:false, watched: true},
        // 'dist/src/**/*spec.js',
        'node_modules/es6-shim/es6-shim.js',
        'node_modules/zone.js/dist/zone.js',
        'node_modules/reflect-metadata/Reflect.js',
        'node_modules/systemjs/dist/system-polyfills.js',
        'node_modules/systemjs/dist/system.src.js',
        'karma-test-shim.js',
        'dist/systemjs.config.js',
        {pattern: 'node_modules/@angular/**/*.js', included: false, watched: true},
        {pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true},
      ],
  
  
      // list of files to exclude
      exclude: [
      ],
  
  
      // preprocess matching files before serving them to the browser
      // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
      preprocessors: {
      },
  
  
      // test results reporter to use
      // possible values: 'dots', 'progress'
      // available reporters: https://npmjs.org/browse/keyword/karma-reporter
      reporters: ['progress'],
  
  
      // web server port
      port: 9876,
  
  
      // enable / disable colors in the output (reporters and logs)
      colors: true,
  
  
      // level of logging
      // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
      logLevel: config.LOG_INFO,
  
  
      // enable / disable watching file and executing tests whenever any file changes
      autoWatch: true,
  
  
      // start these browsers
      // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
      browsers: ['Chrome'],
  
  
      // Continuous Integration mode
      // if true, Karma captures browsers, runs the tests and exits
      singleRun: false,
  
      // Concurrency level
      // how many browser should be started simultaneous
      concurrency: Infinity
    })
  }
  </code></pre>
  
  <p>And finally following is my karma-test-shim.js. This is where the issue is happening, as I have included @angular/core/testing, it complains:</p>
  
  <pre><code>/*global jasmine, __karma__, window*/
  Error.stackTraceLimit = Infinity;
  
  jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
  
  __karma__.loaded = function () {
  };
  
  System.map = {
      '@angular/*':'node_modules/@angular/*'
  }
  
  // System.paths = {
  //     'test/*': '/base/scripts/test/*.js',
  //     'build/*': '/base/scripts/build/*.js',
  //     'angular2/*': 'angular2/*',
  //     'rx': 'rx'
  // };
  
  System.config({
    packages: {
      'base/dist/app': {
        defaultExtension: false,
        format: 'register',
        map: Object.keys(window.__karma__.files)
          .filter(onlyAppFiles)
          .reduce(function (pathsMapping, appPath) {
            var moduleName = appPath.replace(/^\/base\/dist\/app\//, './').replace(/\.js$/, '');
            pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
            return pathsMapping;
          }, {})
      }
    }
  });
  
  System.import('@angular/core/testing').then(function (testing) {
    return System.import('@angular/platform-browser-dynamic/testing').then(function (providers) {
      testing.setBaseTestProviders(providers.TEST_BROWSER_PLATFORM_PROVIDERS,
        providers.TEST_BROWSER_APPLICATION_PROVIDERS);
    });
  }).then(function () {
    return Promise.all(
      Object.keys(window.__karma__.files)
        .filter(onlySpecFiles)
        .map(function (moduleName) {
          console.log('Spec file --- '+moduleName);
          return System.import(moduleName);
        }));
  }).then(function () {
    __karma__.start();
  }, function (error) {
      console.log("Karma Error----- \n"+error);
    __karma__.error(error.stack || error);
  });
  
  function onlyAppFiles(filePath) {
    return /^\/base\/dist\/app\/(?!.*\.spec\.js$)([a-z0-9-_\.\/]+)\.js$/.test(filePath);
  }
  
  function onlySpecFiles(path) {
    return /\.spec\.js$/.test(path);
  }
  </code></pre>