<commit_before>'use strict';

const loaders = require('./webpack/loaders');
const postcssInit = require('./webpack/postcss');

module.exports = (config) => {
  config.set({
    frameworks: [
      'jasmine',
    ],

    plugins: [
      'karma-jasmine',
      'karma-sourcemap-writer',
      'karma-sourcemap-loader',
      'karma-webpack',
      'karma-coverage',
      'karma-spec-reporter',
      'karma-chrome-launcher',
    ],

    files: [
      './src/tests.entry.ts',
      {
        pattern: '**/*.map',
        served: true,
        included: false,
        watched: true,
      },
    ],

    preprocessors: {
      './src/**/*.ts': [
        'webpack',
        'sourcemap',
      ],
      './src/**/!(*.test|tests.*).ts': [
        'coverage',
        'sourcemap',
      ],
    },

    webpack: {
      entry: './src/tests.entry.ts',
      devtool: 'inline-source-map',
      verbose: true,
      resolve: {
        extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'],
      },
      module: {
        loaders: combinedLoaders(),
        postLoaders: [
          loaders.istanbulInstrumenter,
        ],
      },
      stats: { colors: true, reasons: true },
      debug: false,
      plugins: [],
      postcss: postcssInit,
    },

    webpackServer: {
      noInfo: true, // prevent console spamming when running in Karma!
    },

    reporters: ['spec', 'coverage'],

    // only output json report to be remapped by remap-istanbul
    coverageReporter: {
      reporters: [
        { type: 'json' },
      ],
      dir: './coverage/',
      subdir: (browser) => {
        return browser.toLowerCase().split(/[ /-]/)[0]; // returns 'chrome'
      },
    },

    port: 9999,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'], // Alternatively: 'PhantomJS'
    captureTimeout: 6000,
    singleRun: true,
  });
};

function combinedLoaders() {
  return Object.keys(loaders).reduce(function reduce(aggregate, k) {
    switch (k) {
    case 'tslint': // intolerably slow
      return aggregate;
    case 'ts':
    case 'tsTest':
      return aggregate.concat([ // force inline source maps
        Object.assign(loaders[k],
          { query: { babelOptions: { sourceMaps: 'inline' } } })]);
    default:
      return aggregate.concat([loaders[k]]);
    }
  },
  []);
}
<commit_msg>Webpack still too verbose<commit_after>'use strict';

const loaders = require('./webpack/loaders');
const postcssInit = require('./webpack/postcss');

module.exports = (config) => {
  config.set({
    frameworks: [
      'jasmine',
    ],

    plugins: [
      'karma-jasmine',
      'karma-sourcemap-writer',
      'karma-sourcemap-loader',
      'karma-webpack',
      'karma-coverage',
      'karma-spec-reporter',
      'karma-chrome-launcher',
    ],

    files: [
      './src/tests.entry.ts',
      {
        pattern: '**/*.map',
        served: true,
        included: false,
        watched: true,
      },
    ],

    preprocessors: {
      './src/**/*.ts': [
        'webpack',
        'sourcemap',
      ],
      './src/**/!(*.test|tests.*).ts': [
        'coverage',
        'sourcemap',
      ],
    },

    webpack: {
      entry: './src/tests.entry.ts',
      devtool: 'inline-source-map',
      verbose: false,
      resolve: {
        extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'],
      },
      module: {
        loaders: combinedLoaders(),
        postLoaders: [
          loaders.istanbulInstrumenter,
        ],
      },
      stats: { colors: true, reasons: true },
      debug: false,
      plugins: [],
      postcss: postcssInit,
    },

    webpackServer: {
      noInfo: true, // prevent console spamming when running in Karma!
    },

    reporters: ['spec', 'coverage'],

    // only output json report to be remapped by remap-istanbul
    coverageReporter: {
      reporters: [
        { type: 'json' },
      ],
      dir: './coverage/',
      subdir: (browser) => {
        return browser.toLowerCase().split(/[ /-]/)[0]; // returns 'chrome'
      },
    },

    port: 9999,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'], // Alternatively: 'PhantomJS'
    captureTimeout: 6000,
    singleRun: true,
  });
};

function combinedLoaders() {
  return Object.keys(loaders).reduce(function reduce(aggregate, k) {
    switch (k) {
    case 'tslint': // intolerably slow
      return aggregate;
    case 'ts':
    case 'tsTest':
      return aggregate.concat([ // force inline source maps
        Object.assign(loaders[k],
          { query: { babelOptions: { sourceMaps: 'inline' } } })]);
    default:
      return aggregate.concat([loaders[k]]);
    }
  },
  []);
}
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Fri Jul 29 2016 14:59:48 GMT+0200 (CEST)

// Note that you ".babelrc" will be the default options for babel.
var babelMoreOptions = { presets: 'es2015' };

require('argv-set-env')();
var webpack = require('./tools/webpack')('test');

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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      "node_modules/jquery/dist/jquery.js",
      "node_modules/api-check/dist/api-check.js",
      "node_modules/angular/angular.js",
      "node_modules/angular-mocks/angular-mocks.js",
      "node_modules/angular-animate/angular-animate.js",
      "node_modules/angular-aria/angular-aria.js",
      "node_modules/angular-messages/angular-messages.js",
      "node_modules/angular-material/angular-material.js",
      "node_modules/angular-material/angular-material-mocks.js",
      "node_modules/angular-formly/dist/formly.js",
      "node_modules/underscore/underscore.js",
      "test/index.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: {
      "test/index.js": ["webpack"]
    },

    webpack: webpack,

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress', "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', 'Firefox', 'PhantomJS'],

    // 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
  })
}
<commit_msg>chore: add chrome test<commit_after>// Karma configuration
// Generated on Fri Jul 29 2016 14:59:48 GMT+0200 (CEST)

// Note that you ".babelrc" will be the default options for babel.
var babelMoreOptions = { presets: 'es2015' };

require('argv-set-env')();
var webpack = require('./tools/webpack')('test');

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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      "node_modules/jquery/dist/jquery.js",
      "node_modules/api-check/dist/api-check.js",
      "node_modules/angular/angular.js",
      "node_modules/angular-mocks/angular-mocks.js",
      "node_modules/angular-animate/angular-animate.js",
      "node_modules/angular-aria/angular-aria.js",
      "node_modules/angular-messages/angular-messages.js",
      "node_modules/angular-material/angular-material.js",
      "node_modules/angular-material/angular-material-mocks.js",
      "node_modules/angular-formly/dist/formly.js",
      "node_modules/underscore/underscore.js",
      "test/index.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: {
      "test/index.js": ["webpack"]
    },

    webpack: webpack,

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress', "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', 'Firefox', 'PhantomJS'],

    // This is the new content for your travis-ci configuration test
    //  Custom launcher for Travis-CI
    customLaunchers: {
          Chrome_travis_ci: {
              base: 'Chrome',
              flags: ['--no-sandbox']
          }
      },

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

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Sun Nov 06 2016 12:33:19 GMT+0200 (Egypt Standard Time)

