/**
 * @author: @AngularClass
 */

module.exports = function(config) {
  var testWebpackConfig = require('./webpack.test.js')({env: 'test'});

  var configuration = {

    // base path that will be used to resolve all patterns (e.g. files, exclude)
    basePath: '',

    /*
     * Frameworks to use
     *
     * available frameworks: https://npmjs.org/browse/keyword/karma-adapter
     */
    frameworks: ['jasmine'],

    // list of files to exclude
    exclude: [ ],

    /*
     * list of files / patterns to load in the browser
     *
     * we are building the test environment in ./spec-bundle.js
     */
    files: [ { pattern: './config/spec-bundle.js', watched: false } ],

    /*
     * preprocess matching files before serving them to the browser
     * available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
     */
    preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] },

    // Webpack Config at ./webpack.test.js
    webpack: testWebpackConfig,

    coverageReporter: {
      type: 'in-memory'
    },

    remapCoverageReporter: {
      'text-summary': null,
      json: './coverage/coverage.json',
      html: './coverage/html'
    },

    // Webpack please don't spam the console when running in karma!
    webpackMiddleware: { stats: 'errors-only'},

    /*
     * test results reporter to use
     *
     * possible values: 'dots', 'progress'
     * available reporters: https://npmjs.org/browse/keyword/karma-reporter
     */
    reporters: [ 'mocha', 'coverage', 'remap-coverage' ],

    // 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: false,

    /*
     * start these browsers
     * available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
     */
    browsers: [
      'Chrome'
    ],

    customLaunchers: {
      ChromeTravisCi: {
        base: 'Chrome',
        flags: ['--no-sandbox']
      }
    },

    /*
     * Continuous Integration mode
     * if true, Karma captures browsers, runs the tests and exits
     */
    singleRun: true
  };

  if (process.env.TRAVIS){
    configuration.browsers = [
      'ChromeTravisCi'
    ];
  }

  config.set(configuration);
};

@@ -618,16 +618,110 @@
 files: %5B
+%0A      %7B pattern: './src/assets/img/*', watched: false, included: false, served: true %7D,%0A     
  %7B patte
@@ -767,16 +767,20 @@
  false %7D
+%0A   
  %5D,%0A%0A   
@@ -2199,24 +2199,27 @@
 her%0A     */%0A
+/*%0A
     browsers
@@ -2358,24 +2358,502 @@
     %7D%0A    %7D,
+%0A*/%0A    customLaunchers: %7B%0A      'PhantomJS_custom': %7B%0A        base: 'PhantomJS',%0A        options: %7B%0A          windowName: 'alm-window',%0A          settings: %7B%0A            webSecurityEnabled: false%0A          %7D,%0A        %7D,%0A        flags: %5B'--load-images=true'%5D,%0A        debug: true%0A      %7D%0A    %7D,%0A    phantomjsLauncher: %7B%0A      // Have phantomjs exit if a ResourceError is encountered%0A      // (useful if karma exits without killing phantom)%0A      exitOnResourceError: true%0A    %7D,
 %0A%0A    /*%0A   

remove reference to Chrome in karma config