// Karma configuration
// Generated on Mon May 02 2016 11:53:39 GMT+0200 (W. Europe Daylight 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: ['commonjs', 'mocha', 'chai'],

    // list of files / patterns to load in the browser
    files: [
      'node_modules/babel-polyfill/dist/polyfill.js',
      'miniprototype.js',
      'MiniBase.js',
      'Flatten.js',
      'copv2/*.js',
      'tests/**/*Tests.js'
    ],


    // 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: {
      'miniprototype.js': ['babel', 'commonjs'],
      'minibase.js': ['babel', 'commonjs'],
      'Layers.js': ['babel', 'commonjs'],
      'Flatten.js': ['babel', 'commonjs'],
      'copv2/*.js': ['babel', 'commonjs'],
      'tests/**/*.js': ['babel', 'commonjs'],
    },

    babelPreprocessor: {
      options: {
        presets: ['es2015'],
        sourceMap: 'inline'
      },
      // filename: function (file) {
      //   var lastSlash = file.originalPath.lastIndexOf('/');
      //   var folder = file.originalPath.substring(0, lastSlash + 1);
      //   var basename = file.originalPath.substring(lastSlash + 1);
      //   return folder + 'es5/' + basename;
      // },
      sourceFileName: function (file) {
        return file.originalPath;
      }
    },

    commonjsPreprocessor: {
      modulesRoot: '.'
    },



    // 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: ['PhantomJS', 'Chrome', 'Firefox', 'IE', 'Safari', 'Opera'],


    // 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
  })
}

@@ -135,19 +135,28 @@
 %7B%0A  
+var 
 config
-.set(
+uration = 
 %7B%0A%0A 
@@ -2491,24 +2491,219 @@
 , 'Opera'%5D,%0A
+    // see below for the browsers which are run on Travis CI%0A    customLaunchers: %7B%0A        Chrome_no_sandbox: %7B%0A            base: 'Chrome',%0A            flags: %5B'--no-sandbox'%5D,%0A        %7D%0A    %7D,%0A
 %0A%0A    // Con
@@ -2925,12 +2925,138 @@
 nity%0A  %7D
-)
+;%0A  if (process.env.TRAVIS) %7B%0A      configuration.browsers = %5B'Chrome_no_sandbox', 'Firefox'%5D;%0A  %7D%0A  config.set(configuration);
 %0A%7D%0A

apply Chrome --no-sandbox workaround for travis ci