module.exports = function (config) {
  config.set({

    basePath: 'client/app',

    frameworks: ['jasmine'],

    files: [
      'bower_components/angular/angular.js',
      'bower_components/jquery/jquery.js',
      'bower_components/angular-cookies/angular-cookies.js',
      'bower_components/angular-resource/angular-resource.js',
      'bower_components/angular-sanitize/angular-sanitize.js',
      'bower_components/angular-ui-router/release/angular-ui-router.js',
      'bower_components/angular-rating/src/angular-rating.js',
      'bower_components/angular-translate/angular-translate.js',
      'bower_components/angular-translate-loader-url/angular-translate-loader-url.js',
      'bower_components/angular-mocks/angular-mocks.js',
      '../../node_modules/sinon/lib/sinon.js',
      'app.module.js',
      'app.routes.js',
      'components/**/*.js',
      'directives/**/*.js',
      'filters**/*.js',
      'pages/**/*.js',
      'services/**/*.js',
      '../test/**/*.js'
    ],

    exclude: [
    ],

    preprocessors: {
    },

    reporters: ['progress'],

    port: 9876,

    colors: true,

    logLevel: config.LOG_INFO,

    autoWatch: true,

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

    plugins: [
      'karma-jasmine',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-phantomjs-launcher'
    ],

    singleRun: false,

    concurrency: Infinity
  })
}
<commit_msg>use all browsers for testing<commit_after>// Karma configuration
// Generated on Sun Nov 06 2016 12:33:19 GMT+0200 (Egypt Standard Time)

module.exports = function (config) {
  config.set({

    basePath: 'client/app',

    frameworks: ['jasmine'],

    files: [
      'bower_components/angular/angular.js',
      'bower_components/jquery/jquery.js',
      'bower_components/angular-cookies/angular-cookies.js',
      'bower_components/angular-resource/angular-resource.js',
      'bower_components/angular-sanitize/angular-sanitize.js',
      'bower_components/angular-ui-router/release/angular-ui-router.js',
      'bower_components/angular-rating/src/angular-rating.js',
      'bower_components/angular-translate/angular-translate.js',
      'bower_components/angular-translate-loader-url/angular-translate-loader-url.js',
      'bower_components/angular-mocks/angular-mocks.js',
      '../../node_modules/sinon/lib/sinon.js',
      'app.module.js',
      'app.routes.js',
      'components/**/*.js',
      'directives/**/*.js',
      'filters**/*.js',
      'pages/**/*.js',
      'services/**/*.js',
      '../test/**/*.js'
    ],

    exclude: [
    ],

    preprocessors: {
    },

    reporters: ['progress'],

    port: 9876,

    colors: true,

    logLevel: config.LOG_INFO,

    autoWatch: true,

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

    plugins: [
      'karma-jasmine',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-phantomjs-launcher'
    ],

    singleRun: false,

    concurrency: Infinity
  })
}
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Mon Jun 06 2016 11:19:28 GMT+0200 (Central European Daylight Time)

module.exports = function(config) {
  config.set({

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

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

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

    // list of files / patterns to load in the browser
    files: [
		'src/**/*.js',
		'tests/**/*.js',
        { pattern: 'configs/*.json', watched: true, served: true, included: false }
    ],

    // 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: {
        'grid.js': 'coverage'
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress', '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'],

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

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}
<commit_msg>add typescript files to tests<commit_after>// Karma configuration
// Generated on Mon Jun 06 2016 11:19:28 GMT+0200 (Central European Daylight Time)

module.exports = function(config) {
  config.set({

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

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

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

    // list of files / patterns to load in the browser
    files: [
		'src/**/*.js',
		'ts/**/*.js',
		'tests/**/*.js',
        { pattern: 'configs/*.json', watched: true, served: true, included: false }
    ],

    // 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: {
        'grid.js': 'coverage'
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress', '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'],

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

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}
<|endoftext|>


<commit_before>angular.module('dvizer').service('electionService', ['$http', '$log', function ($http, $log) {

    var self = this;

    this.intimacyData = {};
    this.intimacyImageUrls = [];

    this.fetchIntimacyData = function () {
        return $http.get('lab/election/data/data3_forceAtlas2Layout.json').then(function (json) {
            self.intimacyImageUrls = _extractImageUrl(json.data);
            self.intimacyData = json.data;
        });
    };

    function _extractImageUrl(data) {
        var urls = [],
            prefix,
            noRepeat = {},
            nodes = data.nodes,
            edges = data.edges;

        prefix = 'lab/election/avatar/';
        nodes.forEach(function (item) {
            // process image
            if (item.attributes.Image) {
                if (angular.isString(item.attributes.Image)) item.attributes.Image = item.attributes.Image.trim();
                item.type = 'image';
                item.url = prefix + item.attributes.Image;
                if (!noRepeat[item.attributes.Image]) {
                    noRepeat[item.attributes.Image] = true;
                    urls.push(prefix + item.attributes.Image);
                }
            } else {
                item.type = 'def';
                item.url = null;
            }
        });
        var noRepeat={};
        edges.forEach(function (item) {
            item.color = '#908BF7';//908BF7,0027cc,0b0085,FE6A37
            item.hidden = false;
            noRepeat[item.source]=true;
            noRepeat[item.target]=true;
        });
        nodes.forEach(function (item) {
            if(noRepeat[item.label]) item.hidden=false; else item.hidden=true;
            item.color = '#908BF7';//#fff,0027cc,0b0085,0070c2
        });
        return urls;
    }
}]);
<commit_msg>just test<commit_after>angular.module('dvizer').service('electionService', ['$http', '$log', function ($http, $log) {

    var self = this;

    this.intimacyData = {};
    this.intimacyImageUrls = [];

    this.fetchIntimacyData = function () {
        return $http.get('lab/election/data/data3_forceAtlas2Layout.json').then(function (json) {
            self.intimacyImageUrls = _extractImageUrl(json.data);
            self.intimacyData = json.data;
        });
    };

    function _extractImageUrl(data) {
        var urls = [],
            prefix,
            noRepeat = {},
            nodes = data.nodes,
            edges = data.edges;

        prefix = 'lab/election/avatar/';
        nodes.forEach(function (item) {
            // process image
            if (item.attributes.Image) {
                if (angular.isString(item.attributes.Image)) item.attributes.Image = item.attributes.Image.trim();
                item.type = 'image';
                item.url = prefix + item.attributes.Image;
                if (!noRepeat[item.attributes.Image]) {
                    noRepeat[item.attributes.Image] = true;
                    urls.push(prefix + item.attributes.Image);
                }
            } else {
                item.type = 'def';
                item.url = null;
            }
        });
        var noRepeat={};
        edges.forEach(function (item) {
            item.color = '#908BF7';//908BF7,0027cc,0b0085,FE6A37
            item.hidden = false;
            noRepeat[item.source]=true;
            noRepeat[item.target]=true;
        });
        nodes.forEach(function (item) {
            if(noRepeat[item.label]) item.hidden=false; else item.hidden=true;
            item.color = '#908BF7';//#fff,0027cc,0b0085,0070c2
        });

        return urls;
    }
}]);
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Sat Jul 16 2016 09:08:14 GMT+0200 (CEST)

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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'vendor/bowser/src/bowser.js',
      'vendor/angular/angular.js',
      'vendor/angular-resource/angular-resource.js',
      'vendor/angular-mocks/angular-mocks.js',
      'vendor/jquery/dist/jquery.js',
      'vendor/jstree/dist/jstree.js',
      'vendor/jsTree-directive/jsTree.directive.js',
      'vendor/chart.js/dist/Chart.min.js',
      'vendor/angular-chart.js/dist/angular-chart.min.js',
      'app/**/*.js',
    ],

    // list of files to exclude
    exclude: [
      '**/*.swp'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      '**/app/**/!(*spec|routing).js': ['coverage'],
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: [
      'progress',
      '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: [
      'PhantomJS'
      //, 'Chrome'
      //, 'Firefox'
    ],

    // 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
  })
}
<commit_msg>karma: Remove unused vendor deps<commit_after>// Karma configuration
// Generated on Sat Jul 16 2016 09:08:14 GMT+0200 (CEST)

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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'vendor/bowser/src/bowser.js',
      'vendor/angular/angular.js',
      'vendor/angular-resource/angular-resource.js',
      'vendor/angular-mocks/angular-mocks.js',
      'vendor/jquery/dist/jquery.js',
      'app/**/*.js',
    ],

    // list of files to exclude
    exclude: [
      '**/*.swp'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      '**/app/**/!(*spec|routing).js': ['coverage'],
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: [
      'progress',
      '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: [
      'PhantomJS'
      //, 'Chrome'
      //, 'Firefox'
    ],

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


<commit_before>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/scripts/app.js',
      'app/scripts/**/*.js',
      'test/mock/**/*.js',
      'test/spec/**/*.js'
    ],

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

    // web server port
    port: 8080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};
