// Karma configuration
// Generated on Thu Mar 26 2015 12:45:35 GMT-0700 (PDT)
// This processes the arguments given to karma at runtime, the ones we care about for custom functionality are taken and processed.
var arguments = require('./karma_utilities/arguments');
arguments.given(process.argv);

// This is a var that will hold our coverage settings. Defaults to instanbul.
var coverageSettings = (arguments.debug == true) ? ['coverage'] : [];
// var testBrowsers = arguments.browsers || ['Chrome'];
var unoPath = '../../../leolee_MBP_WORKSPACE_1953/leolee_MBP_WORKSPACE_1953/e3/components/ss/lodging/products/lux/pLUXMain.main/PartnerCentral/src/main/webapp/js/uno';

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: ['mocha', 'chai'],
    // frameworks: ['mocha', 'chai', 'requirejs'], //this is the frameworks for requirejs

    // list of files / patterns to load in the browser
    //This includes dependencies such as backbone and jquery
    files: [
      // requirejs, un comment to have requirejs work
      // 'files/test-main.js',

      // Chai assertion library.
      {pattern: 'node_modules/chai/chai.js', watched: false, included: true, served: true},

      // UNO's dependencies
      // {pattern: , watched: false, included: true, served: true},
      {pattern: unoPath+'/../jquery-ui-1.10.3.custom/js/jquery-1.9.1.js', watched: false, included: true, served: true},
      {pattern: unoPath+'/../libs/underscore/underscore.js', watched: false, included: true, served: true},
      {pattern: unoPath+'/../libs/backbone/backbone.js', watched: false, included: true, served: true},
      {pattern: unoPath+'/../libs/handlebars/handlebars.js', watched: false, included: true, served: true},

      //Mock data
      {pattern: './files/mock_data/uno.mock.data.js', watched: false, included: true, served: true},
      {pattern: './files/mock_data/uno.utility.js', watched: false, included: true, served: true},
      // {pattern: unoPath+'/uno.js', watched: false, included: true, served: true},

      'files/karma/**/*.js',
      'files/karma/**/*.test.js',

      //Path to UNO
      // unoPath+'/uno.js',
      // unoPath+'/*.js',
      // unoPath+'/**/*.js',
      unoPath+'/mvc/utils/sharedViewMethods.js'
    ],


    // list of files to exclude
    exclude: [
      unoPath+'/mvc/models/*.js',
      unoPath+'/uno.viewProperties.min.js',
      unoPath+'/uno.viewProperties.min.js.map',
      unoPath+'/(assignSelection|viewProperties).js'
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor


    preprocessors: {
      'files/karma/**/*.js' : coverageSettings
    },


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


    //Adding plugins requires you to manually add all plugins, rather than karma infer with karma-*
    plugins: [
      'karma-mocha',
      'karma-chrome-launcher',
      'karma-phantomjs-launcher',
      'karma-chai',
      'karma-coverage',
      'karma-mocha-reporter'
    ],

    // optionally, configure the reporter.
    // This creates a code coverage report.
    coverageReporter: {
      type : 'html',
      dir : '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: 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
  });
};
