var path = require('path');

module.exports = function karma(config) {
  config.set({
    basePath: '',
    frameworks: ['phantomjs-shim', 'mocha', 'chai'],
    files: [
      'test/index.js',
    ],
    preprocessors: {
      'test/index.js': ['webpack', 'sourcemap'],
    },
    webpack: {
      devtool: 'inline-source-map',
      module: {
        loaders: [
          { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
        ],
        postLoaders: [{
          test: /\.js$/,
          exclude: /(test|node_modules)\//,
          loader: 'istanbul-instrumenter'
        }],
      },
      resolve: {
        alias: {
          'react-background-video': path.join(process.cwd(), 'lib'),
        },
      },
    },

    coverageReporter: {
      type: 'lcov',
      dir: 'coverage/',
    },

    webpackServer: {
      noInfo: true,
    },

    exclude: [],
    port: 8080,
    logLevel: config.LOG_INFO,
    colors: true,
    autoWatch: false,
    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],
    reporters: ['progress', 'coverage'],
    captureTimeout: 60000,
    // to avoid DISCONNECTED messages
    browserDisconnectTimeout: 10000, // default 2000
    browserDisconnectTolerance: 1, // default 0
    browserNoActivityTimeout: 60000,
    singleRun: true,
  });
};

@@ -305,25 +305,12 @@
 l: '
-inline-source-map
+eval
 ',%0A 
@@ -328,25 +328,28 @@
 : %7B%0A        
-l
+preL
 oaders: %5B%0A  
@@ -341,24 +341,25 @@
 reLoaders: %5B
+%7B
 %0A          %7B
@@ -356,18 +356,16 @@
         
- %7B
  test: /
@@ -375,58 +375,125 @@
 s$/,
- loader: 'babel-loader', exclude: /node_modules/ %7D
+%0A          loader: 'istanbul-instrumenter',%0A          include: %5B%0A            path.join(__dirname, 'src'),%0A          %5D
 ,%0A  
@@ -490,32 +490,33 @@
      %5D,%0A        
+%7D
 %5D,%0A        postL
@@ -514,13 +514,9 @@
     
-postL
+l
 oade
@@ -514,32 +514,34 @@
     loaders: %5B%7B%0A
+  
           test: 
@@ -563,40 +563,32 @@
     
-exclu
+  loa
 de
+r
 : 
-/(test%7Cnode_modules)%5C//
+'babel-loader'
 ,%0A  
@@ -599,39 +599,122 @@
     
-loa
+  inclu
 de
-r
 : 
-'istanbul-instrumenter'
+%5B%0A              path.join(__dirname, 'src'),%0A              path.join(__dirname, 'test'),%0A            %5D,
 %0A   
@@ -831,11 +831,11 @@
 ), '
-lib
+src
 '),%0A
@@ -1334,16 +1334,13 @@
 : %5B'
-progress
+mocha
 ', '

Update karma config