<commit_msg>updating test runner<commit_after>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-strap/dist/angular-strap.min.js',
      'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/scripts/authoring-app.js',
      'app/scripts/controllers/problemsets.js',
      //'app/scripts/**/*.js',
      //'test/mock/**/*.js',
      'test/spec/**/*.js'
    ],

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

    // web server port
    port: 8080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Fri Mar 21 2014 17:52:41 GMT-0300 (ART)

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'],

    // list of files / patterns to load in the browser
    files: [
      //Configs
      'config.js',

      'lib/angular/angular.min.js',
      'lib/angular-mocks/angular-mocks.js',
      'lib/moment/moment.js',
      'lib/angular-moment/angular-moment.js',
      'lib/qrcode-generator/js/qrcode.js',
      'lib/angular-qrcode/qrcode.js',
      'lib/angular-route/angular-route.min.js',
      'lib/angular-foundation/mm-foundation.min.js',
      'lib/angular-foundation/mm-foundation-tpls.min.js',
      'lib/peer.js',
      'lib/bitcore/browser/bundle.js',
      'lib/crypto-js/rollups/sha256.js',
      'lib/crypto-js/rollups/pbkdf2.js',
      'lib/crypto-js/rollups/aes.js',
      'lib/file-saver/FileSaver.js',
      'lib/socket.io-client/socket.io.js',
      'lib/sjcl.js',
      'lib/ios-imagefile-megapixel/megapix-image.js',
      'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
      'js/copayBundle.js',

      //Test-Specific Code
      'lib/chai/chai.js',
      'test/lib/chai-should.js',
      'test/lib/chai-expect.js',

      //Mocha stuff
      'test/mocha.conf.js',

      //App-specific Code
      'js/app.js',
      'js/routes.js',
      'js/directives.js',
      'js/filters.js',
      'js/services/*.js',
      'js/controllers/*.js',
      'js/init.js',

      //test files
      'test/unit/**/*.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: {

    },

    // 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: ['Chrome'],

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

    // if browser doesn't capture output in given timeout (ms), kill it
    captureTimeout: 60000
  });
};
<commit_msg>add peerjs to karma<commit_after>// Karma configuration
// Generated on Fri Mar 21 2014 17:52:41 GMT-0300 (ART)

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'],

    // list of files / patterns to load in the browser
    files: [
      //Configs
      'config.js',

      'lib/angular/angular.min.js',
      'lib/angular-mocks/angular-mocks.js',
      'lib/moment/moment.js',
      'lib/angular-moment/angular-moment.js',
      'lib/qrcode-generator/js/qrcode.js',
      'lib/angular-qrcode/qrcode.js',
      'lib/angular-route/angular-route.min.js',
      'lib/angular-foundation/mm-foundation.min.js',
      'lib/angular-foundation/mm-foundation-tpls.min.js',
      'lib/peerjs/peer.js',
      'lib/bitcore/browser/bundle.js',
      'lib/crypto-js/rollups/sha256.js',
      'lib/crypto-js/rollups/pbkdf2.js',
      'lib/crypto-js/rollups/aes.js',
      'lib/file-saver/FileSaver.js',
      'lib/socket.io-client/socket.io.js',
      'lib/sjcl.js',
      'lib/ios-imagefile-megapixel/megapix-image.js',
      'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
      'js/copayBundle.js',

      //Test-Specific Code
      'lib/chai/chai.js',
      'test/lib/chai-should.js',
      'test/lib/chai-expect.js',

      //Mocha stuff
      'test/mocha.conf.js',

      //App-specific Code
      'js/app.js',
      'js/routes.js',
      'js/directives.js',
      'js/filters.js',
      'js/services/*.js',
      'js/controllers/*.js',
      'js/init.js',

      //test files
      'test/unit/**/*.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: {

    },

    // 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: ['Chrome'],

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

    // if browser doesn't capture output in given timeout (ms), kill it
    captureTimeout: 60000
  });
};
<|endoftext|>


<commit_before>/**
 *  UI for the page to download an export (form, case, or SMS; single or bulk).
 *
 *  Contains two models:
 *      downloadFormModel: Controls the form where the user specifies a date range, etc. Also contains
 *          functionality to download the multimedia associated with an export (form exports only).
 *      downloadProgressModel: Controls the progress bar, etc. once the user has clicked 'Prepare Export'.
 *          Includes functionality to email the user when the export is done, rather than them waiting for it.
 */
