title: Karma - Uncaught SyntaxError: Unexpected token import in Angular 2
body: <p>I am following this tutorial <a href="https://www.youtube.com/watch?v=yG4FH60fhUE" rel="nofollow noreferrer">https://www.youtube.com/watch?v=yG4FH60fhUE</a> and <a href="https://angular.io/docs/ts/latest/guide/testing.html" rel="nofollow noreferrer">https://angular.io/docs/ts/latest/guide/testing.html</a> to write simple unit test cases in Angular 2 and verify the setup of Karma. I get this error Uncaught SyntaxError: Unexpected token import --- compute.spec.ts:2 .The syntax is very simple and looks similar to the tutorial. But I dont know why I am getting this error. These are the versions used </p>
  
  <pre><code> //package.json
      "scripts": {
      "clean": "ionic-app-scripts clean",
      "build": "ionic-app-scripts build",
      "serve": "ionic-app-scripts serve",
      "ionic:build": "ionic-app-scripts build",
      "ionic:serve": "ionic-app-scripts serve",
      "test": "karma start karma.conf.js"
    },
    "dependencies": {
      "@angular/animations": "4.0.3",
      "@angular/common": "2.4.10",
      "@angular/compiler": "2.4.10",
      "@angular/core": "2.4.10",
      "@angular/flex-layout": "2.0.0-beta.5",
      "@angular/forms": "2.4.10",
      "@angular/http": "2.4.10",
      "@angular/material": "2.0.0-beta.2",
      "@angular/platform-browser": "2.4.10",
      "@angular/platform-browser-dynamic": "2.4.10",
      "@angular/router": "3.4.10",
      "@types/c3": "^0.4.39",
      "angular-hammer": "^2.2.0",
      "angular2-mqtt": "^1.7.1",
      "c3": "^0.4.11",
      "core-js": "^2.4.1",
      "d3": "^3.5.17",
      "karma": "^1.7.0",
      "karma-chrome-launcher": "^2.1.1",
      "karma-jasmine": "^1.1.0",
      "rxjs": "^5.1.0",
      "sw-toolbox": "^3.6.0",
      "zone.js": "^0.7.7"
    },
    "devDependencies": {
      "@angular/compiler-cli": "2.4.10",
      "@ionic/app-scripts": "1.1.4",
      "@types/c3": "^0.4.39",
      "@types/jasmine": "^2.5.47",
      "c3": "^0.4.11",
      "jasmine-core": "^2.6.2",
      "karma": "^1.7.0",
      "typescript": "2.2.2"
    }
  
  My project structure 
  
      myproject
       -src
         -app
           -01-fundamentals
             -compute.ts
             -compute.spec.ts   
       -karma.conf.js
  
      //compute.spec.ts
  
      import {compute} from './compute';
      describe('compute',() =&gt; {
  
          it('should return 0 if input is negative', () =&gt; {
        const result= compute(-1);
        expect(result).toBe(0);
      })
      })
  
      //karma.conf.js
      module.exports = function(config) {
        config.set({
          basePath: '',
          frameworks: ['jasmine'],
          files: ["src/app/**/*.spec.ts"
          ],
          exclude: [
          ],
          preprocessors: {
          },
          reporters: ['progress'],
          port: 9876,
          colors: true,
          logLevel: config.LOG_DEBUG,
          autoWatch: true,
          browsers: ['Chrome'],
          singleRun: false,
          concurrency: Infinity,
          plugins: [ 'karma-jasmine', 'karma-chrome-launcher'],
          mime: {
            'text/x-typescript': ['ts','tsx']
          },
        })
      }
  </code></pre>