hqDefine('export/js/download_export', function () {
    'use strict';

    var downloadFormModel = function (options) {
        hqImport("hqwebapp/js/assert_properties").assert(options, [
            'defaultDateRange',
            'exportList',
            'exportType',
            'formOrCase',
            'maxColumnSize',
            'multimediaUrl',    // present if we should check for multimedia
            'progressModel',
            'prepareUrl',
            'prepareMultimediaUrl',
            'smsExport',
            'userTypes',
        ]);

        var self = _.extend({}, options);

        // Form data
        self.dateRange = ko.observable(self.defaultDateRange);
        self.emw = ko.observable();     // "expanded mobile worker" => the users (for forms) or case owners (for cases)

        // UI flags
        self.preparingExport = ko.observable(false);
        self.prepareExportError = ko.observable('');
        self.preparingMultimediaExport = ko.observable(false);
        self.hasMultimedia = ko.observable(false);

        // Once the download starts, this (downloadFormModel) disables the form and displays a message.
        // When the download is complete, the downloadProgressModel gives the user the option to clear
        // filters and do another download. Listen for that signal.
        self.downloadInProgress = ko.observable(false);
        self.progressModel.showDownloadStatus.subscribe(function (newValue) {
            self.downloadInProgress(newValue);
        });

        self.isValid = ko.computed(function () {
            return !!self.dateRange();
        });

        self.disablePrepareExport = ko.computed(function () {
            return !self.isValid() || self.preparingExport();
        });
        self.disablePrepareMultimediaExport = ko.computed(function () {
            return !self.isValid() || self.preparingMultimediaExport();
        });

        // Determine whether or not to show button to download multimedia
        if (self.multimediaUrl) {
            $.ajax({
                method: 'GET',
                url: self.multimediaUrl,
                data: {
                    export_id: self.exportList[0].export_id,
                    form_or_case: self.formOrCase,
                },
                success: function (data) {
                    if (data.success) {
                        self.hasMultimedia(data.hasMultimedia);
                    }
                },
            });
        }

        self.sendAnalytics = function () {
            var action = (self.exportList.length > 1) ? "Bulk" : "Regular";
            hqImport('analytix/js/google').track.event("Download Export", self.exportType, action);
            _.each(self.exportList, function (export_) {
                if (export_.has_case_history_table) {
                    hqImport('analytix/js/google').track.event("Download Case History Export", export_.domain, export_.export_id);
                }
            });
        };

        self.prepareExport = function () {
            self.emw(hqImport('reports/js/reports.util').urlSerialize($('form[name="exportFiltersForm"]')));
            self.prepareExportError('');
            self.preparingExport(true);

            // Generate human-readable list of mobile workers, to send to analytics
            function getFilterString() {
                var filterName = self.exportType === "form" ? "emw" : "case_list_filter",
                    filterNamesAsString = $("form[name='exportFiltersForm']").find("input[name=" + filterName + "]").val(),
                    filterNamesAsArray = filterNamesAsString ? filterNamesAsString.split(',') : [];
                return _.map(filterNamesAsArray, function (item) {
                    var prefix = "t__";
                    if (item.substring(0, prefix.length) === prefix) {
                        return self.userTypes[item.substring(prefix.length)];
                    }
                    return item;
                }).join();
            }

            hqImport('analytix/js/kissmetrix').track.event("Clicked Prepare Export", {
                "Export type": self.exportType,
                "filters": getFilterString(),
            });

            $.ajax({
                method: 'POST',
                url: self.prepareUrl,
                data: {
                    form_or_case: self.formOrCase,
                    sms_export: self.smsExport,
                    exports: JSON.stringify(self.exportList),
                    max_column_size: self.maxColumnSize,
                    form_data: JSON.stringify({
                        date_range: self.dateRange(),
                        emw: self.emw(),
                    }),
                },
                success: function (data) {
                    if (data.success) {
                        self.sendAnalytics();
                        self.preparingExport(false);
                        self.downloadInProgress(true);
                        self.progressModel.startDownload(data.download_id);
                    } else {
                        self.handleError(data);
                    }
                },
                error: self.handleError,
            });
        };

        self.prepareMultimediaExport = function () {
            self.prepareExportError('');
            self.preparingMultimediaExport(true);
            $.ajax({
                method: 'POST',
                url: self.prepareMultimediaUrl,
                data: {
                    form_or_case: self.formOrCase,
                    sms_export: self.smsExport,
                    exports: JSON.stringify(self.exportList),
                    form_data: JSON.stringify({
                        date_range: self.dateRange(),
                        emw: self.emw(),
                    }),
                },
                success: function (data) {
                    if (data.success) {
                        self.sendAnalytics();
                        self.preparingMultimediaExport(false);
                        self.downloadInProgress(true);
                        self.progressModel.startMultimediaDownload(data.download_id);
                    } else {
                        self.handleError(data);
                    }
                },
                error: self.handleError,
            });
        };

        self.handleError = function (data) {
            if (data && data.error) {
                // The server returned an error message.
                self.prepareExportError(data.error);
            } else {
                self.prepareExportError(gettext("Sorry, there was a problem reaching the server. Please try again."));
            }
            self.preparingExport(false);
            self.preparingMultimediaExport(false);
        };

        return self;
    };

    var downloadProgressModel = function (options) {
        hqImport("hqwebapp/js/assert_properties").assert(options, ['exportType', 'formOrCase', 'emailUrl', 'pollUrl']);

        var self = {};

        self.exportType = options.exportType;
        self.formOrCase = options.formOrCase;
        self.downloadId = ko.observable();
        self.progress = ko.observable();

        // URLs for user actions
        self.pollUrl = options.pollUrl;
        self.emailUrl = options.emailUrl;

        // URLs related to the completed download
        self.dropboxUrl = ko.observable();
        self.downloadUrl = ko.observable();

        // UI flags
        self.showDownloadStatus = ko.observable();
        self.isDownloaded = ko.observable();
        self.isDownloadReady = ko.observable();
        self.isMultimediaDownload = ko.observable();
        self.sendEmailFlag = ko.observable();

        // Error handling
        self.progressError = ko.observable();
        self.celeryError = ko.observable('');
        self.downloadError = ko.observable('');
        self.showError = ko.computed(function () {
            return self.celeryError() || self.downloadError();
        });

        self.resetDownload = function () {
            self.downloadId(null);
            self._numErrors = 0;
            self._numCeleryRetries = 0;
            self._lastProgress = 0;
            self.showDownloadStatus(false);
            self.isDownloadReady(false);
            self.isDownloaded(false);
            self.celeryError('');
            self.downloadError('');
            self.isMultimediaDownload(false);
            self.progress(0);
            self.progressError('');
            self.sendEmailFlag(false);
            self.dropboxUrl('');
            self.downloadUrl('');
        };
        self.resetDownload();

        self.startDownload = function (downloadId) {
            self.showDownloadStatus(true);
            self.downloadId(downloadId);
            self.interval = setInterval(self._checkDownloadProgress, 2000);
        };

        self.startMultimediaDownload = function (downloadId) {
            self.isMultimediaDownload(true);
            self.startDownload(downloadId);
        };

        self.clickDownload = function () {
            self.isDownloaded(true);
            self.sendAnalytics();
            return true;    // allow default click action
        };

        self.sendAnalytics = function () {
            hqImport('analytix/js/google').track.event("Download Export", hqImport('export/js/utils').capitalize(self.exportType), "Saved");
            hqImport('analytix/js/kissmetrix').track.event("Clicked Download button");
        };

        self._checkDownloadProgress = function () {
            $.ajax({
                method: 'GET',
                url: self.pollUrl,
                data: {
                    form_or_case: self.formOrCase,
                    download_id: self.downloadId,
                },
                success: function (data) {
                    if (data.is_poll_successful) {
                        self._updateProgressBar(data);
                        self.downloadId(data.download_id);
                        if (data.has_file && data.is_ready) {
                            clearInterval(self.interval);
                            return;
                        }
                        if (data.progress && data.progress.error) {
                            clearInterval(self.interval);
                            self.progressError(data.progress.error_message);
                            return;
                        }
                        if (data.progress.current > self._lastProgress) {
                            self._lastProgress = data.progress.current;
                            // processing is still going, keep moving.
                            // this avoids failing hard prematurely at celery errors if
                            // the polling is still reporting forward progress.
                            self._numCeleryRetries = 0;
                            return;
                        }
                    }
                    if (data.error) {
                        self._dealWithErrors(data);
                    }
                    if (_.isNull(data.is_alive)) {
                        self._dealWithCeleryErrors();
                    }
                },
                error: self._dealWithErrors,
            });
        };

        self._dealWithCeleryErrors = function () {
            // Sometimes the task handler for celery is a little slow to get
            // started, so we have to try a few times.
            if (self._numCeleryRetries > 10) {
                clearInterval(self.interval);
                self.celeryError(gettext("Server maintenance in progress. Please try again later."));
            }
            self._numCeleryRetries ++;
        };

        self._dealWithErrors = function (data) {
            if (self._numErrors > 3) {
                if (data && data.error) {
                    self.downloadError(data.error);
                } else {
                    self.downloadError(gettext("There was an error downloading your export."));
                }
                clearInterval(self.interval);
            }
            self._numErrors ++;
        };

        self._updateProgressBar = function (data) {
            var progressPercent = 0;
            if (data.is_ready && data.has_file) {
                progressPercent = 100;
                self.isDownloadReady(true);
                self.dropboxUrl(data.dropbox_url);
                self.downloadUrl(data.download_url);
            } else if (_.isNumber(data.progress.percent)) {
                progressPercent = data.progress.percent;
            }
            self.progress(progressPercent);
        };

        self.sendEmailUponCompletion = function () {
            self.sendEmailFlag(true);
            $.ajax({
                method: 'POST',
                dataType: 'json',
                url: self.emailUrl,
                data: { download_id: self.downloadId },
            });
        };

        return self;
    };

    $(function () {
        hqImport("reports/js/filters/main").init();

        var initialPageData = hqImport("hqwebapp/js/initial_page_data"),
            exportList = initialPageData.get('export_list'),
            exportType = exportList[0].export_type;

        var progressModel = downloadProgressModel({
            exportType: exportType,
            emailUrl: initialPageData.reverse('add_export_email_request'),
            formOrCase: initialPageData.get('form_or_case'),
            pollUrl: initialPageData.reverse('poll_custom_export_download'),
        });

        $("#download-export-form").koApplyBindings(downloadFormModel({
            defaultDateRange: initialPageData.get('default_date_range'),
            exportList: exportList,
            exportType: exportType,
            formOrCase: initialPageData.get('form_or_case'),
            maxColumnSize: initialPageData.get('max_column_size') || 2000,
            multimediaUrl: initialPageData.get('check_for_multimedia') ? initialPageData.reverse('has_multimedia') : '',
            progressModel: progressModel,
            prepareUrl: initialPageData.reverse('prepare_custom_export'),
            prepareMultimediaUrl: initialPageData.reverse('prepare_form_multimedia'),
            smsExport: initialPageData.get('sms_export'),
            userTypes: initialPageData.get('user_types'),
        }));

        $("#download-progress").koApplyBindings(progressModel);

        $(".hqwebapp-datespan").each(function () {
            var $el = $(this).find("input");
            $el.createDateRangePicker(
                $el.data("labels"),
                $el.data("separator"),
                $el.data('startDate'),
                $el.data('endDate')
            );
        });
    });
});
<commit_msg>Removed EMW observable in favor of fetching it just before preparing export.<commit_after>/**
 *  UI for the page to download an export (form, case, or SMS; single or bulk).
 *
 *  Contains two models:
 *      downloadFormModel: Controls the form where the user specifies a date range, etc. Also contains
 *          functionality to download the multimedia associated with an export (form exports only).
 *      downloadProgressModel: Controls the progress bar, etc. once the user has clicked 'Prepare Export'.
 *          Includes functionality to email the user when the export is done, rather than them waiting for it.
 */
hqDefine('export/js/download_export', function () {
    'use strict';

    var downloadFormModel = function (options) {
        hqImport("hqwebapp/js/assert_properties").assert(options, [
            'defaultDateRange',
            'exportList',
            'exportType',
            'formOrCase',
            'maxColumnSize',
            'multimediaUrl',    // present if we should check for multimedia
            'progressModel',
            'prepareUrl',
            'prepareMultimediaUrl',
            'smsExport',
            'userTypes',
        ]);

        var self = _.extend({}, options);

        // Form data
        self.dateRange = ko.observable(self.defaultDateRange);
        self.getEMW = function () {
            // "expanded mobile worker" => the users (for forms) or case owners (for cases)
            return hqImport('reports/js/reports.util').urlSerialize($('form[name="exportFiltersForm"]'));
        };

        // UI flags
        self.preparingExport = ko.observable(false);
        self.prepareExportError = ko.observable('');
        self.preparingMultimediaExport = ko.observable(false);
        self.hasMultimedia = ko.observable(false);

        // Once the download starts, this (downloadFormModel) disables the form and displays a message.
        // When the download is complete, the downloadProgressModel gives the user the option to clear
        // filters and do another download. Listen for that signal.
        self.downloadInProgress = ko.observable(false);
        self.progressModel.showDownloadStatus.subscribe(function (newValue) {
            self.downloadInProgress(newValue);
        });

        self.isValid = ko.computed(function () {
            return !!self.dateRange();
        });

        self.disablePrepareExport = ko.computed(function () {
            return !self.isValid() || self.preparingExport();
        });
        self.disablePrepareMultimediaExport = ko.computed(function () {
            return !self.isValid() || self.preparingMultimediaExport();
        });

        // Determine whether or not to show button to download multimedia
        if (self.multimediaUrl) {
            $.ajax({
                method: 'GET',
                url: self.multimediaUrl,
                data: {
                    export_id: self.exportList[0].export_id,
                    form_or_case: self.formOrCase,
                },
                success: function (data) {
                    if (data.success) {
                        self.hasMultimedia(data.hasMultimedia);
                    }
                },
            });
        }

        self.sendAnalytics = function () {
            var action = (self.exportList.length > 1) ? "Bulk" : "Regular";
            hqImport('analytix/js/google').track.event("Download Export", self.exportType, action);
            _.each(self.exportList, function (export_) {
                if (export_.has_case_history_table) {
                    hqImport('analytix/js/google').track.event("Download Case History Export", export_.domain, export_.export_id);
                }
            });
        };

        self.prepareExport = function () {
            self.prepareExportError('');
            self.preparingExport(true);

            // Generate human-readable list of mobile workers, to send to analytics
            function getFilterString() {
                var filterName = self.exportType === "form" ? "emw" : "case_list_filter",
                    filterNamesAsString = $("form[name='exportFiltersForm']").find("input[name=" + filterName + "]").val(),
                    filterNamesAsArray = filterNamesAsString ? filterNamesAsString.split(',') : [];
                return _.map(filterNamesAsArray, function (item) {
                    var prefix = "t__";
                    if (item.substring(0, prefix.length) === prefix) {
                        return self.userTypes[item.substring(prefix.length)];
                    }
                    return item;
                }).join();
            }

            hqImport('analytix/js/kissmetrix').track.event("Clicked Prepare Export", {
                "Export type": self.exportType,
                "filters": getFilterString(),
            });

            $.ajax({
                method: 'POST',
                url: self.prepareUrl,
                data: {
                    form_or_case: self.formOrCase,
                    sms_export: self.smsExport,
                    exports: JSON.stringify(self.exportList),
                    max_column_size: self.maxColumnSize,
                    form_data: JSON.stringify({
                        date_range: self.dateRange(),
                        emw: self.getEMW(),
                    }),
                },
                success: function (data) {
                    if (data.success) {
                        self.sendAnalytics();
                        self.preparingExport(false);
                        self.downloadInProgress(true);
                        self.progressModel.startDownload(data.download_id);
                    } else {
                        self.handleError(data);
                    }
                },
                error: self.handleError,
            });
        };

        self.prepareMultimediaExport = function () {
            self.prepareExportError('');
            self.preparingMultimediaExport(true);
            $.ajax({
                method: 'POST',
                url: self.prepareMultimediaUrl,
                data: {
                    form_or_case: self.formOrCase,
                    sms_export: self.smsExport,
                    exports: JSON.stringify(self.exportList),
                    form_data: JSON.stringify({
                        date_range: self.dateRange(),
                        emw: self.getEMW(),
                    }),
                },
                success: function (data) {
                    if (data.success) {
                        self.sendAnalytics();
                        self.preparingMultimediaExport(false);
                        self.downloadInProgress(true);
                        self.progressModel.startMultimediaDownload(data.download_id);
                    } else {
                        self.handleError(data);
                    }
                },
                error: self.handleError,
            });
        };

        self.handleError = function (data) {
            if (data && data.error) {
                // The server returned an error message.
                self.prepareExportError(data.error);
            } else {
                self.prepareExportError(gettext("Sorry, there was a problem reaching the server. Please try again."));
            }
            self.preparingExport(false);
            self.preparingMultimediaExport(false);
        };

        return self;
    };

    var downloadProgressModel = function (options) {
        hqImport("hqwebapp/js/assert_properties").assert(options, ['exportType', 'formOrCase', 'emailUrl', 'pollUrl']);

        var self = {};

        self.exportType = options.exportType;
        self.formOrCase = options.formOrCase;
        self.downloadId = ko.observable();
        self.progress = ko.observable();

        // URLs for user actions
        self.pollUrl = options.pollUrl;
        self.emailUrl = options.emailUrl;

        // URLs related to the completed download
        self.dropboxUrl = ko.observable();
        self.downloadUrl = ko.observable();

        // UI flags
        self.showDownloadStatus = ko.observable();
        self.isDownloaded = ko.observable();
        self.isDownloadReady = ko.observable();
        self.isMultimediaDownload = ko.observable();
        self.sendEmailFlag = ko.observable();

        // Error handling
        self.progressError = ko.observable();
        self.celeryError = ko.observable('');
        self.downloadError = ko.observable('');
        self.showError = ko.computed(function () {
            return self.celeryError() || self.downloadError();
        });

        self.resetDownload = function () {
            self.downloadId(null);
            self._numErrors = 0;
            self._numCeleryRetries = 0;
            self._lastProgress = 0;
            self.showDownloadStatus(false);
            self.isDownloadReady(false);
            self.isDownloaded(false);
            self.celeryError('');
            self.downloadError('');
            self.isMultimediaDownload(false);
            self.progress(0);
            self.progressError('');
            self.sendEmailFlag(false);
            self.dropboxUrl('');
            self.downloadUrl('');
        };
        self.resetDownload();

        self.startDownload = function (downloadId) {
            self.showDownloadStatus(true);
            self.downloadId(downloadId);
            self.interval = setInterval(self._checkDownloadProgress, 2000);
        };

        self.startMultimediaDownload = function (downloadId) {
            self.isMultimediaDownload(true);
            self.startDownload(downloadId);
        };

        self.clickDownload = function () {
            self.isDownloaded(true);
            self.sendAnalytics();
            return true;    // allow default click action
        };

        self.sendAnalytics = function () {
            hqImport('analytix/js/google').track.event("Download Export", hqImport('export/js/utils').capitalize(self.exportType), "Saved");
            hqImport('analytix/js/kissmetrix').track.event("Clicked Download button");
        };

        self._checkDownloadProgress = function () {
            $.ajax({
                method: 'GET',
                url: self.pollUrl,
                data: {
                    form_or_case: self.formOrCase,
                    download_id: self.downloadId,
                },
                success: function (data) {
                    if (data.is_poll_successful) {
                        self._updateProgressBar(data);
                        self.downloadId(data.download_id);
                        if (data.has_file && data.is_ready) {
                            clearInterval(self.interval);
                            return;
                        }
                        if (data.progress && data.progress.error) {
                            clearInterval(self.interval);
                            self.progressError(data.progress.error_message);
                            return;
                        }
                        if (data.progress.current > self._lastProgress) {
                            self._lastProgress = data.progress.current;
                            // processing is still going, keep moving.
                            // this avoids failing hard prematurely at celery errors if
                            // the polling is still reporting forward progress.
                            self._numCeleryRetries = 0;
                            return;
                        }
                    }
                    if (data.error) {
                        self._dealWithErrors(data);
                    }
                    if (_.isNull(data.is_alive)) {
                        self._dealWithCeleryErrors();
                    }
                },
                error: self._dealWithErrors,
            });
        };

        self._dealWithCeleryErrors = function () {
            // Sometimes the task handler for celery is a little slow to get
            // started, so we have to try a few times.
            if (self._numCeleryRetries > 10) {
                clearInterval(self.interval);
                self.celeryError(gettext("Server maintenance in progress. Please try again later."));
            }
            self._numCeleryRetries ++;
        };

        self._dealWithErrors = function (data) {
            if (self._numErrors > 3) {
                if (data && data.error) {
                    self.downloadError(data.error);
                } else {
                    self.downloadError(gettext("There was an error downloading your export."));
                }
                clearInterval(self.interval);
            }
            self._numErrors ++;
        };

        self._updateProgressBar = function (data) {
            var progressPercent = 0;
            if (data.is_ready && data.has_file) {
                progressPercent = 100;
                self.isDownloadReady(true);
                self.dropboxUrl(data.dropbox_url);
                self.downloadUrl(data.download_url);
            } else if (_.isNumber(data.progress.percent)) {
                progressPercent = data.progress.percent;
            }
            self.progress(progressPercent);
        };

        self.sendEmailUponCompletion = function () {
            self.sendEmailFlag(true);
            $.ajax({
                method: 'POST',
                dataType: 'json',
                url: self.emailUrl,
                data: { download_id: self.downloadId },
            });
        };

        return self;
    };

    $(function () {
        hqImport("reports/js/filters/main").init();

        var initialPageData = hqImport("hqwebapp/js/initial_page_data"),
            exportList = initialPageData.get('export_list'),
            exportType = exportList[0].export_type;

        var progressModel = downloadProgressModel({
            exportType: exportType,
            emailUrl: initialPageData.reverse('add_export_email_request'),
            formOrCase: initialPageData.get('form_or_case'),
            pollUrl: initialPageData.reverse('poll_custom_export_download'),
        });

        $("#download-export-form").koApplyBindings(downloadFormModel({
            defaultDateRange: initialPageData.get('default_date_range'),
            exportList: exportList,
            exportType: exportType,
            formOrCase: initialPageData.get('form_or_case'),
            maxColumnSize: initialPageData.get('max_column_size') || 2000,
            multimediaUrl: initialPageData.get('check_for_multimedia') ? initialPageData.reverse('has_multimedia') : '',
            progressModel: progressModel,
            prepareUrl: initialPageData.reverse('prepare_custom_export'),
            prepareMultimediaUrl: initialPageData.reverse('prepare_form_multimedia'),
            smsExport: initialPageData.get('sms_export'),
            userTypes: initialPageData.get('user_types'),
        }));

        $("#download-progress").koApplyBindings(progressModel);

        $(".hqwebapp-datespan").each(function () {
            var $el = $(this).find("input");
            $el.createDateRangePicker(
                $el.data("labels"),
                $el.data("separator"),
                $el.data('startDate'),
                $el.data('endDate')
            );
        });
    });
});
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Fri Mar 06 2015 12:58:28 GMT+0100 (CET)

module.exports = function(config) {
  var customLaunchers = {
    sl_chrome35: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '35'
    },
    sl_chrome36: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '36'
    },
    sl_chrome37: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '37'
    },
    sl_chrome38: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '38'
    },
    sl_chrome39: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '39'
    },
    sl_chrome40: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '40'
    },
    sl_firefox30: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '30'
    },
    sl_firefox31: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '31'
    },
    sl_firefox32: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '32'
    },
    sl_firefox33: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '33'
    },
    sl_firefox34: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '34'
    },
    sl_firefox35: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '35'
    },
    sl_ie9: {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '9'
    },
    sl_ie10: {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '10'
    },
    sl_ie11: {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '11'
    }
  };

  config.set({
    sauceLabs: {
      testName: 'Schemata.js',
      build:    process.env.WERCKER_BUILD_ID
    },
    customLaunchers: customLaunchers,
    browsers: Object.keys(customLaunchers),
    reporters: ['dots', 'saucelabs'],
    singleRun: true,
    browserDisconnectTimeout: 30000,
    browserNoActivityTimeout: 4 * 600000,
    captureTimeout: 4 * 600000,
    browserDisconnectTolerance: 2,

    // 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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'jspm_packages/system.js',
      'config.js',
      'test/runner.js',
      { pattern: 'jspm_packages/**/*', included: false },
      { pattern: 'src/**/*.js',        included: false },
      { pattern: 'test/**/*.json',     included: false },
      { pattern: 'test/**/*.js',       included: false }
    ],

    // 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: {
    },

    // 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,
  });
};
<commit_msg>tweaking saucelabs config<commit_after>// Karma configuration
// Generated on Fri Mar 06 2015 12:58:28 GMT+0100 (CET)

module.exports = function(config) {
  var customLaunchers = {
    sl_chrome35: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '35'
    },
    sl_chrome36: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '36'
    },
    sl_chrome37: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '37'
    },
    sl_chrome38: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '38'
    },
    sl_chrome39: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '39'
    },
    sl_chrome40: {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '40'
    },
    sl_firefox30: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '30'
    },
    sl_firefox31: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '31'
    },
    sl_firefox32: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '32'
    },
    sl_firefox33: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '33'
    },
    sl_firefox34: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '34'
    },
    sl_firefox35: {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '35'
    },
    sl_ie9: {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '9'
    },
    sl_ie10: {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '10'
    },
    sl_ie11: {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '11'
    }
  };

  config.set({
    sauceLabs: {
      testName: 'Schemata.js',
      build:    process.env.WERCKER_BUILD_ID,
      recordVideo:       false,
      recordScreenshots: false,
      captureHtml:       false,
      commandTimeout:    600,
      idleTimeout:       1000
    },
    customLaunchers: customLaunchers,
    browsers: Object.keys(customLaunchers),
    reporters: ['dots', 'saucelabs'],
    singleRun: true,
    browserDisconnectTimeout: 30000,
    browserNoActivityTimeout: 4 * 600000,
    captureTimeout: 4 * 600000,
    browserDisconnectTolerance: 2,

    // 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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'jspm_packages/system.js',
      'config.js',
      'test/runner.js',
      { pattern: 'jspm_packages/**/*', included: false },
      { pattern: 'src/**/*.js',        included: false },
      { pattern: 'test/**/*.json',     included: false },
      { pattern: 'test/**/*.js',       included: false }
    ],

    // 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: {
    },

    // 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,
  });
};
<|endoftext|>


<commit_before>module.exports = function(config) {
    config.set({
        frameworks: ['mocha'],
        browsers: ['Firefox', 'PhantomJS'],
        files: [require.resolve('es5-shim'), 'build/test.js'],
        reporters: ['dots']
    });

    if (process.env.CI && process.env.SAUCE_ACCESS_KEY) {
        var customLaunchers = {
            sauceLabsFirefox: {
                base: 'SauceLabs',
                browserName: 'firefox'
            },
            sauceLabsChrome: {
                base: 'SauceLabs',
                browserName: 'chrome'
            },
            sauceLabsIE11: {
                base: 'SauceLabs',
                browserName: 'internet explorer',
                version: 11
            },
            sauceLabsIE10: {
                base: 'SauceLabs',
                browserName: 'internet explorer',
                version: 10
            },
            sauceLabsIE9: {
                base: 'SauceLabs',
                browserName: 'internet explorer',
                version: 9
            },
            sauceLabsIE8: {
                base: 'SauceLabs',
                browserName: 'internet explorer',
                version: 8
            }
        };

        config.set({
            browsers: Object.keys(customLaunchers),
            reporters: ['dots', 'saucelabs'],
            captureTimeout: 120000,
            sauceLabs: {
                testName: 'Loud'
            },
            customLaunchers: customLaunchers
        });
    }
};
<commit_msg>Revert "Test in Internet Explorer in SauceLabs"<commit_after>module.exports = function(config) {
    config.set({
        frameworks: ['mocha'],
        browsers: ['Firefox', 'PhantomJS'],
        files: [require.resolve('es5-shim'), 'build/test.js'],
        reporters: ['dots']
    });

    if (process.env.CI && process.env.SAUCE_ACCESS_KEY) {
        var customLaunchers = {
            sauceLabsFirefox: {
                base: 'SauceLabs',
                browserName: 'firefox'
            },
            sauceLabsChrome: {
                base: 'SauceLabs',
                browserName: 'chrome'
            }
        };

        config.set({
            browsers: Object.keys(customLaunchers),
            reporters: ['dots', 'saucelabs'],
            captureTimeout: 120000,
            sauceLabs: {
                testName: 'Loud'
            },
            customLaunchers: customLaunchers
        });
    }
};
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Wed Nov 18 2015 23:20:04 GMT-0800 (PST)

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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'node_modules/angular/angular.js',
      'node_modules/angular-mocks/angular-mocks.js',
      'node_modules/angular-route/angular-route.js',
      'node_modules/angular-ui-bootstrap/ui-bootstrap.js',
      'public/dev/*.js',
      'test/*.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: {
    },

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

    htmlReporter : {
      outputFile: 'test/results.html'
    },

    // 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'],

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

    // Concurrency level
    // how many browser should be started simultanous
    concurrency: Infinity
  })
};
<commit_msg>final FINAL, removed Chrome from karma config for now<commit_after>// Karma configuration
// Generated on Wed Nov 18 2015 23:20:04 GMT-0800 (PST)

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: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'node_modules/angular/angular.js',
      'node_modules/angular-mocks/angular-mocks.js',
      'node_modules/angular-route/angular-route.js',
      'node_modules/angular-ui-bootstrap/ui-bootstrap.js',
      'public/dev/*.js',
      'test/*.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: {
    },

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

    htmlReporter : {
      outputFile: 'test/results.html'
    },

    // 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
    // Add whatever browser you want, Chrome, Opera, etc.  Using Firefox now to appease Travis
    browsers: ['Firefox'],

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

    // Concurrency level
    // how many browser should be started simultanous
    concurrency: Infinity
  })
};
<|endoftext|>


<commit_before>// @AngularClass
var path = require('path');

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

    // 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: 'spec-bundle.js', watched: false } ],

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

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

    coverageReporter: {
      dir : 'coverage/',
      reporters: [
        { type: 'text-summary' },
        { type: 'json' },
        { type: 'html' }
      ]
    },

    // Webpack please don't spam the console when running in karma!
    webpackServer: { noInfo: true },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: [ 'mocha', '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',
      'PhantomJS'
    ],

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

};
<commit_msg>style(karma.conf): remove path<commit_after>// @AngularClass

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

  config.set({

    // 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: 'spec-bundle.js', watched: false } ],

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

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

    coverageReporter: {
      dir : 'coverage/',
      reporters: [
        { type: 'text-summary' },
        { type: 'json' },
        { type: 'html' }
      ]
    },

    // Webpack please don't spam the console when running in karma!
    webpackServer: { noInfo: true },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: [ 'mocha', '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',
      'PhantomJS'
    ],

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

};
<|endoftext|>


<commit_before>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function (config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/jquery/jquery.js',
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/bower_components/angular-animate/angular-animate.js',
      'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
      'app/bower_components/angular-ui/build/angular-ui.js',
      'app/bower_components/ngprogress-lite/ngprogress-lite.min.js',
      'app/scripts/*.js',
      'app/scripts/workers/*.js',
      'app/scripts/**/*.js',
      'test/spec/**/*.js',
      //include the directory where directive templates are stored.
      'app/views/**/*.html'
    ],

    // generate js files from html templates to expose them during testing.
    preprocessors: {
      'app/views/**/*.html': 'ng-html2js'
    },

    ngHtml2JsPreprocessor: {
      // If your build process changes the path to your templates,
      // use stripPrefix and prependPrefix to adjust it.
      stripPrefix: "app/",
      prependPrefix: "",

      // the name of the Angular module to create
      moduleName: "emuwebApp.templates"
    },

    proxies: {
      '/scripts/workers/': 'http://localhost:9000/scripts/workers/'
    },

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

    // web server port
    port: 8081,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS','Chrome','Firefox'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};
<commit_msg>json fixture updates<commit_after>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function (config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/jquery/jquery.js',
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/bower_components/angular-animate/angular-animate.js',
      'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
      'app/bower_components/angular-ui/build/angular-ui.js',
      'app/bower_components/ngprogress-lite/ngprogress-lite.min.js',
      'app/bower_components/jasmine-jquery/lib/jasmine-jquery.js',
      'app/scripts/*.js',
      'app/scripts/workers/*.js',
      'app/scripts/**/*.js',
      'test/spec/**/*.js',
      //include the directory where directive templates are stored.
      'app/views/**/*.html',

      // JSON fixture
      {
        pattern: 'app/demoDBs/*/*.json',
        watched: true,
        served: true,
        included: false
      }
    ],

    // generate js files from html templates to expose them during testing.
    preprocessors: {
      'app/views/**/*.html': 'ng-html2js'
    },

    ngHtml2JsPreprocessor: {
      // If your build process changes the path to your templates,
      // use stripPrefix and prependPrefix to adjust it.
      stripPrefix: 'app/',
      prependPrefix: '',

      // the name of the Angular module to create
      moduleName: 'emuwebApp.templates'
    },

    proxies: {
      '/scripts/workers/': 'http://localhost:9000/scripts/workers/'
    },

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

    // web server port
    port: 8081,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};<|endoftext|>